summaryrefslogtreecommitdiffstats
path: root/toolchain
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2015-09-06 10:07:03 +0000
committerFelix Fietkau <nbd@openwrt.org>2015-09-06 10:07:03 +0000
commit400fb6cadc65746c57b01a8cdec63885f3c3db8c (patch)
tree9b1bacdcac0d45dc4bd6be9df8f43cfe6ffe24c2 /toolchain
parentedb5d7511bd76a091b1f52d757520cc2e1762590 (diff)
downloadmaster-31e0f0ae-400fb6cadc65746c57b01a8cdec63885f3c3db8c.tar.gz
master-31e0f0ae-400fb6cadc65746c57b01a8cdec63885f3c3db8c.tar.bz2
master-31e0f0ae-400fb6cadc65746c57b01a8cdec63885f3c3db8c.zip
gcc: remove version 4.9-linaro
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 46798
Diffstat (limited to 'toolchain')
-rw-r--r--toolchain/gcc/Config.in5
-rw-r--r--toolchain/gcc/Config.version8
-rw-r--r--toolchain/gcc/common.mk8
-rw-r--r--toolchain/gcc/patches/4.9-linaro/001-revert_register_mode_search.patch65
-rw-r--r--toolchain/gcc/patches/4.9-linaro/002-case_insensitive.patch14
-rw-r--r--toolchain/gcc/patches/4.9-linaro/010-documentation.patch23
-rw-r--r--toolchain/gcc/patches/4.9-linaro/020-no-plt-backport.patch28
-rw-r--r--toolchain/gcc/patches/4.9-linaro/100-uclibc-conf.patch33
-rw-r--r--toolchain/gcc/patches/4.9-linaro/200-musl_config.patch199
-rw-r--r--toolchain/gcc/patches/4.9-linaro/201-musl_arm.patch40
-rw-r--r--toolchain/gcc/patches/4.9-linaro/202-musl_mips.patch13
-rw-r--r--toolchain/gcc/patches/4.9-linaro/203-musl_powerpc.patch100
-rw-r--r--toolchain/gcc/patches/4.9-linaro/204-musl_sh.patch17
-rw-r--r--toolchain/gcc/patches/4.9-linaro/205-musl_x86.patch48
-rw-r--r--toolchain/gcc/patches/4.9-linaro/206-musl_aarch64.patch11
-rw-r--r--toolchain/gcc/patches/4.9-linaro/207-musl_fixincludes.patch12
-rw-r--r--toolchain/gcc/patches/4.9-linaro/208-musl_gomp.patch11
-rw-r--r--toolchain/gcc/patches/4.9-linaro/209-musl_libstdc++.patch26
-rw-r--r--toolchain/gcc/patches/4.9-linaro/210-disable_libsanitizer_off_t_check.patch11
-rw-r--r--toolchain/gcc/patches/4.9-linaro/220-musl_mips_softfloat.patch8
-rw-r--r--toolchain/gcc/patches/4.9-linaro/221-musl_mips64.patch20
-rw-r--r--toolchain/gcc/patches/4.9-linaro/800-arm_v5te_no_ldrd_strd.patch11
-rw-r--r--toolchain/gcc/patches/4.9-linaro/810-arm-softfloat-libgcc.patch25
-rw-r--r--toolchain/gcc/patches/4.9-linaro/820-libgcc_pic.patch36
-rw-r--r--toolchain/gcc/patches/4.9-linaro/830-arm_unbreak_armv4t.patch13
-rw-r--r--toolchain/gcc/patches/4.9-linaro/840-armv4_pass_fix-v4bx_to_ld.patch19
-rw-r--r--toolchain/gcc/patches/4.9-linaro/850-use_shared_libgcc.patch47
-rw-r--r--toolchain/gcc/patches/4.9-linaro/851-libgcc_no_compat.patch12
-rw-r--r--toolchain/gcc/patches/4.9-linaro/860-use_eh_frame.patch42
-rw-r--r--toolchain/gcc/patches/4.9-linaro/870-ppc_no_crtsavres.patch11
-rw-r--r--toolchain/gcc/patches/4.9-linaro/880-no_java_section.patch11
-rw-r--r--toolchain/gcc/patches/4.9-linaro/900-bad-mips16-crt.patch9
-rw-r--r--toolchain/gcc/patches/4.9-linaro/910-mbsd_multi.patch232
-rw-r--r--toolchain/gcc/patches/4.9-linaro/920-specs_nonfatal_getenv.patch14
-rw-r--r--toolchain/gcc/patches/4.9-linaro/930-fix-mips-noexecstack.patch111
-rw-r--r--toolchain/gcc/patches/4.9-linaro/940-no-clobber-stamp-bits.patch11
36 files changed, 0 insertions, 1304 deletions
diff --git a/toolchain/gcc/Config.in b/toolchain/gcc/Config.in
index 8a68056e9a..2d4400afb4 100644
--- a/toolchain/gcc/Config.in
+++ b/toolchain/gcc/Config.in
@@ -15,11 +15,6 @@ choice
select GCC_VERSION_4_8_LINARO
bool "gcc 4.8.x with Linaro enhancements"
- config GCC_USE_VERSION_4_9_LINARO
- select GCC_VERSION_4_9_LINARO
- bool "gcc 4.9.x with Linaro enhancements"
- depends on BROKEN
-
config GCC_USE_VERSION_5
select GCC_VERSION_5
bool "gcc 5.x"
diff --git a/toolchain/gcc/Config.version b/toolchain/gcc/Config.version
index c5cf232b92..4bbcf5d384 100644
--- a/toolchain/gcc/Config.version
+++ b/toolchain/gcc/Config.version
@@ -6,16 +6,12 @@ config GCC_VERSION_4_8_LINARO
default y if (!TOOLCHAINOPTS && !TARGET_octeon)
bool
-config GCC_VERSION_4_9_LINARO
- bool
-
config GCC_VERSION
string
default "4.6.3" if GCC_VERSION_4_6_3
default "5.2.0" if GCC_VERSION_5
default "4.6-linaro" if GCC_VERSION_4_6_LINARO
default "4.8-linaro" if GCC_VERSION_4_8_LINARO
- default "4.9-linaro" if GCC_VERSION_4_9_LINARO
default "4.6-linaro"
config GCC_VERSION_4_6
@@ -26,9 +22,5 @@ config GCC_VERSION_4_8
bool
default y if GCC_VERSION_4_8_LINARO
-config GCC_VERSION_4_9
- bool
- default y if GCC_VERSION_4_9_LINARO
-
config GCC_VERSION_5
bool
diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk
index bc5a732c3a..0a148ce97f 100644
--- a/toolchain/gcc/common.mk
+++ b/toolchain/gcc/common.mk
@@ -41,14 +41,6 @@ ifeq ($(findstring linaro, $(CONFIG_GCC_VERSION)),linaro)
PKG_MD5SUM:=5ba2f3a449b1658ccc09d27cc7ab3c03
PKG_COMP:=xz
endif
- ifeq ($(CONFIG_GCC_VERSION),"4.9-linaro")
- LINARO_RELEASE:=15.03
- PKG_REV:=4.9-2015.03
- PKG_VERSION:=4.9.3
- PKG_VERSION_MAJOR:=4.9
- PKG_MD5SUM:=f9d256d120adfbb45dd3e2d22b70cba9
- PKG_COMP:=xz
- endif
ifneq ($(LINARO_RELEASE),)
PKG_SOURCE_URL:=http://releases.linaro.org/$(LINARO_RELEASE)/components/toolchain/gcc-linaro/$(PKG_VERSION_MAJOR)
else
diff --git a/toolchain/gcc/patches/4.9-linaro/001-revert_register_mode_search.patch b/toolchain/gcc/patches/4.9-linaro/001-revert_register_mode_search.patch
deleted file mode 100644
index 5adb22ad42..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/001-revert_register_mode_search.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-Revert of:
-
-commit 275035b56823b26d5fb7e90fad945b998648edf2
-Author: bergner <bergner@138bc75d-0d04-0410-961f-82ee72b054a4>
-Date: Thu Sep 5 14:09:07 2013 +0000
-
- PR target/58139
- * reginfo.c (choose_hard_reg_mode): Scan through all mode classes
- looking for widest mode.
-
-
- git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202286 138bc75d-0d04-0410-961f-82ee72b054a4
-
-
---- a/gcc/reginfo.c
-+++ b/gcc/reginfo.c
-@@ -621,35 +621,40 @@ choose_hard_reg_mode (unsigned int regno
- mode = GET_MODE_WIDER_MODE (mode))
- if ((unsigned) hard_regno_nregs[regno][mode] == nregs
- && HARD_REGNO_MODE_OK (regno, mode)
-- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
-- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
-+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
- found_mode = mode;
-
-+ if (found_mode != VOIDmode)
-+ return found_mode;
-+
- for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT);
- mode != VOIDmode;
- mode = GET_MODE_WIDER_MODE (mode))
- if ((unsigned) hard_regno_nregs[regno][mode] == nregs
- && HARD_REGNO_MODE_OK (regno, mode)
-- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
-- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
-+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
- found_mode = mode;
-
-+ if (found_mode != VOIDmode)
-+ return found_mode;
-+
- for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_FLOAT);
- mode != VOIDmode;
- mode = GET_MODE_WIDER_MODE (mode))
- if ((unsigned) hard_regno_nregs[regno][mode] == nregs
- && HARD_REGNO_MODE_OK (regno, mode)
-- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
-- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
-+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
- found_mode = mode;
-
-+ if (found_mode != VOIDmode)
-+ return found_mode;
-+
- for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_INT);
- mode != VOIDmode;
- mode = GET_MODE_WIDER_MODE (mode))
- if ((unsigned) hard_regno_nregs[regno][mode] == nregs
- && HARD_REGNO_MODE_OK (regno, mode)
-- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
-- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
-+ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
- found_mode = mode;
-
- if (found_mode != VOIDmode)
diff --git a/toolchain/gcc/patches/4.9-linaro/002-case_insensitive.patch b/toolchain/gcc/patches/4.9-linaro/002-case_insensitive.patch
deleted file mode 100644
index b3d2dbe291..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/002-case_insensitive.patch
+++ /dev/null
@@ -1,14 +0,0 @@
---- a/include/filenames.h
-+++ b/include/filenames.h
-@@ -43,11 +43,6 @@ extern "C" {
- # define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c)
- # define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f)
- #else /* not DOSish */
--# if defined(__APPLE__)
--# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM
--# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1
--# endif
--# endif /* __APPLE__ */
- # define HAS_DRIVE_SPEC(f) (0)
- # define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c)
- # define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f)
diff --git a/toolchain/gcc/patches/4.9-linaro/010-documentation.patch b/toolchain/gcc/patches/4.9-linaro/010-documentation.patch
deleted file mode 100644
index 9f17b64da9..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/010-documentation.patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- a/gcc/Makefile.in
-+++ b/gcc/Makefile.in
-@@ -2847,18 +2847,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
- doc/gccint.info: $(TEXI_GCCINT_FILES)
- doc/cppinternals.info: $(TEXI_CPPINT_FILES)
-
--doc/%.info: %.texi
-- if [ x$(BUILD_INFO) = xinfo ]; then \
-- $(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \
-- -I $(gcc_docdir)/include -o $@ $<; \
-- fi
-+doc/%.info:
-
- # Duplicate entry to handle renaming of gccinstall.info
--doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES)
-- if [ x$(BUILD_INFO) = xinfo ]; then \
-- $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
-- -I $(gcc_docdir)/include -o $@ $<; \
-- fi
-+doc/gccinstall.info:
-
- doc/cpp.dvi: $(TEXI_CPP_FILES)
- doc/gcc.dvi: $(TEXI_GCC_FILES)
diff --git a/toolchain/gcc/patches/4.9-linaro/020-no-plt-backport.patch b/toolchain/gcc/patches/4.9-linaro/020-no-plt-backport.patch
deleted file mode 100644
index 10cf323c08..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/020-no-plt-backport.patch
+++ /dev/null
@@ -1,28 +0,0 @@
---- a/gcc/calls.c
-+++ b/gcc/calls.c
-@@ -184,6 +184,12 @@ prepare_call_address (tree fndecl, rtx f
- && targetm.small_register_classes_for_mode_p (FUNCTION_MODE))
- ? force_not_mem (memory_address (FUNCTION_MODE, funexp))
- : memory_address (FUNCTION_MODE, funexp));
-+ else if (flag_pic && !flag_plt && fndecl
-+ && TREE_CODE (fndecl) == FUNCTION_DECL
-+ && !targetm.binds_local_p (fndecl))
-+ {
-+ funexp = force_reg (Pmode, funexp);
-+ }
- else if (! sibcallp)
- {
- #ifndef NO_FUNCTION_CSE
---- a/gcc/common.opt
-+++ b/gcc/common.opt
-@@ -1659,6 +1659,10 @@ fpie
- Common Report Var(flag_pie,1) Negative(fPIC)
- Generate position-independent code for executables if possible (small mode)
-
-+fplt
-+Common Report Var(flag_plt) Init(1)
-+Use PLT for PIC calls (-fno-plt: load the address from GOT at call site)
-+
- fplugin=
- Common Joined RejectNegative Var(common_deferred_options) Defer
- Specify a plugin to load
diff --git a/toolchain/gcc/patches/4.9-linaro/100-uclibc-conf.patch b/toolchain/gcc/patches/4.9-linaro/100-uclibc-conf.patch
deleted file mode 100644
index ff9ad94f62..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/100-uclibc-conf.patch
+++ /dev/null
@@ -1,33 +0,0 @@
---- a/contrib/regression/objs-gcc.sh
-+++ b/contrib/regression/objs-gcc.sh
-@@ -106,6 +106,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H
- then
- make all-gdb all-dejagnu all-ld || exit 1
- make install-gdb install-dejagnu install-ld || exit 1
-+elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
-+ then
-+ make all-gdb all-dejagnu all-ld || exit 1
-+ make install-gdb install-dejagnu install-ld || exit 1
- elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
- make bootstrap || exit 1
- make install || exit 1
---- a/libjava/classpath/ltconfig
-+++ b/libjava/classpath/ltconfig
-@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-
-
- # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
- case $host_os in
--linux-gnu*) ;;
-+linux-gnu*|linux-uclibc*) ;;
- linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
- esac
-
-@@ -1247,7 +1247,7 @@ linux-gnuoldld* | linux-gnuaout* | linux
- ;;
-
- # This must be Linux ELF.
--linux-gnu*)
-+linux*)
- version_type=linux
- need_lib_prefix=no
- need_version=no
diff --git a/toolchain/gcc/patches/4.9-linaro/200-musl_config.patch b/toolchain/gcc/patches/4.9-linaro/200-musl_config.patch
deleted file mode 100644
index f7c8adadc2..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/200-musl_config.patch
+++ /dev/null
@@ -1,199 +0,0 @@
---- a/gcc/config.gcc
-+++ b/gcc/config.gcc
-@@ -595,7 +595,7 @@ case ${target} in
- esac
-
- # Common C libraries.
--tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
-+tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
-
- # 32-bit x86 processors supported by --with-arch=. Each processor
- # MUST be separated by exactly one space.
-@@ -720,6 +720,9 @@ case ${target} in
- *-*-*uclibc*)
- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
- ;;
-+ *-*-*musl*)
-+ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
-+ ;;
- *)
- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
- ;;
---- a/gcc/config/linux.h
-+++ b/gcc/config/linux.h
-@@ -32,10 +32,12 @@ see the files COPYING3 and COPYING.RUNTI
- #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
- #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
- #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
-+#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
- #else
- #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
- #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
- #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
-+#define OPTION_MUSL (linux_libc == LIBC_MUSL)
- #endif
-
- #define GNU_USER_TARGET_OS_CPP_BUILTINS() \
-@@ -53,18 +55,21 @@ see the files COPYING3 and COPYING.RUNTI
- uClibc or Bionic is the default C library and whether
- -muclibc or -mglibc or -mbionic has been passed to change the default. */
-
--#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \
-- "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
-+#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \
-+ "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
-
- #if DEFAULT_LIBC == LIBC_GLIBC
--#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
-- CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
-+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
-+ CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
- #elif DEFAULT_LIBC == LIBC_UCLIBC
--#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
-- CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
-+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
-+ CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
- #elif DEFAULT_LIBC == LIBC_BIONIC
--#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
-- CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
-+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
-+ CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
-+#elif DEFAULT_LIBC == LIBC_MUSL
-+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
-+ CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
- #else
- #error "Unsupported DEFAULT_LIBC"
- #endif /* DEFAULT_LIBC */
-@@ -84,21 +89,92 @@ see the files COPYING3 and COPYING.RUNTI
-
- #define GNU_USER_DYNAMIC_LINKER \
- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
-- BIONIC_DYNAMIC_LINKER)
-+ BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
- #define GNU_USER_DYNAMIC_LINKER32 \
- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
-- BIONIC_DYNAMIC_LINKER32)
-+ BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
- #define GNU_USER_DYNAMIC_LINKER64 \
- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
-- BIONIC_DYNAMIC_LINKER64)
-+ BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
- #define GNU_USER_DYNAMIC_LINKERX32 \
- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
-- BIONIC_DYNAMIC_LINKERX32)
-+ BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32)
-
- /* Whether we have Bionic libc runtime */
- #undef TARGET_HAS_BIONIC
- #define TARGET_HAS_BIONIC (OPTION_BIONIC)
-
-+/* musl avoids problematic includes by rearranging the include directories.
-+ * Unfortunately, this is mostly duplicated from cppdefault.c */
-+#if DEFAULT_LIBC == LIBC_MUSL
-+#define INCLUDE_DEFAULTS_MUSL_GPP \
-+ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
-+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
-+ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
-+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
-+ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
-+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
-+
-+#ifdef LOCAL_INCLUDE_DIR
-+#define INCLUDE_DEFAULTS_MUSL_LOCAL \
-+ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
-+ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
-+#else
-+#define INCLUDE_DEFAULTS_MUSL_LOCAL
-+#endif
-+
-+#ifdef PREFIX_INCLUDE_DIR
-+#define INCLUDE_DEFAULTS_MUSL_PREFIX \
-+ { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
-+#else
-+#define INCLUDE_DEFAULTS_MUSL_PREFIX
-+#endif
-+
-+#ifdef CROSS_INCLUDE_DIR
-+#define INCLUDE_DEFAULTS_MUSL_CROSS \
-+ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
-+#else
-+#define INCLUDE_DEFAULTS_MUSL_CROSS
-+#endif
-+
-+#ifdef TOOL_INCLUDE_DIR
-+#define INCLUDE_DEFAULTS_MUSL_TOOL \
-+ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
-+#else
-+#define INCLUDE_DEFAULTS_MUSL_TOOL
-+#endif
-+
-+#ifdef NATIVE_SYSTEM_HEADER_DIR
-+#define INCLUDE_DEFAULTS_MUSL_NATIVE \
-+ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
-+ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
-+#else
-+#define INCLUDE_DEFAULTS_MUSL_NATIVE
-+#endif
-+
-+#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
-+# undef INCLUDE_DEFAULTS_MUSL_LOCAL
-+# define INCLUDE_DEFAULTS_MUSL_LOCAL
-+# undef INCLUDE_DEFAULTS_MUSL_NATIVE
-+# define INCLUDE_DEFAULTS_MUSL_NATIVE
-+#else
-+# undef INCLUDE_DEFAULTS_MUSL_CROSS
-+# define INCLUDE_DEFAULTS_MUSL_CROSS
-+#endif
-+
-+#undef INCLUDE_DEFAULTS
-+#define INCLUDE_DEFAULTS \
-+ { \
-+ INCLUDE_DEFAULTS_MUSL_GPP \
-+ INCLUDE_DEFAULTS_MUSL_PREFIX \
-+ INCLUDE_DEFAULTS_MUSL_CROSS \
-+ INCLUDE_DEFAULTS_MUSL_TOOL \
-+ INCLUDE_DEFAULTS_MUSL_NATIVE \
-+ { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
-+ { 0, 0, 0, 0, 0, 0 } \
-+ }
-+#endif
-+
- #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */
- /* This is a *uclinux* target. We don't define below macros to normal linux
- versions, because doing so would require *uclinux* targets to include
---- a/gcc/config/linux.opt
-+++ b/gcc/config/linux.opt
-@@ -30,3 +30,7 @@ Use GNU C library
- muclibc
- Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
- Use uClibc C library
-+
-+mmusl
-+Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
-+Use musl C library
---- a/gcc/ginclude/stddef.h
-+++ b/gcc/ginclude/stddef.h
-@@ -181,6 +181,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
- #ifndef _GCC_SIZE_T
- #ifndef _SIZET_
- #ifndef __size_t
-+#ifndef __DEFINED_size_t /* musl */
- #define __size_t__ /* BeOS */
- #define __SIZE_T__ /* Cray Unicos/Mk */
- #define _SIZE_T
-@@ -197,6 +198,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
- #define ___int_size_t_h
- #define _GCC_SIZE_T
- #define _SIZET_
-+#define __DEFINED_size_t /* musl */
- #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
- || defined(__FreeBSD_kernel__)
- /* __size_t is a typedef on FreeBSD 5, must not trash it. */
-@@ -214,6 +216,7 @@ typedef __SIZE_TYPE__ size_t;
- typedef long ssize_t;
- #endif /* __BEOS__ */
- #endif /* !(defined (__GNUG__) && defined (size_t)) */
-+#endif /* __DEFINED_size_t */
- #endif /* __size_t */
- #endif /* _SIZET_ */
- #endif /* _GCC_SIZE_T */
diff --git a/toolchain/gcc/patches/4.9-linaro/201-musl_arm.patch b/toolchain/gcc/patches/4.9-linaro/201-musl_arm.patch
deleted file mode 100644
index f39ff52468..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/201-musl_arm.patch
+++ /dev/null
@@ -1,40 +0,0 @@
---- a/gcc/config/arm/linux-eabi.h
-+++ b/gcc/config/arm/linux-eabi.h
-@@ -77,6 +77,23 @@
- %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
- %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
-
-+/* For ARM musl currently supports four dynamic linkers:
-+ - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
-+ - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI
-+ - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB
-+ - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB
-+ musl does not support the legacy OABI mode.
-+ All the dynamic linkers live in /lib.
-+ We default to soft-float, EL. */
-+#undef MUSL_DYNAMIC_LINKER
-+#if TARGET_BIG_ENDIAN_DEFAULT
-+#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}"
-+#else
-+#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
-+#endif
-+#define MUSL_DYNAMIC_LINKER \
-+ "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
-+
- /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
- use the GNU/Linux version, not the generic BPABI version. */
- #undef LINK_SPEC
---- a/libitm/config/arm/hwcap.cc
-+++ b/libitm/config/arm/hwcap.cc
-@@ -40,7 +40,11 @@ int GTM_hwcap HIDDEN = 0
-
- #ifdef __linux__
- #include <unistd.h>
-+#ifdef __GLIBC__
- #include <sys/fcntl.h>
-+#else
-+#include <fcntl.h>
-+#endif
- #include <elf.h>
-
- static void __attribute__((constructor))
diff --git a/toolchain/gcc/patches/4.9-linaro/202-musl_mips.patch b/toolchain/gcc/patches/4.9-linaro/202-musl_mips.patch
deleted file mode 100644
index 06d25d52e4..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/202-musl_mips.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/gcc/config/mips/linux.h
-+++ b/gcc/config/mips/linux.h
-@@ -23,3 +23,10 @@ along with GCC; see the file COPYING3.
- #undef UCLIBC_DYNAMIC_LINKER
- #define UCLIBC_DYNAMIC_LINKER \
- "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
-+
-+#if TARGET_ENDIAN_DEFAULT == 0 /* LE */
-+#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}"
-+#else
-+#define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
-+#endif
-+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E ".so.1"
diff --git a/toolchain/gcc/patches/4.9-linaro/203-musl_powerpc.patch b/toolchain/gcc/patches/4.9-linaro/203-musl_powerpc.patch
deleted file mode 100644
index 033f586f4c..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/203-musl_powerpc.patch
+++ /dev/null
@@ -1,100 +0,0 @@
---- a/gcc/config.gcc
-+++ b/gcc/config.gcc
-@@ -2344,6 +2344,10 @@ powerpc*-*-linux*)
- powerpc*-*-linux*paired*)
- tm_file="${tm_file} rs6000/750cl.h" ;;
- esac
-+ case ${target} in
-+ *-linux*-musl*)
-+ enable_secureplt=yes ;;
-+ esac
- if test x${enable_secureplt} = xyes; then
- tm_file="rs6000/secureplt.h ${tm_file}"
- fi
---- a/gcc/config/rs6000/linux64.h
-+++ b/gcc/config/rs6000/linux64.h
-@@ -371,17 +371,21 @@ extern int dot_symbols;
- #endif
- #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
- #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
-+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc%{msoft-float:-sf}.so.1"
-+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1"
- #if DEFAULT_LIBC == LIBC_UCLIBC
--#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
-+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
- #elif DEFAULT_LIBC == LIBC_GLIBC
--#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
-+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
-+#elif DEFAULT_LIBC == LIBC_MUSL
-+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
- #else
- #error "Unsupported DEFAULT_LIBC"
- #endif
- #define GNU_USER_DYNAMIC_LINKER32 \
-- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
-+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
- #define GNU_USER_DYNAMIC_LINKER64 \
-- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
-+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
-
- #undef DEFAULT_ASM_ENDIAN
- #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
---- a/gcc/config/rs6000/secureplt.h
-+++ b/gcc/config/rs6000/secureplt.h
-@@ -18,3 +18,4 @@ along with GCC; see the file COPYING3.
- <http://www.gnu.org/licenses/>. */
-
- #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
-+#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
---- a/gcc/config/rs6000/sysv4.h
-+++ b/gcc/config/rs6000/sysv4.h
-@@ -537,6 +537,9 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
- #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
- #define CC1_SECURE_PLT_DEFAULT_SPEC ""
- #endif
-+#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
-+#define LINK_SECURE_PLT_DEFAULT_SPEC ""
-+#endif
-
- /* Pass -G xxx to the compiler. */
- #define CC1_SPEC "%{G*} %(cc1_cpu)" \
-@@ -585,7 +588,8 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
-
- /* Override the default target of the linker. */
- #define LINK_TARGET_SPEC \
-- ENDIAN_SELECT("", " --oformat elf32-powerpcle", "")
-+ ENDIAN_SELECT("", " --oformat elf32-powerpcle", "") \
-+ "%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}"
-
- /* Any specific OS flags. */
- #define LINK_OS_SPEC "\
-@@ -763,15 +767,18 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
-
- #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
- #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
-+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc%{msoft-float:-sf}.so.1"
- #if DEFAULT_LIBC == LIBC_UCLIBC
--#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
-+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
-+#elif DEFAULT_LIBC == LIBC_MUSL
-+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
- #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
--#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
-+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
- #else
- #error "Unsupported DEFAULT_LIBC"
- #endif
- #define GNU_USER_DYNAMIC_LINKER \
-- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
-+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
-
- #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
- %{rdynamic:-export-dynamic} \
-@@ -894,6 +901,7 @@ ncrtn.o%s"
- { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
- { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
- { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
-+ { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \
- { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
- { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
- { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
diff --git a/toolchain/gcc/patches/4.9-linaro/204-musl_sh.patch b/toolchain/gcc/patches/4.9-linaro/204-musl_sh.patch
deleted file mode 100644
index dfb5b51746..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/204-musl_sh.patch
+++ /dev/null
@@ -1,17 +0,0 @@
---- a/gcc/config/sh/linux.h
-+++ b/gcc/config/sh/linux.h
-@@ -43,7 +43,14 @@ along with GCC; see the file COPYING3.
-
- #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
-
-+#if TARGET_BIG_ENDIAN_DEFAULT /* BE */
-+#define MUSL_DYNAMIC_LINKER_E "eb"
-+#else
-+#define MUSL_DYNAMIC_LINKER_E
-+#endif
-+
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
-+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E ".so.1"
-
- #undef SUBTARGET_LINK_EMUL_SUFFIX
- #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
diff --git a/toolchain/gcc/patches/4.9-linaro/205-musl_x86.patch b/toolchain/gcc/patches/4.9-linaro/205-musl_x86.patch
deleted file mode 100644
index d167105c00..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/205-musl_x86.patch
+++ /dev/null
@@ -1,48 +0,0 @@
---- a/gcc/config/i386/linux.h
-+++ b/gcc/config/i386/linux.h
-@@ -21,3 +21,4 @@ along with GCC; see the file COPYING3.
-
- #define GNU_USER_LINK_EMULATION "elf_i386"
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
-+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
---- a/gcc/config/i386/linux64.h
-+++ b/gcc/config/i386/linux64.h
-@@ -30,3 +30,7 @@ see the files COPYING3 and COPYING.RUNTI
- #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
- #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
- #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
-+
-+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
-+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
-+#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
---- a/libitm/config/linux/x86/tls.h
-+++ b/libitm/config/linux/x86/tls.h
-@@ -25,16 +25,19 @@
- #ifndef LIBITM_X86_TLS_H
- #define LIBITM_X86_TLS_H 1
-
--#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
-+#if defined(__GLIBC_PREREQ)
-+#if __GLIBC_PREREQ(2, 10)
- /* Use slots in the TCB head rather than __thread lookups.
- GLIBC has reserved words 10 through 13 for TM. */
- #define HAVE_ARCH_GTM_THREAD 1
- #define HAVE_ARCH_GTM_THREAD_DISP 1
- #endif
-+#endif
-
- #include "config/generic/tls.h"
-
--#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
-+#if defined(__GLIBC_PREREQ)
-+#if __GLIBC_PREREQ(2, 10)
- namespace GTM HIDDEN {
-
- #ifdef __x86_64__
-@@ -101,5 +104,6 @@ static inline void set_abi_disp(struct a
-
- } // namespace GTM
- #endif /* >= GLIBC 2.10 */
-+#endif
-
- #endif // LIBITM_X86_TLS_H
diff --git a/toolchain/gcc/patches/4.9-linaro/206-musl_aarch64.patch b/toolchain/gcc/patches/4.9-linaro/206-musl_aarch64.patch
deleted file mode 100644
index caf42bf4e4..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/206-musl_aarch64.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/gcc/config/aarch64/aarch64-linux.h
-+++ b/gcc/config/aarch64/aarch64-linux.h
-@@ -23,6 +23,8 @@
-
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
-
-+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64.so.1"
-+
- #define CPP_SPEC "%{pthread:-D_REENTRANT}"
-
- #define LINUX_TARGET_LINK_SPEC "%{h*} \
diff --git a/toolchain/gcc/patches/4.9-linaro/207-musl_fixincludes.patch b/toolchain/gcc/patches/4.9-linaro/207-musl_fixincludes.patch
deleted file mode 100644
index e6fa47f7e6..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/207-musl_fixincludes.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/fixincludes/mkfixinc.sh
-+++ b/fixincludes/mkfixinc.sh
-@@ -19,7 +19,8 @@ case $machine in
- powerpc-*-eabi* | \
- powerpc-*-rtems* | \
- powerpcle-*-eabisim* | \
-- powerpcle-*-eabi* )
-+ powerpcle-*-eabi* | \
-+ *-musl* )
- # IF there is no include fixing,
- # THEN create a no-op fixer and exit
- (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
diff --git a/toolchain/gcc/patches/4.9-linaro/208-musl_gomp.patch b/toolchain/gcc/patches/4.9-linaro/208-musl_gomp.patch
deleted file mode 100644
index 84c781ee7d..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/208-musl_gomp.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/libgomp/config/posix/time.c
-+++ b/libgomp/config/posix/time.c
-@@ -28,6 +28,8 @@
- The following implementation uses the most simple POSIX routines.
- If present, POSIX 4 clocks should be used instead. */
-
-+#define _POSIX_C_SOURCE 199309L /* for clocks */
-+
- #include "libgomp.h"
- #include <unistd.h>
- #if TIME_WITH_SYS_TIME
diff --git a/toolchain/gcc/patches/4.9-linaro/209-musl_libstdc++.patch b/toolchain/gcc/patches/4.9-linaro/209-musl_libstdc++.patch
deleted file mode 100644
index 00d5d313db..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/209-musl_libstdc++.patch
+++ /dev/null
@@ -1,26 +0,0 @@
---- a/libstdc++-v3/configure.host
-+++ b/libstdc++-v3/configure.host
-@@ -263,6 +263,13 @@ case "${host_os}" in
- os_include_dir="os/bsd/freebsd"
- ;;
- gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
-+ # check for musl by target
-+ case "${host_os}" in
-+ *-musl*)
-+ os_include_dir="os/generic"
-+ ;;
-+ *)
-+
- if [ "$uclibc" = "yes" ]; then
- os_include_dir="os/uclibc"
- elif [ "$bionic" = "yes" ]; then
-@@ -271,6 +278,9 @@ case "${host_os}" in
- os_include_dir="os/gnu-linux"
- fi
- ;;
-+
-+ esac
-+ ;;
- hpux*)
- os_include_dir="os/hpux"
- ;;
diff --git a/toolchain/gcc/patches/4.9-linaro/210-disable_libsanitizer_off_t_check.patch b/toolchain/gcc/patches/4.9-linaro/210-disable_libsanitizer_off_t_check.patch
deleted file mode 100644
index 56084692a1..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/210-disable_libsanitizer_off_t_check.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/libsanitizer/interception/interception_type_test.cc
-+++ b/libsanitizer/interception/interception_type_test.cc
-@@ -31,7 +31,7 @@ COMPILER_CHECK(sizeof(OFF64_T) == sizeof
- // rest (they depend on _FILE_OFFSET_BITS setting when building an application).
- # if defined(__ANDROID__) || !defined _FILE_OFFSET_BITS || \
- _FILE_OFFSET_BITS != 64
--COMPILER_CHECK(sizeof(OFF_T) == sizeof(off_t));
-+// COMPILER_CHECK(sizeof(OFF_T) == sizeof(off_t));
- # endif
-
- #endif
diff --git a/toolchain/gcc/patches/4.9-linaro/220-musl_mips_softfloat.patch b/toolchain/gcc/patches/4.9-linaro/220-musl_mips_softfloat.patch
deleted file mode 100644
index 3b6b42a0a9..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/220-musl_mips_softfloat.patch
+++ /dev/null
@@ -1,8 +0,0 @@
---- a/gcc/config/mips/linux.h
-+++ b/gcc/config/mips/linux.h
-@@ -29,4 +29,4 @@ along with GCC; see the file COPYING3.
- #else
- #define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
- #endif
--#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/toolchain/gcc/patches/4.9-linaro/221-musl_mips64.patch b/toolchain/gcc/patches/4.9-linaro/221-musl_mips64.patch
deleted file mode 100644
index f10fc59d06..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/221-musl_mips64.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/gcc/config/mips/linux64.h
-+++ b/gcc/config/mips/linux64.h
-@@ -39,6 +39,16 @@ along with GCC; see the file COPYING3.
- "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}"
-
- #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
-+
-+#if TARGET_ENDIAN_DEFAULT == 0 /* LE */
-+#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}"
-+#else
-+#define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
-+#endif
-+
-+#define MUSL_DYNAMIC_LINKERN32 "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
-+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
-+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
- #define GNU_USER_DYNAMIC_LINKERN32 \
- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
-- BIONIC_DYNAMIC_LINKERN32)
-+ BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32)
diff --git a/toolchain/gcc/patches/4.9-linaro/800-arm_v5te_no_ldrd_strd.patch b/toolchain/gcc/patches/4.9-linaro/800-arm_v5te_no_ldrd_strd.patch
deleted file mode 100644
index 0edeb13c75..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/800-arm_v5te_no_ldrd_strd.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/gcc/config/arm/arm.h
-+++ b/gcc/config/arm/arm.h
-@@ -285,7 +285,7 @@ extern void (*arm_lang_output_object_att
- /* Thumb-1 only. */
- #define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm)
-
--#define TARGET_LDRD (arm_arch5e && ARM_DOUBLEWORD_ALIGN \
-+#define TARGET_LDRD (arm_arch6 && ARM_DOUBLEWORD_ALIGN \
- && !TARGET_THUMB1)
-
- #define TARGET_CRC32 (arm_arch_crc)
diff --git a/toolchain/gcc/patches/4.9-linaro/810-arm-softfloat-libgcc.patch b/toolchain/gcc/patches/4.9-linaro/810-arm-softfloat-libgcc.patch
deleted file mode 100644
index 1d06f5b2ec..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/810-arm-softfloat-libgcc.patch
+++ /dev/null
@@ -1,25 +0,0 @@
---- a/libgcc/config/arm/t-linux
-+++ b/libgcc/config/arm/t-linux
-@@ -1,6 +1,10 @@
- LIB1ASMSRC = arm/lib1funcs.S
- LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
-- _ctzsi2 _arm_addsubdf3 _arm_addsubsf3
-+ _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \
-+ _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \
-+ _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \
-+ _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \
-+ _arm_fixsfsi _arm_fixunssfsi
-
- # Just for these, we omit the frame pointer since it makes such a big
- # difference.
---- a/gcc/config/arm/linux-elf.h
-+++ b/gcc/config/arm/linux-elf.h
-@@ -60,8 +60,6 @@
- %{shared:-lc} \
- %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
-
--#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
--
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
-
- #define LINUX_TARGET_LINK_SPEC "%{h*} \
diff --git a/toolchain/gcc/patches/4.9-linaro/820-libgcc_pic.patch b/toolchain/gcc/patches/4.9-linaro/820-libgcc_pic.patch
deleted file mode 100644
index ebd87f5826..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/820-libgcc_pic.patch
+++ /dev/null
@@ -1,36 +0,0 @@
---- a/libgcc/Makefile.in
-+++ b/libgcc/Makefile.in
-@@ -881,11 +881,12 @@ $(libgcov-driver-objects): %$(objext): $
-
- # Static libraries.
- libgcc.a: $(libgcc-objects)
-+libgcc_pic.a: $(libgcc-s-objects)
- libgcov.a: $(libgcov-objects)
- libunwind.a: $(libunwind-objects)
- libgcc_eh.a: $(libgcc-eh-objects)
-
--libgcc.a libgcov.a libunwind.a libgcc_eh.a:
-+libgcc.a libgcov.a libunwind.a libgcc_eh.a libgcc_pic.a:
- -rm -f $@
-
- objects="$(objects)"; \
-@@ -907,7 +908,7 @@ libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_E
- endif
-
- ifeq ($(enable_shared),yes)
--all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
-+all: libgcc_eh.a libgcc_pic.a libgcc_s$(SHLIB_EXT)
- ifneq ($(LIBUNWIND),)
- all: libunwind$(SHLIB_EXT)
- endif
-@@ -1090,6 +1091,10 @@ install-shared:
- chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
- $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
-
-+ $(INSTALL_DATA) libgcc_pic.a $(mapfile) $(DESTDIR)$(inst_libdir)/
-+ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_pic.a
-+ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_pic.a
-+
- $(subst @multilib_dir@,$(MULTIDIR),$(subst \
- @shlib_base_name@,libgcc_s,$(subst \
- @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
diff --git a/toolchain/gcc/patches/4.9-linaro/830-arm_unbreak_armv4t.patch b/toolchain/gcc/patches/4.9-linaro/830-arm_unbreak_armv4t.patch
deleted file mode 100644
index 37f8f2a54d..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/830-arm_unbreak_armv4t.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-http://sourceware.org/ml/crossgcc/2008-05/msg00009.html
-
---- a/gcc/config/arm/linux-eabi.h
-+++ b/gcc/config/arm/linux-eabi.h
-@@ -45,7 +45,7 @@
- The ARM10TDMI core is the default for armv5t, so set
- SUBTARGET_CPU_DEFAULT to achieve this. */
- #undef SUBTARGET_CPU_DEFAULT
--#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
-+#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi
-
- /* TARGET_BIG_ENDIAN_DEFAULT is set in
- config.gcc for big endian configurations. */
diff --git a/toolchain/gcc/patches/4.9-linaro/840-armv4_pass_fix-v4bx_to_ld.patch b/toolchain/gcc/patches/4.9-linaro/840-armv4_pass_fix-v4bx_to_ld.patch
deleted file mode 100644
index cb1fb98235..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/840-armv4_pass_fix-v4bx_to_ld.patch
+++ /dev/null
@@ -1,19 +0,0 @@
---- a/gcc/config/arm/linux-eabi.h
-+++ b/gcc/config/arm/linux-eabi.h
-@@ -94,10 +94,15 @@
- #define MUSL_DYNAMIC_LINKER \
- "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
-
-+/* For armv4 we pass --fix-v4bx to linker to support EABI */
-+#undef TARGET_FIX_V4BX_SPEC
-+#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*"\
-+ "|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}"
-+
- /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
- use the GNU/Linux version, not the generic BPABI version. */
- #undef LINK_SPEC
--#define LINK_SPEC EABI_LINK_SPEC \
-+#define LINK_SPEC EABI_LINK_SPEC TARGET_FIX_V4BX_SPEC \
- LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
- LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
-
diff --git a/toolchain/gcc/patches/4.9-linaro/850-use_shared_libgcc.patch b/toolchain/gcc/patches/4.9-linaro/850-use_shared_libgcc.patch
deleted file mode 100644
index cef79d8206..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/850-use_shared_libgcc.patch
+++ /dev/null
@@ -1,47 +0,0 @@
---- a/gcc/config/arm/linux-eabi.h
-+++ b/gcc/config/arm/linux-eabi.h
-@@ -131,10 +131,6 @@
- #define ENDFILE_SPEC \
- LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC)
-
--/* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we
-- do not use -lfloat. */
--#undef LIBGCC_SPEC
--
- /* Clear the instruction cache from `beg' to `end'. This is
- implemented in lib1funcs.S, so ensure an error if this definition
- is used. */
---- a/gcc/config/linux.h
-+++ b/gcc/config/linux.h
-@@ -51,6 +51,10 @@ see the files COPYING3 and COPYING.RUNTI
- builtin_assert ("system=posix"); \
- } while (0)
-
-+#ifndef LIBGCC_SPEC
-+#define LIBGCC_SPEC "%{static|static-libgcc:-lgcc}%{!static:%{!static-libgcc:-lgcc_s}}"
-+#endif
-+
- /* Determine which dynamic linker to use depending on whether GLIBC or
- uClibc or Bionic is the default C library and whether
- -muclibc or -mglibc or -mbionic has been passed to change the default. */
---- a/libgcc/mkmap-symver.awk
-+++ b/libgcc/mkmap-symver.awk
-@@ -132,5 +132,5 @@ function output(lib) {
- else if (inherit[lib])
- printf("} %s;\n", inherit[lib]);
- else
-- printf ("\n local:\n\t*;\n};\n");
-+ printf ("\n\t*;\n};\n");
- }
---- a/gcc/config/rs6000/linux.h
-+++ b/gcc/config/rs6000/linux.h
-@@ -62,6 +62,9 @@
- #undef CPLUSPLUS_CPP_SPEC
- #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
-
-+#undef LIBGCC_SPEC
-+#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc"
-+
- #undef LINK_SHLIB_SPEC
- #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
-
diff --git a/toolchain/gcc/patches/4.9-linaro/851-libgcc_no_compat.patch b/toolchain/gcc/patches/4.9-linaro/851-libgcc_no_compat.patch
deleted file mode 100644
index 80c3476841..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/851-libgcc_no_compat.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/libgcc/config/t-libunwind
-+++ b/libgcc/config/t-libunwind
-@@ -2,8 +2,7 @@
-
- HOST_LIBGCC2_CFLAGS += -DUSE_GAS_SYMVER
-
--LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
-- $(srcdir)/unwind-compat.c $(srcdir)/unwind-dw2-fde-compat.c
-+LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
- LIB2ADDEHSTATIC = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
-
- # Override the default value from t-slibgcc-elf-ver and mention -lunwind
diff --git a/toolchain/gcc/patches/4.9-linaro/860-use_eh_frame.patch b/toolchain/gcc/patches/4.9-linaro/860-use_eh_frame.patch
deleted file mode 100644
index 1ac83fe4dc..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/860-use_eh_frame.patch
+++ /dev/null
@@ -1,42 +0,0 @@
---- a/libgcc/unwind-dw2-fde-dip.c
-+++ b/libgcc/unwind-dw2-fde-dip.c
-@@ -46,33 +46,13 @@
- #include "unwind-compat.h"
- #include "gthr.h"
-
--#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
-- && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
-- || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
--# define USE_PT_GNU_EH_FRAME
--#endif
--
--#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
-- && defined(__BIONIC__)
--# define USE_PT_GNU_EH_FRAME
--#endif
--
--#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
-- && defined(__FreeBSD__) && __FreeBSD__ >= 7
--# define ElfW __ElfN
--# define USE_PT_GNU_EH_FRAME
--#endif
--
--#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
-- && defined(__OpenBSD__)
--# define ElfW(type) Elf_##type
--# define USE_PT_GNU_EH_FRAME
--#endif
--
--#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
-- && defined(TARGET_DL_ITERATE_PHDR) \
-- && defined(__sun__) && defined(__svr4__)
-+#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR)
- # define USE_PT_GNU_EH_FRAME
-+# ifdef __OpenBSD__
-+# define ElfW(type) Elf_##type
-+# elif defined(__FreeBSD__) && __FreeBSD__ >= 7
-+# define ElfW __ElfN
-+# endif
- #endif
-
- #if defined(USE_PT_GNU_EH_FRAME)
diff --git a/toolchain/gcc/patches/4.9-linaro/870-ppc_no_crtsavres.patch b/toolchain/gcc/patches/4.9-linaro/870-ppc_no_crtsavres.patch
deleted file mode 100644
index 4e9b50c017..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/870-ppc_no_crtsavres.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/gcc/config/rs6000/rs6000.c
-+++ b/gcc/config/rs6000/rs6000.c
-@@ -20869,7 +20869,7 @@ rs6000_savres_strategy (rs6000_stack_t *
- /* Define cutoff for using out-of-line functions to save registers. */
- if (DEFAULT_ABI == ABI_V4 || TARGET_ELF)
- {
-- if (!optimize_size)
-+ if (1)
- {
- strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
- strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
diff --git a/toolchain/gcc/patches/4.9-linaro/880-no_java_section.patch b/toolchain/gcc/patches/4.9-linaro/880-no_java_section.patch
deleted file mode 100644
index def6c9f4a0..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/880-no_java_section.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/gcc/defaults.h
-+++ b/gcc/defaults.h
-@@ -380,7 +380,7 @@ see the files COPYING3 and COPYING.RUNTI
- /* If we have named section and we support weak symbols, then use the
- .jcr section for recording java classes which need to be registered
- at program start-up time. */
--#if defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
-+#if 0 && defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
- #ifndef JCR_SECTION_NAME
- #define JCR_SECTION_NAME ".jcr"
- #endif
diff --git a/toolchain/gcc/patches/4.9-linaro/900-bad-mips16-crt.patch b/toolchain/gcc/patches/4.9-linaro/900-bad-mips16-crt.patch
deleted file mode 100644
index dd6e9dc889..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/900-bad-mips16-crt.patch
+++ /dev/null
@@ -1,9 +0,0 @@
---- a/libgcc/config/mips/t-mips16
-+++ b/libgcc/config/mips/t-mips16
-@@ -43,3 +43,6 @@ SYNC_CFLAGS = -mno-mips16
-
- # Version these symbols if building libgcc.so.
- SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
-+
-+CRTSTUFF_T_CFLAGS += -mno-mips16
-+CRTSTUFF_T_CFLAGS_S += -mno-mips16
diff --git a/toolchain/gcc/patches/4.9-linaro/910-mbsd_multi.patch b/toolchain/gcc/patches/4.9-linaro/910-mbsd_multi.patch
deleted file mode 100644
index 0f69981641..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/910-mbsd_multi.patch
+++ /dev/null
@@ -1,232 +0,0 @@
-
- This patch brings over a few features from MirBSD:
- * -fhonour-copts
- If this option is not given, it's warned (depending
- on environment variables). This is to catch errors
- of misbuilt packages which override CFLAGS themselves.
- * -Werror-maybe-reset
- Has the effect of -Wno-error if GCC_NO_WERROR is
- set and not '0', a no-operation otherwise. This is
- to be able to use -Werror in "make" but prevent
- GNU autoconf generated configure scripts from
- freaking out.
-
- This patch was authored by Thorsten Glaser <tg at mirbsd.de>
- with copyright assignment to the FSF in effect.
-
---- a/gcc/c-family/c-opts.c
-+++ b/gcc/c-family/c-opts.c
-@@ -105,6 +105,9 @@ static size_t include_cursor;
- /* Whether any standard preincluded header has been preincluded. */
- static bool done_preinclude;
-
-+/* Check if a port honours COPTS. */
-+static int honour_copts = 0;
-+
- static void handle_OPT_d (const char *);
- static void set_std_cxx98 (int);
- static void set_std_cxx11 (int);
-@@ -384,6 +387,9 @@ c_common_handle_option (size_t scode, co
- cpp_opts->warn_endif_labels = value;
- break;
-
-+ case OPT_Werror_maybe_reset:
-+ break;
-+
- case OPT_Winvalid_pch:
- cpp_opts->warn_invalid_pch = value;
- break;
-@@ -492,6 +498,12 @@ c_common_handle_option (size_t scode, co
- flag_no_builtin = !value;
- break;
-
-+ case OPT_fhonour_copts:
-+ if (c_language == clk_c) {
-+ honour_copts++;
-+ }
-+ break;
-+
- case OPT_fconstant_string_class_:
- constant_string_class_name = arg;
- break;
-@@ -1048,6 +1060,47 @@ c_common_init (void)
- return false;
- }
-
-+ if (c_language == clk_c) {
-+ char *ev = getenv ("GCC_HONOUR_COPTS");
-+ int evv;
-+ if (ev == NULL)
-+ evv = -1;
-+ else if ((*ev == '0') || (*ev == '\0'))
-+ evv = 0;
-+ else if (*ev == '1')
-+ evv = 1;
-+ else if (*ev == '2')
-+ evv = 2;
-+ else if (*ev == 's')
-+ evv = -1;
-+ else {
-+ warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
-+ evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */
-+ }
-+ if (evv == 1) {
-+ if (honour_copts == 0) {
-+ error ("someone does not honour COPTS at all in lenient mode");
-+ return false;
-+ } else if (honour_copts != 1) {
-+ warning (0, "someone does not honour COPTS correctly, passed %d times",
-+ honour_copts);
-+ }
-+ } else if (evv == 2) {
-+ if (honour_copts == 0) {
-+ error ("someone does not honour COPTS at all in strict mode");
-+ return false;
-+ } else if (honour_copts != 1) {
-+ error ("someone does not honour COPTS correctly, passed %d times",
-+ honour_copts);
-+ return false;
-+ }
-+ } else if (evv == 0) {
-+ if (honour_copts != 1)
-+ inform (0, "someone does not honour COPTS correctly, passed %d times",
-+ honour_copts);
-+ }
-+ }
-+
- return true;
- }
-
---- a/gcc/c-family/c.opt
-+++ b/gcc/c-family/c.opt
-@@ -391,6 +391,10 @@ Wfloat-conversion
- C ObjC C++ ObjC++ Var(warn_float_conversion) LangEnabledBy(C ObjC C++ ObjC++,Wconversion)
- Warn for implicit type conversions that cause loss of floating point precision
-
-+Werror-maybe-reset
-+C ObjC C++ ObjC++
-+; Documented in common.opt
-+
- Wfloat-equal
- C ObjC C++ ObjC++ Var(warn_float_equal) Warning
- Warn if testing floating point numbers for equality
-@@ -972,6 +976,9 @@ C++ ObjC++ Optimization Alias(fexception
- fhonor-std
- C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
-
-+fhonour-copts
-+C ObjC C++ ObjC++ RejectNegative
-+
- fhosted
- C ObjC
- Assume normal C execution environment
---- a/gcc/common.opt
-+++ b/gcc/common.opt
-@@ -549,6 +549,10 @@ Werror=
- Common Joined
- Treat specified warning as error
-
-+Werror-maybe-reset
-+Common
-+If environment variable GCC_NO_WERROR is set, act as -Wno-error
-+
- Wextra
- Common Var(extra_warnings) Warning
- Print extra (possibly unwanted) warnings
-@@ -1287,6 +1291,9 @@ fguess-branch-probability
- Common Report Var(flag_guess_branch_prob) Optimization
- Enable guessing of branch probabilities
-
-+fhonour-copts
-+Common RejectNegative
-+
- ; Nonzero means ignore `#ident' directives. 0 means handle them.
- ; Generate position-independent code for executables if possible
- ; On SVR4 targets, it also controls whether or not to emit a
---- a/gcc/opts.c
-+++ b/gcc/opts.c
-@@ -1572,6 +1572,17 @@ common_handle_option (struct gcc_options
- opts, opts_set, loc, dc);
- break;
-
-+ case OPT_Werror_maybe_reset:
-+ {
-+ char *ev = getenv ("GCC_NO_WERROR");
-+ if ((ev != NULL) && (*ev != '0'))
-+ warnings_are_errors = 0;
-+ }
-+ break;
-+
-+ case OPT_fhonour_copts:
-+ break;
-+
- case OPT_Wlarger_than_:
- opts->x_larger_than_size = value;
- opts->x_warn_larger_than = value != -1;
---- a/gcc/doc/cppopts.texi
-+++ b/gcc/doc/cppopts.texi
-@@ -163,6 +163,11 @@ in older programs. This warning is on b
- Make all warnings into hard errors. Source code which triggers warnings
- will be rejected.
-
-+ at item -Werror-maybe-reset
-+ at opindex Werror-maybe-reset
-+Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
-+variable is set to anything other than 0 or empty.
-+
- @item -Wsystem-headers
- @opindex Wsystem-headers
- Issue warnings for code in system headers. These are normally unhelpful
---- a/gcc/doc/invoke.texi
-+++ b/gcc/doc/invoke.texi
-@@ -243,7 +243,7 @@ Objective-C and Objective-C++ Dialects}.
- -Wconversion -Wcoverage-mismatch -Wdate-time -Wdelete-incomplete -Wno-cpp @gol
- -Wno-deprecated -Wno-deprecated-declarations -Wdisabled-optimization @gol
- -Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol
---Wno-endif-labels -Werror -Werror=* @gol
-+-Wno-endif-labels -Werror -Werror=* -Werror-maybe-reset @gol
- -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
- -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
- -Wformat-security -Wformat-y2k @gol
-@@ -5042,6 +5042,22 @@ This option is only supported for C and
- @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
- @option{-Wno-pointer-sign}.
-
-+ at item -Werror-maybe-reset
-+ at opindex Werror-maybe-reset
-+Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
-+variable is set to anything other than 0 or empty.
-+
-+ at item -fhonour-copts
-+ at opindex fhonour-copts
-+If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
-+given at least once, and warn if it is given more than once.
-+If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
-+given exactly once.
-+If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
-+is not given exactly once.
-+The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}.
-+This flag and environment variable only affect the C language.
-+
- @item -Wstack-protector
- @opindex Wstack-protector
- @opindex Wno-stack-protector
-@@ -7194,7 +7210,7 @@ so, the first branch is redirected to ei
- second branch or a point immediately following it, depending on whether
- the condition is known to be true or false.
-
--Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
-+Enabled at levels @option{-O3}.
-
- @item -fsplit-wide-types
- @opindex fsplit-wide-types
---- a/gcc/java/jvspec.c
-+++ b/gcc/java/jvspec.c
-@@ -626,6 +626,7 @@ lang_specific_pre_link (void)
- class name. Append dummy `.c' that can be stripped by set_input so %b
- is correct. */
- set_input (concat (main_class_name, "main.c", NULL));
-+ putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack! */
- err = do_spec (jvgenmain_spec);
- if (err == 0)
- {
diff --git a/toolchain/gcc/patches/4.9-linaro/920-specs_nonfatal_getenv.patch b/toolchain/gcc/patches/4.9-linaro/920-specs_nonfatal_getenv.patch
deleted file mode 100644
index 75379e494c..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/920-specs_nonfatal_getenv.patch
+++ /dev/null
@@ -1,14 +0,0 @@
---- a/gcc/gcc.c
-+++ b/gcc/gcc.c
-@@ -8105,7 +8105,10 @@ getenv_spec_function (int argc, const ch
-
- value = getenv (argv[0]);
- if (!value)
-- fatal_error ("environment variable %qs not defined", argv[0]);
-+ {
-+ warning (0, "environment variable %qs not defined", argv[0]);
-+ value = "";
-+ }
-
- /* We have to escape every character of the environment variable so
- they are not interpreted as active spec characters. A
diff --git a/toolchain/gcc/patches/4.9-linaro/930-fix-mips-noexecstack.patch b/toolchain/gcc/patches/4.9-linaro/930-fix-mips-noexecstack.patch
deleted file mode 100644
index 8d94933ce9..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/930-fix-mips-noexecstack.patch
+++ /dev/null
@@ -1,111 +0,0 @@
-From da45b3fde60095756f5f6030f6012c23a3d34429 Mon Sep 17 00:00:00 2001
-From: Andrew McDonnell <bugs@andrewmcdonnell.net>
-Date: Fri, 3 Oct 2014 19:09:00 +0930
-Subject: Add .note.GNU-stack section
-
-See http://lists.busybox.net/pipermail/uclibc/2014-October/048671.html
-Below copied from https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02430.html
-
-Re: [Patch, MIPS] Add .note.GNU-stack section
-
- From: Steve Ellcey <sellcey at mips dot com>
-
-On Wed, 2014-09-10 at 10:15 -0700, Eric Christopher wrote:
->
->
-> On Wed, Sep 10, 2014 at 9:27 AM, <pinskia@gmail.com> wrote:
-
-> This works except you did not update the assembly files in
-> libgcc or glibc. We (Cavium) have the same patch in our tree
-> for a few released versions.
-
-> Mind just checking yours in then Andrew?
-
-> Thanks!
-> -eric
-
-I talked to Andrew about what files he changed in GCC and created and
-tested this new patch. Andrew also mentioned changing some assembly
-files in glibc but I don't see any use of '.section .note.GNU-stack' in
-any assembly files in glibc (for any platform) so I wasn't planning on
-creating a glibc to add them to mips glibc assembly language files.
-
-OK to check in this patch?
-
-Steve Ellcey
-sellcey@mips.com
-
-
-
-2014-09-26 Steve Ellcey <sellcey@mips.com>
----
- gcc/config/mips/mips.c | 3 +++
- libgcc/config/mips/crti.S | 4 ++++
- libgcc/config/mips/crtn.S | 3 +++
- libgcc/config/mips/mips16.S | 4 ++++
- libgcc/config/mips/vr4120-div.S | 4 ++++
- 5 files changed, 18 insertions(+)
-
---- a/gcc/config/mips/mips.c
-+++ b/gcc/config/mips/mips.c
-@@ -19142,6 +19142,9 @@ mips_atomic_assign_expand_fenv (tree *ho
- #define TARGET_USE_BY_PIECES_INFRASTRUCTURE_P \
- mips_use_by_pieces_infrastructure_p
-
-+#undef TARGET_ASM_FILE_END
-+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
-+
- struct gcc_target targetm = TARGET_INITIALIZER;
-
- #include "gt-mips.h"
---- a/libgcc/config/mips/crti.S
-+++ b/libgcc/config/mips/crti.S
-@@ -21,6 +21,10 @@ a copy of the GCC Runtime Library Except
- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- <http://www.gnu.org/licenses/>. */
-
-+
-+/* An executable stack is *not* required for these functions. */
-+ .section .note.GNU-stack,"",%progbits
-+
- /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack.
- Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */
-
---- a/libgcc/config/mips/crtn.S
-+++ b/libgcc/config/mips/crtn.S
-@@ -21,6 +21,9 @@ a copy of the GCC Runtime Library Except
- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- <http://www.gnu.org/licenses/>. */
-
-+/* An executable stack is *not* required for these functions. */
-+ .section .note.GNU-stack,"",%progbits
-+
- /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack.
- Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */
-
---- a/libgcc/config/mips/mips16.S
-+++ b/libgcc/config/mips/mips16.S
-@@ -35,6 +35,10 @@ see the files COPYING3 and COPYING.RUNTI
- values using the soft-float calling convention, but do the actual
- operation using the hard floating point instructions. */
-
-+/* An executable stack is *not* required for these functions. */
-+ .section .note.GNU-stack,"",%progbits
-+ .previous
-+
- #if defined _MIPS_SIM && (_MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIO64)
-
- /* This file contains 32-bit assembly code. */
---- a/libgcc/config/mips/vr4120-div.S
-+++ b/libgcc/config/mips/vr4120-div.S
-@@ -26,6 +26,10 @@ see the files COPYING3 and COPYING.RUNTI
- -mfix-vr4120. div and ddiv do not give the correct result when one
- of the operands is negative. */
-
-+/* An executable stack is *not* required for these functions. */
-+ .section .note.GNU-stack,"",%progbits
-+ .previous
-+
- .set nomips16
-
- #define DIV \
diff --git a/toolchain/gcc/patches/4.9-linaro/940-no-clobber-stamp-bits.patch b/toolchain/gcc/patches/4.9-linaro/940-no-clobber-stamp-bits.patch
deleted file mode 100644
index 32417942af..0000000000
--- a/toolchain/gcc/patches/4.9-linaro/940-no-clobber-stamp-bits.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/libstdc++-v3/include/Makefile.in
-+++ b/libstdc++-v3/include/Makefile.in
-@@ -1366,7 +1366,7 @@ stamp-bits: ${bits_headers}
- @$(STAMP) stamp-bits
-
- stamp-bits-sup: stamp-bits ${bits_sup_headers}
-- @-cd ${bits_builddir} && $(LN_S) $? . 2>/dev/null
-+ @-cd ${bits_builddir} && $(LN_S) $(filter-out stamp-bits,$?) . 2>/dev/null
- @$(STAMP) stamp-bits-sup
-
- stamp-c_base: ${c_base_headers}