summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2016-07-01 13:28:26 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-08 09:57:25 +0100
commit6074ed6cd46e5167903e835508d4d6062bf04501 (patch)
tree8c69d915ac0aeed93dc02cbdc695abf00dd2535d
parent14c90118287a1be1766f92410c2b14f6b72b7a57 (diff)
downloadpoky-6074ed6cd46e5167903e835508d4d6062bf04501.tar.gz
gcc: remove GCC 4.9
(From OE-Core rev: 615b784bd3d53a77b7e34e3879a72e7e51477db6) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9.inc141
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch42
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0002-uclibc-conf.patch53
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0003-gcc-uclibc-locale-ctype_touplow_t.patch87
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0004-uclibc-locale.patch2862
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0005-uclibc-locale-no__x.patch257
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0006-uclibc-locale-wchar_fix.patch68
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0007-uclibc-locale-update.patch542
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0008-missing-execinfo_h.patch28
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0009-c99-snprintf.patch28
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0010-c99-complex-ugly-hack.patch29
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0011-index_macro.patch44
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0013-libstdc-namespace.patch54
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0014-sh-pr24836.patch45
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch47
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0016-gcc-poison-system-directories.patch190
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0017-gcc-poison-dir-extend.patch39
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch73
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0019-64-bit-multilib-hack.patch82
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0020-optional-libstdc.patch98
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch59
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0022-COLLECT_GCC_OPTIONS.patch38
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch96
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0025-fortran-cross-compile-hack.patch46
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0026-libgcc-sjlj-check.patch74
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0027-cpp-honor-sysroot.patch54
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0028-MIPS64-Default-to-N64-ABI.patch31
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch228
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0030-gcc-Fix-argument-list-too-long-error.patch40
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0031-Disable-sdt.patch113
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0032-libtool.patch42
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch40
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch102
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0040-fix-g++-sysroot.patch40
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0041-libtool-avoid-libdir.patch19
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0043-cpp.patch40
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0044-gengtypes.patch97
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0046-libatomic-deptracking.patch41
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0047-repomembug.patch53
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch42
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0050-Revert-Use-dbx_reg_number-for-spanning-registers.patch80
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0051-eabispe.patch23
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0052-Add-target-hook-to-override-DWARF2-frame-register-si.patch138
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0053-gcc-fix-segfault-from-calling-free-on-non-malloc-d-a.patch66
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0054-gcc-Makefile.in-fix-parallel-building-failure.patch61
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0055-dwarf-reg-processing-helper.patch148
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0056-define-default-cfa-register-mapping.patch75
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0057-aarch64-config.patch32
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0058-gcc-r212171.patch113
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0059-gcc-PR-rtl-optimization-63348.patch59
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0060-Only-allow-e500-double-in-SPE_SIMD_REGNO_P-registers.patch55
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0061-target-gcc-includedir.patch81
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0062-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch24
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0063-nativesdk-gcc-support.patch198
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0064-handle-target-sysroot-multilib.patch88
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0065-gcc-483-universal-initializer-no-warning.patch107
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0066-cxxflags-for-build.patch123
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0067-fix-arm-thumb.patch39
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0067-gcc-musl-support.patch267
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0068-musl-dynamic-linker.patch205
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0069-musl-no-fixincludes.patch21
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0070-libstdc-musl.patch32
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0071-Ignore-fdebug-prefix-map-in-producer-string-by-Danie.patch31
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0072-support-ffile-prefix-map.patch284
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0073-Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch43
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0074-fdebug-prefix-map-support-to-remap-relative-path.patch51
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0075-libgcc-use-ldflags.patch16
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.9/0076-remove-prototypes-cfns.patch153
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-canadian_4.9.bb5
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-initial_4.9.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross_4.9.bb3
-rw-r--r--meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.9.bb3
-rw-r--r--meta/recipes-devtools/gcc/gcc-crosssdk_4.9.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-runtime_4.9.bb3
-rw-r--r--meta/recipes-devtools/gcc/gcc-sanitizers_4.9.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-source_4.9.bb4
-rw-r--r--meta/recipes-devtools/gcc/gcc_4.9.bb13
-rw-r--r--meta/recipes-devtools/gcc/libgcc-initial_4.9.bb2
-rw-r--r--meta/recipes-devtools/gcc/libgcc_4.9.bb2
-rw-r--r--meta/recipes-devtools/gcc/libgfortran_4.9.bb3
80 files changed, 0 insertions, 8761 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.9.inc b/meta/recipes-devtools/gcc/gcc-4.9.inc
deleted file mode 100644
index 64701c8e27..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9.inc
+++ /dev/null
@@ -1,141 +0,0 @@
1require gcc-common.inc
2
3# Third digit in PV should be incremented after a minor release
4
5PV = "4.9.3"
6
7# BINV should be incremented to a revision after a minor gcc release
8
9BINV = "4.9.3"
10
11FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc-4.9:"
12
13DEPENDS =+ "mpfr gmp libmpc zlib"
14NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native"
15
16LICENSE = "GPL-3.0-with-GCC-exception & GPLv3"
17
18LIC_FILES_CHKSUM = "\
19 file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
20 file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
21 file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
22 file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
23 file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8 \
24"
25
26SRC_URI = "\
27 ${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \
28 file://0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \
29 file://0002-uclibc-conf.patch \
30 file://0003-gcc-uclibc-locale-ctype_touplow_t.patch \
31 file://0004-uclibc-locale.patch \
32 file://0005-uclibc-locale-no__x.patch \
33 file://0006-uclibc-locale-wchar_fix.patch \
34 file://0007-uclibc-locale-update.patch \
35 file://0008-missing-execinfo_h.patch \
36 file://0009-c99-snprintf.patch \
37 file://0010-c99-complex-ugly-hack.patch \
38 file://0011-index_macro.patch \
39 file://0013-libstdc-namespace.patch \
40 file://0014-sh-pr24836.patch \
41 file://0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch \
42 file://0016-gcc-poison-system-directories.patch \
43 file://0017-gcc-poison-dir-extend.patch \
44 file://0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch \
45 file://0019-64-bit-multilib-hack.patch \
46 file://0020-optional-libstdc.patch \
47 file://0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch \
48 file://0022-COLLECT_GCC_OPTIONS.patch \
49 file://0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \
50 file://0025-fortran-cross-compile-hack.patch \
51 file://0026-libgcc-sjlj-check.patch \
52 file://0027-cpp-honor-sysroot.patch \
53 file://0028-MIPS64-Default-to-N64-ABI.patch \
54 file://0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch \
55 file://0030-gcc-Fix-argument-list-too-long-error.patch \
56 file://0031-Disable-sdt.patch \
57 file://0032-libtool.patch \
58 file://0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch \
59 file://0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch \
60 file://0040-fix-g++-sysroot.patch \
61 file://0041-libtool-avoid-libdir.patch \
62 file://0043-cpp.patch \
63 file://0044-gengtypes.patch \
64 file://0046-libatomic-deptracking.patch \
65 file://0047-repomembug.patch \
66 file://0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch \
67 file://0050-Revert-Use-dbx_reg_number-for-spanning-registers.patch \
68 file://0051-eabispe.patch \
69 file://0052-Add-target-hook-to-override-DWARF2-frame-register-si.patch \
70 file://0053-gcc-fix-segfault-from-calling-free-on-non-malloc-d-a.patch \
71 file://0054-gcc-Makefile.in-fix-parallel-building-failure.patch \
72 file://0055-dwarf-reg-processing-helper.patch \
73 file://0056-define-default-cfa-register-mapping.patch \
74 file://0057-aarch64-config.patch \
75 file://0058-gcc-r212171.patch \
76 file://0059-gcc-PR-rtl-optimization-63348.patch \
77 file://0060-Only-allow-e500-double-in-SPE_SIMD_REGNO_P-registers.patch \
78 file://0061-target-gcc-includedir.patch \
79 file://0062-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch \
80 file://0063-nativesdk-gcc-support.patch \
81 file://0064-handle-target-sysroot-multilib.patch \
82 file://0065-gcc-483-universal-initializer-no-warning.patch \
83 file://0066-cxxflags-for-build.patch \
84 file://0067-fix-arm-thumb.patch \
85 file://0067-gcc-musl-support.patch \
86 file://0068-musl-dynamic-linker.patch \
87 file://0069-musl-no-fixincludes.patch \
88 file://0070-libstdc-musl.patch \
89 file://0071-Ignore-fdebug-prefix-map-in-producer-string-by-Danie.patch \
90 file://0072-support-ffile-prefix-map.patch \
91 file://0073-Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch \
92 file://0074-fdebug-prefix-map-support-to-remap-relative-path.patch \
93 file://0075-libgcc-use-ldflags.patch \
94 file://0076-remove-prototypes-cfns.patch \
95"
96SRC_URI[md5sum] = "6f831b4d251872736e8e9cc09746f327"
97SRC_URI[sha256sum] = "2332b2a5a321b57508b9031354a8503af6fdfb868b8c1748d33028d100a8b67e"
98
99UPSTREAM_CHECK_REGEX = "gcc-(?P<pver>4\.9\.\d+).tar"
100
101S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
102B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
103
104# Language Overrides
105FORTRAN = ""
106JAVA = ""
107
108LTO = "--enable-lto"
109
110EXTRA_OECONF_BASE = "\
111 ${LTO} \
112 --enable-libssp \
113 --disable-bootstrap \
114 --disable-libmudflap \
115 --with-system-zlib \
116 --with-linker-hash-style=${LINKER_HASH_STYLE} \
117 --enable-linker-build-id \
118 --with-ppl=no \
119 --with-cloog=no \
120 --enable-checking=release \
121 --enable-cheaders=c_global \
122"
123
124EXTRA_OECONF_INITIAL = "\
125 --disable-libmudflap \
126 --disable-libgomp \
127 --disable-libssp \
128 --disable-libquadmath \
129 --with-system-zlib \
130 --disable-lto \
131 --disable-plugin \
132 --enable-decimal-float=no \
133"
134
135EXTRA_OECONF_append_libc-uclibc = " --disable-decimal-float "
136
137EXTRA_OECONF_PATHS = "\
138 --with-gxx-include-dir=/not/exist{target_includedir}/c++/${BINV} \
139 --with-sysroot=/not/exist \
140 --with-build-sysroot=${STAGING_DIR_TARGET} \
141"
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch b/meta/recipes-devtools/gcc/gcc-4.9/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
deleted file mode 100644
index e588011678..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
+++ /dev/null
@@ -1,42 +0,0 @@
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.9/0002-uclibc-conf.patch b/meta/recipes-devtools/gcc/gcc-4.9/0002-uclibc-conf.patch
deleted file mode 100644
index dda3b1041b..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0002-uclibc-conf.patch
+++ /dev/null
@@ -1,53 +0,0 @@
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.9/0003-gcc-uclibc-locale-ctype_touplow_t.patch b/meta/recipes-devtools/gcc/gcc-4.9/0003-gcc-uclibc-locale-ctype_touplow_t.patch
deleted file mode 100644
index 7098e99502..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0003-gcc-uclibc-locale-ctype_touplow_t.patch
+++ /dev/null
@@ -1,87 +0,0 @@
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.9/0004-uclibc-locale.patch b/meta/recipes-devtools/gcc/gcc-4.9/0004-uclibc-locale.patch
deleted file mode 100644
index 49f5f338e3..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0004-uclibc-locale.patch
+++ /dev/null
@@ -1,2862 +0,0 @@
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.9/0005-uclibc-locale-no__x.patch b/meta/recipes-devtools/gcc/gcc-4.9/0005-uclibc-locale-no__x.patch
deleted file mode 100644
index dcbbfe4545..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0005-uclibc-locale-no__x.patch
+++ /dev/null
@@ -1,257 +0,0 @@
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.9/0006-uclibc-locale-wchar_fix.patch b/meta/recipes-devtools/gcc/gcc-4.9/0006-uclibc-locale-wchar_fix.patch
deleted file mode 100644
index 3406859e11..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0006-uclibc-locale-wchar_fix.patch
+++ /dev/null
@@ -1,68 +0,0 @@
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.9/0007-uclibc-locale-update.patch b/meta/recipes-devtools/gcc/gcc-4.9/0007-uclibc-locale-update.patch
deleted file mode 100644
index 58511233d7..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0007-uclibc-locale-update.patch
+++ /dev/null
@@ -1,542 +0,0 @@
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.9/0008-missing-execinfo_h.patch b/meta/recipes-devtools/gcc/gcc-4.9/0008-missing-execinfo_h.patch
deleted file mode 100644
index 282380934a..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0008-missing-execinfo_h.patch
+++ /dev/null
@@ -1,28 +0,0 @@
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.9/0009-c99-snprintf.patch b/meta/recipes-devtools/gcc/gcc-4.9/0009-c99-snprintf.patch
deleted file mode 100644
index 7168778df4..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0009-c99-snprintf.patch
+++ /dev/null
@@ -1,28 +0,0 @@
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.9/0010-c99-complex-ugly-hack.patch b/meta/recipes-devtools/gcc/gcc-4.9/0010-c99-complex-ugly-hack.patch
deleted file mode 100644
index b628571e5d..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0010-c99-complex-ugly-hack.patch
+++ /dev/null
@@ -1,29 +0,0 @@
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.9/0011-index_macro.patch b/meta/recipes-devtools/gcc/gcc-4.9/0011-index_macro.patch
deleted file mode 100644
index 8ee79b09b4..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0011-index_macro.patch
+++ /dev/null
@@ -1,44 +0,0 @@
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.9/0013-libstdc-namespace.patch b/meta/recipes-devtools/gcc/gcc-4.9/0013-libstdc-namespace.patch
deleted file mode 100644
index 4a3efdebd8..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0013-libstdc-namespace.patch
+++ /dev/null
@@ -1,54 +0,0 @@
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.9/0014-sh-pr24836.patch b/meta/recipes-devtools/gcc/gcc-4.9/0014-sh-pr24836.patch
deleted file mode 100644
index cb8fd525b2..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0014-sh-pr24836.patch
+++ /dev/null
@@ -1,45 +0,0 @@
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.9/0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch b/meta/recipes-devtools/gcc/gcc-4.9/0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch
deleted file mode 100644
index 37c46fc2e2..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch
+++ /dev/null
@@ -1,47 +0,0 @@
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
14Index: gcc-4.9.2/gcc/config/arm/coff.h
15===================================================================
16--- gcc-4.9.2.orig/gcc/config/arm/coff.h
17+++ gcc-4.9.2/gcc/config/arm/coff.h
18@@ -32,8 +32,11 @@
19 #define TARGET_DEFAULT (MASK_APCS_FRAME)
20
21 #ifndef MULTILIB_DEFAULTS
22+#ifndef TARGET_ENDIAN_OPTION
23+#define TARGET_ENDIAN_OPTION "mlittle-endian"
24+#endif
25 #define MULTILIB_DEFAULTS \
26- { "marm", "mlittle-endian", "mfloat-abi=soft", "mno-thumb-interwork" }
27+ { "marm", TARGET_ENDIAN_OPTION, "mfloat-abi=soft", "mno-thumb-interwork" }
28 #endif
29
30 /* This is COFF, but prefer stabs. */
31Index: gcc-4.9.2/gcc/config/arm/elf.h
32===================================================================
33--- gcc-4.9.2.orig/gcc/config/arm/elf.h
34+++ gcc-4.9.2/gcc/config/arm/elf.h
35@@ -116,8 +116,11 @@
36 #endif
37
38 #ifndef MULTILIB_DEFAULTS
39+#ifndef TARGET_ENDIAN_OPTION
40+#define TARGET_ENDIAN_OPTION "mlittle-endian"
41+#endif
42 #define MULTILIB_DEFAULTS \
43- { "marm", "mlittle-endian", "mfloat-abi=soft", "mno-thumb-interwork", "fno-leading-underscore" }
44+ { "marm", TARGET_ENDIAN_OPTION, "mfloat-abi=soft", "mno-thumb-interwork", "fno-leading-underscore" }
45 #endif
46
47 #define TARGET_ASM_FILE_START_APP_OFF true
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0016-gcc-poison-system-directories.patch b/meta/recipes-devtools/gcc/gcc-4.9/0016-gcc-poison-system-directories.patch
deleted file mode 100644
index 475ef96b96..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0016-gcc-poison-system-directories.patch
+++ /dev/null
@@ -1,190 +0,0 @@
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
20Index: gcc-4.9-20140316/gcc/common.opt
21===================================================================
22--- gcc-4.9-20140316.orig/gcc/common.opt
23+++ gcc-4.9-20140316/gcc/common.opt
24@@ -603,6 +603,10 @@ Wpedantic
25 Common Var(pedantic) Warning
26 Issue warnings needed for strict compliance to the standard
27
28+Wpoison-system-directories
29+Common Var(flag_poison_system_directories) Init(1) Warning
30+Warn for -I and -L options using system directories if cross compiling
31+
32 Wshadow
33 Common Var(warn_shadow) Warning
34 Warn when one local variable shadows another
35Index: gcc-4.9-20140316/gcc/config.in
36===================================================================
37--- gcc-4.9-20140316.orig/gcc/config.in
38+++ gcc-4.9-20140316/gcc/config.in
39@@ -138,6 +138,12 @@
40 #endif
41
42
43+/* Define to warn for use of native system header directories */
44+#ifndef USED_FOR_TARGET
45+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
46+#endif
47+
48+
49 /* Define if you want all operations on RTL (the basic data structure of the
50 optimizer and back end) to be checked for dynamic type safety at runtime.
51 This is quite expensive. */
52Index: gcc-4.9-20140316/gcc/configure
53===================================================================
54--- gcc-4.9-20140316.orig/gcc/configure
55+++ gcc-4.9-20140316/gcc/configure
56@@ -928,6 +928,7 @@ with_system_zlib
57 enable_maintainer_mode
58 enable_link_mutex
59 enable_version_specific_runtime_libs
60+enable_poison_system_directories
61 enable_plugin
62 enable_host_shared
63 enable_libquadmath_support
64@@ -1648,6 +1649,8 @@ Optional Features:
65 --enable-version-specific-runtime-libs
66 specify that runtime libraries should be installed
67 in a compiler-specific directory
68+ --enable-poison-system-directories
69+ warn for use of native system header directories
70 --enable-plugin enable plugin support
71 --enable-host-shared build host code as shared libraries
72 --disable-libquadmath-support
73@@ -27702,6 +27705,19 @@ if test "${enable_version_specific_runti
74 fi
75
76
77+# Check whether --enable-poison-system-directories was given.
78+if test "${enable_poison_system_directories+set}" = set; then :
79+ enableval=$enable_poison_system_directories;
80+else
81+ enable_poison_system_directories=no
82+fi
83+
84+if test "x${enable_poison_system_directories}" = "xyes"; then
85+
86+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
87+
88+fi
89+
90 # Substitute configuration variables
91
92
93Index: gcc-4.9-20140316/gcc/configure.ac
94===================================================================
95--- gcc-4.9-20140316.orig/gcc/configure.ac
96+++ gcc-4.9-20140316/gcc/configure.ac
97@@ -5366,6 +5366,16 @@ AC_ARG_ENABLE(version-specific-runtime-l
98 [specify that runtime libraries should be
99 installed in a compiler-specific directory])])
100
101+AC_ARG_ENABLE([poison-system-directories],
102+ AS_HELP_STRING([--enable-poison-system-directories],
103+ [warn for use of native system header directories]),,
104+ [enable_poison_system_directories=no])
105+if test "x${enable_poison_system_directories}" = "xyes"; then
106+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
107+ [1],
108+ [Define to warn for use of native system header directories])
109+fi
110+
111 # Substitute configuration variables
112 AC_SUBST(subdirs)
113 AC_SUBST(srcdir)
114Index: gcc-4.9-20140316/gcc/doc/invoke.texi
115===================================================================
116--- gcc-4.9-20140316.orig/gcc/doc/invoke.texi
117+++ gcc-4.9-20140316/gcc/doc/invoke.texi
118@@ -260,6 +260,7 @@ Objective-C and Objective-C++ Dialects}.
119 -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
120 -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
121 -Wpointer-arith -Wno-pointer-to-int-cast @gol
122+-Wno-poison-system-directories @gol
123 -Wredundant-decls -Wno-return-local-addr @gol
124 -Wreturn-type -Wsequence-point -Wshadow @gol
125 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
126@@ -4230,6 +4231,14 @@ headers---for that, @option{-Wunknown-pr
127 for most targets, it is made up of code and thus requires the stack
128 to be made executable in order for the program to work properly.
129
130+@item -Wno-poison-system-directories
131+@opindex Wno-poison-system-directories
132+Do not warn for @option{-I} or @option{-L} options using system
133+directories such as @file{/usr/include} when cross compiling. This
134+option is intended for use in chroot environments when such
135+directories contain the correct headers and libraries for the target
136+system rather than the host.
137+
138 @item -Wfloat-equal
139 @opindex Wfloat-equal
140 @opindex Wno-float-equal
141Index: gcc-4.9-20140316/gcc/gcc.c
142===================================================================
143--- gcc-4.9-20140316.orig/gcc/gcc.c
144+++ gcc-4.9-20140316/gcc/gcc.c
145@@ -764,6 +764,8 @@ proper position among the other output f
146 "%{fuse-ld=*:-fuse-ld=%*}\
147 %X %{o*} %{e*} %{N} %{n} %{r}\
148 %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} " VTABLE_VERIFICATION_SPEC " \
149+ %{Wno-poison-system-directories:--no-poison-system-directories}\
150+ %{Werror=poison-system-directories:--error-poison-system-directories}\
151 %{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\
152 %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
153 %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
154Index: gcc-4.9-20140316/gcc/incpath.c
155===================================================================
156--- gcc-4.9-20140316.orig/gcc/incpath.c
157+++ gcc-4.9-20140316/gcc/incpath.c
158@@ -28,6 +28,7 @@
159 #include "intl.h"
160 #include "incpath.h"
161 #include "cppdefault.h"
162+#include "diagnostic-core.h"
163
164 /* Microsoft Windows does not natively support inodes.
165 VMS has non-numeric inodes. */
166@@ -382,6 +383,24 @@ merge_include_chains (const char *sysroo
167 }
168 fprintf (stderr, _("End of search list.\n"));
169 }
170+
171+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
172+ if (flag_poison_system_directories)
173+ {
174+ struct cpp_dir *p;
175+
176+ for (p = heads[QUOTE]; p; p = p->next)
177+ {
178+ if ((!strncmp (p->name, "/usr/include", 12))
179+ || (!strncmp (p->name, "/usr/local/include", 18))
180+ || (!strncmp (p->name, "/usr/X11R6/include", 18)))
181+ warning (OPT_Wpoison_system_directories,
182+ "include location \"%s\" is unsafe for "
183+ "cross-compilation",
184+ p->name);
185+ }
186+ }
187+#endif
188 }
189
190 /* Use given -I paths for #include "..." but not #include <...>, and
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0017-gcc-poison-dir-extend.patch b/meta/recipes-devtools/gcc/gcc-4.9/0017-gcc-poison-dir-extend.patch
deleted file mode 100644
index 9e81efd4d5..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0017-gcc-poison-dir-extend.patch
+++ /dev/null
@@ -1,39 +0,0 @@
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.9/0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch b/meta/recipes-devtools/gcc/gcc-4.9/0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
deleted file mode 100644
index a28cafdf95..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0018-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch
+++ /dev/null
@@ -1,73 +0,0 @@
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.9/0019-64-bit-multilib-hack.patch b/meta/recipes-devtools/gcc/gcc-4.9/0019-64-bit-multilib-hack.patch
deleted file mode 100644
index 058be0c40a..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0019-64-bit-multilib-hack.patch
+++ /dev/null
@@ -1,82 +0,0 @@
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
34Index: gcc-4.9-20140316/gcc/config/i386/t-linux64
35===================================================================
36--- gcc-4.9-20140316.orig/gcc/config/i386/t-linux64
37+++ gcc-4.9-20140316/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))
48Index: gcc-4.9-20140316/gcc/config/mips/t-linux64
49===================================================================
50--- gcc-4.9-20140316.orig/gcc/config/mips/t-linux64
51+++ gcc-4.9-20140316/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+
66Index: gcc-4.9-20140316/gcc/config/rs6000/t-linux64
67===================================================================
68--- gcc-4.9-20140316.orig/gcc/config/rs6000/t-linux64
69+++ gcc-4.9-20140316/gcc/config/rs6000/t-linux64
70@@ -26,10 +26,9 @@
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 :=
77-MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
78-MULTILIB_OSDIRNAMES += m32=$(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
81 rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.c
82 $(COMPILE) $<
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0020-optional-libstdc.patch b/meta/recipes-devtools/gcc/gcc-4.9/0020-optional-libstdc.patch
deleted file mode 100644
index 5b466140da..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0020-optional-libstdc.patch
+++ /dev/null
@@ -1,98 +0,0 @@
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
27Index: gcc-4.9-20140316/gcc/c-family/c.opt
28===================================================================
29--- gcc-4.9-20140316.orig/gcc/c-family/c.opt
30+++ gcc-4.9-20140316/gcc/c-family/c.opt
31@@ -1323,6 +1323,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
42Index: gcc-4.9-20140316/gcc/cp/g++spec.c
43===================================================================
44--- gcc-4.9-20140316.orig/gcc/cp/g++spec.c
45+++ gcc-4.9-20140316/gcc/cp/g++spec.c
46@@ -138,6 +138,7 @@ lang_specific_driver (struct cl_decoded_
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;
54Index: gcc-4.9-20140316/gcc/doc/invoke.texi
55===================================================================
56--- gcc-4.9-20140316.orig/gcc/doc/invoke.texi
57+++ gcc-4.9-20140316/gcc/doc/invoke.texi
58@@ -193,6 +193,7 @@ in the following sections.
59 -fvisibility-inlines-hidden @gol
60 -fvtable-verify=@var{std|preinit|none} @gol
61 -fvtv-counts -fvtv-debug @gol
62+-nostdlib++ @gol
63 -fvisibility-ms-compat @gol
64 -fext-numeric-literals @gol
65 -Wabi -Wconversion-null -Wctor-dtor-privacy @gol
66@@ -457,7 +458,7 @@ Objective-C and Objective-C++ Dialects}.
67 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
68 -s -static -static-libgcc -static-libstdc++ @gol
69 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
70--shared -shared-libgcc -symbolic @gol
71+-shared -shared-libgcc -symbolic -nostdlib++ @gol
72 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
73 -u @var{symbol}}
74
75@@ -10285,6 +10286,11 @@ These entries are usually resolved by en
76 libc. These entry points should be supplied through some other
77 mechanism when this option is specified.
78
79+@item -nostdlib++
80+@opindex nostdlib++
81+Do not use the standard system C++ runtime libraries when linking.
82+Only the libraries you specify will be passed to the linker.
83+
84 @cindex @option{-lgcc}, use with @option{-nostdlib}
85 @cindex @option{-nostdlib} and unresolved references
86 @cindex unresolved references and @option{-nostdlib}
87Index: gcc-4.9-20140316/gcc/gcc.c
88===================================================================
89--- gcc-4.9-20140316.orig/gcc/gcc.c
90+++ gcc-4.9-20140316/gcc/gcc.c
91@@ -772,6 +772,7 @@ proper position among the other output f
92 %(mflib) " STACK_SPLIT_SPEC "\
93 %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \
94 %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
95+ %{!nostdlib++:}\
96 %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}"
97 #endif
98
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch b/meta/recipes-devtools/gcc/gcc-4.9/0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch
deleted file mode 100644
index eb3c61f127..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0021-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch
+++ /dev/null
@@ -1,59 +0,0 @@
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.9/0022-COLLECT_GCC_OPTIONS.patch b/meta/recipes-devtools/gcc/gcc-4.9/0022-COLLECT_GCC_OPTIONS.patch
deleted file mode 100644
index 40c8abffae..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0022-COLLECT_GCC_OPTIONS.patch
+++ /dev/null
@@ -1,38 +0,0 @@
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.9/0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch b/meta/recipes-devtools/gcc/gcc-4.9/0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
deleted file mode 100644
index fddfe9e5e8..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0023-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
+++ /dev/null
@@ -1,96 +0,0 @@
1From f7d49ca445e60faa1b5256c6b4f96c1ee5c0e353 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
15While compiling gcc-crosssdk-initial-x86_64 on some host, there is
16occasionally failure that test the existance of default.h doesn't
17work, the reason is tm_include_list='** defaults.h' rather than
18tm_include_list='** ./defaults.h'
19
20So we add the test condition for this situation.
21Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
22---
23 gcc/Makefile.in | 2 +-
24 gcc/configure | 4 ++--
25 gcc/configure.ac | 4 ++--
26 gcc/mkconfig.sh | 4 ++--
27 4 files changed, 7 insertions(+), 7 deletions(-)
28
29diff --git a/gcc/Makefile.in b/gcc/Makefile.in
30index d1ab22f..15fe4b6 100644
31--- a/gcc/Makefile.in
32+++ b/gcc/Makefile.in
33@@ -483,7 +483,7 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
34 TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
35
36 xmake_file=@xmake_file@
37-tmake_file=@tmake_file@
38+tmake_file=@tmake_file@ ./t-oe
39 TM_ENDIAN_CONFIG=@TM_ENDIAN_CONFIG@
40 TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@
41 TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@
42diff --git a/gcc/configure b/gcc/configure
43index 5399b2b..60a04bd 100755
44--- a/gcc/configure
45+++ b/gcc/configure
46@@ -11631,8 +11631,8 @@ for f in $tm_file; do
47 tm_include_list="${tm_include_list} $f"
48 ;;
49 defaults.h )
50- tm_file_list="${tm_file_list} \$(srcdir)/$f"
51- tm_include_list="${tm_include_list} $f"
52+ tm_file_list="${tm_file_list} ./$f"
53+ tm_include_list="${tm_include_list} ./$f"
54 ;;
55 * )
56 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
57diff --git a/gcc/configure.ac b/gcc/configure.ac
58index f87c3b6..460e0d9 100644
59--- a/gcc/configure.ac
60+++ b/gcc/configure.ac
61@@ -1740,8 +1740,8 @@ for f in $tm_file; do
62 tm_include_list="${tm_include_list} $f"
63 ;;
64 defaults.h )
65- tm_file_list="${tm_file_list} \$(srcdir)/$f"
66- tm_include_list="${tm_include_list} $f"
67+ tm_file_list="${tm_file_list} ./$f"
68+ tm_include_list="${tm_include_list} ./$f"
69 ;;
70 * )
71 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
72diff --git a/gcc/mkconfig.sh b/gcc/mkconfig.sh
73index c7146ed..b153f45 100644
74--- a/gcc/mkconfig.sh
75+++ b/gcc/mkconfig.sh
76@@ -77,7 +77,7 @@ if [ -n "$HEADERS" ]; then
77 if [ $# -ge 1 ]; then
78 echo '#ifdef IN_GCC' >> ${output}T
79 for file in "$@"; do
80- if test x"$file" = x"defaults.h"; then
81+ if test x"$file" = x"./defaults.h" -o x"$file" = x"defaults.h"; then
82 postpone_defaults_h="yes"
83 else
84 echo "# include \"$file\"" >> ${output}T
85@@ -106,7 +106,7 @@ esac
86
87 # If we postponed including defaults.h, add the #include now.
88 if test x"$postpone_defaults_h" = x"yes"; then
89- echo "# include \"defaults.h\"" >> ${output}T
90+ echo "# include \"./defaults.h\"" >> ${output}T
91 fi
92
93 # Add multiple inclusion protection guard, part two.
94--
951.9.1
96
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0025-fortran-cross-compile-hack.patch b/meta/recipes-devtools/gcc/gcc-4.9/0025-fortran-cross-compile-hack.patch
deleted file mode 100644
index 0e7914d5c7..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0025-fortran-cross-compile-hack.patch
+++ /dev/null
@@ -1,46 +0,0 @@
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.9/0026-libgcc-sjlj-check.patch b/meta/recipes-devtools/gcc/gcc-4.9/0026-libgcc-sjlj-check.patch
deleted file mode 100644
index d4efab956a..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0026-libgcc-sjlj-check.patch
+++ /dev/null
@@ -1,74 +0,0 @@
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.9/0027-cpp-honor-sysroot.patch b/meta/recipes-devtools/gcc/gcc-4.9/0027-cpp-honor-sysroot.patch
deleted file mode 100644
index 05e95219f8..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0027-cpp-honor-sysroot.patch
+++ /dev/null
@@ -1,54 +0,0 @@
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.9/0028-MIPS64-Default-to-N64-ABI.patch b/meta/recipes-devtools/gcc/gcc-4.9/0028-MIPS64-Default-to-N64-ABI.patch
deleted file mode 100644
index 263872069c..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0028-MIPS64-Default-to-N64-ABI.patch
+++ /dev/null
@@ -1,31 +0,0 @@
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.9/0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch b/meta/recipes-devtools/gcc/gcc-4.9/0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
deleted file mode 100644
index 969d290ad6..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0029-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
+++ /dev/null
@@ -1,228 +0,0 @@
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
32Index: gcc-4.9.0/gcc/config/alpha/linux-elf.h
33===================================================================
34--- gcc-4.9.0.orig/gcc/config/alpha/linux-elf.h 2014-05-07 16:43:50.609106535 +0000
35+++ gcc-4.9.0/gcc/config/alpha/linux-elf.h 2014-05-07 16:43:50.605106535 +0000
36@@ -23,8 +23,8 @@
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
47Index: gcc-4.9.0/gcc/config/arm/linux-eabi.h
48===================================================================
49--- gcc-4.9.0.orig/gcc/config/arm/linux-eabi.h 2014-05-07 16:43:50.609106535 +0000
50+++ gcc-4.9.0/gcc/config/arm/linux-eabi.h 2014-05-07 16:43:50.605106535 +0000
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 \
62Index: gcc-4.9.0/gcc/config/arm/linux-elf.h
63===================================================================
64--- gcc-4.9.0.orig/gcc/config/arm/linux-elf.h 2014-05-07 16:43:50.609106535 +0000
65+++ gcc-4.9.0/gcc/config/arm/linux-elf.h 2014-05-07 16:43:50.605106535 +0000
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} \
75Index: gcc-4.9.0/gcc/config/i386/linux.h
76===================================================================
77--- gcc-4.9.0.orig/gcc/config/i386/linux.h 2014-05-07 16:43:50.609106535 +0000
78+++ gcc-4.9.0/gcc/config/i386/linux.h 2014-05-07 16:43:50.605106535 +0000
79@@ -20,4 +20,4 @@
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"
85Index: gcc-4.9.0/gcc/config/i386/linux64.h
86===================================================================
87--- gcc-4.9.0.orig/gcc/config/i386/linux64.h 2014-05-07 16:43:50.609106535 +0000
88+++ gcc-4.9.0/gcc/config/i386/linux64.h 2014-05-07 16:43:50.605106535 +0000
89@@ -27,6 +27,6 @@
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"
99Index: gcc-4.9.0/gcc/config/mips/linux.h
100===================================================================
101--- gcc-4.9.0.orig/gcc/config/mips/linux.h 2014-05-07 16:43:50.609106535 +0000
102+++ gcc-4.9.0/gcc/config/mips/linux.h 2014-05-07 16:43:50.605106535 +0000
103@@ -18,8 +18,8 @@
104 <http://www.gnu.org/licenses/>. */
105
106 #define GLIBC_DYNAMIC_LINKER \
107- "%{mnan=2008:/lib/ld-linux-mipsn8.so.1;:/lib/ld.so.1}"
108+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
109
110 #undef UCLIBC_DYNAMIC_LINKER
111 #define UCLIBC_DYNAMIC_LINKER \
112- "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
113+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
114Index: gcc-4.9.0/gcc/config/mips/linux64.h
115===================================================================
116--- gcc-4.9.0.orig/gcc/config/mips/linux64.h 2014-05-07 16:43:50.609106535 +0000
117+++ gcc-4.9.0/gcc/config/mips/linux64.h 2014-05-07 16:43:50.605106535 +0000
118@@ -23,20 +23,20 @@
119 #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
120
121 #define GLIBC_DYNAMIC_LINKER32 \
122- "%{mnan=2008:/lib/ld-linux-mipsn8.so.1;:/lib/ld.so.1}"
123+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
124 #define GLIBC_DYNAMIC_LINKER64 \
125- "%{mnan=2008:/lib64/ld-linux-mipsn8.so.1;:/lib64/ld.so.1}"
126+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
127 #define GLIBC_DYNAMIC_LINKERN32 \
128- "%{mnan=2008:/lib32/ld-linux-mipsn8.so.1;:/lib32/ld.so.1}"
129+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
130
131 #undef UCLIBC_DYNAMIC_LINKER32
132 #define UCLIBC_DYNAMIC_LINKER32 \
133- "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
134+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
135 #undef UCLIBC_DYNAMIC_LINKER64
136 #define UCLIBC_DYNAMIC_LINKER64 \
137- "%{mnan=2008:/lib/ld64-uClibc-mipsn8.so.0;:/lib/ld64-uClibc.so.0}"
138+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld64-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld64-uClibc.so.0}"
139 #define UCLIBC_DYNAMIC_LINKERN32 \
140- "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}"
141+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
142
143 #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
144 #define GNU_USER_DYNAMIC_LINKERN32 \
145Index: gcc-4.9.0/gcc/config/rs6000/linux64.h
146===================================================================
147--- gcc-4.9.0.orig/gcc/config/rs6000/linux64.h 2014-05-07 16:43:50.609106535 +0000
148+++ gcc-4.9.0/gcc/config/rs6000/linux64.h 2014-05-07 16:43:50.605106535 +0000
149@@ -367,14 +367,14 @@
150 #undef LINK_OS_DEFAULT_SPEC
151 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
152
153-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
154+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1"
155 #ifdef LINUX64_DEFAULT_ABI_ELFv2
156-#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/lib64/ld64.so.1;:/lib64/ld64.so.2}"
157+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:" SYSTEMLIBS_DIR "ld64.so.1;:" SYSTEMLIBS_DIR "ld64.so.2}"
158 #else
159-#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
160+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:" SYSTEMLIBS_DIR "ld64.so.2;:" SYSTEMLIBS_DIR "ld64.so.1}"
161 #endif
162-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
163-#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
164+#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
165+#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
166 #if DEFAULT_LIBC == LIBC_UCLIBC
167 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
168 #elif DEFAULT_LIBC == LIBC_GLIBC
169Index: gcc-4.9.0/gcc/config/sh/linux.h
170===================================================================
171--- gcc-4.9.0.orig/gcc/config/sh/linux.h 2014-05-07 16:43:50.609106535 +0000
172+++ gcc-4.9.0/gcc/config/sh/linux.h 2014-05-07 16:43:50.605106535 +0000
173@@ -43,7 +43,7 @@
174
175 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
176
177-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
178+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
179
180 #undef SUBTARGET_LINK_EMUL_SUFFIX
181 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
182Index: gcc-4.9.0/gcc/config/sparc/linux.h
183===================================================================
184--- gcc-4.9.0.orig/gcc/config/sparc/linux.h 2014-05-07 16:43:50.609106535 +0000
185+++ gcc-4.9.0/gcc/config/sparc/linux.h 2014-05-07 16:43:50.605106535 +0000
186@@ -83,7 +83,7 @@
187 When the -shared link option is used a final link is not being
188 done. */
189
190-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
191+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
192
193 #undef LINK_SPEC
194 #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
195Index: gcc-4.9.0/gcc/config/sparc/linux64.h
196===================================================================
197--- gcc-4.9.0.orig/gcc/config/sparc/linux64.h 2014-05-07 16:43:50.609106535 +0000
198+++ gcc-4.9.0/gcc/config/sparc/linux64.h 2014-05-07 16:43:50.605106535 +0000
199@@ -92,8 +92,8 @@
200 When the -shared link option is used a final link is not being
201 done. */
202
203-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
204-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
205+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
206+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux.so.2"
207
208 #ifdef SPARC_BI_ARCH
209
210Index: gcc-4.9.0/gcc/config/linux.h
211===================================================================
212--- gcc-4.9.0.orig/gcc/config/linux.h 2014-05-07 16:43:50.609106535 +0000
213+++ gcc-4.9.0/gcc/config/linux.h 2014-05-07 16:43:50.605106535 +0000
214@@ -73,10 +73,10 @@
215 GLIBC_DYNAMIC_LINKER must be defined for each target using them, or
216 GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets
217 supporting both 32-bit and 64-bit compilation. */
218-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
219-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
220-#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
221-#define UCLIBC_DYNAMIC_LINKERX32 "/lib/ldx32-uClibc.so.0"
222+#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0"
223+#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
224+#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
225+#define UCLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ldx32-uClibc.so.0"
226 #define BIONIC_DYNAMIC_LINKER "/system/bin/linker"
227 #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
228 #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0030-gcc-Fix-argument-list-too-long-error.patch b/meta/recipes-devtools/gcc/gcc-4.9/0030-gcc-Fix-argument-list-too-long-error.patch
deleted file mode 100644
index 2ceaff64f7..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0030-gcc-Fix-argument-list-too-long-error.patch
+++ /dev/null
@@ -1,40 +0,0 @@
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.9/0031-Disable-sdt.patch b/meta/recipes-devtools/gcc/gcc-4.9/0031-Disable-sdt.patch
deleted file mode 100644
index 2c1d5e086b..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0031-Disable-sdt.patch
+++ /dev/null
@@ -1,113 +0,0 @@
1From b85265bc94ec1beaf1d3b697c03db62991553467 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
15Disable sdt for libstdc++-v3.
16
17Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
18
19Upstream-Status: Inappropriate [hack]
20---
21 gcc/configure | 12 ++++++------
22 gcc/configure.ac | 18 +++++++++---------
23 libstdc++-v3/configure | 6 +++---
24 libstdc++-v3/configure.ac | 2 +-
25 4 files changed, 19 insertions(+), 19 deletions(-)
26
27diff --git a/gcc/configure b/gcc/configure
28index 3c550a6..01c7626 100755
29--- a/gcc/configure
30+++ b/gcc/configure
31@@ -26812,12 +26812,12 @@ fi
32 { $as_echo "$as_me:${as_lineno-$LINENO}: checking sys/sdt.h in the target C library" >&5
33 $as_echo_n "checking sys/sdt.h in the target C library... " >&6; }
34 have_sys_sdt_h=no
35-if test -f $target_header_dir/sys/sdt.h; then
36- have_sys_sdt_h=yes
37-
38-$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
39-
40-fi
41+#if test -f $target_header_dir/sys/sdt.h; then
42+# have_sys_sdt_h=yes
43+#
44+#$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
45+#
46+#fi
47 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sys_sdt_h" >&5
48 $as_echo "$have_sys_sdt_h" >&6; }
49
50diff --git a/gcc/configure.ac b/gcc/configure.ac
51index 3601ab6..06e501f 100644
52--- a/gcc/configure.ac
53+++ b/gcc/configure.ac
54@@ -4779,15 +4779,15 @@ if test x$gcc_cv_libc_provides_ssp = xyes; then
55 fi
56
57 # Test for <sys/sdt.h> on the target.
58-GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H])
59-AC_MSG_CHECKING(sys/sdt.h in the target C library)
60-have_sys_sdt_h=no
61-if test -f $target_header_dir/sys/sdt.h; then
62- have_sys_sdt_h=yes
63- AC_DEFINE(HAVE_SYS_SDT_H, 1,
64- [Define if your target C library provides sys/sdt.h])
65-fi
66-AC_MSG_RESULT($have_sys_sdt_h)
67+#GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H])
68+#AC_MSG_CHECKING(sys/sdt.h in the target C library)
69+#have_sys_sdt_h=no
70+#if test -f $target_header_dir/sys/sdt.h; then
71+# have_sys_sdt_h=yes
72+# AC_DEFINE(HAVE_SYS_SDT_H, 1,
73+# [Define if your target C library provides sys/sdt.h])
74+#fi
75+#AC_MSG_RESULT($have_sys_sdt_h)
76
77 # Check if TFmode long double should be used by default or not.
78 # Some glibc targets used DFmode long double, but with glibc 2.4
79diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
80index 4953c9f..53a1145 100755
81--- a/libstdc++-v3/configure
82+++ b/libstdc++-v3/configure
83@@ -20578,11 +20578,11 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
84 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
85 ac_compiler_gnu=$ac_cv_c_compiler_gnu
86
87- if test $glibcxx_cv_sys_sdt_h = yes; then
88+# if test $glibcxx_cv_sys_sdt_h = yes; then
89
90-$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
91+#$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
92
93- fi
94+# fi
95 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_sys_sdt_h" >&5
96 $as_echo "$glibcxx_cv_sys_sdt_h" >&6; }
97
98diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
99index 73d430a..f2135e2 100644
100--- a/libstdc++-v3/configure.ac
101+++ b/libstdc++-v3/configure.ac
102@@ -211,7 +211,7 @@ GLIBCXX_CHECK_SC_NPROCESSORS_ONLN
103 GLIBCXX_CHECK_SC_NPROC_ONLN
104 GLIBCXX_CHECK_PTHREADS_NUM_PROCESSORS_NP
105 GLIBCXX_CHECK_SYSCTL_HW_NCPU
106-GLIBCXX_CHECK_SDT_H
107+#GLIBCXX_CHECK_SDT_H
108
109 # Check for available headers.
110 AC_CHECK_HEADERS([endian.h execinfo.h float.h fp.h ieeefp.h inttypes.h \
111--
1121.8.3.1
113
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0032-libtool.patch b/meta/recipes-devtools/gcc/gcc-4.9/0032-libtool.patch
deleted file mode 100644
index 3b3d1b621b..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0032-libtool.patch
+++ /dev/null
@@ -1,42 +0,0 @@
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.9/0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch b/meta/recipes-devtools/gcc/gcc-4.9/0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
deleted file mode 100644
index b236c37a52..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
+++ /dev/null
@@ -1,40 +0,0 @@
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
21Index: gcc-4.9-20140316/gcc/config/arm/linux-eabi.h
22===================================================================
23--- gcc-4.9-20140316.orig/gcc/config/arm/linux-eabi.h
24+++ gcc-4.9-20140316/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 EABI_LINK_SPEC \
37+#define LINK_SPEC TARGET_FIX_V4BX_SPEC EABI_LINK_SPEC \
38 LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
39 LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
40
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch b/meta/recipes-devtools/gcc/gcc-4.9/0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch
deleted file mode 100644
index 66b9f89a13..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch
+++ /dev/null
@@ -1,102 +0,0 @@
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.9/0040-fix-g++-sysroot.patch b/meta/recipes-devtools/gcc/gcc-4.9/0040-fix-g++-sysroot.patch
deleted file mode 100644
index d50aa5c9bc..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0040-fix-g++-sysroot.patch
+++ /dev/null
@@ -1,40 +0,0 @@
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.9/0041-libtool-avoid-libdir.patch b/meta/recipes-devtools/gcc/gcc-4.9/0041-libtool-avoid-libdir.patch
deleted file mode 100644
index 2dd9610a2f..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0041-libtool-avoid-libdir.patch
+++ /dev/null
@@ -1,19 +0,0 @@
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.9/0043-cpp.patch b/meta/recipes-devtools/gcc/gcc-4.9/0043-cpp.patch
deleted file mode 100644
index eaf8646f97..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0043-cpp.patch
+++ /dev/null
@@ -1,40 +0,0 @@
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.9/0044-gengtypes.patch b/meta/recipes-devtools/gcc/gcc-4.9/0044-gengtypes.patch
deleted file mode 100644
index e38761d4c9..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0044-gengtypes.patch
+++ /dev/null
@@ -1,97 +0,0 @@
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.9/0046-libatomic-deptracking.patch b/meta/recipes-devtools/gcc/gcc-4.9/0046-libatomic-deptracking.patch
deleted file mode 100644
index 6ea4f42765..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0046-libatomic-deptracking.patch
+++ /dev/null
@@ -1,41 +0,0 @@
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.9/0047-repomembug.patch b/meta/recipes-devtools/gcc/gcc-4.9/0047-repomembug.patch
deleted file mode 100644
index 9afd55cbdc..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0047-repomembug.patch
+++ /dev/null
@@ -1,53 +0,0 @@
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-Status: 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.9/0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch b/meta/recipes-devtools/gcc/gcc-4.9/0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch
deleted file mode 100644
index b98f8ff01d..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0049-Enable-SPE-AltiVec-generation-on-powepc-linux-target.patch
+++ /dev/null
@@ -1,42 +0,0 @@
1From 9e0e19eac2562f73858602fe26e2044eb8b20c47 Mon Sep 17 00:00:00 2001
2From: Alexandru-Cezar Sardan <alexandru.sardan@freescale.com>
3Date: Wed, 5 Feb 2014 16:52:31 +0200
4Subject: [PATCH] Enable SPE & AltiVec generation on powepc*linux target
5
6When is configured with --target=powerpc-linux, the resulting GCC will
7not be able to generate code for SPE targets (e500v1/v2).
8GCC configured with --target=powerpc-linuxspe will not be able to
9generate AltiVec instructions (for e6500).
10This patch modifies the configured file such that SPE or AltiVec code
11can be generated when gcc is configured with --target=powerpc-linux.
12The ABI and speciffic instructions can be selected through the
13"-mabi=spe or -mabi=altivec" and the "-mspe or -maltivec" parameters.
14
15Upstream-Status: Inappropriate [configuration]
16
17Signed-off-by: Alexandru-Cezar Sardan <alexandru.sardan@freescale.com>
18---
19 gcc/config.gcc | 7 ++++++-
20 1 file changed, 6 insertions(+), 1 deletion(-)
21
22diff --git a/gcc/config.gcc b/gcc/config.gcc
23index cb7a94e..d392c2b 100644
24--- a/gcc/config.gcc
25+++ b/gcc/config.gcc
26@@ -2068,7 +2068,12 @@ powerpc-*-rtems*)
27 tmake_file="rs6000/t-fprules rs6000/t-rtems t-rtems rs6000/t-ppccomm"
28 ;;
29 powerpc*-*-linux*)
30- tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h"
31+ case ${target} in
32+ powerpc*-*-linux*spe* | powerpc*-*-linux*altivec*)
33+ tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h" ;;
34+ *)
35+ tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h rs6000/linuxaltivec.h rs6000/linuxspe.h rs6000/e500.h" ;;
36+ esac
37 extra_options="${extra_options} rs6000/sysv4.opt"
38 tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm"
39 case ${target} in
40--
411.7.9.5
42
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0050-Revert-Use-dbx_reg_number-for-spanning-registers.patch b/meta/recipes-devtools/gcc/gcc-4.9/0050-Revert-Use-dbx_reg_number-for-spanning-registers.patch
deleted file mode 100644
index aead6f67ba..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0050-Revert-Use-dbx_reg_number-for-spanning-registers.patch
+++ /dev/null
@@ -1,80 +0,0 @@
1Upstream-Status: Pending
2
3From cb9b1c041b634a4c128896e3d3eed4082608c797 Mon Sep 17 00:00:00 2001
4From: Khem Raj <raj.khem@gmail.com>
5Date: Sat, 3 May 2014 19:25:17 -0700
6Subject: [PATCH] Revert "2013-05-21 Christian Bruel
7 <christian.bruel@st.com>"
8
9This reverts commit 3983036a8b6b2710c57777194f21507819a73553.
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12
13Conflicts:
14 gcc/ChangeLog
15---
16 gcc/ChangeLog | 219 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
17 gcc/dwarf2out.c | 33 +++++----
18 2 files changed, 234 insertions(+), 18 deletions(-)
19
20diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
21index 1272326..6ac2b28 100644
22--- a/gcc/dwarf2out.c
23+++ b/gcc/dwarf2out.c
24@@ -10870,27 +10870,25 @@ static dw_loc_descr_ref
25 multiple_reg_loc_descriptor (rtx rtl, rtx regs,
26 enum var_init_status initialized)
27 {
28- int size, i;
29+ int nregs, size, i;
30+ unsigned reg;
31 dw_loc_descr_ref loc_result = NULL;
32
33- /* Simple, contiguous registers. */
34- if (regs == NULL_RTX)
35- {
36- unsigned reg = REGNO (rtl);
37- int nregs;
38-
39+ reg = REGNO (rtl);
40 #ifdef LEAF_REG_REMAP
41- if (crtl->uses_only_leaf_regs)
42- {
43- int leaf_reg = LEAF_REG_REMAP (reg);
44- if (leaf_reg != -1)
45- reg = (unsigned) leaf_reg;
46- }
47+ if (crtl->uses_only_leaf_regs)
48+ {
49+ int leaf_reg = LEAF_REG_REMAP (reg);
50+ if (leaf_reg != -1)
51+ reg = (unsigned) leaf_reg;
52+ }
53 #endif
54+ gcc_assert ((unsigned) DBX_REGISTER_NUMBER (reg) == dbx_reg_number (rtl));
55+ nregs = hard_regno_nregs[REGNO (rtl)][GET_MODE (rtl)];
56
57- gcc_assert ((unsigned) DBX_REGISTER_NUMBER (reg) == dbx_reg_number (rtl));
58- nregs = hard_regno_nregs[REGNO (rtl)][GET_MODE (rtl)];
59-
60+ /* Simple, contiguous registers. */
61+ if (regs == NULL_RTX)
62+ {
63 size = GET_MODE_SIZE (GET_MODE (rtl)) / nregs;
64
65 loc_result = NULL;
66@@ -10918,9 +10916,10 @@ multiple_reg_loc_descriptor (rtx rtl, rtx regs,
67 {
68 dw_loc_descr_ref t;
69
70- t = one_reg_loc_descriptor (dbx_reg_number (XVECEXP (regs, 0, i)),
71+ t = one_reg_loc_descriptor (REGNO (XVECEXP (regs, 0, i)),
72 VAR_INIT_STATUS_INITIALIZED);
73 add_loc_descr (&loc_result, t);
74+ size = GET_MODE_SIZE (GET_MODE (XVECEXP (regs, 0, 0)));
75 add_loc_descr_op_piece (&loc_result, size);
76 }
77
78--
791.9.2
80
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0051-eabispe.patch b/meta/recipes-devtools/gcc/gcc-4.9/0051-eabispe.patch
deleted file mode 100644
index 55e38903f8..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0051-eabispe.patch
+++ /dev/null
@@ -1,23 +0,0 @@
1Upstream-Status: Pending
2
3Taken from http://gcc.gnu.org/ml/gcc-patches/2014-04/msg02064.html
4
52014-04-30 Cesar Philippidis <cesar@codesourcery.com>
6
7 gcc/
8 * dwarf2cfi.c (dwf_regno): Don't assert reg is a pseudo
9 register.
10
11
12diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
13index 4180890..40ef0e2 100644
14--- a/gcc/dwarf2cfi.c
15+++ b/gcc/dwarf2cfi.c
16@@ -906,7 +906,6 @@ notice_eh_throw (rtx insn)
17 static inline unsigned
18 dwf_regno (const_rtx reg)
19 {
20- gcc_assert (REGNO (reg) < FIRST_PSEUDO_REGISTER);
21 return DWARF_FRAME_REGNUM (REGNO (reg));
22 }
23
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0052-Add-target-hook-to-override-DWARF2-frame-register-si.patch b/meta/recipes-devtools/gcc/gcc-4.9/0052-Add-target-hook-to-override-DWARF2-frame-register-si.patch
deleted file mode 100644
index f6958b32c9..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0052-Add-target-hook-to-override-DWARF2-frame-register-si.patch
+++ /dev/null
@@ -1,138 +0,0 @@
1From d626297e87e19251a284ea1e9360e831b48999ca Mon Sep 17 00:00:00 2001
2From: mpf <mpf@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Thu, 4 Sep 2014 08:32:05 +0000
4Subject: [PATCH] Add target hook to override DWARF2 frame register size
5
6gcc/
7
8 * target.def (TARGET_DWARF_FRAME_REG_MODE): New target hook.
9 * targhooks.c (default_dwarf_frame_reg_mode): New function.
10 * targhooks.h (default_dwarf_frame_reg_mode): New prototype.
11 * doc/tm.texi.in (TARGET_DWARF_FRAME_REG_MODE): Document.
12 * doc/tm.texi: Regenerate.
13 * dwarf2cfi.c (expand_builtin_init_dwarf_reg_sizes): Abstract mode
14 selection logic to default_dwarf_frame_reg_mode.
15
16
17
18git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214898 138bc75d-0d04-0410-961f-82ee72b054a4
19
20Signed-off-by: Khem Raj <raj.khem@gmail.com>
21Upstream-Status: Backport [gcc 5.0]
22
23---
24 gcc/ChangeLog | 10 ++++++++++
25 gcc/doc/tm.texi | 7 +++++++
26 gcc/doc/tm.texi.in | 2 ++
27 gcc/dwarf2cfi.c | 4 +---
28 gcc/target.def | 11 +++++++++++
29 gcc/targhooks.c | 13 +++++++++++++
30 gcc/targhooks.h | 1 +
31 7 files changed, 45 insertions(+), 3 deletions(-)
32
33Index: gcc-4.9.2/gcc/doc/tm.texi
34===================================================================
35--- gcc-4.9.2.orig/gcc/doc/tm.texi
36+++ gcc-4.9.2/gcc/doc/tm.texi
37@@ -9017,6 +9017,13 @@ register in Dwarf. Otherwise, this hook
38 If not defined, the default is to return @code{NULL_RTX}.
39 @end deftypefn
40
41+@deftypefn {Target Hook} {enum machine_mode} TARGET_DWARF_FRAME_REG_MODE (int @var{regno})
42+Given a register, this hook should return the mode which the
43+corresponding Dwarf frame register should have. This is normally
44+used to return a smaller mode than the raw mode to prevent call
45+clobbered parts of a register altering the frame register size
46+@end deftypefn
47+
48 @deftypefn {Target Hook} void TARGET_INIT_DWARF_REG_SIZES_EXTRA (tree @var{address})
49 If some registers are represented in Dwarf-2 unwind information in
50 multiple pieces, define this hook to fill in information about the
51Index: gcc-4.9.2/gcc/doc/tm.texi.in
52===================================================================
53--- gcc-4.9.2.orig/gcc/doc/tm.texi.in
54+++ gcc-4.9.2/gcc/doc/tm.texi.in
55@@ -6745,6 +6745,8 @@ the target supports DWARF 2 frame unwind
56
57 @hook TARGET_DWARF_REGISTER_SPAN
58
59+@hook TARGET_DWARF_FRAME_REG_MODE
60+
61 @hook TARGET_INIT_DWARF_REG_SIZES_EXTRA
62
63 @hook TARGET_ASM_TTYPE
64Index: gcc-4.9.2/gcc/dwarf2cfi.c
65===================================================================
66--- gcc-4.9.2.orig/gcc/dwarf2cfi.c
67+++ gcc-4.9.2/gcc/dwarf2cfi.c
68@@ -271,11 +271,9 @@ expand_builtin_init_dwarf_reg_sizes (tre
69 if (rnum < DWARF_FRAME_REGISTERS)
70 {
71 HOST_WIDE_INT offset = rnum * GET_MODE_SIZE (mode);
72- enum machine_mode save_mode = reg_raw_mode[i];
73 HOST_WIDE_INT size;
74+ enum machine_mode save_mode = targetm.dwarf_frame_reg_mode (i);
75
76- if (HARD_REGNO_CALL_PART_CLOBBERED (i, save_mode))
77- save_mode = choose_hard_reg_mode (i, 1, true);
78 if (dnum == DWARF_FRAME_RETURN_COLUMN)
79 {
80 if (save_mode == VOIDmode)
81Index: gcc-4.9.2/gcc/target.def
82===================================================================
83--- gcc-4.9.2.orig/gcc/target.def
84+++ gcc-4.9.2/gcc/target.def
85@@ -3218,6 +3218,17 @@ If not defined, the default is to return
86 rtx, (rtx reg),
87 hook_rtx_rtx_null)
88
89+/* Given a register return the mode of the corresponding DWARF frame
90+ register. */
91+DEFHOOK
92+(dwarf_frame_reg_mode,
93+ "Given a register, this hook should return the mode which the\n\
94+corresponding Dwarf frame register should have. This is normally\n\
95+used to return a smaller mode than the raw mode to prevent call\n\
96+clobbered parts of a register altering the frame register size",
97+ enum machine_mode, (int regno),
98+ default_dwarf_frame_reg_mode)
99+
100 /* If expand_builtin_init_dwarf_reg_sizes needs to fill in table
101 entries not corresponding directly to registers below
102 FIRST_PSEUDO_REGISTER, this hook should generate the necessary
103Index: gcc-4.9.2/gcc/targhooks.c
104===================================================================
105--- gcc-4.9.2.orig/gcc/targhooks.c
106+++ gcc-4.9.2/gcc/targhooks.c
107@@ -1438,6 +1438,19 @@ default_debug_unwind_info (void)
108 return UI_NONE;
109 }
110
111+/* Determine the correct mode for a Dwarf frame register that represents
112+ register REGNO. */
113+
114+enum machine_mode
115+default_dwarf_frame_reg_mode (int regno)
116+{
117+ enum machine_mode save_mode = reg_raw_mode[regno];
118+
119+ if (HARD_REGNO_CALL_PART_CLOBBERED (regno, save_mode))
120+ save_mode = choose_hard_reg_mode (regno, 1, true);
121+ return save_mode;
122+}
123+
124 /* To be used by targets where reg_raw_mode doesn't return the right
125 mode for registers used in apply_builtin_return and apply_builtin_arg. */
126
127Index: gcc-4.9.2/gcc/targhooks.h
128===================================================================
129--- gcc-4.9.2.orig/gcc/targhooks.h
130+++ gcc-4.9.2/gcc/targhooks.h
131@@ -194,6 +194,7 @@ extern int default_label_align_max_skip
132 extern int default_jump_align_max_skip (rtx);
133 extern section * default_function_section(tree decl, enum node_frequency freq,
134 bool startup, bool exit);
135+extern enum machine_mode default_dwarf_frame_reg_mode (int);
136 extern enum machine_mode default_get_reg_raw_mode (int);
137
138 extern void *default_get_pch_validity (size_t *);
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0053-gcc-fix-segfault-from-calling-free-on-non-malloc-d-a.patch b/meta/recipes-devtools/gcc/gcc-4.9/0053-gcc-fix-segfault-from-calling-free-on-non-malloc-d-a.patch
deleted file mode 100644
index 23b445c9eb..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0053-gcc-fix-segfault-from-calling-free-on-non-malloc-d-a.patch
+++ /dev/null
@@ -1,66 +0,0 @@
1From a22a222c8f9299f6c07a0274388ade7d4ab8c28d Mon Sep 17 00:00:00 2001
2From: Paul Gortmaker <paul.gortmaker@windriver.com>
3Date: Fri, 20 Jun 2014 16:41:08 -0400
4Subject: [PATCH] gcc: fix segfault from calling free on non-malloc'd area
5
6We see the following on a 32bit gcc installed on 64 bit host:
7
8 Reading symbols from ./i586-pokymllib32-linux-gcc...done.
9 (gdb) run
10 Starting program: x86-pokymllib32-linux/lib32-gcc/4.9.0-r0/image/usr/bin/i586-pokymllib32-linux-gcc
11
12 Program received signal SIGSEGV, Segmentation fault.
13 0xf7e957e0 in free () from /lib/i386-linux-gnu/libc.so.6
14 (gdb) bt
15 #0 0xf7e957e0 in free () from /lib/i386-linux-gnu/libc.so.6
16 #1 0x0804b73c in set_multilib_dir () at gcc-4.9.0/gcc/gcc.c:7827
17 #2 main (argc=1, argv=0xffffd504) at gcc-4.9.0/gcc/gcc.c:6688
18 (gdb)
19
20The problem arises because we conditionally assign the pointer we
21eventually free, and the conditional may assign the pointer to the
22non-malloc'd internal string "." which fails when we free it here:
23
24 if (multilib_dir == NULL && multilib_os_dir != NULL
25 && strcmp (multilib_os_dir, ".") == 0)
26 {
27 free (CONST_CAST (char *, multilib_os_dir));
28 ...
29
30As suggested by Jakub, ensure the "." case is also malloc'd via
31xstrdup() and hence the pointer for the "." case can be freed.
32
33Cc: Jakub Jelinek <jakub@redhat.com>
34Cc: Jeff Law <law@redhat.com>
35Cc: Matthias Klose <doko@ubuntu.com>
36CC: Tobias Burnus <burnus@net-b.de>
37Upstream-Status: Accepted [ https://gcc.gnu.org/ml/gcc-patches/2014-06/msg02069.html ]
38Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
39
40diff --git a/gcc/gcc.c b/gcc/gcc.c
41index 9ac18e60d801..168acf7eb0c9 100644
42--- a/gcc/gcc.c
43+++ b/gcc/gcc.c
44@@ -7790,10 +7790,15 @@ set_multilib_dir (void)
45 q2++;
46 if (*q2 == ':')
47 ml_end = q2;
48- new_multilib_os_dir = XNEWVEC (char, ml_end - q);
49- memcpy (new_multilib_os_dir, q + 1, ml_end - q - 1);
50- new_multilib_os_dir[ml_end - q - 1] = '\0';
51- multilib_os_dir = *new_multilib_os_dir ? new_multilib_os_dir : ".";
52+ if (ml_end - q == 1)
53+ multilib_os_dir = xstrdup (".");
54+ else
55+ {
56+ new_multilib_os_dir = XNEWVEC (char, ml_end - q);
57+ memcpy (new_multilib_os_dir, q + 1, ml_end - q - 1);
58+ new_multilib_os_dir[ml_end - q - 1] = '\0';
59+ multilib_os_dir = new_multilib_os_dir;
60+ }
61
62 if (q2 < end && *q2 == ':')
63 {
64--
651.9.2
66
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0054-gcc-Makefile.in-fix-parallel-building-failure.patch b/meta/recipes-devtools/gcc/gcc-4.9/0054-gcc-Makefile.in-fix-parallel-building-failure.patch
deleted file mode 100644
index 7e8efa1e84..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0054-gcc-Makefile.in-fix-parallel-building-failure.patch
+++ /dev/null
@@ -1,61 +0,0 @@
1gcc/Makefile.in: fix parallel building failure
2
3The gcc-ar.o, gcc-nm.o, gcc-ranlib.o and errors.o included
4config.h which was a generated file. But no explicity rule
5to clarify the dependency. There was potential building
6failure while parallel make.
7
8For gcc-ar.o, gcc-nm.o and gcc-ranlib.o, they were compiled from one C
9source file gcc-ar.c, we add them to ALL_HOST_BACKEND_OBJS, so the
10'$(ALL_HOST_OBJS) : | $(generated_files)' rule could work for these
11objects.
12
13For errors.o, it is part of gengtype, and the gengtype generator program
14is special: Two versions are built. One is for the build machine, and one
15is for the host. We refered what gengtype-parse.o did (which also is part
16of gengtype).
17
18[GCC #61899]
19https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61899
20
21Upstream-Status: Submitted [gcc-patches@gcc.gnu.org]
22
23Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
24---
25 gcc/Makefile.in | 7 ++++++-
26 1 file changed, 6 insertions(+), 1 deletion(-)
27
28diff --git a/gcc/Makefile.in b/gcc/Makefile.in
29index 6475cba..56e50bb 100644
30--- a/gcc/Makefile.in
31+++ b/gcc/Makefile.in
32@@ -1481,13 +1481,16 @@ OBJS-libcommon-target = $(common_out_object_file) prefix.o params.o \
33 opts.o opts-common.o options.o vec.o hooks.o common/common-targhooks.o \
34 hash-table.o file-find.o
35
36+# Objects compiled from one C source file gcc-ar.c
37+OBJS-gcc-ar = gcc-ar.o gcc-nm.o gcc-ranlib.o
38+
39 # This lists all host objects for the front ends.
40 ALL_HOST_FRONTEND_OBJS = $(foreach v,$(CONFIG_LANGUAGES),$($(v)_OBJS))
41
42 ALL_HOST_BACKEND_OBJS = $(GCC_OBJS) $(OBJS) $(OBJS-libcommon) \
43 $(OBJS-libcommon-target) @TREEBROWSER@ main.o c-family/cppspec.o \
44 $(COLLECT2_OBJS) $(EXTRA_GCC_OBJS) $(GCOV_OBJS) $(GCOV_DUMP_OBJS) \
45- lto-wrapper.o
46+ lto-wrapper.o $(OBJS-gcc-ar)
47
48 # This lists all host object files, whether they are included in this
49 # compilation or not.
50@@ -2437,6 +2440,8 @@ gengtype-parse.o: $(CONFIG_H)
51 CFLAGS-build/gengtype-parse.o += -DGENERATOR_FILE
52 build/gengtype-parse.o: $(BCONFIG_H)
53
54+errors.o : $(CONFIG_H)
55+
56 gengtype-state.o build/gengtype-state.o: gengtype-state.c $(SYSTEM_H) \
57 gengtype.h errors.h double-int.h version.h $(HASHTAB_H) $(OBSTACK_H) \
58 $(XREGEX_H)
59--
601.8.1.2
61
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0055-dwarf-reg-processing-helper.patch b/meta/recipes-devtools/gcc/gcc-4.9/0055-dwarf-reg-processing-helper.patch
deleted file mode 100644
index 557dab0f31..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0055-dwarf-reg-processing-helper.patch
+++ /dev/null
@@ -1,148 +0,0 @@
1From 4fd39f1329379e00f958394adde6be96f0caf21f Mon Sep 17 00:00:00 2001
2From: hainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Fri, 5 Dec 2014 16:53:22 +0000
4Subject: [PATCH] 2014-12-05 Olivier Hainque <hainque@adacore.com>
5
6 * dwarf2cfi.c (init_one_dwarf_reg_size): New helper, processing
7 one particular reg for expand_builtin_init_dwarf_reg_sizes.
8 (expand_builtin_init_dwarf_reg_sizes): Rework to use helper and
9 account for dwarf register spans.
10
11
12
13git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218428 138bc75d-0d04-0410-961f-82ee72b054a4
14
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16Upstream-Status: Backport [gcc 5.0]
17
18---
19 gcc/ChangeLog | 7 +++++
20 gcc/dwarf2cfi.c | 98 +++++++++++++++++++++++++++++++++++++++++++++------------
21 2 files changed, 85 insertions(+), 20 deletions(-)
22
23Index: gcc-4.9.2/gcc/dwarf2cfi.c
24===================================================================
25--- gcc-4.9.2.orig/gcc/dwarf2cfi.c
26+++ gcc-4.9.2/gcc/dwarf2cfi.c
27@@ -252,7 +252,59 @@ init_return_column_size (enum machine_mo
28 gen_int_mode (size, mode));
29 }
30
31-/* Generate code to initialize the register size table. */
32+/* Datastructure used by expand_builtin_init_dwarf_reg_sizes and
33+ init_one_dwarf_reg_size to communicate on what has been done by the
34+ latter. */
35+
36+typedef struct
37+{
38+ /* Whether the dwarf return column was initialized. */
39+ bool wrote_return_column;
40+
41+ /* For each hard register REGNO, whether init_one_dwarf_reg_size
42+ was given REGNO to process already. */
43+ bool processed_regno [FIRST_PSEUDO_REGISTER];
44+
45+} init_one_dwarf_reg_state;
46+
47+/* Helper for expand_builtin_init_dwarf_reg_sizes. Generate code to
48+ initialize the dwarf register size table entry corresponding to register
49+ REGNO in REGMODE. TABLE is the table base address, SLOTMODE is the mode to
50+ use for the size entry to initialize, and INIT_STATE is the communication
51+ datastructure conveying what we're doing to our caller. */
52+
53+static
54+void init_one_dwarf_reg_size (int regno, machine_mode regmode,
55+ rtx table, machine_mode slotmode,
56+ init_one_dwarf_reg_state *init_state)
57+{
58+ const unsigned int dnum = DWARF_FRAME_REGNUM (regno);
59+ const unsigned int rnum = DWARF2_FRAME_REG_OUT (dnum, 1);
60+
61+ const HOST_WIDE_INT slotoffset = rnum * GET_MODE_SIZE (slotmode);
62+ const HOST_WIDE_INT regsize = GET_MODE_SIZE (regmode);
63+
64+ init_state->processed_regno[regno] = true;
65+
66+ if (rnum >= DWARF_FRAME_REGISTERS)
67+ return;
68+
69+ if (dnum == DWARF_FRAME_RETURN_COLUMN)
70+ {
71+ if (regmode == VOIDmode)
72+ return;
73+ init_state->wrote_return_column = true;
74+ }
75+
76+ if (slotoffset < 0)
77+ return;
78+
79+ emit_move_insn (adjust_address (table, slotmode, slotoffset),
80+ gen_int_mode (regsize, slotmode));
81+}
82+
83+/* Generate code to initialize the dwarf register size table located
84+ at the provided ADDRESS. */
85
86 void
87 expand_builtin_init_dwarf_reg_sizes (tree address)
88@@ -261,35 +313,40 @@ expand_builtin_init_dwarf_reg_sizes (tre
89 enum machine_mode mode = TYPE_MODE (char_type_node);
90 rtx addr = expand_normal (address);
91 rtx mem = gen_rtx_MEM (BLKmode, addr);
92- bool wrote_return_column = false;
93+
94+ init_one_dwarf_reg_state init_state;
95+
96+ memset ((char *)&init_state, 0, sizeof (init_state));
97
98 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
99 {
100- unsigned int dnum = DWARF_FRAME_REGNUM (i);
101- unsigned int rnum = DWARF2_FRAME_REG_OUT (dnum, 1);
102-
103- if (rnum < DWARF_FRAME_REGISTERS)
104- {
105- HOST_WIDE_INT offset = rnum * GET_MODE_SIZE (mode);
106- HOST_WIDE_INT size;
107- enum machine_mode save_mode = targetm.dwarf_frame_reg_mode (i);
108+ machine_mode save_mode;
109+ rtx span;
110
111- if (dnum == DWARF_FRAME_RETURN_COLUMN)
112+ /* No point in processing a register multiple times. This could happen
113+ with register spans, e.g. when a reg is first processed as a piece of
114+ a span, then as a register on its own later on. */
115+
116+ if (init_state.processed_regno[i])
117+ continue;
118+
119+ save_mode = targetm.dwarf_frame_reg_mode (i);
120+ span = targetm.dwarf_register_span (gen_rtx_REG (save_mode, i));
121+ if (!span)
122+ init_one_dwarf_reg_size (i, save_mode, mem, mode, &init_state);
123+ else
124+ {
125+ for (int si = 0; si < XVECLEN (span, 0); si++)
126 {
127- if (save_mode == VOIDmode)
128- continue;
129- wrote_return_column = true;
130- }
131- size = GET_MODE_SIZE (save_mode);
132- if (offset < 0)
133- continue;
134+ rtx reg = XVECEXP (span, 0, si);
135+ init_one_dwarf_reg_size
136+ (REGNO (reg), GET_MODE (reg), mem, mode, &init_state);
137+ }
138
139- emit_move_insn (adjust_address (mem, mode, offset),
140- gen_int_mode (size, mode));
141 }
142 }
143
144- if (!wrote_return_column)
145+ if (!init_state.wrote_return_column)
146 init_return_column_size (mode, mem, DWARF_FRAME_RETURN_COLUMN);
147
148 #ifdef DWARF_ALT_FRAME_RETURN_COLUMN
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0056-define-default-cfa-register-mapping.patch b/meta/recipes-devtools/gcc/gcc-4.9/0056-define-default-cfa-register-mapping.patch
deleted file mode 100644
index 3b6c94c492..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0056-define-default-cfa-register-mapping.patch
+++ /dev/null
@@ -1,75 +0,0 @@
1From c0235a33de8c4f78cce35b2a8c2035c83fe1bd14 Mon Sep 17 00:00:00 2001
2From: hainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Fri, 5 Dec 2014 17:01:42 +0000
4Subject: [PATCH] 2014-12-05 Olivier Hainque <hainque@adacore.com>
5
6 gcc/
7 * defaults.h: (DWARF_REG_TO_UNWIND_COLUMN): Define default.
8 * dwarf2cfi.c (init_one_dwarf_reg_size): Honor
9 DWARF_REG_TO_UNWIND_COLUMN.
10
11 libgcc/
12 * unwind-dw2.c (DWARF_REG_TO_UNWIND_COLUMN): Remove default def,
13 now provided by defaults.h.
14
15
16
17git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218429 138bc75d-0d04-0410-961f-82ee72b054a4
18
19Signed-off-by: Khem Raj <raj.khem@gmail.com>
20Upstream-Status: Backport [gcc 5.0]
21
22---
23 gcc/ChangeLog | 6 ++++++
24 gcc/defaults.h | 5 +++++
25 gcc/dwarf2cfi.c | 3 ++-
26 libgcc/ChangeLog | 5 +++++
27 libgcc/unwind-dw2.c | 4 ----
28 5 files changed, 18 insertions(+), 5 deletions(-)
29
30Index: gcc-4.9.2/gcc/defaults.h
31===================================================================
32--- gcc-4.9.2.orig/gcc/defaults.h
33+++ gcc-4.9.2/gcc/defaults.h
34@@ -438,6 +438,11 @@ see the files COPYING3 and COPYING.RUNTI
35 #define DWARF_FRAME_REGNUM(REG) DBX_REGISTER_NUMBER (REG)
36 #endif
37
38+/* The mapping from dwarf CFA reg number to internal dwarf reg numbers. */
39+#ifndef DWARF_REG_TO_UNWIND_COLUMN
40+#define DWARF_REG_TO_UNWIND_COLUMN(REGNO) (REGNO)
41+#endif
42+
43 /* Map register numbers held in the call frame info that gcc has
44 collected using DWARF_FRAME_REGNUM to those that should be output in
45 .debug_frame and .eh_frame. */
46Index: gcc-4.9.2/gcc/dwarf2cfi.c
47===================================================================
48--- gcc-4.9.2.orig/gcc/dwarf2cfi.c
49+++ gcc-4.9.2/gcc/dwarf2cfi.c
50@@ -280,8 +280,9 @@ void init_one_dwarf_reg_size (int regno,
51 {
52 const unsigned int dnum = DWARF_FRAME_REGNUM (regno);
53 const unsigned int rnum = DWARF2_FRAME_REG_OUT (dnum, 1);
54+ const unsigned int dcol = DWARF_REG_TO_UNWIND_COLUMN (rnum);
55
56- const HOST_WIDE_INT slotoffset = rnum * GET_MODE_SIZE (slotmode);
57+ const HOST_WIDE_INT slotoffset = dcol * GET_MODE_SIZE (slotmode);
58 const HOST_WIDE_INT regsize = GET_MODE_SIZE (regmode);
59
60 init_state->processed_regno[regno] = true;
61Index: gcc-4.9.2/libgcc/unwind-dw2.c
62===================================================================
63--- gcc-4.9.2.orig/libgcc/unwind-dw2.c
64+++ gcc-4.9.2/libgcc/unwind-dw2.c
65@@ -55,10 +55,6 @@
66 #define PRE_GCC3_DWARF_FRAME_REGISTERS DWARF_FRAME_REGISTERS
67 #endif
68
69-#ifndef DWARF_REG_TO_UNWIND_COLUMN
70-#define DWARF_REG_TO_UNWIND_COLUMN(REGNO) (REGNO)
71-#endif
72-
73 /* ??? For the public function interfaces, we tend to gcc_assert that the
74 column numbers are in range. For the dwarf2 unwind info this does happen,
75 although so far in a case that doesn't actually matter.
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0057-aarch64-config.patch b/meta/recipes-devtools/gcc/gcc-4.9/0057-aarch64-config.patch
deleted file mode 100644
index f29559698a..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0057-aarch64-config.patch
+++ /dev/null
@@ -1,32 +0,0 @@
1Disable the MULTILIB_OSDIRNAMES and other multilib options.
2
3Hard coding the MULTILIB_OSDIRNAMES with ../lib64 is causing problems on
4systems where the libdir is NOT set to /lib64. This is allowed by the ABI, as
5long as the dynamic loader is present in /lib.
6
7We simply want to use the default rules in gcc to find and configure the
8normal libdir.
9
10Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
11
12Index: gcc-4.9.1/gcc/config/aarch64/t-aarch64-linux
13===================================================================
14--- gcc-4.9.1.orig/gcc/config/aarch64/t-aarch64-linux
15+++ gcc-4.9.1/gcc/config/aarch64/t-aarch64-linux
16@@ -21,11 +21,11 @@
17 LIB1ASMSRC = aarch64/lib1funcs.asm
18 LIB1ASMFUNCS = _aarch64_sync_cache_range
19
20-AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
21-MULTILIB_OSDIRNAMES = .=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
22-MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
23+#AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
24+#MULTILIB_OSDIRNAMES = .=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
25+#MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
26
27 # Disable the multilib for linux-gnu targets for the time being; focus
28 # on the baremetal targets.
29-MULTILIB_OPTIONS =
30-MULTILIB_DIRNAMES =
31+#MULTILIB_OPTIONS =
32+#MULTILIB_DIRNAMES =
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0058-gcc-r212171.patch b/meta/recipes-devtools/gcc/gcc-4.9/0058-gcc-r212171.patch
deleted file mode 100644
index d442ba8a82..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0058-gcc-r212171.patch
+++ /dev/null
@@ -1,113 +0,0 @@
1From ca03cf1b133d66eb978c68f6dbc345e9aabcba88 Mon Sep 17 00:00:00 2001
2From: uros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Mon, 30 Jun 2014 19:30:52 +0000
4Subject: [PATCH] r212171
5
6* except.c (emit_note_eh_region_end): New helper
7 function. (convert_to_eh_region_ranges): Use
8 emit_note_eh_region_end to emit EH_REGION_END note.
9 * jump.c (cleanup_barriers): Do not split a call and its
10 corresponding CALL_ARG_LOCATION note.
11
12git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212171 138bc75d-0d04-0410-961f-82ee72b054a4
13
14Upstream-Status: Backport [https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=212171]
15Signed-off-by: Baoshan Pang <baoshan.pang@windriver.com>
16---
17 gcc/except.c | 23 ++++++++++++++++++-----
18 gcc/jump.c | 19 +++++++++++++++----
19 2 files changed, 33 insertions(+), 9 deletions(-)
20
21diff --git a/gcc/except.c b/gcc/except.c
22index dc5c1d2..7ac114f 100644
23--- a/gcc/except.c
24+++ b/gcc/except.c
25@@ -2466,6 +2466,20 @@ add_call_site (rtx landing_pad, int action, int section)
26 return call_site_base + crtl->eh.call_site_record_v[section]->length () - 1;
27 }
28
29+static rtx
30+emit_note_eh_region_end (rtx insn)
31+{
32+ rtx next = NEXT_INSN (insn);
33+
34+ /* Make sure we do not split a call and its corresponding
35+ CALL_ARG_LOCATION note. */
36+ if (next && NOTE_P (next)
37+ && NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION)
38+ insn = next;
39+
40+ return emit_note_after (NOTE_INSN_EH_REGION_END, insn);
41+}
42+
43 /* Turn REG_EH_REGION notes back into NOTE_INSN_EH_REGION notes.
44 The new note numbers will not refer to region numbers, but
45 instead to call site entries. */
46@@ -2544,8 +2558,8 @@ convert_to_eh_region_ranges (void)
47 note = emit_note_before (NOTE_INSN_EH_REGION_BEG,
48 first_no_action_insn_before_switch);
49 NOTE_EH_HANDLER (note) = call_site;
50- note = emit_note_after (NOTE_INSN_EH_REGION_END,
51- last_no_action_insn_before_switch);
52+ note
53+ = emit_note_eh_region_end (last_no_action_insn_before_switch);
54 NOTE_EH_HANDLER (note) = call_site;
55 gcc_assert (last_action != -3
56 || (last_action_insn
57@@ -2569,8 +2583,7 @@ convert_to_eh_region_ranges (void)
58 first_no_action_insn = NULL_RTX;
59 }
60
61- note = emit_note_after (NOTE_INSN_EH_REGION_END,
62- last_action_insn);
63+ note = emit_note_eh_region_end (last_action_insn);
64 NOTE_EH_HANDLER (note) = call_site;
65 }
66
67@@ -2617,7 +2630,7 @@ convert_to_eh_region_ranges (void)
68
69 if (last_action >= -1 && ! first_no_action_insn)
70 {
71- note = emit_note_after (NOTE_INSN_EH_REGION_END, last_action_insn);
72+ note = emit_note_eh_region_end (last_action_insn);
73 NOTE_EH_HANDLER (note) = call_site;
74 }
75
76diff --git a/gcc/jump.c b/gcc/jump.c
77index 9418f65..a5e5f52 100644
78--- a/gcc/jump.c
79+++ b/gcc/jump.c
80@@ -121,15 +121,26 @@ rebuild_jump_labels_chain (rtx chain)
81 static unsigned int
82 cleanup_barriers (void)
83 {
84- rtx insn, next, prev;
85- for (insn = get_insns (); insn; insn = next)
86+ rtx insn;
87+ for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
88 {
89- next = NEXT_INSN (insn);
90 if (BARRIER_P (insn))
91 {
92- prev = prev_nonnote_insn (insn);
93+ rtx prev = prev_nonnote_insn (insn);
94 if (!prev)
95 continue;
96+
97+ if (CALL_P (prev))
98+ {
99+ /* Make sure we do not split a call and its corresponding
100+ CALL_ARG_LOCATION note. */
101+ rtx next = NEXT_INSN (prev);
102+
103+ if (NOTE_P (next)
104+ && NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION)
105+ prev = next;
106+ }
107+
108 if (BARRIER_P (prev))
109 delete_insn (insn);
110 else if (prev != PREV_INSN (insn))
111--
1121.7.9.5
113
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0059-gcc-PR-rtl-optimization-63348.patch b/meta/recipes-devtools/gcc/gcc-4.9/0059-gcc-PR-rtl-optimization-63348.patch
deleted file mode 100644
index de827cbda6..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0059-gcc-PR-rtl-optimization-63348.patch
+++ /dev/null
@@ -1,59 +0,0 @@
1From 6eae3e637fcc22d21b51d44d61e3a9cb4825e776 Mon Sep 17 00:00:00 2001
2From: Jackie Huang <jackie.huang@windriver.com>
3Date: Thu, 30 Oct 2014 20:37:14 -0700
4Subject: [PATCH]PR rtl-optimization/63348
5
6PR rtl-optimization/63348
7* emit-rtl.c (try_split): Do not emit extra barrier.
8
9Note: this patch is to fix the side effect introduced by r212171 which was reported at:
10https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63348
11
12git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215613 138bc75d-0d04-0410-961f-82ee72b054a4
13
14Upstream-Status: Backport [https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=215613]
15Signed-off-by: Baoshan Pang <baoshan.pang@windriver.com>
16Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
17---
18 gcc/emit-rtl.c | 11 -----------
19 1 files changed, 0 insertions(+), 11 deletions(-)
20
21diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
22index 4736f8d..ae69dbd 100644
23--- a/gcc/emit-rtl.c
24+++ b/gcc/emit-rtl.c
25@@ -3422,7 +3422,6 @@ try_split (rtx pat, rtx trial, int last)
26 {
27 rtx before = PREV_INSN (trial);
28 rtx after = NEXT_INSN (trial);
29- int has_barrier = 0;
30 rtx note, seq, tem;
31 int probability;
32 rtx insn_last, insn;
33@@ -3441,14 +3440,6 @@ try_split (rtx pat, rtx trial, int last)
34
35 split_branch_probability = -1;
36
37- /* If we are splitting a JUMP_INSN, it might be followed by a BARRIER.
38- We may need to handle this specially. */
39- if (after && BARRIER_P (after))
40- {
41- has_barrier = 1;
42- after = NEXT_INSN (after);
43- }
44-
45 if (!seq)
46 return trial;
47
48@@ -3594,8 +3585,6 @@ try_split (rtx pat, rtx trial, int last)
49 tem = emit_insn_after_setloc (seq, trial, INSN_LOCATION (trial));
50
51 delete_insn (trial);
52- if (has_barrier)
53- emit_barrier_after (tem);
54
55 /* Recursively call try_split for each new insn created; by the
56 time control returns here that insn will be fully split, so
57--
581.7.1
59
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0060-Only-allow-e500-double-in-SPE_SIMD_REGNO_P-registers.patch b/meta/recipes-devtools/gcc/gcc-4.9/0060-Only-allow-e500-double-in-SPE_SIMD_REGNO_P-registers.patch
deleted file mode 100644
index 75a9fdd441..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0060-Only-allow-e500-double-in-SPE_SIMD_REGNO_P-registers.patch
+++ /dev/null
@@ -1,55 +0,0 @@
1From 5c0092070253113cf0d9c45eacc884b3ecc34d81 Mon Sep 17 00:00:00 2001
2From: jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Sat, 25 Oct 2014 00:23:17 +0000
4Subject: [PATCH] Only allow e500 double in SPE_SIMD_REGNO_P registers.
5
6rs6000_hard_regno_nregs_internal allows SPE vectors in single
7registers satisfying SPE_SIMD_REGNO_P (i.e. register numbers 0 to
831). However, the corresponding test for e500 double treats all
9registers as being able to store a 64-bit value, rather than just
10those GPRs.
11
12Logically this inconsistency is wrong; in addition, it causes problems
13unwinding from signal handlers. linux-unwind.h uses
14ARG_POINTER_REGNUM as a place to store the return address from a
15signal handler, but this logic in rs6000_hard_regno_nregs_internal
16results in that being considered an 8-byte register, resulting in
17assertion failures.
18(<https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02625.html> first
19needs to be applied for unwinding to work in general on e500.) This
20patch makes rs6000_hard_regno_nregs_internal handle the e500 double
21case consistently with SPE vectors.
22
23Tested with no regressions with cross to powerpc-linux-gnuspe (given
24the aforementioned patch applied). Failures of signal handling
25unwinding tests such as gcc.dg/cleanup-{8,9,10,11}.c are fixed by this
26patch.
27
28 * config/rs6000/rs6000.c (rs6000_hard_regno_nregs_internal): Do
29 not allow e500 double in registers not satisyfing
30 SPE_SIMD_REGNO_P.
31
32
33git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@216688 138bc75d-0d04-0410-961f-82ee72b054a4
34
35Signed-off-by: Khem Raj <raj.khem@gmail.com>
36Upstream-Status: Backport [gcc 5.0]
37
38---
39 gcc/ChangeLog | 6 ++++++
40 gcc/config/rs6000/rs6000.c | 2 +-
41 2 files changed, 7 insertions(+), 1 deletion(-)
42
43Index: gcc-4.9.2/gcc/config/rs6000/rs6000.c
44===================================================================
45--- gcc-4.9.2.orig/gcc/config/rs6000/rs6000.c
46+++ gcc-4.9.2/gcc/config/rs6000/rs6000.c
47@@ -1703,7 +1703,7 @@ rs6000_hard_regno_nregs_internal (int re
48 SCmode so as to pass the value correctly in a pair of
49 registers. */
50 else if (TARGET_E500_DOUBLE && FLOAT_MODE_P (mode) && mode != SCmode
51- && !DECIMAL_FLOAT_MODE_P (mode))
52+ && !DECIMAL_FLOAT_MODE_P (mode) && SPE_SIMD_REGNO_P (regno))
53 reg_size = UNITS_PER_FP_WORD;
54
55 else
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0061-target-gcc-includedir.patch b/meta/recipes-devtools/gcc/gcc-4.9/0061-target-gcc-includedir.patch
deleted file mode 100644
index f48c66dcac..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0061-target-gcc-includedir.patch
+++ /dev/null
@@ -1,81 +0,0 @@
1Ensure target gcc headers can be included
2
3There are a few headers installed as part of the OpenEmbedded
4gcc-runtime target (omp.h, ssp/*.h). Being installed from a recipe
5built for the target architecture, these are within the target
6sysroot and not cross/nativesdk; thus they weren't able to be
7found by gcc with the existing search paths. Add support for
8picking up these headers under the sysroot supplied on the gcc
9command line in order to resolve this.
10
11Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
12
13Upstream-Status: Pending
14
15--- a/gcc/Makefile.in 2014-12-23 11:57:33.327873331 +0000
16+++ b/gcc/Makefile.in 2015-01-21 11:32:35.447305394 +0000
17@@ -587,6 +587,7 @@
18
19 # Directory in which the compiler finds libraries etc.
20 libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(version)
21+libsubdir_target = gcc/$(target_noncanonical)/$(version)
22 # Directory in which the compiler finds executables
23 libexecsubdir = $(libexecdir)/gcc/$(target_noncanonical)/$(version)
24 # Directory in which all plugin resources are installed
25@@ -2534,6 +2535,7 @@
26
27 PREPROCESSOR_DEFINES = \
28 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
29+ -DGCC_INCLUDE_SUBDIR_TARGET=\"$(libsubdir_target)/include\" \
30 -DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \
31 -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
32 -DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \
33--- a/gcc/cppdefault.c 2015-01-13 17:40:26.131012725 +0000
34+++ b/gcc/cppdefault.c 2015-01-21 11:30:08.928426492 +0000
35@@ -59,6 +59,10 @@
36 /* This is the dir for gcc's private headers. */
37 { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
38 #endif
39+#ifdef GCC_INCLUDE_SUBDIR_TARGET
40+ /* This is the dir for gcc's private headers under the specified sysroot. */
41+ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
42+#endif
43 #ifdef LOCAL_INCLUDE_DIR
44 /* /usr/local/include comes before the fixincluded header files. */
45 { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
46diff --git a/gcc/defaults.h b/gcc/defaults.h
47index f94ae17..d98b40b 100644
48--- a/gcc/defaults.h
49+++ b/gcc/defaults.h
50@@ -1390,4 +1390,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
51
52 #endif /* GCC_INSN_FLAGS_H */
53
54+/* Default prefixes to attach to command names. */
55+
56+#ifndef STANDARD_STARTFILE_PREFIX_1
57+#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
58+#endif
59+#ifndef STANDARD_STARTFILE_PREFIX_2
60+#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
61+#endif
62+
63 #endif /* ! GCC_DEFAULTS_H */
64diff --git a/gcc/gcc.c b/gcc/gcc.c
65index 9f0b781..174fca8 100644
66--- a/gcc/gcc.c
67+++ b/gcc/gcc.c
68@@ -1189,13 +1189,6 @@ static const char *gcc_libexec_prefix;
69
70 /* Default prefixes to attach to command names. */
71
72-#ifndef STANDARD_STARTFILE_PREFIX_1
73-#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
74-#endif
75-#ifndef STANDARD_STARTFILE_PREFIX_2
76-#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
77-#endif
78-
79 #ifdef CROSS_DIRECTORY_STRUCTURE /* Don't use these prefixes for a cross compiler. */
80 #undef MD_EXEC_PREFIX
81 #undef MD_STARTFILE_PREFIX
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0062-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch b/meta/recipes-devtools/gcc/gcc-4.9/0062-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch
deleted file mode 100644
index c48bd48478..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0062-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch
+++ /dev/null
@@ -1,24 +0,0 @@
1From 861bcfd4ae814f351e0c668ee26d01d1331e0422 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 28 Apr 2015 23:15:27 -0700
4Subject: [PATCH 36/37] Use SYSTEMLIBS_DIR replacement instead of hardcoding
5 base_libdir
6
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9 gcc/config/aarch64/aarch64-linux.h | 2 +-
10 1 file changed, 1 insertion(+), 1 deletion(-)
11
12Index: gcc-4.9.2/gcc/config/aarch64/aarch64-linux.h
13===================================================================
14--- gcc-4.9.2.orig/gcc/config/aarch64/aarch64-linux.h
15+++ gcc-4.9.2/gcc/config/aarch64/aarch64-linux.h
16@@ -21,7 +21,7 @@
17 #ifndef GCC_AARCH64_LINUX_H
18 #define GCC_AARCH64_LINUX_H
19
20-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}.so.1"
21+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}.so.1"
22
23 #define CPP_SPEC "%{pthread:-D_REENTRANT}"
24
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0063-nativesdk-gcc-support.patch b/meta/recipes-devtools/gcc/gcc-4.9/0063-nativesdk-gcc-support.patch
deleted file mode 100644
index f9efa4537b..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0063-nativesdk-gcc-support.patch
+++ /dev/null
@@ -1,198 +0,0 @@
1Being able to build a nativesdk gcc is useful, particularly in cases
2where the host compiler may be of an incompatible version (or a 32
3bit compiler is needed).
4
5Sadly, building nativesdk-gcc is not straight forward. We install
6nativesdk-gcc into a relocatable location and this means that its
7library locations can change. "Normal" sysroot support doesn't help
8in this case since the values of paths like "libdir" change, not just
9base root directory of the system.
10
11In order to handle this we do two things:
12
13a) Add %r into spec file markup which can be used for injected paths
14 such as SYSTEMLIBS_DIR (see gcc_multilib_setup()).
15b) Add other paths which need relocation into a .gccrelocprefix section
16 which the relocation code will notice and adjust automatically.
17
18Upstream-Status: Inappropriate
19RP 2015/7/28
20diff --git a/gcc/gcc.c b/gcc/gcc.c
21index 5fd3d0a..2de29aa 100644
22--- a/gcc/gcc.c
23+++ b/gcc/gcc.c
24@@ -120,6 +120,8 @@ static const char *target_system_root = TARGET_SYSTEM_ROOT;
25 #else
26 static const char *target_system_root = 0;
27 #endif
28+
29+static char target_relocatable_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = SYSTEMLIBS_DIR;
30
31 /* Nonzero means pass the updated target_system_root to the compiler. */
32
33@@ -384,6 +386,7 @@ or with constant text in a single argument.
34 %G process LIBGCC_SPEC as a spec.
35 %R Output the concatenation of target_system_root and
36 target_sysroot_suffix.
37+ %r Output the base path target_relocatable_prefix
38 %S process STARTFILE_SPEC as a spec. A capital S is actually used here.
39 %E process ENDFILE_SPEC as a spec. A capital E is actually used here.
40 %C process CPP_SPEC as a spec.
41@@ -1218,10 +1221,10 @@ static const char *gcc_libexec_prefix;
42 gcc_exec_prefix is set because, in that case, we know where the
43 compiler has been installed, and use paths relative to that
44 location instead. */
45-static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX;
46-static const char *const standard_libexec_prefix = STANDARD_LIBEXEC_PREFIX;
47-static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX;
48-static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
49+static char standard_exec_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_EXEC_PREFIX;
50+static char standard_libexec_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_LIBEXEC_PREFIX;
51+static char standard_bindir_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_BINDIR_PREFIX;
52+static char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
53
54 /* For native compilers, these are well-known paths containing
55 components that may be provided by the system. For cross
56@@ -1229,9 +1232,9 @@ static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
57 static const char *md_exec_prefix = MD_EXEC_PREFIX;
58 static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
59 static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
60-static const char *const standard_startfile_prefix_1
61+static char standard_startfile_prefix_1[4096] __attribute__ ((section (".gccrelocprefix")))
62 = STANDARD_STARTFILE_PREFIX_1;
63-static const char *const standard_startfile_prefix_2
64+static char standard_startfile_prefix_2[4096] __attribute__ ((section (".gccrelocprefix")))
65 = STANDARD_STARTFILE_PREFIX_2;
66
67 /* A relative path to be used in finding the location of tools
68@@ -5305,6 +5308,11 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
69 }
70 break;
71
72+ case 'r':
73+ obstack_grow (&obstack, target_relocatable_prefix,
74+ strlen (target_relocatable_prefix));
75+ break;
76+
77 case 'S':
78 value = do_spec_1 (startfile_spec, 0, NULL);
79 if (value != 0)
80
81diff --git a/gcc/cppdefault.c b/gcc/cppdefault.c
82index dad69e6..cf43f28 100644
83--- a/gcc/cppdefault.c
84+++ b/gcc/cppdefault.c
85@@ -35,6 +35,30 @@
86 # undef CROSS_INCLUDE_DIR
87 #endif
88
89+static char GPLUSPLUS_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_INCLUDE_DIR;
90+static char GCC_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GCC_INCLUDE_DIR;
91+static char GPLUSPLUS_TOOL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_TOOL_INCLUDE_DIR;
92+static char GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_BACKWARD_INCLUDE_DIR;
93+static char STANDARD_STARTFILE_PREFIX_2VAR[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET;
94+#ifdef LOCAL_INCLUDE_DIR
95+static char LOCAL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = LOCAL_INCLUDE_DIR;
96+#endif
97+#ifdef PREFIX_INCLUDE_DIR
98+static char PREFIX_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX_INCLUDE_DIR;
99+#endif
100+#ifdef FIXED_INCLUDE_DIR
101+static char FIXED_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = FIXED_INCLUDE_DIR;
102+#endif
103+#ifdef CROSS_INCLUDE_DIR
104+static char CROSS_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = CROSS_INCLUDE_DIR;
105+#endif
106+#ifdef TOOL_INCLUDE_DIR
107+static char TOOL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = TOOL_INCLUDE_DIR;
108+#endif
109+#ifdef NATIVE_SYSTEM_HEADER_DIR
110+static char NATIVE_SYSTEM_HEADER_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = NATIVE_SYSTEM_HEADER_DIR;
111+#endif
112+
113 const struct default_include cpp_include_defaults[]
114 #ifdef INCLUDE_DEFAULTS
115 = INCLUDE_DEFAULTS;
116@@ -42,38 +66,38 @@ const struct default_include cpp_include_defaults[]
117 = {
118 #ifdef GPLUSPLUS_INCLUDE_DIR
119 /* Pick up GNU C++ generic include files. */
120- { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1,
121+ { GPLUSPLUS_INCLUDE_DIRVAR, "G++", 1, 1,
122 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
123 #endif
124 #ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
125 /* Pick up GNU C++ target-dependent include files. */
126- { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1,
127+ { GPLUSPLUS_TOOL_INCLUDE_DIRVAR, "G++", 1, 1,
128 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 },
129 #endif
130 #ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
131 /* Pick up GNU C++ backward and deprecated include files. */
132- { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1,
133+ { GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR, "G++", 1, 1,
134 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
135 #endif
136 #ifdef GCC_INCLUDE_DIR
137 /* This is the dir for gcc's private headers. */
138- { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
139+ { GCC_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0 },
140 #endif
141 #ifdef GCC_INCLUDE_SUBDIR_TARGET
142 /* This is the dir for gcc's private headers under the specified sysroot. */
143- { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
144+ { STANDARD_STARTFILE_PREFIX_2VAR, "GCC", 0, 0, 1, 0 },
145 #endif
146 #ifdef LOCAL_INCLUDE_DIR
147 /* /usr/local/include comes before the fixincluded header files. */
148- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
149- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
150+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 2 },
151+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 0 },
152 #endif
153 #ifdef PREFIX_INCLUDE_DIR
154- { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0 },
155+ { PREFIX_INCLUDE_DIRVAR, 0, 0, 1, 0, 0 },
156 #endif
157 #ifdef FIXED_INCLUDE_DIR
158 /* This is the dir for fixincludes. */
159- { FIXED_INCLUDE_DIR, "GCC", 0, 0, 0,
160+ { FIXED_INCLUDE_DIRVAR, "GCC", 0, 0, 0,
161 /* A multilib suffix needs adding if different multilibs use
162 different headers. */
163 #ifdef SYSROOT_HEADERS_SUFFIX_SPEC
164@@ -85,16 +109,16 @@ const struct default_include cpp_include_defaults[]
165 #endif
166 #ifdef CROSS_INCLUDE_DIR
167 /* One place the target system's headers might be. */
168- { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
169+ { CROSS_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0 },
170 #endif
171 #ifdef TOOL_INCLUDE_DIR
172 /* Another place the target system's headers might be. */
173- { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0 },
174+ { TOOL_INCLUDE_DIRVAR, "BINUTILS", 0, 1, 0, 0 },
175 #endif
176 #ifdef NATIVE_SYSTEM_HEADER_DIR
177 /* /usr/include comes dead last. */
178- { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 },
179- { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 },
180+ { NATIVE_SYSTEM_HEADER_DIRVAR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 },
181+ { NATIVE_SYSTEM_HEADER_DIRVAR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 },
182 #endif
183 { 0, 0, 0, 0, 0, 0 }
184 };
185diff --git a/gcc/cppdefault.h b/gcc/cppdefault.h
186index 30b6fed..2ef96b7 100644
187--- a/gcc/cppdefault.h
188+++ b/gcc/cppdefault.h
189@@ -33,7 +33,8 @@
190
191 struct default_include
192 {
193- const char *const fname; /* The name of the directory. */
194+ const char *fname; /* The name of the directory. */
195+
196 const char *const component; /* The component containing the directory
197 (see update_path in prefix.c) */
198 const char cplusplus; /* Only look here if we're compiling C++. */
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0064-handle-target-sysroot-multilib.patch b/meta/recipes-devtools/gcc/gcc-4.9/0064-handle-target-sysroot-multilib.patch
deleted file mode 100644
index 53569847f2..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0064-handle-target-sysroot-multilib.patch
+++ /dev/null
@@ -1,88 +0,0 @@
1Search target sysroot gcc version specific dirs with multilib.
2
3We install the gcc libraries (such as crtbegin.p) into
4<sysroot><libdir>/<target-sys>/5.2.0/
5which is a default search path for GCC (aka multi_suffix in the
6code below). <target-sys> is 'machine' in gcc's terminology. We use
7these directories so that multiple gcc versions could in theory
8co-exist on target.
9
10We only want to build one gcc-cross-canadian per arch and have this work
11for all multilibs. <target-sys> can be handled by mapping the multilib
12<target-sys> to the one used by gcc-cross-canadian, e.g. mips64-polkmllib32-linux
13is symlinked to by mips64-poky-linux.
14
15The default gcc search path in the target sysroot for a "lib64" mutlilib is:
16
17<sysroot>/lib32/mips64-poky-linux/5.2.0/
18<sysroot>/lib32/../lib64/
19<sysroot>/usr/lib32/mips64-poky-linux/5.2.0/
20<sysroot>/usr/lib32/../lib64/
21<sysroot>/lib32/
22<sysroot>/usr/lib32/
23
24which means that the lib32 crtbegin.o will be found and the lib64 ones
25will not which leads to compiler failures.
26
27This patch injects a multilib version of that path first so the lib64
28binaries can be found first. With this change the search path becomes:
29
30<sysroot>/lib32/../lib64/mips64-poky-linux/5.2.0/
31<sysroot>/lib32/mips64-poky-linux/5.2.0/
32<sysroot>/lib32/../lib64/
33<sysroot>/usr/lib32/../lib64/mips64-poky-linux/5.2.0/
34<sysroot>/usr/lib32/mips64-poky-linux/5.2.0/
35<sysroot>/usr/lib32/../lib64/
36<sysroot>/lib32/
37<sysroot>/usr/lib32/
38
39Upstream-Status: Pending
40RP 2015/7/31
41
42Index: gcc-5.2.0/gcc/gcc.c
43===================================================================
44--- gcc-5.2.0.orig/gcc/gcc.c
45+++ gcc-5.2.0/gcc/gcc.c
46@@ -2305,7 +2305,7 @@ for_each_path (const struct path_prefix
47 if (path == NULL)
48 {
49 len = paths->max_len + extra_space + 1;
50- len += MAX (MAX (suffix_len, multi_os_dir_len), multiarch_len);
51+ len += MAX ((suffix_len + multi_os_dir_len), multiarch_len);
52 path = XNEWVEC (char, len);
53 }
54
55@@ -2317,6 +2317,33 @@ for_each_path (const struct path_prefix
56 /* Look first in MACHINE/VERSION subdirectory. */
57 if (!skip_multi_dir)
58 {
59+ if (!(pl->os_multilib ? skip_multi_os_dir : skip_multi_dir))
60+ {
61+ const char *this_multi;
62+ size_t this_multi_len;
63+
64+ if (pl->os_multilib)
65+ {
66+ this_multi = multi_os_dir;
67+ this_multi_len = multi_os_dir_len;
68+ }
69+ else
70+ {
71+ this_multi = multi_dir;
72+ this_multi_len = multi_dir_len;
73+ }
74+
75+ /* Look in multilib MACHINE/VERSION subdirectory first */
76+ if (this_multi_len)
77+ {
78+ memcpy (path + len, this_multi, this_multi_len + 1);
79+ memcpy (path + len + this_multi_len, multi_suffix, suffix_len + 1);
80+ ret = callback (path, callback_info);
81+ if (ret)
82+ break;
83+ }
84+ }
85+
86 memcpy (path + len, multi_suffix, suffix_len + 1);
87 ret = callback (path, callback_info);
88 if (ret)
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0065-gcc-483-universal-initializer-no-warning.patch b/meta/recipes-devtools/gcc/gcc-4.9/0065-gcc-483-universal-initializer-no-warning.patch
deleted file mode 100644
index fde227b8ad..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0065-gcc-483-universal-initializer-no-warning.patch
+++ /dev/null
@@ -1,107 +0,0 @@
1Upstream-Status: Backport
2
3Signed-off-by: Kai Kang <kai.kang@windriver.com>
4---
5Fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
6wrong warning when using the universal zero initializer {0}
7
8Backported to GCC 4.8.3
9
10Subject: 2014-06-05 S. Gilles <sgilles@terpmail.umd.edu>
11X-Git-Url: http://repo.or.cz/w/official-gcc.git/commitdiff_plain/95cdf3fdf2d440eb7775def8e35ab970651c33d9?hp=14a3093e9943937cbc63dfbf4d51ca60f8325b29
12git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@211289 138bc75d-0d04-0410-961f-82ee72b054a4
13
14--- gcc-4.8.3.org/gcc/c/c-typeck.c 2014-08-03 20:52:09.257042137 +0200
15+++ gcc-4.8.3/gcc/c/c-typeck.c 2014-08-03 20:57:10.645042614 +0200
16@@ -62,9 +62,9 @@
17 if expr.original_code == SIZEOF_EXPR. */
18 tree c_last_sizeof_arg;
19
20-/* Nonzero if we've already printed a "missing braces around initializer"
21- message within this initializer. */
22-static int missing_braces_mentioned;
23+/* Nonzero if we might need to print a "missing braces around
24+ initializer" message within this initializer. */
25+static int found_missing_braces;
26
27 static int require_constant_value;
28 static int require_constant_elements;
29@@ -6379,6 +6379,9 @@
30 /* 1 if this constructor is erroneous so far. */
31 static int constructor_erroneous;
32
33+/* 1 if this constructor is the universal zero initializer { 0 }. */
34+static int constructor_zeroinit;
35+
36 /* Structure for managing pending initializer elements, organized as an
37 AVL tree. */
38
39@@ -6540,7 +6543,7 @@
40 constructor_stack = 0;
41 constructor_range_stack = 0;
42
43- missing_braces_mentioned = 0;
44+ found_missing_braces = 0;
45
46 spelling_base = 0;
47 spelling_size = 0;
48@@ -6635,6 +6638,7 @@
49 constructor_type = type;
50 constructor_incremental = 1;
51 constructor_designated = 0;
52+ constructor_zeroinit = 1;
53 designator_depth = 0;
54 designator_erroneous = 0;
55
56@@ -6832,11 +6836,8 @@
57 set_nonincremental_init (braced_init_obstack);
58 }
59
60- if (implicit == 1 && warn_missing_braces && !missing_braces_mentioned)
61- {
62- missing_braces_mentioned = 1;
63- warning_init (OPT_Wmissing_braces, "missing braces around initializer");
64- }
65+ if (implicit == 1)
66+ found_missing_braces = 1;
67
68 if (TREE_CODE (constructor_type) == RECORD_TYPE
69 || TREE_CODE (constructor_type) == UNION_TYPE)
70@@ -6969,16 +6970,23 @@
71 }
72 }
73
74+ if (vec_safe_length (constructor_elements) != 1)
75+ constructor_zeroinit = 0;
76+
77+ /* Warn when some structs are initialized with direct aggregation. */
78+ if (!implicit && found_missing_braces && warn_missing_braces
79+ && !constructor_zeroinit)
80+ {
81+ warning_init (OPT_Wmissing_braces,
82+ "missing braces around initializer");
83+ }
84+
85 /* Warn when some struct elements are implicitly initialized to zero. */
86 if (warn_missing_field_initializers
87 && constructor_type
88 && TREE_CODE (constructor_type) == RECORD_TYPE
89 && constructor_unfilled_fields)
90 {
91- bool constructor_zeroinit =
92- (vec_safe_length (constructor_elements) == 1
93- && integer_zerop ((*constructor_elements)[0].value));
94-
95 /* Do not warn for flexible array members or zero-length arrays. */
96 while (constructor_unfilled_fields
97 && (!DECL_SIZE (constructor_unfilled_fields)
98@@ -8093,6 +8101,9 @@
99 designator_depth = 0;
100 designator_erroneous = 0;
101
102+ if (!implicit && value.value && !integer_zerop (value.value))
103+ constructor_zeroinit = 0;
104+
105 /* Handle superfluous braces around string cst as in
106 char x[] = {"foo"}; */
107 if (string_flag
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0066-cxxflags-for-build.patch b/meta/recipes-devtools/gcc/gcc-4.9/0066-cxxflags-for-build.patch
deleted file mode 100644
index 1105e29f68..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0066-cxxflags-for-build.patch
+++ /dev/null
@@ -1,123 +0,0 @@
1Fix various _FOR_BUILD and related variables
2
3When doing a FOR_BUILD thing, you have to override CFLAGS with
4CFLAGS_FOR_BUILD. And if you use C++, you also have to override
5CXXFLAGS with CXXFLAGS_FOR_BUILD.
6Without this, when building for mingw, you end up trying to use
7the mingw headers for a host build.
8
9The same goes for other variables as well, such as CPPFLAGS,
10CPP, and GMPINC.
11
12Upstream-Status: Pending
13
14Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
15Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
16
17diff --git a/Makefile.in b/Makefile.in
18index 9370174..011c29a 100644
19--- a/Makefile.in
20+++ b/Makefile.in
21@@ -152,6 +152,7 @@ BUILD_EXPORTS = \
22 CPP="$(CC_FOR_BUILD) -E"; export CPP; \
23 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
24 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
25+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
26 CXX="$(CXX_FOR_BUILD)"; export CXX; \
27 CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
28 GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
29@@ -170,6 +171,9 @@ BUILD_EXPORTS = \
30 # built for the build system to override those in BASE_FLAGS_TO_PASS.
31 EXTRA_BUILD_FLAGS = \
32 CFLAGS="$(CFLAGS_FOR_BUILD)" \
33+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
34+ CPP="$(CC_FOR_BUILD) -E" \
35+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)" \
36 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
37
38 # This is the list of directories to built for the host system.
39@@ -187,6 +191,7 @@ HOST_SUBDIR = @host_subdir@
40 HOST_EXPORTS = \
41 $(BASE_EXPORTS) \
42 CC="$(CC)"; export CC; \
43+ CPP="$(CC) -E"; export CPP; \
44 ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
45 CFLAGS="$(CFLAGS)"; export CFLAGS; \
46 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
47@@ -711,6 +715,7 @@ BASE_FLAGS_TO_PASS = \
48 "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
49 "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
50 "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
51+ "CXXFLAGS_FOR_BUILD=$(CXXFLAGS_FOR_BUILD)" \
52 "EXPECT=$(EXPECT)" \
53 "FLEX=$(FLEX)" \
54 "INSTALL=$(INSTALL)" \
55diff --git a/Makefile.tpl b/Makefile.tpl
56index 1ea1954..78a59c3 100644
57--- a/Makefile.tpl
58+++ b/Makefile.tpl
59@@ -154,6 +154,7 @@ BUILD_EXPORTS = \
60 CC="$(CC_FOR_BUILD)"; export CC; \
61 CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
62 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
63+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
64 CXX="$(CXX_FOR_BUILD)"; export CXX; \
65 CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
66 GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
67@@ -172,6 +173,9 @@ BUILD_EXPORTS = \
68 # built for the build system to override those in BASE_FLAGS_TO_PASS.
69 EXTRA_BUILD_FLAGS = \
70 CFLAGS="$(CFLAGS_FOR_BUILD)" \
71+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
72+ CPP="$(CC_FOR_BUILD) -E" \
73+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)" \
74 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
75
76 # This is the list of directories to built for the host system.
77@@ -189,6 +193,7 @@ HOST_SUBDIR = @host_subdir@
78 HOST_EXPORTS = \
79 $(BASE_EXPORTS) \
80 CC="$(CC)"; export CC; \
81+ CPP="$(CC) -E"; export CPP; \
82 ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
83 CFLAGS="$(CFLAGS)"; export CFLAGS; \
84 CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
85diff --git a/gcc/Makefile.in b/gcc/Makefile.in
86index cd5bc4a..98ae4f4 100644
87--- a/gcc/Makefile.in
88+++ b/gcc/Makefile.in
89@@ -762,7 +762,7 @@ BUILD_LINKERFLAGS = $(BUILD_CXXFLAGS)
90 # Native linker and preprocessor flags. For x-fragment overrides.
91 BUILD_LDFLAGS=@BUILD_LDFLAGS@
92 BUILD_CPPFLAGS= -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
93- -I$(srcdir)/../include @INCINTL@ $(CPPINC) $(CPPFLAGS)
94+ -I$(srcdir)/../include @INCINTL@ $(CPPINC) $(CPPFLAGS_FOR_BUILD)
95
96 # Actual name to use when installing a native compiler.
97 GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
98diff --git a/gcc/configure b/gcc/configure
99index c7ac14b..5ac63e4 100755
100--- a/gcc/configure
101+++ b/gcc/configure
102@@ -11521,7 +11521,7 @@ else
103 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
104 CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
105 LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
106- GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
107+ GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \
108 ${realsrcdir}/configure \
109 --enable-languages=${enable_languages-all} \
110 --target=$target_alias --host=$build_alias --build=$build_alias
111diff --git a/gcc/configure.ac b/gcc/configure.ac
112index 50856e6..17a4dfd 100644
113--- a/gcc/configure.ac
114+++ b/gcc/configure.ac
115@@ -1633,7 +1633,7 @@ else
116 CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
117 CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
118 LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
119- GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
120+ GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \
121 ${realsrcdir}/configure \
122 --enable-languages=${enable_languages-all} \
123 --target=$target_alias --host=$build_alias --build=$build_alias
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0067-fix-arm-thumb.patch b/meta/recipes-devtools/gcc/gcc-4.9/0067-fix-arm-thumb.patch
deleted file mode 100644
index 2f262e3a3a..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0067-fix-arm-thumb.patch
+++ /dev/null
@@ -1,39 +0,0 @@
1Upstream-Status: Accepted
2
3Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
4---
5
62015-11-25 Vladimir Makarov <vmakarov@redhat.com>
7
8 PR rtl-optimization/67954
9 * lra-constraints.c (curr_insn_transform): Add check on scratch
10 pseudo when change class to NO_REGS. Add an assert.
11
12
13
14git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230894 138bc75d-0d04-0410-961f-82ee72b054a4
15---
16
17diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
18index 4670e81..c62bf6a 100644
19--- a/gcc/lra-constraints.c
20+++ b/gcc/lra-constraints.c
21@@ -3725,7 +3725,8 @@ curr_insn_transform (bool check_only_p)
22 assigment pass and the scratch pseudo will be
23 spilled. Spilled scratch pseudos are transformed
24 back to scratches at the LRA end. */
25- && lra_former_scratch_operand_p (curr_insn, i))
26+ && lra_former_scratch_operand_p (curr_insn, i)
27+ && lra_former_scratch_p (REGNO (op)))
28 {
29 int regno = REGNO (op);
30 lra_change_class (regno, NO_REGS, " Change to", true);
31@@ -3734,6 +3735,8 @@ curr_insn_transform (bool check_only_p)
32 spilled pseudo as there is only one such insn, the
33 current one. */
34 reg_renumber[regno] = -1;
35+ lra_assert (bitmap_single_bit_set_p
36+ (&lra_reg_info[REGNO (op)].insn_bitmap));
37 }
38 /* We can do an optional reload. If the pseudo got a hard
39 reg, we might improve the code through inheritance. If
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0067-gcc-musl-support.patch b/meta/recipes-devtools/gcc/gcc-4.9/0067-gcc-musl-support.patch
deleted file mode 100644
index 9a0b5ade4c..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0067-gcc-musl-support.patch
+++ /dev/null
@@ -1,267 +0,0 @@
1# HG changeset patch
2# Parent e5b4564f249f8634194bdabef4b3057d0e54ee97
3Adding -mmusl as a musl libc specifier, and the necessary hacks for it to know how to find musl's dynamic linker.
4Upstream-Status: backport [partial]
5Signed-off-by: Khem Raj <raj.khem@gmail.com>
6
7
8Index: gcc-4.9.0/gcc/config.gcc
9===================================================================
10--- gcc-4.9.0.orig/gcc/config.gcc 2014-04-22 22:44:17.153567150 -0700
11+++ gcc-4.9.0/gcc/config.gcc 2014-04-23 23:54:31.427357051 -0700
12@@ -594,7 +594,7 @@
13 esac
14
15 # Common C libraries.
16-tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
17+tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
18
19 # 32-bit x86 processors supported by --with-arch=. Each processor
20 # MUST be separated by exactly one space.
21@@ -719,6 +719,9 @@
22 *-*-*uclibc*)
23 tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
24 ;;
25+ *-*-*musl*)
26+ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
27+ ;;
28 *)
29 tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
30 ;;
31@@ -2328,6 +2331,11 @@
32 powerpc*-*-linux*paired*)
33 tm_file="${tm_file} rs6000/750cl.h" ;;
34 esac
35+ case ${target} in
36+ *-linux*-musl*)
37+ enable_secureplt=yes ;;
38+ esac
39+
40 if test x${enable_secureplt} = xyes; then
41 tm_file="rs6000/secureplt.h ${tm_file}"
42 fi
43Index: gcc-4.9.0/gcc/config/linux.h
44===================================================================
45--- gcc-4.9.0.orig/gcc/config/linux.h 2014-01-02 14:23:26.000000000 -0800
46+++ gcc-4.9.0/gcc/config/linux.h 2014-04-24 00:11:29.034028895 -0700
47@@ -32,10 +32,12 @@
48 #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
49 #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
50 #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
51+#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
52 #else
53 #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
54 #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
55 #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
56+#define OPTION_MUSL (linux_libc == LIBC_MUSL)
57 #endif
58
59 #define GNU_USER_TARGET_OS_CPP_BUILTINS() \
60@@ -53,18 +55,21 @@
61 uClibc or Bionic is the default C library and whether
62 -muclibc or -mglibc or -mbionic has been passed to change the default. */
63
64-#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \
65- "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
66+#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \
67+ "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
68
69 #if DEFAULT_LIBC == LIBC_GLIBC
70-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
71- CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
72+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
73+ CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
74 #elif DEFAULT_LIBC == LIBC_UCLIBC
75-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
76- CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
77+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
78+ CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
79 #elif DEFAULT_LIBC == LIBC_BIONIC
80-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
81- CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
82+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
83+ CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
84+#elif DEFAULT_LIBC == LIBC_MUSL
85+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
86+ CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
87 #else
88 #error "Unsupported DEFAULT_LIBC"
89 #endif /* DEFAULT_LIBC */
90@@ -84,16 +89,16 @@
91
92 #define GNU_USER_DYNAMIC_LINKER \
93 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
94- BIONIC_DYNAMIC_LINKER)
95+ BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
96 #define GNU_USER_DYNAMIC_LINKER32 \
97 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
98- BIONIC_DYNAMIC_LINKER32)
99+ BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
100 #define GNU_USER_DYNAMIC_LINKER64 \
101 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
102- BIONIC_DYNAMIC_LINKER64)
103+ BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
104 #define GNU_USER_DYNAMIC_LINKERX32 \
105 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
106- BIONIC_DYNAMIC_LINKERX32)
107+ BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32)
108
109 /* Whether we have Bionic libc runtime */
110 #undef TARGET_HAS_BIONIC
111@@ -127,3 +132,74 @@
112 # define TARGET_LIBC_HAS_FUNCTION linux_libc_has_function
113
114 #endif
115+
116+/* musl avoids problematic includes by rearranging the include directories.
117+ * Unfortunately, this is mostly duplicated from cppdefault.c */
118+#if DEFAULT_LIBC == LIBC_MUSL
119+#define INCLUDE_DEFAULTS_MUSL_GPP \
120+ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
121+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
122+ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
123+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
124+ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
125+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
126+
127+#ifdef LOCAL_INCLUDE_DIR
128+#define INCLUDE_DEFAULTS_MUSL_LOCAL \
129+ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
130+ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
131+#else
132+#define INCLUDE_DEFAULTS_MUSL_LOCAL
133+#endif
134+
135+#ifdef PREFIX_INCLUDE_DIR
136+#define INCLUDE_DEFAULTS_MUSL_PREFIX \
137+ { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
138+#else
139+#define INCLUDE_DEFAULTS_MUSL_PREFIX
140+#endif
141+
142+#ifdef CROSS_INCLUDE_DIR
143+#define INCLUDE_DEFAULTS_MUSL_CROSS \
144+ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
145+#else
146+#define INCLUDE_DEFAULTS_MUSL_CROSS
147+#endif
148+
149+#ifdef TOOL_INCLUDE_DIR
150+#define INCLUDE_DEFAULTS_MUSL_TOOL \
151+ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
152+#else
153+#define INCLUDE_DEFAULTS_MUSL_TOOL
154+#endif
155+
156+#ifdef NATIVE_SYSTEM_HEADER_DIR
157+#define INCLUDE_DEFAULTS_MUSL_NATIVE \
158+ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
159+ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
160+#else
161+#define INCLUDE_DEFAULTS_MUSL_NATIVE
162+#endif
163+
164+#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
165+# undef INCLUDE_DEFAULTS_MUSL_LOCAL
166+# define INCLUDE_DEFAULTS_MUSL_LOCAL
167+# undef INCLUDE_DEFAULTS_MUSL_NATIVE
168+# define INCLUDE_DEFAULTS_MUSL_NATIVE
169+#else
170+# undef INCLUDE_DEFAULTS_MUSL_CROSS
171+# define INCLUDE_DEFAULTS_MUSL_CROSS
172+#endif
173+
174+#undef INCLUDE_DEFAULTS
175+#define INCLUDE_DEFAULTS \
176+ { \
177+ INCLUDE_DEFAULTS_MUSL_GPP \
178+ INCLUDE_DEFAULTS_MUSL_PREFIX \
179+ INCLUDE_DEFAULTS_MUSL_CROSS \
180+ INCLUDE_DEFAULTS_MUSL_TOOL \
181+ INCLUDE_DEFAULTS_MUSL_NATIVE \
182+ { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
183+ { 0, 0, 0, 0, 0, 0 } \
184+ }
185+#endif
186Index: gcc-4.9.0/gcc/config/linux.opt
187===================================================================
188--- gcc-4.9.0.orig/gcc/config/linux.opt 2014-01-02 14:23:26.000000000 -0800
189+++ gcc-4.9.0/gcc/config/linux.opt 2014-04-22 22:44:17.280233817 -0700
190@@ -30,3 +30,7 @@
191 muclibc
192 Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
193 Use uClibc C library
194+
195+mmusl
196+Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
197+Use musl C library
198Index: gcc-4.9.0/gcc/ginclude/stddef.h
199===================================================================
200--- gcc-4.9.0.orig/gcc/ginclude/stddef.h 2014-01-02 14:23:26.000000000 -0800
201+++ gcc-4.9.0/gcc/ginclude/stddef.h 2014-04-22 22:44:17.280233817 -0700
202@@ -181,6 +181,7 @@
203 #ifndef _GCC_SIZE_T
204 #ifndef _SIZET_
205 #ifndef __size_t
206+#ifndef __DEFINED_size_t /* musl */
207 #define __size_t__ /* BeOS */
208 #define __SIZE_T__ /* Cray Unicos/Mk */
209 #define _SIZE_T
210@@ -197,6 +198,7 @@
211 #define ___int_size_t_h
212 #define _GCC_SIZE_T
213 #define _SIZET_
214+#define __DEFINED_size_t /* musl */
215 #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
216 || defined(__FreeBSD_kernel__)
217 /* __size_t is a typedef on FreeBSD 5, must not trash it. */
218@@ -214,6 +216,7 @@
219 typedef long ssize_t;
220 #endif /* __BEOS__ */
221 #endif /* !(defined (__GNUG__) && defined (size_t)) */
222+#endif /* __DEFINED_size_t */
223 #endif /* __size_t */
224 #endif /* _SIZET_ */
225 #endif /* _GCC_SIZE_T */
226Index: gcc-4.9.0/gcc/config/rs6000/secureplt.h
227===================================================================
228--- gcc-4.9.0.orig/gcc/config/rs6000/secureplt.h 2014-01-02 14:23:26.000000000 -0800
229+++ gcc-4.9.0/gcc/config/rs6000/secureplt.h 2014-04-23 23:55:15.114024175 -0700
230@@ -18,3 +18,4 @@
231 <http://www.gnu.org/licenses/>. */
232
233 #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
234+#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
235Index: gcc-4.9.0/gcc/config/rs6000/sysv4.h
236===================================================================
237--- gcc-4.9.0.orig/gcc/config/rs6000/sysv4.h 2014-04-23 23:52:13.854023015 -0700
238+++ gcc-4.9.0/gcc/config/rs6000/sysv4.h 2014-04-24 00:10:55.550695334 -0700
239@@ -538,6 +538,10 @@
240 #define CC1_SECURE_PLT_DEFAULT_SPEC ""
241 #endif
242
243+#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
244+#define LINK_SECURE_PLT_DEFAULT_SPEC ""
245+#endif
246+
247 /* Pass -G xxx to the compiler. */
248 #define CC1_SPEC "%{G*} %(cc1_cpu)" \
249 "%{meabi: %{!mcall-*: -mcall-sysv }} \
250@@ -585,7 +589,8 @@
251
252 /* Override the default target of the linker. */
253 #define LINK_TARGET_SPEC \
254- ENDIAN_SELECT("", " --oformat elf32-powerpcle", "")
255+ ENDIAN_SELECT("", " --oformat elf32-powerpcle", "") \
256+ "%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}"
257
258 /* Any specific OS flags. */
259 #define LINK_OS_SPEC "\
260@@ -894,6 +899,7 @@
261 { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
262 { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
263 { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
264+ { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \
265 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
266 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
267 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0068-musl-dynamic-linker.patch b/meta/recipes-devtools/gcc/gcc-4.9/0068-musl-dynamic-linker.patch
deleted file mode 100644
index 605ac66758..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0068-musl-dynamic-linker.patch
+++ /dev/null
@@ -1,205 +0,0 @@
1# HG changeset patch
2# Parent 6738fd6f6fcc2a72f2ba527bda3325642af26885
3Support for arm-linux-musl.
4Upstream-Status: Backport [partial]
5Signed-off-by: Khem Raj <raj.khem@gmail.com>
6
7
8Index: gcc-4.9.2/gcc/config/arm/linux-eabi.h
9===================================================================
10--- gcc-4.9.2.orig/gcc/config/arm/linux-eabi.h
11+++ gcc-4.9.2/gcc/config/arm/linux-eabi.h
12@@ -81,6 +81,23 @@
13 #undef TARGET_FIX_V4BX_SPEC
14 #define TARGET_FIX_V4BX_SPEC "%{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4: --fix-v4bx}"
15
16+/* For ARM musl currently supports four dynamic linkers:
17+ - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
18+ - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI
19+ - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB
20+ - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB
21+ musl does not support the legacy OABI mode.
22+ All the dynamic linkers live in /lib.
23+ We default to soft-float, EL. */
24+#undef MUSL_DYNAMIC_LINKER
25+#if TARGET_BIG_ENDIAN_DEFAULT
26+#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}"
27+#else
28+#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
29+#endif
30+#define MUSL_DYNAMIC_LINKER \
31+ SYSTEMLIBS_DIR "ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
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
36Index: gcc-4.9.2/libitm/config/arm/hwcap.cc
37===================================================================
38--- gcc-4.9.2.orig/libitm/config/arm/hwcap.cc
39+++ gcc-4.9.2/libitm/config/arm/hwcap.cc
40@@ -40,7 +40,11 @@ int GTM_hwcap HIDDEN = 0
41
42 #ifdef __linux__
43 #include <unistd.h>
44+#ifdef __GLIBC__
45 #include <sys/fcntl.h>
46+#else
47+#include <fcntl.h>
48+#endif
49 #include <elf.h>
50
51 static void __attribute__((constructor))
52Index: gcc-4.9.2/gcc/config/i386/linux.h
53===================================================================
54--- gcc-4.9.2.orig/gcc/config/i386/linux.h
55+++ gcc-4.9.2/gcc/config/i386/linux.h
56@@ -21,3 +21,4 @@ along with GCC; see the file COPYING3.
57
58 #define GNU_USER_LINK_EMULATION "elf_i386"
59 #define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
60+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-i386.so.1"
61Index: gcc-4.9.2/gcc/config/i386/linux64.h
62===================================================================
63--- gcc-4.9.2.orig/gcc/config/i386/linux64.h
64+++ gcc-4.9.2/gcc/config/i386/linux64.h
65@@ -30,3 +30,8 @@ see the files COPYING3 and COPYING.RUNTI
66 #define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
67 #define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux-x86-64.so.2"
68 #define GLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-linux-x32.so.2"
69+
70+#define MUSL_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-musl-i386.so.1"
71+#define MUSL_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-musl-x86_64.so.1"
72+#define MUSL_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-musl-x32.so.1"
73+
74Index: gcc-4.9.2/gcc/config/mips/linux.h
75===================================================================
76--- gcc-4.9.2.orig/gcc/config/mips/linux.h
77+++ gcc-4.9.2/gcc/config/mips/linux.h
78@@ -23,3 +23,6 @@ along with GCC; see the file COPYING3.
79 #undef UCLIBC_DYNAMIC_LINKER
80 #define UCLIBC_DYNAMIC_LINKER \
81 "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
82+
83+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-mips.so.1"
84+
85Index: gcc-4.9.2/gcc/config/mips/linux64.h
86===================================================================
87--- gcc-4.9.2.orig/gcc/config/mips/linux64.h
88+++ gcc-4.9.2/gcc/config/mips/linux64.h
89@@ -39,6 +39,11 @@ along with GCC; see the file COPYING3.
90 "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
91
92 #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
93+
94+#define MUSL_DYNAMIC_LINKERN32 SYSTEMLIBS_DIR "ld-musl-mips.so.1"
95+#define MUSL_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-musl-mips.so.1"
96+#define MUSL_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-musl-mips.so.1"
97+
98 #define GNU_USER_DYNAMIC_LINKERN32 \
99 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
100- BIONIC_DYNAMIC_LINKERN32)
101+ BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32)
102Index: gcc-4.9.2/gcc/config/rs6000/linux64.h
103===================================================================
104--- gcc-4.9.2.orig/gcc/config/rs6000/linux64.h
105+++ gcc-4.9.2/gcc/config/rs6000/linux64.h
106@@ -375,17 +375,22 @@ extern int dot_symbols;
107 #endif
108 #define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
109 #define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
110+#define MUSL_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-musl-powerpc.so.1"
111+#define MUSL_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-musl-powerpc64.so.1"
112+
113 #if DEFAULT_LIBC == LIBC_UCLIBC
114-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
115+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
116 #elif DEFAULT_LIBC == LIBC_GLIBC
117-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
118+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
119+#elif DEFAULT_LIBC == LIBC_MUSL
120+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
121 #else
122 #error "Unsupported DEFAULT_LIBC"
123 #endif
124 #define GNU_USER_DYNAMIC_LINKER32 \
125- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
126+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
127 #define GNU_USER_DYNAMIC_LINKER64 \
128- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
129+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
130
131 #undef DEFAULT_ASM_ENDIAN
132 #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
133Index: gcc-4.9.2/gcc/config/rs6000/sysv4.h
134===================================================================
135--- gcc-4.9.2.orig/gcc/config/rs6000/sysv4.h
136+++ gcc-4.9.2/gcc/config/rs6000/sysv4.h
137@@ -768,15 +768,19 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
138
139 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
140 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
141+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
142+
143 #if DEFAULT_LIBC == LIBC_UCLIBC
144-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
145+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
146+#elif DEFAULT_LIBC == LIBC_MUSL
147+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
148 #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
149-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
150+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
151 #else
152 #error "Unsupported DEFAULT_LIBC"
153 #endif
154 #define GNU_USER_DYNAMIC_LINKER \
155- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
156+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
157
158 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
159 %{rdynamic:-export-dynamic} \
160Index: gcc-4.9.2/libitm/config/linux/x86/tls.h
161===================================================================
162--- gcc-4.9.2.orig/libitm/config/linux/x86/tls.h
163+++ gcc-4.9.2/libitm/config/linux/x86/tls.h
164@@ -25,16 +25,19 @@
165 #ifndef LIBITM_X86_TLS_H
166 #define LIBITM_X86_TLS_H 1
167
168-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
169+#if defined(__GLIBC_PREREQ)
170+#if __GLIBC_PREREQ(2, 10)
171 /* Use slots in the TCB head rather than __thread lookups.
172 GLIBC has reserved words 10 through 13 for TM. */
173 #define HAVE_ARCH_GTM_THREAD 1
174 #define HAVE_ARCH_GTM_THREAD_DISP 1
175 #endif
176+#endif
177
178 #include "config/generic/tls.h"
179
180-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
181+#if defined(__GLIBC_PREREQ)
182+#if __GLIBC_PREREQ(2, 10)
183 namespace GTM HIDDEN {
184
185 #ifdef __x86_64__
186@@ -101,5 +104,6 @@ static inline void set_abi_disp(struct a
187
188 } // namespace GTM
189 #endif /* >= GLIBC 2.10 */
190+#endif
191
192 #endif // LIBITM_X86_TLS_H
193Index: gcc-4.9.2/gcc/config/aarch64/aarch64-linux.h
194===================================================================
195--- gcc-4.9.2.orig/gcc/config/aarch64/aarch64-linux.h
196+++ gcc-4.9.2/gcc/config/aarch64/aarch64-linux.h
197@@ -25,6 +25,8 @@
198
199 #define CPP_SPEC "%{pthread:-D_REENTRANT}"
200
201+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-aarch64.so.1"
202+
203 #define LINUX_TARGET_LINK_SPEC "%{h*} \
204 %{static:-Bstatic} \
205 %{shared:-shared} \
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0069-musl-no-fixincludes.patch b/meta/recipes-devtools/gcc/gcc-4.9/0069-musl-no-fixincludes.patch
deleted file mode 100644
index e2b18a4022..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0069-musl-no-fixincludes.patch
+++ /dev/null
@@ -1,21 +0,0 @@
1# HG changeset patch
2# Parent 600a8a422ccaf5627ad1f5a138e7398df2b9e9d8
3Get rid of ever-broken fixincludes on musl.
4Upstream-Status: Pending
5Signed-off-by: Khem Raj <raj.khem@gmail.com>
6
7
8Index: gcc-4.9-20140316/fixincludes/mkfixinc.sh
9===================================================================
10--- gcc-4.9-20140316.orig/fixincludes/mkfixinc.sh
11+++ gcc-4.9-20140316/fixincludes/mkfixinc.sh
12@@ -19,7 +19,8 @@ case $machine in
13 powerpc-*-eabi* | \
14 powerpc-*-rtems* | \
15 powerpcle-*-eabisim* | \
16- powerpcle-*-eabi* )
17+ powerpcle-*-eabi* | \
18+ *-musl* )
19 # IF there is no include fixing,
20 # THEN create a no-op fixer and exit
21 (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0070-libstdc-musl.patch b/meta/recipes-devtools/gcc/gcc-4.9/0070-libstdc-musl.patch
deleted file mode 100644
index 048e481dce..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0070-libstdc-musl.patch
+++ /dev/null
@@ -1,32 +0,0 @@
1Upstream-Status: Pending
2Signed-off-by: Khem Raj <raj.khem@gmail.com>
3
4Index: gcc-4.9-20140316/libstdc++-v3/configure.host
5===================================================================
6--- gcc-4.9-20140316.orig/libstdc++-v3/configure.host 2014-03-26 01:12:19.466008193 -0700
7+++ gcc-4.9-20140316/libstdc++-v3/configure.host 2014-03-26 01:43:48.222684357 -0700
8@@ -264,14 +264,24 @@
9 os_include_dir="os/bsd/freebsd"
10 ;;
11 gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
12+ # check for musl by target
13+ case "${host_os}" in
14+ *-musl*)
15+ os_include_dir="os/generic"
16+ ;;
17+ *)
18 if [ "$uclibc" = "yes" ]; then
19 os_include_dir="os/uclibc"
20 elif [ "$bionic" = "yes" ]; then
21 os_include_dir="os/bionic"
22+ elif [ "$musl" = "yes" ]; then
23+ os_include_dir="os/generic"
24 else
25 os_include_dir="os/gnu-linux"
26 fi
27 ;;
28+ esac
29+ ;;
30 hpux*)
31 os_include_dir="os/hpux"
32 ;;
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0071-Ignore-fdebug-prefix-map-in-producer-string-by-Danie.patch b/meta/recipes-devtools/gcc/gcc-4.9/0071-Ignore-fdebug-prefix-map-in-producer-string-by-Danie.patch
deleted file mode 100644
index e8f79b590a..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0071-Ignore-fdebug-prefix-map-in-producer-string-by-Danie.patch
+++ /dev/null
@@ -1,31 +0,0 @@
1From 32593b38082ea65f4c82159254adf1e0dc2423be Mon Sep 17 00:00:00 2001
2From: bernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Tue, 16 Feb 2016 03:15:15 -0500
4Subject: [PATCH] Ignore -fdebug-prefix-map in producer string (by Daniel Kahn
5 Gillmor)
6
7* dwarf2out.c (gen_producer_string): Ignore -fdebug-prefix-map.
8
9git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231835 138bc75d-0d04-0410-961f-82ee72b054a4
10
11Upstream-Status: Backport
12Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
13---
14 gcc/dwarf2out.c | 1 +
15 1 file changed, 1 insertion(+)
16
17diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
18index 3614c10..526f114 100644
19--- a/gcc/dwarf2out.c
20+++ b/gcc/dwarf2out.c
21@@ -19670,6 +19670,7 @@ gen_producer_string (void)
22 case OPT_fpreprocessed:
23 case OPT_fltrans_output_list_:
24 case OPT_fresolution_:
25+ case OPT_fdebug_prefix_map_:
26 /* Ignore these. */
27 continue;
28 default:
29--
301.9.1
31
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0072-support-ffile-prefix-map.patch b/meta/recipes-devtools/gcc/gcc-4.9/0072-support-ffile-prefix-map.patch
deleted file mode 100644
index 9809a6a222..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0072-support-ffile-prefix-map.patch
+++ /dev/null
@@ -1,284 +0,0 @@
1From e863be798ed13312a0faf0b961275f211a8123ab Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Thu, 17 Mar 2016 00:32:17 -0400
4Subject: [PATCH] gcc/libcpp: support -ffile-prefix-map=<old>=<new>
5
6Similar -fdebug-prefix-map, add option -ffile-prefix-map to map one
7directory name (old) to another (new) in __FILE__, __BASE_FILE__ and
8__builtin_FILE ().
9
10https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70268
11
12Upstream-Status: Submitted [gcc-patches@gcc.gnu.org]
13Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
14---
15 gcc/c-family/c-opts.c | 6 ++++
16 gcc/c-family/c.opt | 4 +++
17 gcc/dwarf2out.c | 1 +
18 gcc/gimplify.c | 2 ++
19 libcpp/Makefile.in | 10 +++---
20 libcpp/file-map.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++
21 libcpp/include/file-map.h | 30 ++++++++++++++++
22 libcpp/macro.c | 2 ++
23 8 files changed, 142 insertions(+), 5 deletions(-)
24 create mode 100644 libcpp/file-map.c
25 create mode 100644 libcpp/include/file-map.h
26
27diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
28index dd5fd23..9c004a1 100644
29--- a/gcc/c-family/c-opts.c
30+++ b/gcc/c-family/c-opts.c
31@@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see
32 #include "options.h"
33 #include "plugin.h" /* For PLUGIN_INCLUDE_FILE event. */
34 #include "mkdeps.h"
35+#include "file-map.h"
36 #include "c-target.h"
37 #include "tm.h" /* For BYTES_BIG_ENDIAN,
38 DOLLARS_IN_IDENTIFIERS,
39@@ -553,6 +554,11 @@ c_common_handle_option (size_t scode, const char *arg, int value,
40 cpp_opts->narrow_charset = arg;
41 break;
42
43+ case OPT_ffile_prefix_map_:
44+ if (add_file_prefix_map (arg) < 0)
45+ error ("invalid argument %qs to -ffile-prefix-map", arg);
46+ break;
47+
48 case OPT_fwide_exec_charset_:
49 cpp_opts->wide_charset = arg;
50 break;
51diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
52index f295805..3a99662 100644
53--- a/gcc/c-family/c.opt
54+++ b/gcc/c-family/c.opt
55@@ -928,6 +928,10 @@ fexec-charset=
56 C ObjC C++ ObjC++ Joined RejectNegative
57 -fexec-charset=<cset> Convert all strings and character constants to character set <cset>
58
59+ffile-prefix-map=
60+C ObjC C++ ObjC++ Joined RejectNegative
61+-ffile-prefix-map=<old=new> Map one directory name to another in __FILE__, __BASE_FILE__ and __builtin_FILE ()
62+
63 fextended-identifiers
64 C ObjC C++ ObjC++
65 Permit universal character names (\\u and \\U) in identifiers
66diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
67index 99bf6e2..3e58cfd 100644
68--- a/gcc/dwarf2out.c
69+++ b/gcc/dwarf2out.c
70@@ -19199,6 +19199,7 @@ gen_producer_string (void)
71 case OPT_fltrans_output_list_:
72 case OPT_fresolution_:
73 case OPT_fdebug_prefix_map_:
74+ case OPT_ffile_prefix_map_:
75 /* Ignore these. */
76 continue;
77 default:
78diff --git a/gcc/gimplify.c b/gcc/gimplify.c
79index 89e7334..a7a97c0 100644
80--- a/gcc/gimplify.c
81+++ b/gcc/gimplify.c
82@@ -59,6 +59,7 @@ along with GCC; see the file COPYING3. If not see
83 #include "omp-low.h"
84 #include "gimple-low.h"
85 #include "cilk.h"
86+#include "file-map.h"
87
88 #include "langhooks-def.h" /* FIXME: for lhd_set_decl_assembler_name */
89 #include "tree-pass.h" /* FIXME: only for PROP_gimple_any */
90@@ -2288,6 +2289,7 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value)
91 case BUILT_IN_FILE:
92 {
93 expanded_location loc = expand_location (EXPR_LOCATION (*expr_p));
94+ loc.file = remap_file_filename (loc.file);
95 *expr_p = build_string_literal (strlen (loc.file) + 1, loc.file);
96 return GS_OK;
97 }
98diff --git a/libcpp/Makefile.in b/libcpp/Makefile.in
99index 5561c97..5017256 100644
100--- a/libcpp/Makefile.in
101+++ b/libcpp/Makefile.in
102@@ -84,12 +84,12 @@ DEPMODE = $(CXXDEPMODE)
103
104
105 libcpp_a_OBJS = charset.o directives.o directives-only.o errors.o \
106- expr.o files.o identifiers.o init.o lex.o line-map.o macro.o \
107- mkdeps.o pch.o symtab.o traditional.o
108+ expr.o file-map.o files.o identifiers.o init.o lex.o line-map.o \
109+ macro.o mkdeps.o pch.o symtab.o traditional.o
110
111 libcpp_a_SOURCES = charset.c directives.c directives-only.c errors.c \
112- expr.c files.c identifiers.c init.c lex.c line-map.c macro.c \
113- mkdeps.c pch.c symtab.c traditional.c
114+ expr.c file-map.c files.c identifiers.c init.c lex.c line-map.c \
115+ macro.c mkdeps.c pch.c symtab.c traditional.c
116
117 all: libcpp.a $(USED_CATALOGS)
118
119@@ -263,7 +263,7 @@ po/$(PACKAGE).pot: $(libcpp_a_SOURCES)
120
121 TAGS_SOURCES = $(libcpp_a_SOURCES) internal.h ucnid.h \
122 include/line-map.h include/symtab.h include/cpp-id-data.h \
123- include/cpplib.h include/mkdeps.h system.h
124+ include/cpplib.h include/mkdeps.h system.h include/file-map.h
125
126 TAGS: $(TAGS_SOURCES)
127 cd $(srcdir) && etags $(TAGS_SOURCES)
128diff --git a/libcpp/file-map.c b/libcpp/file-map.c
129new file mode 100644
130index 0000000..04e851b
131--- /dev/null
132+++ b/libcpp/file-map.c
133@@ -0,0 +1,92 @@
134+/* Map one directory name to another in __FILE__, __BASE_FILE__
135+ and __builtin_FILE ().
136+ Copyright (C) 2001-2016 Free Software Foundation, Inc.
137+
138+This program is free software; you can redistribute it and/or modify it
139+under the terms of the GNU General Public License as published by the
140+Free Software Foundation; either version 3, or (at your option) any
141+later version.
142+
143+This program is distributed in the hope that it will be useful,
144+but WITHOUT ANY WARRANTY; without even the implied warranty of
145+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
146+GNU General Public License for more details.
147+
148+You should have received a copy of the GNU General Public License
149+along with this program; see the file COPYING3. If not see
150+<http://www.gnu.org/licenses/>.
151+
152+ In other words, you are welcome to use, share and improve this program.
153+ You are forbidden to forbid anyone else to use, share and improve
154+ what you give them. Help stamp out software-hoarding! */
155+
156+#include "config.h"
157+#include "system.h"
158+#include "file-map.h"
159+
160+/* Structure recording the mapping from source file and directory
161+ names at compile time to __FILE__ */
162+typedef struct file_prefix_map
163+{
164+ const char *old_prefix;
165+ const char *new_prefix;
166+ size_t old_len;
167+ size_t new_len;
168+ struct file_prefix_map *next;
169+} file_prefix_map;
170+
171+/* Linked list of such structures. */
172+static file_prefix_map *file_prefix_maps;
173+
174+/* Record prefix mapping of __FILE__. ARG is the argument to
175+ -ffile-prefix-map and must be of the form OLD=NEW. */
176+int
177+add_file_prefix_map (const char *arg)
178+{
179+ file_prefix_map *map;
180+ const char *p;
181+
182+ p = strchr (arg, '=');
183+ if (!p)
184+ {
185+ fprintf(stderr, "invalid argument %qs to -ffile-prefix-map", arg);
186+ return -1;
187+ }
188+ map = XNEW (file_prefix_map);
189+ map->old_prefix = xstrndup (arg, p - arg);
190+ map->old_len = p - arg;
191+ p++;
192+ map->new_prefix = xstrdup (p);
193+ map->new_len = strlen (p);
194+ map->next = file_prefix_maps;
195+ file_prefix_maps = map;
196+
197+ return 0;
198+}
199+
200+/* Perform user-specified mapping of __FILE__ prefixes. Return
201+ the new name corresponding to filename. */
202+
203+const char *
204+remap_file_filename (const char *filename)
205+{
206+ file_prefix_map *map;
207+ char *s;
208+ const char *name;
209+ size_t name_len;
210+
211+ for (map = file_prefix_maps; map; map = map->next)
212+ if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0)
213+ break;
214+ if (!map)
215+ return filename;
216+ name = filename + map->old_len;
217+ name_len = strlen (name) + 1;
218+ s = (char *) alloca (name_len + map->new_len);
219+ memcpy (s, map->new_prefix, map->new_len);
220+ memcpy (s + map->new_len, name, name_len);
221+
222+ return xstrdup (s);
223+}
224+
225+
226diff --git a/libcpp/include/file-map.h b/libcpp/include/file-map.h
227new file mode 100644
228index 0000000..e6f8cbf
229--- /dev/null
230+++ b/libcpp/include/file-map.h
231@@ -0,0 +1,30 @@
232+/* Map one directory name to another in __FILE__, __BASE_FILE__
233+ and __builtin_FILE ().
234+ Copyright (C) 2001-2016 Free Software Foundation, Inc.
235+
236+This program is free software; you can redistribute it and/or modify it
237+under the terms of the GNU General Public License as published by the
238+Free Software Foundation; either version 3, or (at your option) any
239+later version.
240+
241+This program is distributed in the hope that it will be useful,
242+but WITHOUT ANY WARRANTY; without even the implied warranty of
243+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
244+GNU General Public License for more details.
245+
246+You should have received a copy of the GNU General Public License
247+along with this program; see the file COPYING3. If not see
248+<http://www.gnu.org/licenses/>.
249+
250+ In other words, you are welcome to use, share and improve this program.
251+ You are forbidden to forbid anyone else to use, share and improve
252+ what you give them. Help stamp out software-hoarding! */
253+
254+#ifndef LIBCPP_FILE_MAP_H
255+#define LIBCPP_FILE_MAP_H
256+
257+const char * remap_file_filename (const char *filename);
258+
259+int add_file_prefix_map (const char *arg);
260+
261+#endif /* !LIBCPP_FILE_MAP_H */
262diff --git a/libcpp/macro.c b/libcpp/macro.c
263index 11e50f4..5c6f90e 100644
264--- a/libcpp/macro.c
265+++ b/libcpp/macro.c
266@@ -26,6 +26,7 @@ along with this program; see the file COPYING3. If not see
267 #include "system.h"
268 #include "cpplib.h"
269 #include "internal.h"
270+#include "file-map.h"
271
272 typedef struct macro_arg macro_arg;
273 /* This structure represents the tokens of a macro argument. These
274@@ -288,6 +289,7 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node)
275 if (!name)
276 abort ();
277 }
278+ name = remap_file_filename (name);
279 len = strlen (name);
280 buf = _cpp_unaligned_alloc (pfile, len * 2 + 3);
281 result = buf;
282--
2831.9.1
284
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0073-Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch b/meta/recipes-devtools/gcc/gcc-4.9/0073-Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch
deleted file mode 100644
index 94e45ed0aa..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0073-Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch
+++ /dev/null
@@ -1,43 +0,0 @@
1From 5e10baff84038d26dc3d59b2412ba1db92cb8274 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Thu, 17 Mar 2016 00:34:01 -0400
4Subject: [PATCH 2/2] Reuse -fdebug-prefix-map to replace -ffile-prefix-map
5
6The oe-core may use external toolchain to compile,
7which may not support -ffile-prefix-map.
8
9Since we use -fdebug-prefix-map to do the same thing,
10so we could reuse it to replace -ffile-prefix-map.
11
12Upstream-Status: Inappropriate[oe-core specific]
13
14Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
15---
16 gcc/opts-global.c | 4 ++++
17 1 file changed, 4 insertions(+)
18
19diff --git a/gcc/opts-global.c b/gcc/opts-global.c
20index 111884b..037f6c8 100644
21--- a/gcc/opts-global.c
22+++ b/gcc/opts-global.c
23@@ -42,6 +42,7 @@ along with GCC; see the file COPYING3. If not see
24 #include "toplev.h"
25 #include "tree-pass.h"
26 #include "context.h"
27+#include "file-map.h"
28
29 typedef const char *const_char_p; /* For DEF_VEC_P. */
30
31@@ -354,6 +355,9 @@ handle_common_deferred_options (void)
32
33 case OPT_fdebug_prefix_map_:
34 add_debug_prefix_map (opt->arg);
35+
36+ /* Reuse -fdebug-prefix-map to replace -ffile-prefix-map */
37+ add_file_prefix_map (opt->arg);
38 break;
39
40 case OPT_fdump_:
41--
421.9.1
43
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0074-fdebug-prefix-map-support-to-remap-relative-path.patch b/meta/recipes-devtools/gcc/gcc-4.9/0074-fdebug-prefix-map-support-to-remap-relative-path.patch
deleted file mode 100644
index 0b91fdbbcf..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0074-fdebug-prefix-map-support-to-remap-relative-path.patch
+++ /dev/null
@@ -1,51 +0,0 @@
1From 289ad2969a5966c603bf6928ce442db74c4cbb25 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Thu, 24 Mar 2016 11:23:14 -0400
4Subject: [PATCH] gcc/final.c: -fdebug-prefix-map support to remap sources with
5 relative path
6
7PR other/70428
8* final.c (remap_debug_filename): Use lrealpath to translate
9relative path before remapping
10
11https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70428
12Upstream-Status: Submitted [gcc-patches@gcc.gnu.org]
13
14Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
15---
16diff --git a/gcc/final.c b/gcc/final.c
17index 55cf509..c3594c2 100644
18--- a/gcc/final.c
19+++ b/gcc/final.c
20@@ -1554,16 +1554,25 @@ remap_debug_filename (const char *filename)
21 const char *name;
22 size_t name_len;
23
24+ /* Support to remap filename with relative path */
25+ char *realpath = lrealpath (filename);
26+ if (realpath == NULL)
27+ return filename;
28+
29 for (map = debug_prefix_maps; map; map = map->next)
30- if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0)
31+ if (filename_ncmp (realpath, map->old_prefix, map->old_len) == 0)
32 break;
33 if (!map)
34- return filename;
35- name = filename + map->old_len;
36+ {
37+ free (realpath);
38+ return filename;
39+ }
40+ name = realpath + map->old_len;
41 name_len = strlen (name) + 1;
42 s = (char *) alloca (name_len + map->new_len);
43 memcpy (s, map->new_prefix, map->new_len);
44 memcpy (s + map->new_len, name, name_len);
45+ free (realpath);
46 return ggc_strdup (s);
47 }
48
49--
502.7.4
51
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0075-libgcc-use-ldflags.patch b/meta/recipes-devtools/gcc/gcc-4.9/0075-libgcc-use-ldflags.patch
deleted file mode 100644
index 325b72ab5f..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0075-libgcc-use-ldflags.patch
+++ /dev/null
@@ -1,16 +0,0 @@
1Link libgcc using LDFLAGS, not just SHLIB_LDFLAGS
2
3Signed-off-by: Christopher Larson <chris_larson@mentor.com>
4Upstream-Status: Pending
5
6--- gcc-5.3.0.orig/libgcc/config/t-slibgcc
7+++ gcc-5.3.0/libgcc/config/t-slibgcc
8@@ -32,7 +32,7 @@ SHLIB_INSTALL_SOLINK = $(LN_S) $(SHLIB_S
9 $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)
10
11 SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
12- $(SHLIB_LDFLAGS) \
13+ $(LDFLAGS) $(SHLIB_LDFLAGS) \
14 -o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ \
15 $(SHLIB_OBJS) $(SHLIB_LC) && \
16 rm -f $(SHLIB_DIR)/$(SHLIB_SOLINK) && \
diff --git a/meta/recipes-devtools/gcc/gcc-4.9/0076-remove-prototypes-cfns.patch b/meta/recipes-devtools/gcc/gcc-4.9/0076-remove-prototypes-cfns.patch
deleted file mode 100644
index 2954f2eac4..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.9/0076-remove-prototypes-cfns.patch
+++ /dev/null
@@ -1,153 +0,0 @@
1Upstream-Status: backport
2
3From 8c3fa311caa86f61b4e28d1563d1110b44340fb2 Mon Sep 17 00:00:00 2001
4From: edlinger <edlinger@138bc75d-0d04-0410-961f-82ee72b054a4>
5Date: Thu, 25 Feb 2016 15:36:41 +0000
6Subject: [PATCH] 2016-02-25 Bernd Edlinger <bernd.edlinger@hotmail.de>
7
8 Backported from mainline
9 2016-02-19 Jakub Jelinek <jakub@redhat.com>
10 Bernd Edlinger <bernd.edlinger@hotmail.de>
11
12 * Make-lang.in: Invoke gperf with -L C++.
13 * cfns.gperf: Remove prototypes for hash and libc_name_p
14 inlines.
15 * cfns.h: Regenerated.
16 * except.c (nothrow_libfn_p): Adjust.
17
18
19---
20 gcc/cp/Make-lang.in | 2 +-
21 gcc/cp/cfns.gperf | 10 ++--------
22 gcc/cp/cfns.h | 41 ++++++++++++++---------------------------
23 gcc/cp/except.c | 3 ++-
24 5 files changed, 31 insertions(+), 37 deletions(-)
25
26diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
27index bd1c1d7..a0ea0d4 100644
28--- a/gcc/cp/Make-lang.in
29+++ b/gcc/cp/Make-lang.in
30@@ -111,7 +111,7 @@ else
31 # deleting the $(srcdir)/cp/cfns.h file.
32 $(srcdir)/cp/cfns.h:
33 endif
34- gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L ANSI-C \
35+ gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L C++ \
36 $(srcdir)/cp/cfns.gperf --output-file $(srcdir)/cp/cfns.h
37
38 #
39diff --git a/gcc/cp/cfns.gperf b/gcc/cp/cfns.gperf
40index 05ca753..d9b16b8 100644
41--- a/gcc/cp/cfns.gperf
42+++ b/gcc/cp/cfns.gperf
43@@ -1,3 +1,5 @@
44+%language=C++
45+%define class-name libc_name
46 %{
47 /* Copyright (C) 2000-2014 Free Software Foundation, Inc.
48
49@@ -16,14 +18,6 @@ for more details.
50 You should have received a copy of the GNU General Public License
51 along with GCC; see the file COPYING3. If not see
52 <http://www.gnu.org/licenses/>. */
53-#ifdef __GNUC__
54-__inline
55-#endif
56-static unsigned int hash (const char *, unsigned int);
57-#ifdef __GNUC__
58-__inline
59-#endif
60-const char * libc_name_p (const char *, unsigned int);
61 %}
62 %%
63 # The standard C library functions, for feeding to gperf; the result is used
64diff --git a/gcc/cp/cfns.h b/gcc/cp/cfns.h
65index c845ddf..65801d1 100644
66--- a/gcc/cp/cfns.h
67+++ b/gcc/cp/cfns.h
68@@ -1,5 +1,5 @@
69-/* ANSI-C code produced by gperf version 3.0.3 */
70-/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L ANSI-C cfns.gperf */
71+/* C++ code produced by gperf version 3.0.4 */
72+/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L C++ --output-file cfns.h cfns.gperf */
73
74 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
75 && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
76@@ -28,7 +28,7 @@
77 #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
78 #endif
79
80-#line 1 "cfns.gperf"
81+#line 3 "cfns.gperf"
82
83 /* Copyright (C) 2000-2014 Free Software Foundation, Inc.
84
85@@ -47,25 +47,18 @@ for more details.
86 You should have received a copy of the GNU General Public License
87 along with GCC; see the file COPYING3. If not see
88 <http://www.gnu.org/licenses/>. */
89-#ifdef __GNUC__
90-__inline
91-#endif
92-static unsigned int hash (const char *, unsigned int);
93-#ifdef __GNUC__
94-__inline
95-#endif
96-const char * libc_name_p (const char *, unsigned int);
97 /* maximum key range = 391, duplicates = 0 */
98
99-#ifdef __GNUC__
100-__inline
101-#else
102-#ifdef __cplusplus
103-inline
104-#endif
105-#endif
106-static unsigned int
107-hash (register const char *str, register unsigned int len)
108+class libc_name
109+{
110+private:
111+ static inline unsigned int hash (const char *str, unsigned int len);
112+public:
113+ static const char *libc_name_p (const char *str, unsigned int len);
114+};
115+
116+inline unsigned int
117+libc_name::hash (register const char *str, register unsigned int len)
118 {
119 static const unsigned short asso_values[] =
120 {
121@@ -122,14 +115,8 @@ hash (register const char *str, register unsigned int len)
122 return hval + asso_values[(unsigned char)str[len - 1]];
123 }
124
125-#ifdef __GNUC__
126-__inline
127-#ifdef __GNUC_STDC_INLINE__
128-__attribute__ ((__gnu_inline__))
129-#endif
130-#endif
131 const char *
132-libc_name_p (register const char *str, register unsigned int len)
133+libc_name::libc_name_p (register const char *str, register unsigned int len)
134 {
135 enum
136 {
137diff --git a/gcc/cp/except.c b/gcc/cp/except.c
138index 221971a..32340f5 100644
139--- a/gcc/cp/except.c
140+++ b/gcc/cp/except.c
141@@ -1030,7 +1030,8 @@ nothrow_libfn_p (const_tree fn)
142 unless the system headers are playing rename tricks, and if
143 they are, we don't want to be confused by them. */
144 id = DECL_NAME (fn);
145- return !!libc_name_p (IDENTIFIER_POINTER (id), IDENTIFIER_LENGTH (id));
146+ return !!libc_name::libc_name_p (IDENTIFIER_POINTER (id),
147+ IDENTIFIER_LENGTH (id));
148 }
149
150 /* Returns nonzero if an exception of type FROM will be caught by a
151--
1522.8.2
153
diff --git a/meta/recipes-devtools/gcc/gcc-cross-canadian_4.9.bb b/meta/recipes-devtools/gcc/gcc-cross-canadian_4.9.bb
deleted file mode 100644
index bf53c5cd78..0000000000
--- a/meta/recipes-devtools/gcc/gcc-cross-canadian_4.9.bb
+++ /dev/null
@@ -1,5 +0,0 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-cross-canadian.inc
3
4
5
diff --git a/meta/recipes-devtools/gcc/gcc-cross-initial_4.9.bb b/meta/recipes-devtools/gcc/gcc-cross-initial_4.9.bb
deleted file mode 100644
index 4c73e5ce61..0000000000
--- a/meta/recipes-devtools/gcc/gcc-cross-initial_4.9.bb
+++ /dev/null
@@ -1,2 +0,0 @@
1require recipes-devtools/gcc/gcc-cross_${PV}.bb
2require gcc-cross-initial.inc
diff --git a/meta/recipes-devtools/gcc/gcc-cross_4.9.bb b/meta/recipes-devtools/gcc/gcc-cross_4.9.bb
deleted file mode 100644
index b43cca0c52..0000000000
--- a/meta/recipes-devtools/gcc/gcc-cross_4.9.bb
+++ /dev/null
@@ -1,3 +0,0 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-cross.inc
3
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.9.bb b/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.9.bb
deleted file mode 100644
index fd90e1140f..0000000000
--- a/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.9.bb
+++ /dev/null
@@ -1,3 +0,0 @@
1require recipes-devtools/gcc/gcc-cross-initial_${PV}.bb
2require gcc-crosssdk-initial.inc
3
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk_4.9.bb b/meta/recipes-devtools/gcc/gcc-crosssdk_4.9.bb
deleted file mode 100644
index 40a6c4feff..0000000000
--- a/meta/recipes-devtools/gcc/gcc-crosssdk_4.9.bb
+++ /dev/null
@@ -1,2 +0,0 @@
1require recipes-devtools/gcc/gcc-cross_${PV}.bb
2require gcc-crosssdk.inc
diff --git a/meta/recipes-devtools/gcc/gcc-runtime_4.9.bb b/meta/recipes-devtools/gcc/gcc-runtime_4.9.bb
deleted file mode 100644
index 497d691688..0000000000
--- a/meta/recipes-devtools/gcc/gcc-runtime_4.9.bb
+++ /dev/null
@@ -1,3 +0,0 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-runtime.inc
3
diff --git a/meta/recipes-devtools/gcc/gcc-sanitizers_4.9.bb b/meta/recipes-devtools/gcc/gcc-sanitizers_4.9.bb
deleted file mode 100644
index 601f666023..0000000000
--- a/meta/recipes-devtools/gcc/gcc-sanitizers_4.9.bb
+++ /dev/null
@@ -1,2 +0,0 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-sanitizers.inc
diff --git a/meta/recipes-devtools/gcc/gcc-source_4.9.bb b/meta/recipes-devtools/gcc/gcc-source_4.9.bb
deleted file mode 100644
index b890fa33ea..0000000000
--- a/meta/recipes-devtools/gcc/gcc-source_4.9.bb
+++ /dev/null
@@ -1,4 +0,0 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require recipes-devtools/gcc/gcc-source.inc
3
4EXCLUDE_FROM_WORLD = "1"
diff --git a/meta/recipes-devtools/gcc/gcc_4.9.bb b/meta/recipes-devtools/gcc/gcc_4.9.bb
deleted file mode 100644
index a9dc612fbf..0000000000
--- a/meta/recipes-devtools/gcc/gcc_4.9.bb
+++ /dev/null
@@ -1,13 +0,0 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-target.inc
3
4# http://errors.yoctoproject.org/Errors/Details/20497/
5ARM_INSTRUCTION_SET_armv4 = "arm"
6ARM_INSTRUCTION_SET_armv5 = "arm"
7
8BBCLASSEXTEND = "nativesdk"
9
10#SYSTEMHEADERS_class-nativesdk = "${@'${target_includedir}'.replace(d.getVar('SDKPATH', True),'%r')}"
11#SYSTEMLIBS_class-nativesdk = "${@'${target_base_libdir}'.replace(d.getVar('SDKPATH', True),'%r')}/"
12#SYSTEMLIBS1_class-nativesdk = "${@'${target_libdir}'.replace(d.getVar('SDKPATH', True),'%r')}/"
13
diff --git a/meta/recipes-devtools/gcc/libgcc-initial_4.9.bb b/meta/recipes-devtools/gcc/libgcc-initial_4.9.bb
deleted file mode 100644
index 19f253fce8..0000000000
--- a/meta/recipes-devtools/gcc/libgcc-initial_4.9.bb
+++ /dev/null
@@ -1,2 +0,0 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require libgcc-initial.inc
diff --git a/meta/recipes-devtools/gcc/libgcc_4.9.bb b/meta/recipes-devtools/gcc/libgcc_4.9.bb
deleted file mode 100644
index a5152f28e9..0000000000
--- a/meta/recipes-devtools/gcc/libgcc_4.9.bb
+++ /dev/null
@@ -1,2 +0,0 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require libgcc.inc
diff --git a/meta/recipes-devtools/gcc/libgfortran_4.9.bb b/meta/recipes-devtools/gcc/libgfortran_4.9.bb
deleted file mode 100644
index 71dd8b4bdc..0000000000
--- a/meta/recipes-devtools/gcc/libgfortran_4.9.bb
+++ /dev/null
@@ -1,3 +0,0 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require libgfortran.inc
3