aboutsummaryrefslogtreecommitdiff
path: root/meta-linaro-toolchain
diff options
context:
space:
mode:
authorKoen Kooi <koen.kooi@linaro.org>2013-10-07 14:31:19 +0200
committerKoen Kooi <koen.kooi@linaro.org>2013-10-08 07:29:14 +0200
commit509022fa4160e3b299b1a29892027d16ea21f6cf (patch)
tree0c5cee555ee21a7daf7ef1fefd8e9066946932cb /meta-linaro-toolchain
parent17b0ce154992b099f7f037aa01fc05972125dc07 (diff)
gcc 4.8: sync patches with OE-core
This brings us inline with OE-core gcc and replaces the backported sysroot patch with the upstream one. Only 0036-PR-target-56102.patch didn't apply and was left out of the SRC_URI Signed-off-by: Koen Kooi <koen.kooi@linaro.org>
Diffstat (limited to 'meta-linaro-toolchain')
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8.inc16
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0036-PR-target-56102.patch83
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0037-gcc-4.8-PR56797.patch66
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0038-gcc-4.8-build-args.patch41
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0039-gcc-4.8-PR57717.patch23
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0040-fix-g++-sysroot.patch40
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0041-libtool-avoid-libdir.patch19
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0042-pr57748.patch78
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0043-cpp.patch40
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0044-gengtypes.patch97
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0045-gcc-4.8-PR57717-PowerPC-E500v2.patch21
-rw-r--r--meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/fix-g++-sysroot.patch78
12 files changed, 521 insertions, 81 deletions
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8.inc b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8.inc
index eb22d31a..4faa5a35 100644
--- a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8.inc
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8.inc
@@ -45,12 +45,22 @@ SRC_URI = "http://cbuild.validation.linaro.org/snapshots/gcc-${PV}-${RELEASE}.ta
file://0033-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch \
file://0034-Use-the-multilib-config-files-from-B-instead-of-usin.patch \
file://0035-wcast-qual-PR-55383.patch \
- file://gcc-4.8-PR56797.patch \
+ file://0037-gcc-4.8-PR56797.patch \
+ file://0038-gcc-4.8-build-args.patch \
+ file://0039-gcc-4.8-PR57717.patch \
+ file://0040-fix-g++-sysroot.patch \
+ file://0041-libtool-avoid-libdir.patch \
+ file://0042-pr57748.patch \
+ file://0043-cpp.patch \
+ file://0044-gengtypes.patch \
+ file://0045-gcc-4.8-PR57717-PowerPC-E500v2.patch \
+ file://0046-libatomic-deptracking.patch \
file://use-lib-for-aarch64.patch \
- file://fix-g++-sysroot.patch \
- file://0046-libatomic-deptracking.patch \
"
+# Don't apply:
+# file://0036-PR-target-56102.patch
+
SRC_URI[md5sum] = "2e2612bc0ad158abdb22c4be1dc0d1c4"
SRC_URI[sha256sum] = "a507096ab16564353a8ebe3cd270a6f82d3c2e3a4303e2b883723b217f002c0b"
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0036-PR-target-56102.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0036-PR-target-56102.patch
new file mode 100644
index 00000000..a9498fcb
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0036-PR-target-56102.patch
@@ -0,0 +1,83 @@
+From fa049b3584a1cc36c250205e3d5841e6a40ff677 Mon Sep 17 00:00:00 2001
+From: amker <amker@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Wed, 27 Mar 2013 08:16:54 +0000
+Subject: [PATCH] PR target/56102
+
+* config/arm/arm.c (thumb1_rtx_costs, thumb1_size_rtx_costs): Fix rtx costs for SET/ASHIFT/ASHIFTRT/LSHIFTRT/ROTATERT patterns with mult-word mode.
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197155 138bc75d-0d04-0410-961f-82ee72b054a4
+
+Upstream-Status: Backport
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57329
+
+Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
+---
+ gcc/config/arm/arm.c | 17 ++++++++++++++---
+ 1 file changed, 14 insertions(+), 3 deletions(-)
+
+diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
+index 460d333..edf850d 100644
+--- a/gcc/config/arm/arm.c
++++ b/gcc/config/arm/arm.c
+@@ -7094,7 +7094,7 @@ static inline int
+ thumb1_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer)
+ {
+ enum machine_mode mode = GET_MODE (x);
+- int total;
++ int total, words;
+
+ switch (code)
+ {
+@@ -7102,6 +7102,8 @@ thumb1_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer)
+ case ASHIFTRT:
+ case LSHIFTRT:
+ case ROTATERT:
++ return (mode == SImode) ? COSTS_N_INSNS (1) : COSTS_N_INSNS (2);
++
+ case PLUS:
+ case MINUS:
+ case COMPARE:
+@@ -7125,7 +7127,10 @@ thumb1_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer)
+ return COSTS_N_INSNS (1) + 16;
+
+ case SET:
+- return (COSTS_N_INSNS (1)
++ /* A SET doesn't have a mode, so let's look at the SET_DEST to get
++ the mode. */
++ words = ARM_NUM_INTS (GET_MODE_SIZE (GET_MODE (SET_DEST (x))));
++ return (COSTS_N_INSNS (words)
+ + 4 * ((MEM_P (SET_SRC (x)))
+ + MEM_P (SET_DEST (x))));
+
+@@ -7822,6 +7827,7 @@ static inline int
+ thumb1_size_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer)
+ {
+ enum machine_mode mode = GET_MODE (x);
++ int words;
+
+ switch (code)
+ {
+@@ -7829,6 +7835,8 @@ thumb1_size_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer)
+ case ASHIFTRT:
+ case LSHIFTRT:
+ case ROTATERT:
++ return (mode == SImode) ? COSTS_N_INSNS (1) : COSTS_N_INSNS (2);
++
+ case PLUS:
+ case MINUS:
+ case COMPARE:
+@@ -7847,7 +7855,10 @@ thumb1_size_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer)
+ return COSTS_N_INSNS (1);
+
+ case SET:
+- return (COSTS_N_INSNS (1)
++ /* A SET doesn't have a mode, so let's look at the SET_DEST to get
++ the mode. */
++ words = ARM_NUM_INTS (GET_MODE_SIZE (GET_MODE (SET_DEST (x))));
++ return (COSTS_N_INSNS (words)
+ + 4 * ((MEM_P (SET_SRC (x)))
+ + MEM_P (SET_DEST (x))));
+
+--
+1.8.2.1
+
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0037-gcc-4.8-PR56797.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0037-gcc-4.8-PR56797.patch
new file mode 100644
index 00000000..b5d7b864
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0037-gcc-4.8-PR56797.patch
@@ -0,0 +1,66 @@
+Upstream-Status: Backport
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+From patchwork Fri Apr 19 09:34:49 2013
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [ARM] Fix PR56797
+Date: Thu, 18 Apr 2013 23:34:49 -0000
+From: Greta Yorsh <Greta.Yorsh@arm.com>
+X-Patchwork-Id: 237891
+Message-Id: <000801ce3ce1$23fbdd60$6bf39820$@yorsh@arm.com>
+To: "GCC Patches" <gcc-patches@gcc.gnu.org>
+Cc: <raj.khem@gmail.com>, "Richard Earnshaw" <Richard.Earnshaw@arm.com>,
+ "Ramana Radhakrishnan" <Ramana.Radhakrishnan@arm.com>
+
+Fix PR56797
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56797
+
+The problem is that peephole optimizer thinks it can generate an ldm, but
+the pattern for ldm no longer matches, because after r188738 it requires
+that if one of the destination registers is SP then the base register must
+be SP, and it's not SP in the test case.
+
+The test case fails on armv5t but doesn't fail on armv6t2 or armv7-a because
+peephole doesn't trigger there (because there is a different epilogue
+sequence). It looks like a latent problem for other architecture or CPUs.
+
+This patch adds this condition to the peephole optimizer.
+
+No regression on qemu for arm-none-eabi and fixes the test reported in the
+PR. I couldn't minimize the test sufficiently to include it in the
+testsuite.
+
+Ok for trunk?
+
+Thanks,
+Greta
+
+gcc/
+
+2013-04-18 Greta Yorsh <Greta.Yorsh@arm.com>
+
+ PR target/56797
+ * config/arm/arm.c (load_multiple_sequence): Require SP
+ as base register for loads if SP is in the register list.
+
+
+diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
+index d00849c..60fef78 100644
+--- a/gcc/config/arm/arm.c
++++ b/gcc/config/arm/arm.c
+@@ -10347,6 +10347,13 @@ load_multiple_sequence (rtx *operands, int nops, int *regs, int *saved_order,
+ || (i != nops - 1 && unsorted_regs[i] == base_reg))
+ return 0;
+
++ /* Don't allow SP to be loaded unless it is also the base
++ register. It guarantees that SP is reset correctly when
++ an LDM instruction is interruptted. Otherwise, we might
++ end up with a corrupt stack. */
++ if (unsorted_regs[i] == SP_REGNUM && base_reg != SP_REGNUM)
++ return 0;
++
+ unsorted_offsets[i] = INTVAL (offset);
+ if (i == 0 || unsorted_offsets[i] < unsorted_offsets[order[0]])
+ order[0] = i;
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0038-gcc-4.8-build-args.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0038-gcc-4.8-build-args.patch
new file mode 100644
index 00000000..c27e0096
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0038-gcc-4.8-build-args.patch
@@ -0,0 +1,41 @@
+When cross compiling a target gcc, target flags may be used on the host
+
+Configure identifies a number of warning flags (WARN_CFLAGS and
+WARN_CXXFLAGS) from the $CC value. The cross compiler may be different
+from the host compiler and may not support the same set of flags. This
+leads to problems such as:
+
+cc1plus: error: unrecognized command line option "-Wno-narrowing"
+cc1plus: error: unrecognized command line option "-Wno-overlength-strings"
+
+Work around this problem by removing the warning flags from the
+BUILD_CXXFLAGS value, in a way similar to the BUILD_CFLAGS.
+
+Upstream-Status: Pending
+
+Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
+
+Index: gcc-4.8.0/gcc/configure
+===================================================================
+--- gcc-4.8.0.orig/gcc/configure
++++ gcc-4.8.0/gcc/configure
+@@ -11720,6 +10581,7 @@ STMP_FIXINC=stmp-fixinc
+ if test x$build != x$host || test "x$coverage_flags" != x
+ then
+ BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
++ BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
+ BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
+ fi
+
+Index: gcc-4.8.0/gcc/configure.ac
+===================================================================
+--- gcc-4.8.0.orig/gcc/configure.ac
++++ gcc-4.8.0/gcc/configure.ac
+@@ -1901,6 +1901,7 @@ STMP_FIXINC=stmp-fixinc AC_SUBST(STMP_F
+ if test x$build != x$host || test "x$coverage_flags" != x
+ then
+ BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
++ BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
+ BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
+ fi
+
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0039-gcc-4.8-PR57717.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0039-gcc-4.8-PR57717.patch
new file mode 100644
index 00000000..f983f70d
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0039-gcc-4.8-PR57717.patch
@@ -0,0 +1,23 @@
+This backports fix from http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57717
+
+Upstream-Status: Backport
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: gcc-4.8.1/gcc/config/rs6000/rs6000.c
+===================================================================
+--- gcc-4.8.1.orig/gcc/config/rs6000/rs6000.c 2013-05-09 18:54:06.000000000 -0700
++++ gcc-4.8.1/gcc/config/rs6000/rs6000.c 2013-06-27 08:22:40.459021366 -0700
+@@ -5431,11 +5431,12 @@
+
+ case TFmode:
+ case TDmode:
+- case TImode:
+ if (TARGET_E500_DOUBLE)
+ return (SPE_CONST_OFFSET_OK (offset)
+ && SPE_CONST_OFFSET_OK (offset + 8));
++ /* Fall through. */
+
++ case TImode:
+ extra = 8;
+ if (!worst_case)
+ break;
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0040-fix-g++-sysroot.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0040-fix-g++-sysroot.patch
new file mode 100644
index 00000000..d50aa5c9
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0040-fix-g++-sysroot.patch
@@ -0,0 +1,40 @@
+Portions of
+
+http://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg26013.html
+
+are not upstreamed yet. So lets keep missing pieces.
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: gcc-4.8.1/gcc/configure.ac
+===================================================================
+--- gcc-4.8.1.orig/gcc/configure.ac 2013-07-15 15:55:49.488399132 -0700
++++ gcc-4.8.1/gcc/configure.ac 2013-07-15 16:02:31.772406679 -0700
+@@ -148,7 +148,9 @@
+ if test "${with_sysroot+set}" = set; then
+ gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
+ if test "${gcc_gxx_without_sysroot}"; then
+- gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
++ if test x${with_sysroot} != x/; then
++ gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
++ fi
+ gcc_gxx_include_dir_add_sysroot=1
+ fi
+ fi
+Index: gcc-4.8.1/gcc/configure
+===================================================================
+--- gcc-4.8.1.orig/gcc/configure 2013-07-15 15:55:49.472399132 -0700
++++ gcc-4.8.1/gcc/configure 2013-07-15 16:02:31.780406680 -0700
+@@ -3325,7 +3325,9 @@
+ if test "${with_sysroot+set}" = set; then
+ gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
+ if test "${gcc_gxx_without_sysroot}"; then
+- gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
++ if test x${with_sysroot} != x/; then
++ gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
++ fi
+ gcc_gxx_include_dir_add_sysroot=1
+ fi
+ fi
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0041-libtool-avoid-libdir.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0041-libtool-avoid-libdir.patch
new file mode 100644
index 00000000..2dd9610a
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0041-libtool-avoid-libdir.patch
@@ -0,0 +1,19 @@
+Avoid using libdir from .la which usually points to a host path
+
+Upstream-Status: Inappropriate [embedded specific]
+Signed-off-by: Jonathan Liu <net147@gmail.com>
+
+diff --git a/ltmain.sh b/ltmain.sh
+index a03433f..1902a90 100644
+--- a/ltmain.sh
++++ b/ltmain.sh
+@@ -5628,6 +5628,9 @@ func_mode_link ()
+ absdir="$abs_ladir"
+ libdir="$abs_ladir"
+ else
++ # Instead of using libdir from .la which usually points to a host path,
++ # use the path the .la is contained in.
++ libdir="$abs_ladir"
+ dir="$libdir"
+ absdir="$libdir"
+ fi
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0042-pr57748.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0042-pr57748.patch
new file mode 100644
index 00000000..5356f722
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0042-pr57748.patch
@@ -0,0 +1,78 @@
+Upstream-Status: Backport
+Signed-off-by: Khem Raj
+
+2013-08-01 Martin Jambor <mjambor@suse.cz>
+
+ PR middle-end/57748
+ * stor-layout.c (compute_record_mode): Treat zero-sized array fields
+ like incomplete types.
+
+testsuite/
+ * gcc.dg/torture/pr57748.c: New test.
+
+
+Index: gcc-4.8.1/gcc/stor-layout.c
+===================================================================
+--- gcc-4.8.1.orig/gcc/stor-layout.c 2013-04-28 10:29:18.000000000 -0700
++++ gcc-4.8.1/gcc/stor-layout.c 2013-08-01 15:02:08.018006125 -0700
+@@ -1618,7 +1618,9 @@
+ && integer_zerop (TYPE_SIZE (TREE_TYPE (field)))))
+ || ! host_integerp (bit_position (field), 1)
+ || DECL_SIZE (field) == 0
+- || ! host_integerp (DECL_SIZE (field), 1))
++ || ! host_integerp (DECL_SIZE (field), 1)
++ || (TREE_CODE (TREE_TYPE (field)) == ARRAY_TYPE
++ && tree_low_cst (DECL_SIZE (field), 1) == 0))
+ return;
+
+ /* If this field is the whole struct, remember its mode so
+Index: gcc-4.8.1/gcc/testsuite/gcc.dg/torture/pr57748.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gcc-4.8.1/gcc/testsuite/gcc.dg/torture/pr57748.c 2013-08-01 15:02:08.062006126 -0700
+@@ -0,0 +1,45 @@
++/* PR middle-end/57748 */
++/* { dg-do run } */
++
++#include <stdlib.h>
++
++extern void abort (void);
++
++typedef long long V
++ __attribute__ ((vector_size (2 * sizeof (long long)), may_alias));
++
++typedef struct S { V a; V b[0]; } P __attribute__((aligned (1)));
++
++struct __attribute__((packed)) T { char c; P s; };
++
++void __attribute__((noinline, noclone))
++check (struct T *t)
++{
++ if (t->s.b[0][0] != 3 || t->s.b[0][1] != 4)
++ abort ();
++}
++
++int __attribute__((noinline, noclone))
++get_i (void)
++{
++ return 0;
++}
++
++void __attribute__((noinline, noclone))
++foo (P *p)
++{
++ V a = { 3, 4 };
++ int i = get_i();
++ p->b[i] = a;
++}
++
++int
++main ()
++{
++ struct T *t = (struct T *) malloc (128);
++
++ foo (&t->s);
++ check (t);
++
++ return 0;
++}
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0043-cpp.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0043-cpp.patch
new file mode 100644
index 00000000..eaf8646f
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0043-cpp.patch
@@ -0,0 +1,40 @@
+The OE environment sets and exports CPP as being the target gcc. When building
+gcc-cross-canadian for a mingw targetted sdk, the following can be found in
+build.x86_64-pokysdk-mingw32.i586-poky-linux/build-x86_64-linux/libiberty/config.log:
+
+configure:3641: checking for _FILE_OFFSET_BITS value needed for large files
+configure:3666: gcc -c -isystem/media/build1/poky/build/tmp/sysroots/x86_64-linux/usr/include -O2 -pipe conftest.c >&5
+configure:3666: $? = 0
+configure:3698: result: no
+configure:3786: checking how to run the C preprocessor
+configure:3856: result: x86_64-pokysdk-mingw32-gcc -E --sysroot=/media/build1/poky/build/tmp/sysroots/x86_64-nativesdk-mingw32-pokysdk-mingw32
+configure:3876: x86_64-pokysdk-mingw32-gcc -E --sysroot=/media/build1/poky/build/tmp/sysroots/x86_64-nativesdk-mingw32-pokysdk-mingw32 conftest.c
+configure:3876: $? = 0
+
+Note this is a *build* target (in build-x86_64-linux) so it should be using
+the host "gcc", not x86_64-pokysdk-mingw32-gcc. Since the mingw32 headers are
+very different, using the wrong cpp is a real problem. It is leaking into
+configure through the CPP variable. Ultimately this leads to build failures
+related to not being able to include a process.h file for pem-unix.c.
+
+The fix is to ensure we export a sane CPP value into the build environment when
+using build targets. We could define a CPP_FOR_BUILD value which may be the version
+which needs to be upstreamed but for now, this fix is good enough to avoid the
+problem.
+
+RP 22/08/2013
+
+Upstream-Status: Pending
+
+Index: gcc-4.8.1/Makefile.in
+===================================================================
+--- gcc-4.8.1.orig/Makefile.in 2013-03-30 11:25:03.000000000 +0000
++++ gcc-4.8.1/Makefile.in 2013-08-13 12:03:17.151988882 +0000
+@@ -149,6 +149,7 @@
+ AR="$(AR_FOR_BUILD)"; export AR; \
+ AS="$(AS_FOR_BUILD)"; export AS; \
+ CC="$(CC_FOR_BUILD)"; export CC; \
++ CPP="$(CC_FOR_BUILD) -E"; export CPP; \
+ CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
+ CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
+ CXX="$(CXX_FOR_BUILD)"; export CXX; \
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0044-gengtypes.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0044-gengtypes.patch
new file mode 100644
index 00000000..e38761d4
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0044-gengtypes.patch
@@ -0,0 +1,97 @@
+gengtype is generated for both the build system and the target. -DGENERATOR_FILE
+was added in the patch http://gcc.gnu.org/ml/gcc-patches/2012-07/msg00273.html
+and was applied to both versions of gengtype.
+
+Unfortunately the presence of this flag triggers the build configuration (bconfig.h)
+to be included for the target build of gengtype. Compiling gengtype with the target
+compiler and bconfig.h can result in errors if the build and target systems are
+dissimilar. An example case this fails is cross compiling gcc on linux for a darwin
+target system:
+
+In 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:
+| /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*, ...)':
+| /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
+| # define fputc(C, Stream) fputc_unlocked (C, Stream)
+
+which occurs since auto-build.h and auto-host.h have differnet values of
+HAVE_FPUTC_UNLOCKED:
+
+#define HAVE_FPUTC_UNLOCKED 1
+/* #undef HAVE_FPUTS_UNLOCKED */
+
+The obvious fix is to only include the flag on build/ targets which this patch does, however
+this also leads to compile errors due to const_tree being undefined but used in double_int.h
+
+I added a GENERATOR_FILE2 flag to workaround those in the
+target case and allow the build to succeed.
+
+Only the build/gengtypes should have the -DGENERATOR_FILE
+
+RP 22/8/2013
+
+Upstream-Status: Pending
+
+Index: gcc-4.8.1/gcc/Makefile.in
+===================================================================
+--- gcc-4.8.1.orig/gcc/Makefile.in 2013-08-19 11:40:36.844014424 +0000
++++ gcc-4.8.1/gcc/Makefile.in 2013-08-19 11:40:37.784014402 +0000
+@@ -3903,27 +3903,29 @@
+
+ gengtype-lex.o build/gengtype-lex.o : gengtype-lex.c gengtype.h $(SYSTEM_H)
+ gengtype-lex.o: $(CONFIG_H) $(BCONFIG_H)
+-CFLAGS-gengtype-lex.o += -DGENERATOR_FILE
++CFLAGS-build/gengtype-lex.o += -DGENERATOR_FILE
+ build/gengtype-lex.o: $(BCONFIG_H)
+
+ gengtype-parse.o build/gengtype-parse.o : gengtype-parse.c gengtype.h \
+ $(SYSTEM_H)
+ gengtype-parse.o: $(CONFIG_H)
+-CFLAGS-gengtype-parse.o += -DGENERATOR_FILE
++CFLAGS-build/gengtype-parse.o += -DGENERATOR_FILE
+ build/gengtype-parse.o: $(BCONFIG_H)
+
+ gengtype-state.o build/gengtype-state.o: gengtype-state.c $(SYSTEM_H) \
+ gengtype.h errors.h double-int.h version.h $(HASHTAB_H) $(OBSTACK_H) \
+ $(XREGEX_H)
+ gengtype-state.o: $(CONFIG_H)
+-CFLAGS-gengtype-state.o += -DGENERATOR_FILE
++CFLAGS-gengtype-state.o += -DGENERATOR_FILE2
++CFLAGS-build/gengtype-state.o += -DGENERATOR_FILE
+ build/gengtype-state.o: $(BCONFIG_H)
+
+ gengtype.o build/gengtype.o : gengtype.c $(SYSTEM_H) gengtype.h \
+ rtl.def insn-notes.def errors.h double-int.h version.h $(HASHTAB_H) \
+ $(OBSTACK_H) $(XREGEX_H)
+ gengtype.o: $(CONFIG_H)
+-CFLAGS-gengtype.o += -DGENERATOR_FILE
++CFLAGS-gengtype.o += -DGENERATOR_FILE2
++CFLAGS-build/gengtype.o += -DGENERATOR_FILE
+ build/gengtype.o: $(BCONFIG_H)
+
+ build/genmddeps.o: genmddeps.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \
+@@ -3988,7 +3990,7 @@
+ # any system header is included.
+ gengtype-lex.c : gengtype-lex.l
+ -$(FLEX) $(FLEXFLAGS) -o$@ $< && { \
+- echo '#include "bconfig.h"' > $@.tmp; \
++ echo '' > $@.tmp; \
+ cat $@ >> $@.tmp; \
+ mv $@.tmp $@; \
+ }
+Index: gcc-4.8.1/gcc/double-int.h
+===================================================================
+--- gcc-4.8.1.orig/gcc/double-int.h 2013-01-30 11:04:30.000000000 +0000
++++ gcc-4.8.1/gcc/double-int.h 2013-08-19 11:41:51.564012719 +0000
+@@ -448,10 +448,12 @@
+
+
+ #ifndef GENERATOR_FILE
++#ifndef GENERATOR_FILE2
+ /* Conversion to and from GMP integer representations. */
+
+ void mpz_set_double_int (mpz_t, double_int, bool);
+ double_int mpz_get_double_int (const_tree, mpz_t, bool);
+ #endif
++#endif
+
+ #endif /* DOUBLE_INT_H */
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0045-gcc-4.8-PR57717-PowerPC-E500v2.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0045-gcc-4.8-PR57717-PowerPC-E500v2.patch
new file mode 100644
index 00000000..96fa1da0
--- /dev/null
+++ b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/0045-gcc-4.8-PR57717-PowerPC-E500v2.patch
@@ -0,0 +1,21 @@
+This backports fix from http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57717
+
+Upstream-Status: Backport
+Signed-off-by: Julian Brown <Julian_Brown@mentor.com>
+
+fix for PR57717 (PowerPC E500v2)
+http://gcc.gnu.org/ml/gcc-patches/2013-08/msg00668.html
+
+--- a/gcc/config/rs6000/rs6000.c 2013-05-09 20:54:06.000000000 -0500
++++ b/gcc/config/rs6000/rs6000.c 2013-08-28 01:25:24.865218744 -0500
+@@ -6337,9 +6337,7 @@
+ && GET_CODE (XEXP (x, 1)) == CONST_INT
+ && reg_offset_p
+ && !SPE_VECTOR_MODE (mode)
+- && !(TARGET_E500_DOUBLE && (mode == DFmode || mode == TFmode
+- || mode == DDmode || mode == TDmode
+- || mode == DImode))
++ && !(TARGET_E500_DOUBLE && GET_MODE_SIZE (mode) > UNITS_PER_WORD)
+ && VECTOR_MEM_NONE_P (mode))
+ {
+ HOST_WIDE_INT val = INTVAL (XEXP (x, 1));
diff --git a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/fix-g++-sysroot.patch b/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/fix-g++-sysroot.patch
deleted file mode 100644
index e6028d55..00000000
--- a/meta-linaro-toolchain/recipes-devtools/gcc/gcc-linaro-4.8/fix-g++-sysroot.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-backport
-
-http://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg26013.html
-
-Upstream-Status: Pending
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Refreshed for meta-linaro by Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
-
----
- gcc/configure | 8 +++++++-
- gcc/configure.ac | 8 +++++++-
- 2 files changed, 14 insertions(+), 2 deletions(-)
-
---- gcc-linaro-4.7-2013.02.orig/gcc/configure
-+++ gcc-linaro-4.7-2013.02/gcc/configure
-@@ -3322,11 +3322,13 @@ fi
-
- gcc_gxx_include_dir_add_sysroot=0
- if test "${with_sysroot+set}" = set; then
- gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
- if test "${gcc_gxx_without_sysroot}"; then
-- gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
-+ if test x${with_sysroot} != x/; then
-+ gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
-+ fi
- gcc_gxx_include_dir_add_sysroot=1
- fi
- fi
-
-
-@@ -7284,10 +7286,14 @@ fi
-
- # Check whether --with-sysroot was given.
- if test "${with_sysroot+set}" = set; then :
- withval=$with_sysroot;
- case ${with_sysroot} in
-+ /) ;;
-+ */) with_sysroot=`echo $with_sysroot | sed 's,/$,,'` ;;
-+ esac
-+ case ${with_sysroot} in
- yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;;
- *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
- esac
-
- TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
---- gcc-linaro-4.7-2013.02.orig/gcc/configure.ac
-+++ gcc-linaro-4.7-2013.02/gcc/configure.ac
-@@ -147,11 +147,13 @@ fi
-
- gcc_gxx_include_dir_add_sysroot=0
- if test "${with_sysroot+set}" = set; then
- gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
- if test "${gcc_gxx_without_sysroot}"; then
-- gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
-+ if test x${with_sysroot} != x/; then
-+ gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
-+ fi
- gcc_gxx_include_dir_add_sysroot=1
- fi
- fi
-
- AC_ARG_WITH(cpp_install_dir,
-@@ -784,10 +786,14 @@ AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
- AC_ARG_WITH(sysroot,
- [AS_HELP_STRING([[--with-sysroot[=DIR]]],
- [search for usr/lib, usr/include, et al, within DIR])],
- [
- case ${with_sysroot} in
-+ /) ;;
-+ */) with_sysroot=`echo $with_sysroot | sed 's,/$,,'` ;;
-+ esac
-+ case ${with_sysroot} in
- yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;;
- *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
- esac
-
- TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'