summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2016-11-18 17:57:42 (GMT)
committerGitHub <noreply@github.com>2016-11-18 17:57:42 (GMT)
commitfbac89da087fabe294ff8b62a822c3b6e04952a5 (patch)
tree8def2ff90d7a2a09ca0f62514e6d1926d3137cd8
parentf0bb72b741510d1a00ddbc041079f05adc4898e1 (diff)
parent5d4e179980925af1b5f66fe955c29f8e6536492a (diff)
Merge pull request #477 from stilor/gcc-4.9.4
Gcc 4.9.4 support
-rw-r--r--config/cc/gcc.in12
-rw-r--r--patches/gcc/4.9.3/850-libstdcxx-uclibc-c99.patch255
-rw-r--r--patches/gcc/4.9.3/920-libgcc-remove-unistd-header.patch12
-rw-r--r--patches/gcc/4.9.4/001-gcc_bug_62231.patch (renamed from patches/gcc/4.9.3/001_gcc_bug_62231.patch)0
-rw-r--r--patches/gcc/4.9.4/002-gcc_bug_62231.patch (renamed from patches/gcc/4.9.3/002_gcc_bug_62231.patch)0
-rw-r--r--patches/gcc/4.9.4/100-uclibc-conf.patch (renamed from patches/gcc/4.9.3/100-uclibc-conf.patch)0
-rw-r--r--patches/gcc/4.9.4/1000-powerpc-link-with-math-lib.patch.conditional (renamed from patches/gcc/4.9.3/1000-powerpc-link-with-math-lib.patch.conditional)28
-rw-r--r--patches/gcc/4.9.4/111-pr65730.patch (renamed from patches/gcc/4.9.3/111-pr65730.patch)9
-rw-r--r--patches/gcc/4.9.4/120-gcc-config.gcc-fix-typo-for-powerpc-e6500-cpu_is_64b.patch (renamed from patches/gcc/4.9.3/120-gcc-config.gcc-fix-typo-for-powerpc-e6500-cpu_is_64b.patch)9
-rw-r--r--patches/gcc/4.9.4/130-pr43538.patch (renamed from patches/gcc/4.9.3/130-pr43538.patch)0
-rw-r--r--patches/gcc/4.9.4/131-mt-ospace-preserve-FLAGS_FOR_TARGET.patch (renamed from patches/gcc/4.9.3/131-mt-ospace-preserve-FLAGS_FOR_TARGET.patch)0
-rw-r--r--patches/gcc/4.9.4/140-sanitizer-Fix-build-with-_FILE_OFFSET_BITS-64.patch37
-rw-r--r--patches/gcc/4.9.4/301-missing-execinfo_h.patch (renamed from patches/gcc/4.9.3/301-missing-execinfo_h.patch)0
-rw-r--r--patches/gcc/4.9.4/810-arm-softfloat-libgcc.patch (renamed from patches/gcc/4.9.3/810-arm-softfloat-libgcc.patch)14
-rw-r--r--patches/gcc/4.9.4/830-arm_unbreak_armv4t.patch (renamed from patches/gcc/4.9.3/830-arm_unbreak_armv4t.patch)0
-rw-r--r--patches/gcc/4.9.4/840-microblaze-enable-dwarf-eh-support.patch (renamed from patches/gcc/4.9.3/840-microblaze-enable-dwarf-eh-support.patch)39
-rw-r--r--patches/gcc/4.9.4/850-libstdcxx-uclibc-c99.patch274
-rw-r--r--patches/gcc/4.9.4/860-cilk-wchar.patch (renamed from patches/gcc/4.9.3/860-cilk-wchar.patch)0
-rw-r--r--patches/gcc/4.9.4/870-xtensa-add-mauto-litpools-option.patch (renamed from patches/gcc/4.9.3/870-xtensa-add-mauto-litpools-option.patch)61
-rw-r--r--patches/gcc/4.9.4/871-xtensa-reimplement-register-spilling.patch (renamed from patches/gcc/4.9.3/871-xtensa-reimplement-register-spilling.patch)0
-rw-r--r--patches/gcc/4.9.4/872-xtensa-use-unwind-dw2-fde-dip-instead-of-unwind-dw2-.patch (renamed from patches/gcc/4.9.3/872-xtensa-use-unwind-dw2-fde-dip-instead-of-unwind-dw2-.patch)0
-rw-r--r--patches/gcc/4.9.4/873-xtensa-fix-_Unwind_GetCFA.patch (renamed from patches/gcc/4.9.3/873-xtensa-fix-_Unwind_GetCFA.patch)0
-rw-r--r--patches/gcc/4.9.4/874-xtensa-add-uclinux-support.patch169
-rw-r--r--patches/gcc/4.9.4/880-nios2_legitimize_address.patch49
-rw-r--r--patches/gcc/4.9.4/890-fix-m68k-compile.patch15
-rw-r--r--patches/gcc/4.9.4/891-fix-m68k-uclinux.patch18
-rw-r--r--patches/gcc/4.9.4/900-musl-support.patch (renamed from patches/gcc/4.9.3/900-musl-support.patch)16
-rw-r--r--patches/gcc/4.9.4/901-microblaze-uclibc.patch21
-rw-r--r--patches/gcc/4.9.4/930-libgcc-disable-split-stack-nothreads.patch14
-rw-r--r--patches/gcc/4.9.4/940-uclinux-enable-threads.patch20
-rw-r--r--samples/sh4-multilib-linux-gnu/crosstool.config2
-rw-r--r--samples/sh4-multilib-linux-uclibc/crosstool.config2
-rw-r--r--samples/sh4-unknown-linux-gnu/crosstool.config2
-rw-r--r--samples/sparc-leon-linux-uclibc/crosstool.config2
34 files changed, 709 insertions, 371 deletions
diff --git a/config/cc/gcc.in b/config/cc/gcc.in
index 6f6e1a3..691355a 100644
--- a/config/cc/gcc.in
+++ b/config/cc/gcc.in
@@ -54,15 +54,15 @@ config CC_GCC_SHOW_LINARO
help
Linaro is maintaining some advanced/more stable/experimental versions
of gcc, especially for the ARM architecture.
-
+
Those versions have not been blessed by the gcc comunity (nor have they
been cursed either!), but they look to be pretty much stable, and even
more stable than the upstream versions. YMMV...
-
+
If you do not know what this Linaro stuff is, then simply say 'n' here,
and rest in peace. OTOH, if you know what you are doing, you will be
able to use and enjoy :-) the Linaro versions by saying 'y' here.
-
+
Linaro: http://www.linaro.org/
choice
@@ -93,9 +93,9 @@ config CC_GCC_V_linaro_4_9
depends on CC_GCC_SHOW_LINARO
select CC_GCC_4_9
-config CC_GCC_V_4_9_3
+config CC_GCC_V_4_9_4
bool
- prompt "4.9.3"
+ prompt "4.9.4"
select CC_GCC_4_9
config CC_GCC_V_linaro_4_8
@@ -291,7 +291,7 @@ config CC_GCC_VERSION
default "5.4.0" if CC_GCC_V_5_4_0
default "linaro-5.2-2015.11-2" if CC_GCC_V_linaro_5_2
default "linaro-4.9-2015.06" if CC_GCC_V_linaro_4_9
- default "4.9.3" if CC_GCC_V_4_9_3
+ default "4.9.4" if CC_GCC_V_4_9_4
default "linaro-4.8-2015.06" if CC_GCC_V_linaro_4_8
default "4.8.5" if CC_GCC_V_4_8_5
diff --git a/patches/gcc/4.9.3/850-libstdcxx-uclibc-c99.patch b/patches/gcc/4.9.3/850-libstdcxx-uclibc-c99.patch
deleted file mode 100644
index d103af1..0000000
--- a/patches/gcc/4.9.3/850-libstdcxx-uclibc-c99.patch
+++ /dev/null
@@ -1,255 +0,0 @@
-Allow C99-depending features of libstdc++ with uClibc
-
-The libstdc++ code is fairly restrictive on how it checks for C99
-compatibility: it requires *complete* C99 support to enable certain
-features. For example, uClibc provides a good number of C99 features,
-but not C99 complex number support. For this reason, libstdc++
-completely disables many the standard C++ methods that can in fact
-work because uClibc provides the necessary functions.
-
-This patch is similar and highly inspired from
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58393, but implemented in
-a way that doesn't involve changing the configure.ac script, as
-autoreconfiguring gcc is complicated. It simply relies on the fact
-that uClibc defines the __UCLIBC__ definition.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-[Gustavo: update for 4.9.3]
-
-diff -Nura gcc-4.9.3.orig/libstdc++-v3/config/locale/generic/c_locale.h gcc-4.9.3/libstdc++-v3/config/locale/generic/c_locale.h
---- gcc-4.9.3.orig/libstdc++-v3/config/locale/generic/c_locale.h 2014-01-02 19:30:10.000000000 -0300
-+++ gcc-4.9.3/libstdc++-v3/config/locale/generic/c_locale.h 2015-06-27 06:46:04.420022179 -0300
-@@ -70,7 +70,7 @@
- __builtin_va_list __args;
- __builtin_va_start(__args, __fmt);
-
--#ifdef _GLIBCXX_USE_C99
-+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
- const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args);
- #else
- const int __ret = __builtin_vsprintf(__out, __fmt, __args);
-diff -Nura gcc-4.9.3.orig/libstdc++-v3/config/locale/gnu/c_locale.h gcc-4.9.3/libstdc++-v3/config/locale/gnu/c_locale.h
---- gcc-4.9.3.orig/libstdc++-v3/config/locale/gnu/c_locale.h 2014-01-02 19:30:10.000000000 -0300
-+++ gcc-4.9.3/libstdc++-v3/config/locale/gnu/c_locale.h 2015-06-27 06:46:04.465023743 -0300
-@@ -88,7 +88,7 @@
- __builtin_va_list __args;
- __builtin_va_start(__args, __fmt);
-
--#ifdef _GLIBCXX_USE_C99
-+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
- const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args);
- #else
- const int __ret = __builtin_vsprintf(__out, __fmt, __args);
-diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/bits/basic_string.h gcc-4.9.3/libstdc++-v3/include/bits/basic_string.h
---- gcc-4.9.3.orig/libstdc++-v3/include/bits/basic_string.h 2015-05-28 13:27:46.000000000 -0300
-+++ gcc-4.9.3/libstdc++-v3/include/bits/basic_string.h 2015-06-27 06:49:04.741284648 -0300
-@@ -2844,7 +2844,7 @@
- _GLIBCXX_END_NAMESPACE_VERSION
- } // namespace
-
--#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99)
-+#if __cplusplus >= 201103L && (defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__))
-
- #include <ext/string_conversions.h>
-
-diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/bits/locale_facets_nonio.tcc gcc-4.9.3/libstdc++-v3/include/bits/locale_facets_nonio.tcc
---- gcc-4.9.3.orig/libstdc++-v3/include/bits/locale_facets_nonio.tcc 2014-01-02 19:30:10.000000000 -0300
-+++ gcc-4.9.3/libstdc++-v3/include/bits/locale_facets_nonio.tcc 2015-06-27 06:46:04.466023777 -0300
-@@ -572,7 +572,7 @@
- {
- const locale __loc = __io.getloc();
- const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
--#ifdef _GLIBCXX_USE_C99
-+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
- // First try a buffer perhaps big enough.
- int __cs_size = 64;
- char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
-diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/bits/locale_facets.tcc gcc-4.9.3/libstdc++-v3/include/bits/locale_facets.tcc
---- gcc-4.9.3.orig/libstdc++-v3/include/bits/locale_facets.tcc 2014-01-02 19:30:10.000000000 -0300
-+++ gcc-4.9.3/libstdc++-v3/include/bits/locale_facets.tcc 2015-06-27 06:46:04.466023777 -0300
-@@ -987,7 +987,7 @@
- char __fbuf[16];
- __num_base::_S_format_float(__io, __fbuf, __mod);
-
--#ifdef _GLIBCXX_USE_C99
-+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
- // First try a buffer perhaps big enough (most probably sufficient
- // for non-ios_base::fixed outputs)
- int __cs_size = __max_digits * 3;
-diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/c_compatibility/math.h gcc-4.9.3/libstdc++-v3/include/c_compatibility/math.h
---- gcc-4.9.3.orig/libstdc++-v3/include/c_compatibility/math.h 2014-01-02 19:30:10.000000000 -0300
-+++ gcc-4.9.3/libstdc++-v3/include/c_compatibility/math.h 2015-06-27 06:46:04.466023777 -0300
-@@ -56,7 +56,7 @@
- using std::floor;
- using std::fmod;
-
--#if _GLIBCXX_USE_C99
-+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
- using std::fpclassify;
- using std::isfinite;
- using std::isinf;
-diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.9.3/libstdc++-v3/include/c_compatibility/wchar.h
---- gcc-4.9.3.orig/libstdc++-v3/include/c_compatibility/wchar.h 2014-01-02 19:30:10.000000000 -0300
-+++ gcc-4.9.3/libstdc++-v3/include/c_compatibility/wchar.h 2015-06-27 06:46:04.466023777 -0300
-@@ -103,7 +103,7 @@
- using std::wmemset;
- using std::wcsftime;
-
--#if _GLIBCXX_USE_C99
-+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
- using std::wcstold;
- using std::wcstoll;
- using std::wcstoull;
-diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/c_global/cstdio gcc-4.9.3/libstdc++-v3/include/c_global/cstdio
---- gcc-4.9.3.orig/libstdc++-v3/include/c_global/cstdio 2014-01-23 18:17:15.000000000 -0300
-+++ gcc-4.9.3/libstdc++-v3/include/c_global/cstdio 2015-06-27 06:46:04.481024298 -0300
-@@ -146,7 +146,7 @@
- using ::vsprintf;
- } // namespace
-
--#if _GLIBCXX_USE_C99
-+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
-
- #undef snprintf
- #undef vfscanf
-diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/c_global/cstdlib gcc-4.9.3/libstdc++-v3/include/c_global/cstdlib
---- gcc-4.9.3.orig/libstdc++-v3/include/c_global/cstdlib 2014-01-02 19:30:10.000000000 -0300
-+++ gcc-4.9.3/libstdc++-v3/include/c_global/cstdlib 2015-06-27 06:46:04.466023777 -0300
-@@ -182,7 +182,7 @@
- _GLIBCXX_END_NAMESPACE_VERSION
- } // namespace
-
--#if _GLIBCXX_USE_C99
-+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
-
- #undef _Exit
- #undef llabs
-diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/c_global/cwchar gcc-4.9.3/libstdc++-v3/include/c_global/cwchar
---- gcc-4.9.3.orig/libstdc++-v3/include/c_global/cwchar 2014-01-02 19:30:10.000000000 -0300
-+++ gcc-4.9.3/libstdc++-v3/include/c_global/cwchar 2015-06-27 06:46:04.466023777 -0300
-@@ -232,7 +232,7 @@
- _GLIBCXX_END_NAMESPACE_VERSION
- } // namespace
-
--#if _GLIBCXX_USE_C99
-+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
-
- #undef wcstold
- #undef wcstoll
-@@ -289,7 +289,7 @@
- using std::vwscanf;
- #endif
-
--#if _GLIBCXX_USE_C99
-+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
- using std::wcstold;
- using std::wcstoll;
- using std::wcstoull;
-diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/c_std/cstdio gcc-4.9.3/libstdc++-v3/include/c_std/cstdio
---- gcc-4.9.3.orig/libstdc++-v3/include/c_std/cstdio 2014-01-02 19:30:10.000000000 -0300
-+++ gcc-4.9.3/libstdc++-v3/include/c_std/cstdio 2015-06-27 06:46:04.480024263 -0300
-@@ -144,7 +144,7 @@
- using ::vsprintf;
- } // namespace std
-
--#if _GLIBCXX_USE_C99
-+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
-
- #undef snprintf
- #undef vfscanf
-diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/c_std/cstdlib gcc-4.9.3/libstdc++-v3/include/c_std/cstdlib
---- gcc-4.9.3.orig/libstdc++-v3/include/c_std/cstdlib 2014-01-02 19:30:10.000000000 -0300
-+++ gcc-4.9.3/libstdc++-v3/include/c_std/cstdlib 2015-06-27 06:46:04.480024263 -0300
-@@ -180,7 +180,7 @@
- _GLIBCXX_END_NAMESPACE_VERSION
- } // namespace
-
--#if _GLIBCXX_USE_C99
-+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
-
- #undef _Exit
- #undef llabs
-diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/c_std/cwchar gcc-4.9.3/libstdc++-v3/include/c_std/cwchar
---- gcc-4.9.3.orig/libstdc++-v3/include/c_std/cwchar 2014-01-02 19:30:10.000000000 -0300
-+++ gcc-4.9.3/libstdc++-v3/include/c_std/cwchar 2015-06-27 06:46:04.480024263 -0300
-@@ -228,7 +228,7 @@
- _GLIBCXX_END_NAMESPACE_VERSION
- } // namespace
-
--#if _GLIBCXX_USE_C99
-+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
-
- #undef wcstold
- #undef wcstoll
-diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/ext/vstring.h gcc-4.9.3/libstdc++-v3/include/ext/vstring.h
---- gcc-4.9.3.orig/libstdc++-v3/include/ext/vstring.h 2014-01-02 19:30:10.000000000 -0300
-+++ gcc-4.9.3/libstdc++-v3/include/ext/vstring.h 2015-06-27 06:46:04.480024263 -0300
-@@ -2680,7 +2680,7 @@
- _GLIBCXX_END_NAMESPACE_VERSION
- } // namespace
-
--#if ((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99))
-+#if ((__cplusplus >= 201103L) && (defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)))
-
- #include <ext/string_conversions.h>
-
-diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/tr1/cstdio gcc-4.9.3/libstdc++-v3/include/tr1/cstdio
---- gcc-4.9.3.orig/libstdc++-v3/include/tr1/cstdio 2014-01-02 19:30:10.000000000 -0300
-+++ gcc-4.9.3/libstdc++-v3/include/tr1/cstdio 2015-06-27 06:46:04.480024263 -0300
-@@ -33,7 +33,7 @@
-
- #include <cstdio>
-
--#if _GLIBCXX_USE_C99
-+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
-
- namespace std _GLIBCXX_VISIBILITY(default)
- {
-diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/tr1/cstdlib gcc-4.9.3/libstdc++-v3/include/tr1/cstdlib
---- gcc-4.9.3.orig/libstdc++-v3/include/tr1/cstdlib 2014-01-02 19:30:10.000000000 -0300
-+++ gcc-4.9.3/libstdc++-v3/include/tr1/cstdlib 2015-06-27 06:46:04.480024263 -0300
-@@ -35,7 +35,7 @@
-
- #if _GLIBCXX_HOSTED
-
--#if _GLIBCXX_USE_C99
-+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
-
- namespace std _GLIBCXX_VISIBILITY(default)
- {
-diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/tr1/cwchar gcc-4.9.3/libstdc++-v3/include/tr1/cwchar
---- gcc-4.9.3.orig/libstdc++-v3/include/tr1/cwchar 2014-01-02 19:30:10.000000000 -0300
-+++ gcc-4.9.3/libstdc++-v3/include/tr1/cwchar 2015-06-27 06:46:04.480024263 -0300
-@@ -52,7 +52,7 @@
- using std::vwscanf;
- #endif
-
--#if _GLIBCXX_USE_C99
-+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
- using std::wcstold;
- using std::wcstoll;
- using std::wcstoull;
-diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/tr1/stdlib.h gcc-4.9.3/libstdc++-v3/include/tr1/stdlib.h
---- gcc-4.9.3.orig/libstdc++-v3/include/tr1/stdlib.h 2014-01-02 19:30:10.000000000 -0300
-+++ gcc-4.9.3/libstdc++-v3/include/tr1/stdlib.h 2015-06-27 06:46:04.481024298 -0300
-@@ -33,7 +33,7 @@
-
- #if _GLIBCXX_HOSTED
-
--#if _GLIBCXX_USE_C99
-+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
-
- using std::tr1::atoll;
- using std::tr1::strtoll;
-diff -Nura gcc-4.9.3.orig/libstdc++-v3/src/c++11/debug.cc gcc-4.9.3/libstdc++-v3/src/c++11/debug.cc
---- gcc-4.9.3.orig/libstdc++-v3/src/c++11/debug.cc 2014-01-02 19:30:10.000000000 -0300
-+++ gcc-4.9.3/libstdc++-v3/src/c++11/debug.cc 2015-06-27 06:46:04.481024298 -0300
-@@ -788,7 +788,7 @@
- int __n __attribute__ ((__unused__)),
- const char* __fmt, _Tp __s) const throw ()
- {
--#ifdef _GLIBCXX_USE_C99
-+#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
- std::snprintf(__buf, __n, __fmt, __s);
- #else
- std::sprintf(__buf, __fmt, __s);
diff --git a/patches/gcc/4.9.3/920-libgcc-remove-unistd-header.patch b/patches/gcc/4.9.3/920-libgcc-remove-unistd-header.patch
deleted file mode 100644
index df5372b..0000000
--- a/patches/gcc/4.9.3/920-libgcc-remove-unistd-header.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-Upstream status: In progress
-
---- a/libgcc/config/nios2/linux-atomic.c
-+++ b/libgcc/config/nios2/linux-atomic.c
-@@ -20,7 +20,6 @@
- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- <http://www.gnu.org/licenses/>. */
-
--#include <asm/unistd.h>
- #define EFAULT 14
- #define EBUSY 16
- #define ENOSYS 38
diff --git a/patches/gcc/4.9.3/001_gcc_bug_62231.patch b/patches/gcc/4.9.4/001-gcc_bug_62231.patch
index e7c9cf9..e7c9cf9 100644
--- a/patches/gcc/4.9.3/001_gcc_bug_62231.patch
+++ b/patches/gcc/4.9.4/001-gcc_bug_62231.patch
diff --git a/patches/gcc/4.9.3/002_gcc_bug_62231.patch b/patches/gcc/4.9.4/002-gcc_bug_62231.patch
index b970ebc..b970ebc 100644
--- a/patches/gcc/4.9.3/002_gcc_bug_62231.patch
+++ b/patches/gcc/4.9.4/002-gcc_bug_62231.patch
diff --git a/patches/gcc/4.9.3/100-uclibc-conf.patch b/patches/gcc/4.9.4/100-uclibc-conf.patch
index d56bf0a..d56bf0a 100644
--- a/patches/gcc/4.9.3/100-uclibc-conf.patch
+++ b/patches/gcc/4.9.4/100-uclibc-conf.patch
diff --git a/patches/gcc/4.9.3/1000-powerpc-link-with-math-lib.patch.conditional b/patches/gcc/4.9.4/1000-powerpc-link-with-math-lib.patch.conditional
index b7094fe..5e0484f 100644
--- a/patches/gcc/4.9.3/1000-powerpc-link-with-math-lib.patch.conditional
+++ b/patches/gcc/4.9.4/1000-powerpc-link-with-math-lib.patch.conditional
@@ -14,19 +14,19 @@ Forward port to gcc 4.5.1 by Gustavo Zacarias <gustavo@zacarias.com.ar>
libgcc/configure.ac | 21 +++++++++++++++++++++
3 files changed, 56 insertions(+), 1 deletion(-)
-Index: gcc-4.8.0/libgcc/Makefile.in
+Index: b/libgcc/Makefile.in
===================================================================
---- gcc-4.8.0.orig/libgcc/Makefile.in 2013-02-04 20:06:20.000000000 +0100
-+++ gcc-4.8.0/libgcc/Makefile.in 2013-03-24 09:12:43.000000000 +0100
-@@ -41,6 +41,7 @@
- decimal_float = @decimal_float@
+--- a/libgcc/Makefile.in
++++ b/libgcc/Makefile.in
+@@ -42,6 +42,7 @@
+ enable_vtable_verify = @enable_vtable_verify@
enable_decimal_float = @enable_decimal_float@
fixed_point = @fixed_point@
+LIBGCC_LIBM = @LIBGCC_LIBM@
host_noncanonical = @host_noncanonical@
target_noncanonical = @target_noncanonical@
-@@ -927,9 +928,10 @@
+@@ -943,9 +944,10 @@
@multilib_dir@,$(MULTIDIR),$(subst \
@shlib_objs@,$(objects) libgcc.a,$(subst \
@shlib_base_name@,libgcc_s,$(subst \
@@ -38,10 +38,10 @@ Index: gcc-4.8.0/libgcc/Makefile.in
libunwind$(SHLIB_EXT): $(libunwind-s-objects) $(extra-parts)
# @multilib_flags@ is still needed because this may use
-Index: gcc-4.8.0/libgcc/configure
+Index: b/libgcc/configure
===================================================================
---- gcc-4.8.0.orig/libgcc/configure 2012-11-05 00:08:42.000000000 +0100
-+++ gcc-4.8.0/libgcc/configure 2013-03-24 09:12:43.000000000 +0100
+--- a/libgcc/configure
++++ b/libgcc/configure
@@ -564,6 +564,7 @@
tmake_file
sfp_machine_header
@@ -50,7 +50,7 @@ Index: gcc-4.8.0/libgcc/configure
set_have_cc_tls
vis_hide
fixed_point
-@@ -4481,6 +4482,37 @@
+@@ -4535,6 +4536,37 @@
fi
fi
@@ -88,11 +88,11 @@ Index: gcc-4.8.0/libgcc/configure
# Conditionalize the makefile for this target machine.
tmake_file_=
-Index: gcc-4.8.0/libgcc/configure.ac
+Index: b/libgcc/configure.ac
===================================================================
---- gcc-4.8.0.orig/libgcc/configure.ac 2012-10-15 15:10:30.000000000 +0200
-+++ gcc-4.8.0/libgcc/configure.ac 2013-03-24 09:12:43.000000000 +0100
-@@ -326,6 +326,27 @@
+--- a/libgcc/configure.ac
++++ b/libgcc/configure.ac
+@@ -357,6 +357,27 @@
fi
AC_SUBST(set_have_cc_tls)
diff --git a/patches/gcc/4.9.3/111-pr65730.patch b/patches/gcc/4.9.4/111-pr65730.patch
index f195e30..8a41fd2 100644
--- a/patches/gcc/4.9.3/111-pr65730.patch
+++ b/patches/gcc/4.9.4/111-pr65730.patch
@@ -16,11 +16,11 @@ Changes to ChangeLog are dropped.
gcc/config/xtensa/xtensa.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
-diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
-index eb039ba..7296e36 100644
+Index: b/gcc/config/xtensa/xtensa.c
+===================================================================
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
-@@ -1461,8 +1461,9 @@ init_alignment_context (struct alignment_context *ac, rtx mem)
+@@ -1436,8 +1436,9 @@
if (ac->shift != NULL_RTX)
{
/* Shift is the byte count, but we need the bitcount. */
@@ -32,6 +32,3 @@ index eb039ba..7296e36 100644
NULL_RTX, 1, OPTAB_DIRECT);
ac->modemask = expand_simple_binop (SImode, ASHIFT,
GEN_INT (GET_MODE_MASK (mode)),
---
-1.8.1.4
-
diff --git a/patches/gcc/4.9.3/120-gcc-config.gcc-fix-typo-for-powerpc-e6500-cpu_is_64b.patch b/patches/gcc/4.9.4/120-gcc-config.gcc-fix-typo-for-powerpc-e6500-cpu_is_64b.patch
index 7d9c9e3..bb77c4b 100644
--- a/patches/gcc/4.9.3/120-gcc-config.gcc-fix-typo-for-powerpc-e6500-cpu_is_64b.patch
+++ b/patches/gcc/4.9.4/120-gcc-config.gcc-fix-typo-for-powerpc-e6500-cpu_is_64b.patch
@@ -11,11 +11,11 @@ Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
gcc/config.gcc | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
-diff --git a/gcc/config.gcc b/gcc/config.gcc
-index 4a7cbd2..9cc765e 100644
+Index: b/gcc/config.gcc
+===================================================================
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
-@@ -439,7 +439,7 @@ powerpc*-*-*)
+@@ -441,7 +441,7 @@
extra_headers="ppc-asm.h altivec.h spe.h ppu_intrinsics.h paired.h spu2vmx.h vec_types.h si2vmx.h htmintrin.h htmxlintrin.h"
need_64bit_hwint=yes
case x$with_cpu in
@@ -24,6 +24,3 @@ index 4a7cbd2..9cc765e 100644
cpu_is_64bit=yes
;;
esac
---
-2.6.2
-
diff --git a/patches/gcc/4.9.3/130-pr43538.patch b/patches/gcc/4.9.4/130-pr43538.patch
index 19e57bb..19e57bb 100644
--- a/patches/gcc/4.9.3/130-pr43538.patch
+++ b/patches/gcc/4.9.4/130-pr43538.patch
diff --git a/patches/gcc/4.9.3/131-mt-ospace-preserve-FLAGS_FOR_TARGET.patch b/patches/gcc/4.9.4/131-mt-ospace-preserve-FLAGS_FOR_TARGET.patch
index 1c49fb0..1c49fb0 100644
--- a/patches/gcc/4.9.3/131-mt-ospace-preserve-FLAGS_FOR_TARGET.patch
+++ b/patches/gcc/4.9.4/131-mt-ospace-preserve-FLAGS_FOR_TARGET.patch
diff --git a/patches/gcc/4.9.4/140-sanitizer-Fix-build-with-_FILE_OFFSET_BITS-64.patch b/patches/gcc/4.9.4/140-sanitizer-Fix-build-with-_FILE_OFFSET_BITS-64.patch
new file mode 100644
index 0000000..55f3228
--- /dev/null
+++ b/patches/gcc/4.9.4/140-sanitizer-Fix-build-with-_FILE_OFFSET_BITS-64.patch
@@ -0,0 +1,37 @@
+From 3c536954a67a883630f4a7513a27f02a892c3dcb Mon Sep 17 00:00:00 2001
+From: Evgeniy Stepanov <eugeni.stepanov@gmail.com>
+Date: Tue, 21 Oct 2014 21:08:13 +0000
+Subject: [PATCH] [sanitizer] Fix build with _FILE_OFFSET_BITS=64.
+
+Sanitizer source is not affected by _FILE_OFFSET_BITS in general,
+but this one file must be built with 32-bit off_t. More details in the code.
+
+git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@220328 91177308-0d34-0410-b5e6-96231b3b80d8
+Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
+---
+ lib/sanitizer_common/sanitizer_platform_limits_posix.cc | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+index bbc1108..fc09522 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -13,7 +13,15 @@
+
+ #include "sanitizer_platform.h"
+ #if SANITIZER_LINUX || SANITIZER_MAC
++// Tests in this file assume that off_t-dependent data structures match the
++// libc ABI. For example, struct dirent here is what readdir() function (as
++// exported from libc) returns, and not the user-facing "dirent", which
++// depends on _FILE_OFFSET_BITS setting.
++// To get this "true" dirent definition, we undefine _FILE_OFFSET_BITS below.
++#ifdef _FILE_OFFSET_BITS
++#undef _FILE_OFFSET_BITS
++#endif
+
+ #include "sanitizer_internal_defs.h"
+ #include "sanitizer_platform_limits_posix.h"
+
+--
+2.1.4
+
diff --git a/patches/gcc/4.9.3/301-missing-execinfo_h.patch b/patches/gcc/4.9.4/301-missing-execinfo_h.patch
index 00efda2..00efda2 100644
--- a/patches/gcc/4.9.3/301-missing-execinfo_h.patch
+++ b/patches/gcc/4.9.4/301-missing-execinfo_h.patch
diff --git a/patches/gcc/4.9.3/810-arm-softfloat-libgcc.patch b/patches/gcc/4.9.4/810-arm-softfloat-libgcc.patch
index c8cb377..5efa7fd 100644
--- a/patches/gcc/4.9.3/810-arm-softfloat-libgcc.patch
+++ b/patches/gcc/4.9.4/810-arm-softfloat-libgcc.patch
@@ -1,8 +1,8 @@
-Index: gcc-4.8.0/gcc/config/arm/linux-elf.h
+Index: b/gcc/config/arm/linux-elf.h
===================================================================
---- gcc-4.8.0.orig/gcc/config/arm/linux-elf.h 2013-01-10 21:38:27.000000000 +0100
-+++ gcc-4.8.0/gcc/config/arm/linux-elf.h 2013-03-23 17:40:00.000000000 +0100
-@@ -55,7 +55,7 @@
+--- a/gcc/config/arm/linux-elf.h
++++ b/gcc/config/arm/linux-elf.h
+@@ -60,7 +60,7 @@
%{shared:-lc} \
%{!shared:%{profile:-lc_p}%{!profile:-lc}}"
@@ -11,10 +11,10 @@ Index: gcc-4.8.0/gcc/config/arm/linux-elf.h
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
-Index: gcc-4.8.0/libgcc/config/arm/t-linux
+Index: b/libgcc/config/arm/t-linux
===================================================================
---- gcc-4.8.0.orig/libgcc/config/arm/t-linux 2012-03-22 16:14:46.000000000 +0100
-+++ gcc-4.8.0/libgcc/config/arm/t-linux 2013-03-23 17:40:54.000000000 +0100
+--- a/libgcc/config/arm/t-linux
++++ b/libgcc/config/arm/t-linux
@@ -1,6 +1,11 @@
LIB1ASMSRC = arm/lib1funcs.S
LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
diff --git a/patches/gcc/4.9.3/830-arm_unbreak_armv4t.patch b/patches/gcc/4.9.4/830-arm_unbreak_armv4t.patch
index 37f8f2a..37f8f2a 100644
--- a/patches/gcc/4.9.3/830-arm_unbreak_armv4t.patch
+++ b/patches/gcc/4.9.4/830-arm_unbreak_armv4t.patch
diff --git a/patches/gcc/4.9.3/840-microblaze-enable-dwarf-eh-support.patch b/patches/gcc/4.9.4/840-microblaze-enable-dwarf-eh-support.patch
index e116e2b..03fc47f 100644
--- a/patches/gcc/4.9.3/840-microblaze-enable-dwarf-eh-support.patch
+++ b/patches/gcc/4.9.4/840-microblaze-enable-dwarf-eh-support.patch
@@ -33,11 +33,11 @@ Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
gcc/config/microblaze/microblaze.md | 11 +++++++++
5 files changed, 52 insertions(+), 7 deletions(-)
-diff --git a/gcc/common/config/microblaze/microblaze-common.c b/gcc/common/config/microblaze/microblaze-common.c
-index 5835acc..85e6a53 100644
+Index: b/gcc/common/config/microblaze/microblaze-common.c
+===================================================================
--- a/gcc/common/config/microblaze/microblaze-common.c
+++ b/gcc/common/config/microblaze/microblaze-common.c
-@@ -39,7 +39,4 @@ static const struct default_options microblaze_option_optimization_table[] =
+@@ -37,7 +37,4 @@
#undef TARGET_OPTION_OPTIMIZATION_TABLE
#define TARGET_OPTION_OPTIMIZATION_TABLE microblaze_option_optimization_table
@@ -45,11 +45,11 @@ index 5835acc..85e6a53 100644
-#define TARGET_EXCEPT_UNWIND_INFO sjlj_except_unwind_info
-
struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER;
-diff --git a/gcc/config/microblaze/microblaze-protos.h b/gcc/config/microblaze/microblaze-protos.h
-index c30ec72..260f4e4 100644
+Index: b/gcc/config/microblaze/microblaze-protos.h
+===================================================================
--- a/gcc/config/microblaze/microblaze-protos.h
+++ b/gcc/config/microblaze/microblaze-protos.h
-@@ -56,6 +56,7 @@ extern bool microblaze_tls_referenced_p (rtx);
+@@ -54,6 +54,7 @@
extern int symbol_mentioned_p (rtx);
extern int label_mentioned_p (rtx);
extern bool microblaze_cannot_force_const_mem (enum machine_mode, rtx);
@@ -57,11 +57,11 @@ index c30ec72..260f4e4 100644
#endif /* RTX_CODE */
/* Declare functions in microblaze-c.c. */
-diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
-index fe61fce..15166d3 100644
+Index: b/gcc/config/microblaze/microblaze.c
+===================================================================
--- a/gcc/config/microblaze/microblaze.c
+++ b/gcc/config/microblaze/microblaze.c
-@@ -1999,6 +1999,11 @@ microblaze_must_save_register (int regno)
+@@ -1906,6 +1906,11 @@
if (frame_pointer_needed && (regno == HARD_FRAME_POINTER_REGNUM))
return 1;
@@ -73,7 +73,7 @@ index fe61fce..15166d3 100644
if (!crtl->is_leaf)
{
if (regno == MB_ABI_SUB_RETURN_ADDR_REGNUM)
-@@ -2026,6 +2031,13 @@ microblaze_must_save_register (int regno)
+@@ -1933,6 +1938,13 @@
return 1;
}
@@ -87,7 +87,7 @@ index fe61fce..15166d3 100644
return 0;
}
-@@ -3131,6 +3143,12 @@ microblaze_expand_epilogue (void)
+@@ -2962,6 +2974,12 @@
emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, fsiz_rtx));
}
@@ -100,7 +100,7 @@ index fe61fce..15166d3 100644
emit_jump_insn (gen_return_internal (gen_rtx_REG (Pmode, GP_REG_FIRST +
MB_ABI_SUB_RETURN_ADDR_REGNUM)));
}
-@@ -3427,10 +3445,13 @@ microblaze_return_addr (int count, rtx frame ATTRIBUTE_UNUSED)
+@@ -3256,10 +3274,13 @@
if (count != 0)
return NULL_RTX;
@@ -118,11 +118,11 @@ index fe61fce..15166d3 100644
}
/* Queue an .ident string in the queue of top-level asm statements.
-diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
-index 4072283..5e9f49c 100644
+Index: b/gcc/config/microblaze/microblaze.h
+===================================================================
--- a/gcc/config/microblaze/microblaze.h
+++ b/gcc/config/microblaze/microblaze.h
-@@ -184,6 +184,21 @@ extern enum pipeline_type microblaze_pipe;
+@@ -184,6 +184,21 @@
#define INCOMING_RETURN_ADDR_RTX \
gen_rtx_REG (VOIDmode, GP_REG_FIRST + MB_ABI_SUB_RETURN_ADDR_REGNUM)
@@ -144,11 +144,11 @@ index 4072283..5e9f49c 100644
/* Use DWARF 2 debugging information by default. */
#define DWARF2_DEBUGGING_INFO
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
-diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
-index ed6131a..dc2405f 100644
+Index: b/gcc/config/microblaze/microblaze.md
+===================================================================
--- a/gcc/config/microblaze/microblaze.md
+++ b/gcc/config/microblaze/microblaze.md
-@@ -2327,4 +2327,15 @@
+@@ -2261,4 +2261,15 @@
(set_attr "mode" "SI")
(set_attr "length" "4")])
@@ -164,6 +164,3 @@ index ed6131a..dc2405f 100644
+
(include "sync.md")
+
---
-1.8.3.2
-
diff --git a/patches/gcc/4.9.4/850-libstdcxx-uclibc-c99.patch b/patches/gcc/4.9.4/850-libstdcxx-uclibc-c99.patch
new file mode 100644
index 0000000..533d01f
--- /dev/null
+++ b/patches/gcc/4.9.4/850-libstdcxx-uclibc-c99.patch
@@ -0,0 +1,274 @@
+Allow C99-depending features of libstdc++ with uClibc
+
+The libstdc++ code is fairly restrictive on how it checks for C99
+compatibility: it requires *complete* C99 support to enable certain
+features. For example, uClibc provides a good number of C99 features,
+but not C99 complex number support. For this reason, libstdc++
+completely disables many the standard C++ methods that can in fact
+work because uClibc provides the necessary functions.
+
+This patch is similar and highly inspired from
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58393, but implemented in
+a way that doesn't involve changing the configure.ac script, as
+autoreconfiguring gcc is complicated. It simply relies on the fact
+that uClibc defines the __UCLIBC__ definition.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+[Gustavo: update for 4.9.3]
+
+Index: b/libstdc++-v3/config/locale/generic/c_locale.h
+===================================================================
+--- a/libstdc++-v3/config/locale/generic/c_locale.h
++++ b/libstdc++-v3/config/locale/generic/c_locale.h
+@@ -70,7 +70,7 @@
+ __builtin_va_list __args;
+ __builtin_va_start(__args, __fmt);
+
+-#ifdef _GLIBCXX_USE_C99
++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
+ const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args);
+ #else
+ const int __ret = __builtin_vsprintf(__out, __fmt, __args);
+Index: b/libstdc++-v3/config/locale/gnu/c_locale.h
+===================================================================
+--- a/libstdc++-v3/config/locale/gnu/c_locale.h
++++ b/libstdc++-v3/config/locale/gnu/c_locale.h
+@@ -88,7 +88,7 @@
+ __builtin_va_list __args;
+ __builtin_va_start(__args, __fmt);
+
+-#ifdef _GLIBCXX_USE_C99
++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
+ const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args);
+ #else
+ const int __ret = __builtin_vsprintf(__out, __fmt, __args);
+Index: b/libstdc++-v3/include/bits/basic_string.h
+===================================================================
+--- a/libstdc++-v3/include/bits/basic_string.h
++++ b/libstdc++-v3/include/bits/basic_string.h
+@@ -2843,7 +2843,7 @@
+ _GLIBCXX_END_NAMESPACE_VERSION
+ } // namespace
+
+-#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99)
++#if __cplusplus >= 201103L && (defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__))
+
+ #include <ext/string_conversions.h>
+
+Index: b/libstdc++-v3/include/bits/locale_facets_nonio.tcc
+===================================================================
+--- a/libstdc++-v3/include/bits/locale_facets_nonio.tcc
++++ b/libstdc++-v3/include/bits/locale_facets_nonio.tcc
+@@ -572,7 +572,7 @@
+ {
+ const locale __loc = __io.getloc();
+ const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
+-#ifdef _GLIBCXX_USE_C99
++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
+ // First try a buffer perhaps big enough.
+ int __cs_size = 64;
+ char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
+Index: b/libstdc++-v3/include/bits/locale_facets.tcc
+===================================================================
+--- a/libstdc++-v3/include/bits/locale_facets.tcc
++++ b/libstdc++-v3/include/bits/locale_facets.tcc
+@@ -987,7 +987,7 @@
+ char __fbuf[16];
+ __num_base::_S_format_float(__io, __fbuf, __mod);
+
+-#ifdef _GLIBCXX_USE_C99
++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
+ // First try a buffer perhaps big enough (most probably sufficient
+ // for non-ios_base::fixed outputs)
+ int __cs_size = __max_digits * 3;
+Index: b/libstdc++-v3/include/c_compatibility/math.h
+===================================================================
+--- a/libstdc++-v3/include/c_compatibility/math.h
++++ b/libstdc++-v3/include/c_compatibility/math.h
+@@ -56,7 +56,7 @@
+ using std::floor;
+ using std::fmod;
+
+-#if _GLIBCXX_USE_C99
++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
+ using std::fpclassify;
+ using std::isfinite;
+ using std::isinf;
+Index: b/libstdc++-v3/include/c_compatibility/wchar.h
+===================================================================
+--- a/libstdc++-v3/include/c_compatibility/wchar.h
++++ b/libstdc++-v3/include/c_compatibility/wchar.h
+@@ -103,7 +103,7 @@
+ using std::wmemset;
+ using std::wcsftime;
+
+-#if _GLIBCXX_USE_C99
++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
+ using std::wcstold;
+ using std::wcstoll;
+ using std::wcstoull;
+Index: b/libstdc++-v3/include/c_global/cstdio
+===================================================================
+--- a/libstdc++-v3/include/c_global/cstdio
++++ b/libstdc++-v3/include/c_global/cstdio
+@@ -146,7 +146,7 @@
+ using ::vsprintf;
+ } // namespace
+
+-#if _GLIBCXX_USE_C99
++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
+
+ #undef snprintf
+ #undef vfscanf
+Index: b/libstdc++-v3/include/c_global/cstdlib
+===================================================================
+--- a/libstdc++-v3/include/c_global/cstdlib
++++ b/libstdc++-v3/include/c_global/cstdlib
+@@ -182,7 +182,7 @@
+ _GLIBCXX_END_NAMESPACE_VERSION
+ } // namespace
+
+-#if _GLIBCXX_USE_C99
++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
+
+ #undef _Exit
+ #undef llabs
+Index: b/libstdc++-v3/include/c_global/cwchar
+===================================================================
+--- a/libstdc++-v3/include/c_global/cwchar
++++ b/libstdc++-v3/include/c_global/cwchar
+@@ -232,7 +232,7 @@
+ _GLIBCXX_END_NAMESPACE_VERSION
+ } // namespace
+
+-#if _GLIBCXX_USE_C99
++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
+
+ #undef wcstold
+ #undef wcstoll
+@@ -289,7 +289,7 @@
+ using std::vwscanf;
+ #endif
+
+-#if _GLIBCXX_USE_C99
++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
+ using std::wcstold;
+ using std::wcstoll;
+ using std::wcstoull;
+Index: b/libstdc++-v3/include/c_std/cstdio
+===================================================================
+--- a/libstdc++-v3/include/c_std/cstdio
++++ b/libstdc++-v3/include/c_std/cstdio
+@@ -144,7 +144,7 @@
+ using ::vsprintf;
+ } // namespace std
+
+-#if _GLIBCXX_USE_C99
++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
+
+ #undef snprintf
+ #undef vfscanf
+Index: b/libstdc++-v3/include/c_std/cstdlib
+===================================================================
+--- a/libstdc++-v3/include/c_std/cstdlib
++++ b/libstdc++-v3/include/c_std/cstdlib
+@@ -180,7 +180,7 @@
+ _GLIBCXX_END_NAMESPACE_VERSION
+ } // namespace
+
+-#if _GLIBCXX_USE_C99
++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
+
+ #undef _Exit
+ #undef llabs
+Index: b/libstdc++-v3/include/c_std/cwchar
+===================================================================
+--- a/libstdc++-v3/include/c_std/cwchar
++++ b/libstdc++-v3/include/c_std/cwchar
+@@ -228,7 +228,7 @@
+ _GLIBCXX_END_NAMESPACE_VERSION
+ } // namespace
+
+-#if _GLIBCXX_USE_C99
++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
+
+ #undef wcstold
+ #undef wcstoll
+Index: b/libstdc++-v3/include/ext/vstring.h
+===================================================================
+--- a/libstdc++-v3/include/ext/vstring.h
++++ b/libstdc++-v3/include/ext/vstring.h
+@@ -2680,7 +2680,7 @@
+ _GLIBCXX_END_NAMESPACE_VERSION
+ } // namespace
+
+-#if ((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99))
++#if ((__cplusplus >= 201103L) && (defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)))
+
+ #include <ext/string_conversions.h>
+
+Index: b/libstdc++-v3/include/tr1/cstdio
+===================================================================
+--- a/libstdc++-v3/include/tr1/cstdio
++++ b/libstdc++-v3/include/tr1/cstdio
+@@ -33,7 +33,7 @@
+
+ #include <cstdio>
+
+-#if _GLIBCXX_USE_C99
++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
+
+ namespace std _GLIBCXX_VISIBILITY(default)
+ {
+Index: b/libstdc++-v3/include/tr1/cstdlib
+===================================================================
+--- a/libstdc++-v3/include/tr1/cstdlib
++++ b/libstdc++-v3/include/tr1/cstdlib
+@@ -35,7 +35,7 @@
+
+ #if _GLIBCXX_HOSTED
+
+-#if _GLIBCXX_USE_C99
++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
+
+ namespace std _GLIBCXX_VISIBILITY(default)
+ {
+Index: b/libstdc++-v3/include/tr1/cwchar
+===================================================================
+--- a/libstdc++-v3/include/tr1/cwchar
++++ b/libstdc++-v3/include/tr1/cwchar
+@@ -52,7 +52,7 @@
+ using std::vwscanf;
+ #endif
+
+-#if _GLIBCXX_USE_C99
++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
+ using std::wcstold;
+ using std::wcstoll;
+ using std::wcstoull;
+Index: b/libstdc++-v3/include/tr1/stdlib.h
+===================================================================
+--- a/libstdc++-v3/include/tr1/stdlib.h
++++ b/libstdc++-v3/include/tr1/stdlib.h
+@@ -33,7 +33,7 @@
+
+ #if _GLIBCXX_HOSTED
+
+-#if _GLIBCXX_USE_C99
++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
+
+ using std::tr1::atoll;
+ using std::tr1::strtoll;
+Index: b/libstdc++-v3/src/c++11/debug.cc
+===================================================================
+--- a/libstdc++-v3/src/c++11/debug.cc
++++ b/libstdc++-v3/src/c++11/debug.cc
+@@ -788,7 +788,7 @@
+ int __n __attribute__ ((__unused__)),
+ const char* __fmt, _Tp __s) const throw ()
+ {
+-#ifdef _GLIBCXX_USE_C99
++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
+ std::snprintf(__buf, __n, __fmt, __s);
+ #else
+ std::sprintf(__buf, __fmt, __s);
diff --git a/patches/gcc/4.9.3/860-cilk-wchar.patch b/patches/gcc/4.9.4/860-cilk-wchar.patch
index 1837405..1837405 100644
--- a/patches/gcc/4.9.3/860-cilk-wchar.patch
+++ b/patches/gcc/4.9.4/860-cilk-wchar.patch
diff --git a/patches/gcc/4.9.3/870-xtensa-add-mauto-litpools-option.patch b/patches/gcc/4.9.4/870-xtensa-add-mauto-litpools-option.patch
index aa1376c..98c7b3f 100644
--- a/patches/gcc/4.9.3/870-xtensa-add-mauto-litpools-option.patch
+++ b/patches/gcc/4.9.4/870-xtensa-add-mauto-litpools-option.patch
@@ -48,8 +48,8 @@ Changes to ChangeLogs and documentation are dropped.
gcc/config/xtensa/xtensa.opt | 4 ++++
7 files changed, 54 insertions(+), 20 deletions(-)
-diff --git a/gcc/config/xtensa/constraints.md b/gcc/config/xtensa/constraints.md
-index 30f4c1f..773d4f9 100644
+Index: b/gcc/config/xtensa/constraints.md
+===================================================================
--- a/gcc/config/xtensa/constraints.md
+++ b/gcc/config/xtensa/constraints.md
@@ -111,6 +111,11 @@
@@ -64,11 +64,11 @@ index 30f4c1f..773d4f9 100644
;; Memory constraints. Do not use define_memory_constraint here. Doing so
;; causes reload to force some constants into the constant pool, but since
;; the Xtensa constant pool can only be accessed with L32R instructions, it
-diff --git a/gcc/config/xtensa/elf.h b/gcc/config/xtensa/elf.h
-index e59bede..12056f7 100644
+Index: b/gcc/config/xtensa/elf.h
+===================================================================
--- a/gcc/config/xtensa/elf.h
+++ b/gcc/config/xtensa/elf.h
-@@ -48,7 +48,9 @@ along with GCC; see the file COPYING3. If not see
+@@ -48,7 +48,9 @@
%{mtarget-align:--target-align} \
%{mno-target-align:--no-target-align} \
%{mlongcalls:--longcalls} \
@@ -79,11 +79,11 @@ index e59bede..12056f7 100644
#undef LIB_SPEC
#define LIB_SPEC "-lc -lsim -lc -lhandlers-sim -lhal"
-diff --git a/gcc/config/xtensa/linux.h b/gcc/config/xtensa/linux.h
-index 675aacf..5b0243a 100644
+Index: b/gcc/config/xtensa/linux.h
+===================================================================
--- a/gcc/config/xtensa/linux.h
+++ b/gcc/config/xtensa/linux.h
-@@ -42,7 +42,9 @@ along with GCC; see the file COPYING3. If not see
+@@ -42,7 +42,9 @@
%{mtarget-align:--target-align} \
%{mno-target-align:--no-target-align} \
%{mlongcalls:--longcalls} \
@@ -94,8 +94,8 @@ index 675aacf..5b0243a 100644
#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
-diff --git a/gcc/config/xtensa/predicates.md b/gcc/config/xtensa/predicates.md
-index e02209e..d7dfa11 100644
+Index: b/gcc/config/xtensa/predicates.md
+===================================================================
--- a/gcc/config/xtensa/predicates.md
+++ b/gcc/config/xtensa/predicates.md
@@ -142,7 +142,8 @@
@@ -108,11 +108,11 @@ index e02209e..d7dfa11 100644
&& GET_MODE_SIZE (mode) % UNITS_PER_WORD == 0")))))
;; Accept the floating point constant 1 in the appropriate mode.
-diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
-index eb039ba..206ff80 100644
+Index: b/gcc/config/xtensa/xtensa.c
+===================================================================
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
-@@ -501,6 +501,9 @@ xtensa_valid_move (machine_mode mode, rtx *operands)
+@@ -477,6 +477,9 @@
{
int dst_regnum = xt_true_regnum (operands[0]);
@@ -121,8 +121,8 @@ index eb039ba..206ff80 100644
+
/* The stack pointer can only be assigned with a MOVSP opcode. */
if (dst_regnum == STACK_POINTER_REGNUM)
- return !TARGET_WINDOWED_ABI
-@@ -1069,7 +1072,7 @@ xtensa_emit_move_sequence (rtx *operands, machine_mode mode)
+ return (mode == SImode
+@@ -1044,7 +1047,7 @@
return 1;
}
@@ -131,7 +131,7 @@ index eb039ba..206ff80 100644
{
src = force_const_mem (SImode, src);
operands[1] = src;
-@@ -2449,6 +2452,20 @@ print_operand (FILE *file, rtx x, int letter)
+@@ -2428,6 +2431,20 @@
}
break;
@@ -152,11 +152,11 @@ index eb039ba..206ff80 100644
default:
if (GET_CODE (x) == REG || GET_CODE (x) == SUBREG)
fprintf (file, "%s", reg_names[xt_true_regnum (x)]);
-diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md
-index 6d84384..0e673a3 100644
+Index: b/gcc/config/xtensa/xtensa.md
+===================================================================
--- a/gcc/config/xtensa/xtensa.md
+++ b/gcc/config/xtensa/xtensa.md
-@@ -761,8 +761,8 @@
+@@ -799,8 +799,8 @@
})
(define_insn "movsi_internal"
@@ -167,7 +167,7 @@ index 6d84384..0e673a3 100644
"xtensa_valid_move (SImode, operands)"
"@
movi.n\t%0, %x1
-@@ -774,15 +774,16 @@
+@@ -812,15 +812,16 @@
mov\t%0, %1
movsp\t%0, %1
movi\t%0, %x1
@@ -186,7 +186,7 @@ index 6d84384..0e673a3 100644
;; 16-bit Integer moves
-@@ -796,21 +797,22 @@
+@@ -834,21 +835,22 @@
})
(define_insn "movhi_internal"
@@ -213,7 +213,7 @@ index 6d84384..0e673a3 100644
;; 8-bit Integer moves
-@@ -881,7 +883,7 @@
+@@ -919,7 +921,7 @@
(match_operand:SF 1 "general_operand" ""))]
""
{
@@ -222,7 +222,7 @@ index 6d84384..0e673a3 100644
operands[1] = force_const_mem (SFmode, operands[1]);
if ((!register_operand (operands[0], SFmode)
-@@ -896,8 +898,8 @@
+@@ -934,8 +936,8 @@
})
(define_insn "movsf_internal"
@@ -233,7 +233,7 @@ index 6d84384..0e673a3 100644
"((register_operand (operands[0], SFmode)
|| register_operand (operands[1], SFmode))
&& !(FP_REG_P (xt_true_regnum (operands[0]))
-@@ -912,13 +914,14 @@
+@@ -950,13 +952,14 @@
mov\t%0, %1
wfr\t%0, %1
rfr\t%0, %1
@@ -250,7 +250,7 @@ index 6d84384..0e673a3 100644
(define_insn "*lsiu"
[(set (match_operand:SF 0 "register_operand" "=f")
-@@ -991,7 +994,7 @@
+@@ -997,7 +1000,7 @@
(match_operand:DF 1 "general_operand" ""))]
""
{
@@ -259,7 +259,7 @@ index 6d84384..0e673a3 100644
operands[1] = force_const_mem (DFmode, operands[1]);
if (!register_operand (operands[0], DFmode)
-@@ -1002,8 +1005,8 @@
+@@ -1008,8 +1011,8 @@
})
(define_insn_and_split "movdf_internal"
@@ -270,11 +270,11 @@ index 6d84384..0e673a3 100644
"register_operand (operands[0], DFmode)
|| register_operand (operands[1], DFmode)"
"#"
-diff --git a/gcc/config/xtensa/xtensa.opt b/gcc/config/xtensa/xtensa.opt
-index 2fd6cee..21c6e96 100644
+Index: b/gcc/config/xtensa/xtensa.opt
+===================================================================
--- a/gcc/config/xtensa/xtensa.opt
+++ b/gcc/config/xtensa/xtensa.opt
-@@ -38,6 +38,10 @@ mtext-section-literals
+@@ -38,6 +38,10 @@
Target
Intersperse literal pools with code in the text section
@@ -285,6 +285,3 @@ index 2fd6cee..21c6e96 100644
mserialize-volatile
Target Report Mask(SERIALIZE_VOLATILE)
-mno-serialize-volatile Do not serialize volatile memory references with MEMW instructions
---
-1.8.1.4
-
diff --git a/patches/gcc/4.9.3/871-xtensa-reimplement-register-spilling.patch b/patches/gcc/4.9.4/871-xtensa-reimplement-register-spilling.patch
index abc7a08..abc7a08 100644
--- a/patches/gcc/4.9.3/871-xtensa-reimplement-register-spilling.patch
+++ b/patches/gcc/4.9.4/871-xtensa-reimplement-register-spilling.patch
diff --git a/patches/gcc/4.9.3/872-xtensa-use-unwind-dw2-fde-dip-instead-of-unwind-dw2-.patch b/patches/gcc/4.9.4/872-xtensa-use-unwind-dw2-fde-dip-instead-of-unwind-dw2-.patch
index f23a5c0..f23a5c0 100644
--- a/patches/gcc/4.9.3/872-xtensa-use-unwind-dw2-fde-dip-instead-of-unwind-dw2-.patch
+++ b/patches/gcc/4.9.4/872-xtensa-use-unwind-dw2-fde-dip-instead-of-unwind-dw2-.patch
diff --git a/patches/gcc/4.9.3/873-xtensa-fix-_Unwind_GetCFA.patch b/patches/gcc/4.9.4/873-xtensa-fix-_Unwind_GetCFA.patch
index dc40513..dc40513 100644
--- a/patches/gcc/4.9.3/873-xtensa-fix-_Unwind_GetCFA.patch
+++ b/patches/gcc/4.9.4/873-xtensa-fix-_Unwind_GetCFA.patch
diff --git a/patches/gcc/4.9.4/874-xtensa-add-uclinux-support.patch b/patches/gcc/4.9.4/874-xtensa-add-uclinux-support.patch
new file mode 100644
index 0000000..881aec0
--- /dev/null
+++ b/patches/gcc/4.9.4/874-xtensa-add-uclinux-support.patch
@@ -0,0 +1,169 @@
+From 70c2cb98fb129b4766b5da0f945dc41fd568c77a Mon Sep 17 00:00:00 2001
+From: Max Filippov <jcmvbkbc@gmail.com>
+Date: Sat, 22 Aug 2015 08:44:26 +0300
+Subject: [PATCH] xtensa: add uclinux support
+
+2015-10-03 Max Filippov <jcmvbkbc@gmail.com>
+gcc/
+ * config.gcc (xtensa*-*-uclinux*): New configuration.
+ * config/xtensa/uclinux.h: New file.
+ * config/xtensa/uclinux.opt: New file.
+
+libgcc/
+ * config.host (xtensa*-*-uclinux*): New configuration.
+
+Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
+---
+Backported from: r228450
+
+ gcc/config.gcc | 5 ++++
+ gcc/config/xtensa/uclinux.h | 69 +++++++++++++++++++++++++++++++++++++++++++
+ gcc/config/xtensa/uclinux.opt | 32 ++++++++++++++++++++
+ libgcc/config.host | 5 ++++
+ 4 files changed, 111 insertions(+)
+ create mode 100644 gcc/config/xtensa/uclinux.h
+ create mode 100644 gcc/config/xtensa/uclinux.opt
+
+Index: b/gcc/config.gcc
+===================================================================
+--- a/gcc/config.gcc
++++ b/gcc/config.gcc
+@@ -2871,6 +2871,11 @@
+ tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h xtensa/linux.h"
+ tmake_file="${tmake_file} xtensa/t-xtensa"
+ ;;
++xtensa*-*-uclinux*)
++ tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h xtensa/uclinux.h"
++ tmake_file="${tmake_file} xtensa/t-xtensa"
++ extra_options="${extra_options} xtensa/uclinux.opt"
++ ;;
+ am33_2.0-*-linux*)
+ tm_file="mn10300/mn10300.h dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h mn10300/linux.h"
+ gas=yes gnu_ld=yes
+Index: b/gcc/config/xtensa/uclinux.h
+===================================================================
+--- /dev/null
++++ b/gcc/config/xtensa/uclinux.h
+@@ -0,0 +1,69 @@
++/* Xtensa uClinux configuration.
++ Derived from the configuration for GCC for Intel i386 running Linux.
++ Copyright (C) 2001-2015 Free Software Foundation, Inc.
++
++This file is part of GCC.
++
++GCC is free software; you can redistribute it and/or modify it under
++the terms of the GNU General Public License as published by the Free
++Software Foundation; either version 3, or (at your option) any later
++version.
++
++GCC is distributed in the hope that it will be useful, but WITHOUT ANY
++WARRANTY; without even the implied warranty of MERCHANTABILITY or
++FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
++for more details.
++
++You should have received a copy of the GNU General Public License
++along with GCC; see the file COPYING3. If not see
++<http://www.gnu.org/licenses/>. */
++
++#undef TARGET_OS_CPP_BUILTINS
++#define TARGET_OS_CPP_BUILTINS() \
++ do \
++ { \
++ GNU_USER_TARGET_OS_CPP_BUILTINS (); \
++ builtin_define ("__uClinux__"); \
++ } \
++ while (0)
++
++#undef SUBTARGET_CPP_SPEC
++#define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
++
++#undef SIZE_TYPE
++#define SIZE_TYPE "unsigned int"
++
++#undef PTRDIFF_TYPE
++#define PTRDIFF_TYPE "int"
++
++#undef WCHAR_TYPE
++#define WCHAR_TYPE "long int"
++
++#undef WCHAR_TYPE_SIZE
++#define WCHAR_TYPE_SIZE 32
++
++#undef ASM_SPEC
++#define ASM_SPEC \
++ "%{mtext-section-literals:--text-section-literals} \
++ %{mno-text-section-literals:--no-text-section-literals} \
++ %{mtarget-align:--target-align} \
++ %{mno-target-align:--no-target-align} \
++ %{mlongcalls:--longcalls} \
++ %{mno-longcalls:--no-longcalls} \
++ %{mauto-litpools:--auto-litpools} \
++ %{mno-auto-litpools:--no-auto-litpools}"
++
++#undef LINK_SPEC
++#define LINK_SPEC "%{!no-elf2flt:%{!elf2flt*:-elf2flt}}"
++
++#undef LOCAL_LABEL_PREFIX
++#define LOCAL_LABEL_PREFIX "."
++
++/* Always enable "-fpic" for Xtensa Linux. */
++#define XTENSA_ALWAYS_PIC 1
++
++#undef TARGET_LIBC_HAS_FUNCTION
++#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
++
++#undef DBX_REGISTER_NUMBER
++
+Index: b/gcc/config/xtensa/uclinux.opt
+===================================================================
+--- /dev/null
++++ b/gcc/config/xtensa/uclinux.opt
+@@ -0,0 +1,32 @@
++; Xtensa uClinux options.
++
++; Copyright (C) 2015 Free Software Foundation, Inc.
++;
++; This file is part of GCC.
++;
++; GCC is free software; you can redistribute it and/or modify it under
++; the terms of the GNU General Public License as published by the Free
++; Software Foundation; either version 3, or (at your option) any later
++; version.
++;
++; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
++; WARRANTY; without even the implied warranty of MERCHANTABILITY or
++; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
++; for more details.
++;
++; You should have received a copy of the GNU General Public License
++; along with GCC; see the file COPYING3. If not see
++; <http://www.gnu.org/licenses/>.
++
++; See the GCC internals manual (options.texi) for a description of
++; this file's format.
++
++; Please try to keep this file in ASCII collating order.
++
++elf2flt
++Driver
++
++elf2flt=
++Driver JoinedOrMissing
++
++; This comment is to ensure we retain the blank line above.
+Index: b/libgcc/config.host
+===================================================================
+--- a/libgcc/config.host
++++ b/libgcc/config.host
+@@ -1213,6 +1213,11 @@
+ tmake_file="$tmake_file xtensa/t-xtensa xtensa/t-linux t-slibgcc-libgcc"
+ md_unwind_header=xtensa/linux-unwind.h
+ ;;
++xtensa*-*-uclinux*)
++ tmake_file="$tmake_file xtensa/t-xtensa xtensa/t-linux t-slibgcc-libgcc"
++ md_unwind_header=xtensa/linux-unwind.h
++ extra_parts="$extra_parts crtbeginS.o crtbeginT.o crtendS.o"
++ ;;
+ am33_2.0-*-linux*)
+ # Don't need crtbeginT.o from *-*-linux* default.
+ extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
diff --git a/patches/gcc/4.9.4/880-nios2_legitimize_address.patch b/patches/gcc/4.9.4/880-nios2_legitimize_address.patch
new file mode 100644
index 0000000..4623f29
--- /dev/null
+++ b/patches/gcc/4.9.4/880-nios2_legitimize_address.patch
@@ -0,0 +1,49 @@
+From b0ea54f3f995754881e0ea6651133aa7b58eeaa2 Mon Sep 17 00:00:00 2001
+From: cltang <cltang@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Tue, 22 Sep 2015 12:23:20 +0000
+Subject: [PATCH] nios2_legitimize_address 2015-09-22 Chung-Lin Tang
+ <cltang@codesourcery.com>
+
+ Backport from mainline
+ 2015-09-22 Chung-Lin Tang <cltang@codesourcery.com>
+
+ * config/nios2/nios2.c (nios2_legitimize_address): When handling
+ 'reg + reloc' cases, allow first operand to be non-REG, and use
+ force_reg() to enforce address pattern.
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@228013 138bc75d-0d04-0410-961f-82ee72b054a4
+
+Fixes:
+http://autobuild.buildroot.net/results/901/90186d1fe134b804c0101554296b1235dc0ccbb0
+
+[backported to 4.9.3]
+Signed-off-by: Romain Naour <romain.naour@gmail.com>
+---
+ gcc/config/nios2/nios2.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gcc/config/nios2/nios2.c b/gcc/config/nios2/nios2.c
+index 047b615..41dd6f9 100644
+--- a/gcc/config/nios2/nios2.c
++++ b/gcc/config/nios2/nios2.c
+@@ -1786,15 +1786,15 @@ nios2_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
+
+ Which will be output as '%tls_le(var+48)(r23)' in assembly. */
+ if (GET_CODE (x) == PLUS
+- && GET_CODE (XEXP (x, 0)) == REG
+ && GET_CODE (XEXP (x, 1)) == CONST)
+ {
+- rtx unspec, offset, reg = XEXP (x, 0);
++ rtx unspec, offset;
+ split_const (XEXP (x, 1), &unspec, &offset);
+ if (GET_CODE (unspec) == UNSPEC
+ && !nios2_large_offset_p (XINT (unspec, 1))
+ && offset != const0_rtx)
+ {
++ rtx reg = force_reg (Pmode, XEXP (x, 0));
+ unspec = copy_rtx (unspec);
+ XVECEXP (unspec, 0, 0)
+ = plus_constant (Pmode, XVECEXP (unspec, 0, 0), INTVAL (offset));
+--
+2.5.0
+
diff --git a/patches/gcc/4.9.4/890-fix-m68k-compile.patch b/patches/gcc/4.9.4/890-fix-m68k-compile.patch
new file mode 100644
index 0000000..140977b
--- /dev/null
+++ b/patches/gcc/4.9.4/890-fix-m68k-compile.patch
@@ -0,0 +1,15 @@
+remove unused header, which breaks the toolchain building
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+
+diff -Nur gcc-4.9.3.orig/libgcc/config/m68k/linux-atomic.c gcc-4.9.3/libgcc/config/m68k/linux-atomic.c
+--- gcc-4.9.3.orig/libgcc/config/m68k/linux-atomic.c 2014-01-02 23:25:22.000000000 +0100
++++ gcc-4.9.3/libgcc/config/m68k/linux-atomic.c 2016-03-18 22:24:40.000000000 +0100
+@@ -33,7 +33,6 @@
+ using the kernel helper defined below. There is no support for
+ 64-bit operations yet. */
+
+-#include <asm/unistd.h>
+ #include <stdbool.h>
+
+ #ifndef __NR_atomic_cmpxchg_32
diff --git a/patches/gcc/4.9.4/891-fix-m68k-uclinux.patch b/patches/gcc/4.9.4/891-fix-m68k-uclinux.patch
new file mode 100644
index 0000000..4347642
--- /dev/null
+++ b/patches/gcc/4.9.4/891-fix-m68k-uclinux.patch
@@ -0,0 +1,18 @@
+avoids internal compiler error while compiling linux-atomic.c
+See here:
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53833
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+
+diff -Nur gcc-4.9.3.orig/libgcc/config.host gcc-4.9.3/libgcc/config.host
+--- gcc-4.9.3.orig/libgcc/config.host 2014-03-27 16:40:31.000000000 +0100
++++ gcc-4.9.3/libgcc/config.host 2016-04-05 16:20:53.422809885 +0200
+@@ -750,7 +750,7 @@
+ m68k*-*-openbsd*)
+ ;;
+ m68k-*-uclinux*) # Motorola m68k/ColdFire running uClinux with uClibc
+- tmake_file="$tmake_file m68k/t-floatlib m68k/t-linux"
++ tmake_file="$tmake_file m68k/t-floatlib"
+ md_unwind_header=m68k/linux-unwind.h
+ ;;
+ m68k-*-linux*) # Motorola m68k's running GNU/Linux
diff --git a/patches/gcc/4.9.3/900-musl-support.patch b/patches/gcc/4.9.4/900-musl-support.patch
index a711b06..a862d01 100644
--- a/patches/gcc/4.9.3/900-musl-support.patch
+++ b/patches/gcc/4.9.4/900-musl-support.patch
@@ -60,7 +60,7 @@ Index: b/gcc/config.gcc
*)
tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
;;
-@@ -2322,6 +2325,10 @@
+@@ -2338,6 +2341,10 @@
powerpc*-*-linux*paired*)
tm_file="${tm_file} rs6000/750cl.h" ;;
esac
@@ -308,7 +308,7 @@ Index: b/gcc/config/microblaze/linux.h
===================================================================
--- a/gcc/config/microblaze/linux.h
+++ b/gcc/config/microblaze/linux.h
-@@ -25,7 +25,23 @@
+@@ -28,7 +28,23 @@
#undef TLS_NEEDS_GOT
#define TLS_NEEDS_GOT 1
@@ -337,7 +337,7 @@ Index: b/gcc/config/rs6000/linux64.h
===================================================================
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
-@@ -375,17 +375,23 @@
+@@ -371,17 +371,23 @@
#endif
#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
@@ -452,7 +452,7 @@ Index: b/gcc/configure
===================================================================
--- a/gcc/configure
+++ b/gcc/configure
-@@ -27449,6 +27453,9 @@
+@@ -27601,6 +27601,9 @@
gcc_cv_target_dl_iterate_phdr=no
fi
;;
@@ -466,7 +466,7 @@ Index: b/gcc/configure.ac
===================================================================
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
-@@ -5108,6 +5112,9 @@
+@@ -5173,6 +5173,9 @@
gcc_cv_target_dl_iterate_phdr=no
fi
;;
@@ -588,7 +588,7 @@ Index: b/libstdc++-v3/configure.host
===================================================================
--- a/libstdc++-v3/configure.host
+++ b/libstdc++-v3/configure.host
-@@ -264,6 +264,13 @@
+@@ -266,6 +266,13 @@
os_include_dir="os/bsd/freebsd"
;;
gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
@@ -602,7 +602,7 @@ Index: b/libstdc++-v3/configure.host
if [ "$uclibc" = "yes" ]; then
os_include_dir="os/uclibc"
elif [ "$bionic" = "yes" ]; then
-@@ -272,6 +279,9 @@
+@@ -274,6 +281,9 @@
os_include_dir="os/gnu-linux"
fi
;;
@@ -637,4 +637,4 @@ Index: b/gcc/config/mips/linux.h
+#define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
+#endif
+#undef MUSL_DYNAMIC_LINKER
-+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E ".so.1"
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
diff --git a/patches/gcc/4.9.4/901-microblaze-uclibc.patch b/patches/gcc/4.9.4/901-microblaze-uclibc.patch
new file mode 100644
index 0000000..82c44e1
--- /dev/null
+++ b/patches/gcc/4.9.4/901-microblaze-uclibc.patch
@@ -0,0 +1,21 @@
+Add dynamic linker support for uClibc
+
+Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
+
+diff -Nur gcc-4.9.3.orig/gcc/config/microblaze/linux.h gcc-4.9.3/gcc/config/microblaze/linux.h
+--- gcc-4.9.3.orig/gcc/config/microblaze/linux.h 2016-06-04 21:21:09.430646655 +0200
++++ gcc-4.9.3/gcc/config/microblaze/linux.h 2016-06-04 21:21:44.596003509 +0200
+@@ -36,10 +36,13 @@
+
+ #undef MUSL_DYNAMIC_LINKER
+ #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-microblaze" MUSL_DYNAMIC_LINKER_E ".so.1"
++#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+
+ #if DEFAULT_LIBC == LIBC_MUSL
+ #define DYNAMIC_LINKER MUSL_DYNAMIC_LINKER
++#elif DEFAULT_LIBC == LIBC_UCLIBC
++#define DYNAMIC_LINKER UCLIBC_DYNAMIC_LINKER
+ #else
+ #define DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
+ #endif
diff --git a/patches/gcc/4.9.4/930-libgcc-disable-split-stack-nothreads.patch b/patches/gcc/4.9.4/930-libgcc-disable-split-stack-nothreads.patch
new file mode 100644
index 0000000..670cf8d
--- /dev/null
+++ b/patches/gcc/4.9.4/930-libgcc-disable-split-stack-nothreads.patch
@@ -0,0 +1,14 @@
+disable split-stack for non-thread builds
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+
+diff -Nur gcc-4.9.3.orig/libgcc/config/t-stack gcc-4.9.3/libgcc/config/t-stack
+--- gcc-4.9.3.orig/libgcc/config/t-stack 2010-10-01 21:31:49.000000000 +0200
++++ gcc-4.9.3/libgcc/config/t-stack 2016-03-07 01:34:32.000000000 +0100
+@@ -1,4 +1,6 @@
+ # Makefile fragment to provide generic support for -fsplit-stack.
+ # This should be used in config.host for any host which supports
+ # -fsplit-stack.
++ifeq ($(enable_threads),yes)
+ LIB2ADD_ST += $(srcdir)/generic-morestack.c $(srcdir)/generic-morestack-thread.c
++endif
diff --git a/patches/gcc/4.9.4/940-uclinux-enable-threads.patch b/patches/gcc/4.9.4/940-uclinux-enable-threads.patch
new file mode 100644
index 0000000..5108147
--- /dev/null
+++ b/patches/gcc/4.9.4/940-uclinux-enable-threads.patch
@@ -0,0 +1,20 @@
+Enable POSIX threads for uClinux targets
+Reported upstream:
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71721
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+
+Index: b/gcc/config.gcc
+===================================================================
+--- a/gcc/config.gcc
++++ b/gcc/config.gcc
+@@ -810,6 +810,9 @@
+ *-*-uclinux*)
+ extra_options="$extra_options gnu-user.opt"
+ use_gcc_stdint=wrap
++ case ${enable_threads} in
++ "" | yes | posix) thread_file='posix' ;;
++ esac
+ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC SINGLE_LIBC"
+ ;;
+ *-*-rdos*)
diff --git a/samples/sh4-multilib-linux-gnu/crosstool.config b/samples/sh4-multilib-linux-gnu/crosstool.config
index cb2d3b7..9a3e1dc 100644
--- a/samples/sh4-multilib-linux-gnu/crosstool.config
+++ b/samples/sh4-multilib-linux-gnu/crosstool.config
@@ -6,7 +6,7 @@ CT_ARCH_SH_SH4=y
CT_TARGET_VENDOR="multilib"
CT_KERNEL_linux=y
CT_BINUTILS_PLUGINS=y
-CT_CC_GCC_V_4_9_3=y
+CT_CC_GCC_V_4_9_4=y
CT_CC_GCC_MULTILIB_LIST="m4,m4a"
CT_CC_LANG_CXX=y
CT_DEBUG_gdb=y
diff --git a/samples/sh4-multilib-linux-uclibc/crosstool.config b/samples/sh4-multilib-linux-uclibc/crosstool.config
index e634521..06e6d0c 100644
--- a/samples/sh4-multilib-linux-uclibc/crosstool.config
+++ b/samples/sh4-multilib-linux-uclibc/crosstool.config
@@ -7,7 +7,7 @@ CT_TARGET_VENDOR="multilib"
CT_KERNEL_linux=y
CT_BINUTILS_PLUGINS=y
CT_LIBC_uClibc=y
-CT_CC_GCC_V_4_9_3=y
+CT_CC_GCC_V_4_9_4=y
CT_CC_GCC_MULTILIB_LIST="m4,m4a,m3"
CT_CC_LANG_CXX=y
CT_DEBUG_gdb=y
diff --git a/samples/sh4-unknown-linux-gnu/crosstool.config b/samples/sh4-unknown-linux-gnu/crosstool.config
index ab0cc7a..d43ccbd 100644
--- a/samples/sh4-unknown-linux-gnu/crosstool.config
+++ b/samples/sh4-unknown-linux-gnu/crosstool.config
@@ -5,7 +5,7 @@ CT_ARCH_sh=y
CT_ARCH_SH_SH4=y
CT_KERNEL_linux=y
CT_BINUTILS_PLUGINS=y
-CT_CC_GCC_V_4_9_3=y
+CT_CC_GCC_V_4_9_4=y
CT_CC_LANG_CXX=y
CT_DEBUG_gdb=y
# CT_GDB_CROSS_PYTHON is not set
diff --git a/samples/sparc-leon-linux-uclibc/crosstool.config b/samples/sparc-leon-linux-uclibc/crosstool.config
index 97488a5..c877632 100644
--- a/samples/sparc-leon-linux-uclibc/crosstool.config
+++ b/samples/sparc-leon-linux-uclibc/crosstool.config
@@ -12,6 +12,6 @@ CT_LIBC_uClibc=y
CT_LIBC_UCLIBC_CONFIG_FILE="${CT_LIB_DIR}/samples/${CT_TARGET}/uClibc.config"
CT_LIBC_UCLIBC_IPV6=y
CT_LIBC_UCLIBC_WCHAR=y
-CT_CC_GCC_V_4_9_3=y
+CT_CC_GCC_V_4_9_4=y
CT_CC_GCC_EXTRA_CONFIG_ARRAY="--disable-libitm"
CT_CC_LANG_CXX=y