summaryrefslogtreecommitdiffstats
path: root/toolchain/gcc
diff options
context:
space:
mode:
authorRoman Yeryomin <roman@advem.lv>2013-05-26 01:02:55 +0300
committerRoman Yeryomin <roman@advem.lv>2013-05-26 01:02:55 +0300
commit342045a35b1981a89e4bc80842b10c065e1050da (patch)
tree4140720b20e8d641c11da882010d6130a75fef21 /toolchain/gcc
parent7338133dde8238afce34676214b494c8db96689b (diff)
parent1a116ce7818ecee5d167a9c0ebb1a0feca9120e6 (diff)
Merge trunk into realtek-unstable
Conflicts: Config.in feeds.conf.default package/base-files/files/etc/hotplug2-common.rules package/network/config/netifd/files/etc/init.d/network
Diffstat (limited to 'toolchain/gcc')
-rw-r--r--toolchain/gcc/Config.in53
-rw-r--r--toolchain/gcc/Config.version44
-rw-r--r--toolchain/gcc/common.mk70
-rw-r--r--toolchain/gcc/final/Makefile10
-rw-r--r--toolchain/gcc/initial/Makefile4
-rw-r--r--toolchain/gcc/minimal/Makefile5
-rw-r--r--toolchain/gcc/patches/4.5-linaro/100-uclibc-conf.patch33
-rw-r--r--toolchain/gcc/patches/4.5-linaro/200-musl.patch242
-rw-r--r--toolchain/gcc/patches/4.5-linaro/200-ppc_include_config_linux_h.patch11
-rw-r--r--toolchain/gcc/patches/4.5-linaro/301-missing-execinfo_h.patch11
-rw-r--r--toolchain/gcc/patches/4.5-linaro/302-c99-snprintf.patch11
-rw-r--r--toolchain/gcc/patches/4.5-linaro/305-libmudflap-susv3-legacy.patch47
-rw-r--r--toolchain/gcc/patches/4.5-linaro/810-arm-softfloat-libgcc.patch26
-rw-r--r--toolchain/gcc/patches/4.5-linaro/820-libgcc_pic.patch36
-rw-r--r--toolchain/gcc/patches/4.5-linaro/830-arm_unbreak_armv4t.patch13
-rw-r--r--toolchain/gcc/patches/4.5-linaro/840-armv4_pass_fix-v4bx_to_ld.patch18
-rw-r--r--toolchain/gcc/patches/4.5-linaro/910-mbsd_multi.patch253
-rw-r--r--toolchain/gcc/patches/4.5-linaro/920-specs_nonfatal_getenv.patch14
-rw-r--r--toolchain/gcc/patches/4.5-linaro/993-arm_insn-opinit-RTX_CODE-fixup.patch14
-rw-r--r--toolchain/gcc/patches/4.5-linaro/995-fa526.patch257
-rw-r--r--toolchain/gcc/patches/4.5-linaro/999-coldfire.patch10
-rw-r--r--toolchain/gcc/patches/4.6-linaro/010-documentation.patch23
-rw-r--r--toolchain/gcc/patches/4.6-linaro/020-gcc_bug_54295.patch70
-rw-r--r--toolchain/gcc/patches/4.6-linaro/200-musl.patch57
-rw-r--r--toolchain/gcc/patches/4.6-linaro/830-arm_unbreak_armv4t.patch2
-rw-r--r--toolchain/gcc/patches/4.6-linaro/840-armv4_pass_fix-v4bx_to_ld.patch6
-rw-r--r--toolchain/gcc/patches/4.6-linaro/850-use_shared_libgcc.patch4
-rw-r--r--toolchain/gcc/patches/4.6-linaro/860-uclibc_use_eh_frame.patch2
-rw-r--r--toolchain/gcc/patches/4.6-linaro/870-ppc_no_crtsavres.patch2
-rw-r--r--toolchain/gcc/patches/4.6-linaro/900-bad-mips16-crt9
-rw-r--r--toolchain/gcc/patches/4.6-linaro/910-mbsd_multi.patch4
-rw-r--r--toolchain/gcc/patches/4.6-linaro/999-coldfire.patch2
-rw-r--r--toolchain/gcc/patches/4.6.2/000-gcc-bug-54369.patch45
-rw-r--r--toolchain/gcc/patches/4.6.2/002-siginfo_t.patch157
-rw-r--r--toolchain/gcc/patches/4.6.2/200-musl.patch231
-rw-r--r--toolchain/gcc/patches/4.6.2/301-missing-execinfo_h.patch11
-rw-r--r--toolchain/gcc/patches/4.6.2/302-c99-snprintf.patch11
-rw-r--r--toolchain/gcc/patches/4.6.2/305-libmudflap-susv3-legacy.patch47
-rw-r--r--toolchain/gcc/patches/4.6.2/810-arm-softfloat-libgcc.patch26
-rw-r--r--toolchain/gcc/patches/4.6.2/910-mbsd_multi.patch253
-rw-r--r--toolchain/gcc/patches/4.6.2/920-specs_nonfatal_getenv.patch14
-rw-r--r--toolchain/gcc/patches/4.6.2/993-arm_insn-opinit-RTX_CODE-fixup.patch15
-rw-r--r--toolchain/gcc/patches/4.6.2/999-coldfire.patch10
-rw-r--r--toolchain/gcc/patches/4.6.3/000-gcc-bug-54369.patch13
-rw-r--r--toolchain/gcc/patches/4.6.3/002-siginfo_t.patch60
-rw-r--r--toolchain/gcc/patches/4.6.3/010-documentation.patch23
-rw-r--r--toolchain/gcc/patches/4.6.3/200-musl.patch47
-rw-r--r--toolchain/gcc/patches/4.6.3/840-armv4_pass_fix-v4bx_to_ld.patch6
-rw-r--r--toolchain/gcc/patches/4.6.3/999-coldfire.patch2
-rw-r--r--toolchain/gcc/patches/4.7-linaro/301-missing-execinfo_h.patch11
-rw-r--r--toolchain/gcc/patches/4.7-linaro/302-c99-snprintf.patch11
-rw-r--r--toolchain/gcc/patches/4.7-linaro/305-libmudflap-susv3-legacy.patch47
-rw-r--r--toolchain/gcc/patches/4.7-linaro/820-libgcc_pic.patch36
-rw-r--r--toolchain/gcc/patches/4.7-linaro/870-ppc_no_crtsavres.patch20
-rw-r--r--toolchain/gcc/patches/4.7-linaro/993-arm_insn-opinit-RTX_CODE-fixup.patch16
-rw-r--r--toolchain/gcc/patches/4.7-linaro/999-coldfire.patch10
-rw-r--r--toolchain/gcc/patches/4.7.2/100-uclibc-conf.patch33
-rw-r--r--toolchain/gcc/patches/4.7.2/301-missing-execinfo_h.patch11
-rw-r--r--toolchain/gcc/patches/4.7.2/302-c99-snprintf.patch11
-rw-r--r--toolchain/gcc/patches/4.7.2/305-libmudflap-susv3-legacy.patch47
-rw-r--r--toolchain/gcc/patches/4.7.2/830-arm_unbreak_armv4t.patch13
-rw-r--r--toolchain/gcc/patches/4.7.2/840-armv4_pass_fix-v4bx_to_ld.patch19
-rw-r--r--toolchain/gcc/patches/4.7.2/870-ppc_no_crtsavres.patch20
-rw-r--r--toolchain/gcc/patches/4.7.2/993-arm_insn-opinit-RTX_CODE-fixup.patch16
-rw-r--r--toolchain/gcc/patches/4.7.2/999-coldfire.patch10
-rw-r--r--toolchain/gcc/patches/4.8-linaro/010-documentation.patch23
-rw-r--r--toolchain/gcc/patches/4.8-linaro/100-uclibc-conf.patch (renamed from toolchain/gcc/patches/4.6.2/100-uclibc-conf.patch)0
-rw-r--r--toolchain/gcc/patches/4.8-linaro/200-musl.patch (renamed from toolchain/gcc/patches/4.7.2/200-musl.patch)96
-rw-r--r--toolchain/gcc/patches/4.8-linaro/810-arm-softfloat-libgcc.patch (renamed from toolchain/gcc/patches/4.7-linaro/810-arm-softfloat-libgcc.patch)11
-rw-r--r--toolchain/gcc/patches/4.8-linaro/820-libgcc_pic.patch (renamed from toolchain/gcc/patches/4.7.2/820-libgcc_pic.patch)6
-rw-r--r--toolchain/gcc/patches/4.8-linaro/830-arm_unbreak_armv4t.patch (renamed from toolchain/gcc/patches/4.6.2/830-arm_unbreak_armv4t.patch)0
-rw-r--r--toolchain/gcc/patches/4.8-linaro/840-armv4_pass_fix-v4bx_to_ld.patch (renamed from toolchain/gcc/patches/4.7-linaro/840-armv4_pass_fix-v4bx_to_ld.patch)6
-rw-r--r--toolchain/gcc/patches/4.8-linaro/850-use_shared_libgcc.patch (renamed from toolchain/gcc/patches/4.5-linaro/850-use_shared_libgcc.patch)40
-rw-r--r--toolchain/gcc/patches/4.8-linaro/860-uclibc_use_eh_frame.patch29
-rw-r--r--toolchain/gcc/patches/4.8-linaro/870-ppc_no_crtsavres.patch11
-rw-r--r--toolchain/gcc/patches/4.8-linaro/900-bad-mips16-crt.patch9
-rw-r--r--toolchain/gcc/patches/4.8-linaro/910-mbsd_multi.patch (renamed from toolchain/gcc/patches/4.7-linaro/910-mbsd_multi.patch)44
-rw-r--r--toolchain/gcc/patches/4.8-linaro/920-specs_nonfatal_getenv.patch (renamed from toolchain/gcc/patches/4.7-linaro/920-specs_nonfatal_getenv.patch)2
-rw-r--r--toolchain/gcc/patches/4.8.0/010-documentation.patch23
-rw-r--r--toolchain/gcc/patches/4.8.0/100-uclibc-conf.patch (renamed from toolchain/gcc/patches/4.7-linaro/100-uclibc-conf.patch)0
-rw-r--r--toolchain/gcc/patches/4.8.0/200-musl.patch (renamed from toolchain/gcc/patches/4.7-linaro/200-musl.patch)77
-rw-r--r--toolchain/gcc/patches/4.8.0/810-arm-softfloat-libgcc.patch (renamed from toolchain/gcc/patches/4.7.2/810-arm-softfloat-libgcc.patch)15
-rw-r--r--toolchain/gcc/patches/4.8.0/820-libgcc_pic.patch (renamed from toolchain/gcc/patches/4.6.2/820-libgcc_pic.patch)6
-rw-r--r--toolchain/gcc/patches/4.8.0/830-arm_unbreak_armv4t.patch (renamed from toolchain/gcc/patches/4.7-linaro/830-arm_unbreak_armv4t.patch)0
-rw-r--r--toolchain/gcc/patches/4.8.0/840-armv4_pass_fix-v4bx_to_ld.patch (renamed from toolchain/gcc/patches/4.6.2/840-armv4_pass_fix-v4bx_to_ld.patch)6
-rw-r--r--toolchain/gcc/patches/4.8.0/850-use_shared_libgcc.patch58
-rw-r--r--toolchain/gcc/patches/4.8.0/860-uclibc_use_eh_frame.patch29
-rw-r--r--toolchain/gcc/patches/4.8.0/870-ppc_no_crtsavres.patch11
-rw-r--r--toolchain/gcc/patches/4.8.0/900-bad-mips16-crt.patch9
-rw-r--r--toolchain/gcc/patches/4.8.0/910-mbsd_multi.patch (renamed from toolchain/gcc/patches/4.7.2/910-mbsd_multi.patch)44
-rw-r--r--toolchain/gcc/patches/4.8.0/920-specs_nonfatal_getenv.patch (renamed from toolchain/gcc/patches/4.7.2/920-specs_nonfatal_getenv.patch)2
-rw-r--r--toolchain/gcc/patches/llvm/100-uclibc-conf.patch200
-rw-r--r--toolchain/gcc/patches/llvm/200-uclibc-locale.patch2790
-rw-r--r--toolchain/gcc/patches/llvm/203-uclibc-locale-no__x.patch213
-rw-r--r--toolchain/gcc/patches/llvm/204-uclibc-locale-wchar_fix.patch48
-rw-r--r--toolchain/gcc/patches/llvm/205-uclibc-locale-update.patch347
-rw-r--r--toolchain/gcc/patches/llvm/300-libstdc++-pic.patch50
-rw-r--r--toolchain/gcc/patches/llvm/301-missing-execinfo_h.patch11
-rw-r--r--toolchain/gcc/patches/llvm/302-c99-snprintf.patch11
-rw-r--r--toolchain/gcc/patches/llvm/303-c99-complex-ugly-hack.patch12
-rw-r--r--toolchain/gcc/patches/llvm/304-index_macro.patch24
-rw-r--r--toolchain/gcc/patches/llvm/305-libmudflap-susv3-legacy.patch47
-rw-r--r--toolchain/gcc/patches/llvm/306-libstdc++-namespace.patch34
-rw-r--r--toolchain/gcc/patches/llvm/307-locale_facets.patch26
-rw-r--r--toolchain/gcc/patches/llvm/402-libbackend_dep_gcov-iov.h.patch11
-rw-r--r--toolchain/gcc/patches/llvm/800-arm-bigendian.patch67
-rw-r--r--toolchain/gcc/patches/llvm/904-flatten-switch-stmt-00.patch72
-rw-r--r--toolchain/gcc/patches/llvm/910-mbsd_multi.patch278
-rw-r--r--toolchain/gcc/patches/llvm/910-soft-float.patch25
-rw-r--r--toolchain/gcc/patches/llvm/920-soft-float.patch22
-rw-r--r--toolchain/gcc/patches/llvm/930-eabi_fixes.patch32
-rw-r--r--toolchain/gcc/patches/llvm/951-bug_37014.patch76
-rw-r--r--toolchain/gcc/patches/llvm/952-bug_34762.patch49
-rw-r--r--toolchain/gcc/patches/llvm/960-apple_no_m32.patch28
-rw-r--r--toolchain/gcc/patches/llvm/961-llvm_mips_compile_fix.patch16
115 files changed, 628 insertions, 7083 deletions
diff --git a/toolchain/gcc/Config.in b/toolchain/gcc/Config.in
index b5218aee3..f87d62792 100644
--- a/toolchain/gcc/Config.in
+++ b/toolchain/gcc/Config.in
@@ -2,48 +2,42 @@
choice
prompt "GCC compiler Version" if TOOLCHAINOPTS
- default GCC_VERSION_4_4_7 if GCC_DEFAULT_VERSION_4_4_7
- default GCC_VERSION_4_6_LINARO
+ default GCC_USE_VERSION_4_4_7 if avr32
+ default GCC_USE_VERSION_4_6_LINARO
help
Select the version of gcc you wish to use.
- config GCC_VERSION_4_4_7
+ config GCC_USE_VERSION_4_4_7
+ select GCC_VERSION_4_4_7
bool "gcc 4.4.7"
- depends avr32
+ depends on avr32
- config GCC_VERSION_4_6_2
- bool "gcc 4.6.2"
-
- config GCC_VERSION_4_6_3
+ config GCC_USE_VERSION_4_6_3
+ select GCC_VERSION_4_6_3
bool "gcc 4.6.3"
- config GCC_VERSION_4_7_2
- bool "gcc 4.7.2"
-
- config GCC_VERSION_4_5_LINARO
- bool "gcc 4.5.x with Linaro enhancements"
+ config GCC_USE_VERSION_4_8_0
+ select GCC_VERSION_4_8_0
+ bool "gcc 4.8.0"
- config GCC_VERSION_4_6_LINARO
+ config GCC_USE_VERSION_4_6_LINARO
+ select GCC_VERSION_4_6_LINARO
bool "gcc 4.6.x with Linaro enhancements"
- config GCC_VERSION_4_7_LINARO
- bool "gcc 4.7.x with Linaro enhancements"
-
- config GCC_VERSION_LLVM
- bool "llvm-gcc 4.2"
- depends BROKEN
+ config GCC_USE_VERSION_4_8_LINARO
+ select GCC_VERSION_4_8_LINARO
+ bool "gcc 4.8.x with Linaro enhancements"
endchoice
config GCC_USE_GRAPHITE
bool
prompt "Compile in support for the new Graphite framework in GCC 4.4+" if TOOLCHAINOPTS
- depends !GCC_VERSION_LLVM
config GCC_USE_SYSTEM_PPL_CLOOG
bool
prompt "Use the system versions of PPL and CLooG"
- depends GCC_USE_GRAPHITE
+ depends on GCC_USE_GRAPHITE
default n
config EXTRA_GCC_CONFIG_OPTIONS
@@ -60,13 +54,6 @@ config SSP_SUPPORT
help
Enable Stack-Smashing Protection support
-config TLS_SUPPORT
- bool
- prompt "Enable Thread-local storage (TLS) support" if TOOLCHAINOPTS
- default n
- help
- Enable Thread-local storage support
-
config SJLJ_EXCEPTIONS
bool
prompt "Use setjump()/longjump() exceptions" if TOOLCHAINOPTS
@@ -76,16 +63,8 @@ config SJLJ_EXCEPTIONS
frame unwinding exceptions handling routines. Warning: increases
code size and runtime memory usage.
-config INSTALL_LIBSTDCPP
- bool
- prompt "Build/install c++ compiler and libstdc++?" if TOOLCHAINOPTS
- default y if !USE_MUSL
- help
- Build/install c++ compiler and libstdc++?
-
config INSTALL_LIBGCJ
bool
- depends on !GCC_VERSION_LLVM
prompt "Build/install java compiler and GNU classpath ?" if TOOLCHAINOPTS
default n
help
diff --git a/toolchain/gcc/Config.version b/toolchain/gcc/Config.version
index a47343039..167da7616 100644
--- a/toolchain/gcc/Config.version
+++ b/toolchain/gcc/Config.version
@@ -1,52 +1,38 @@
-config GCC_DEFAULT_VERSION
+config GCC_VERSION_4_4_7
+ default y if (!TOOLCHAINOPTS && avr32)
bool
-config GCC_DEFAULT_VERSION_4_4_7
- select GCC_DEFAULT_VERSION
- default y if avr32
+config GCC_VERSION_4_6_3
bool
-config GCC_DEFAULT_VERSION_4_6_LINARO
- default y if !(GCC_DEFAULT_VERSION)
+config GCC_VERSION_4_6_LINARO
+ default y if (!TOOLCHAINOPTS && !avr32)
bool
+config GCC_VERSION_4_8_LINARO
+ bool
+
+config GCC_VERSION_4_8_0
+ bool
config GCC_VERSION
string
default "4.4.7" if GCC_VERSION_4_4_7
- default "4.6.2" if GCC_VERSION_4_6_2
default "4.6.3" if GCC_VERSION_4_6_3
- default "4.7.2" if GCC_VERSION_4_7_2
- default "4.5-linaro" if GCC_VERSION_4_5_LINARO
+ default "4.8.0" if GCC_VERSION_4_8_0
default "4.6-linaro" if GCC_VERSION_4_6_LINARO
- default "4.7-linaro" if GCC_VERSION_4_7_LINARO
- default "llvm" if GCC_VERSION_LLVM
+ default "4.8-linaro" if GCC_VERSION_4_8_LINARO
default "4.6-linaro"
config GCC_VERSION_4_4
bool
default y if GCC_VERSION_4_4_7
-config GCC_VERSION_4_5
- bool
- default y if GCC_VERSION_4_5_LINARO
-
config GCC_VERSION_4_6
bool
- default y if (GCC_VERSION_4_6_2 || GCC_VERSION_4_6_3 || GCC_VERSION_4_6_LINARO)
+ default y if (GCC_VERSION_4_6_3 || GCC_VERSION_4_6_LINARO)
-config GCC_VERSION_4_7
+config GCC_VERSION_4_8
bool
- default y if (GCC_VERSION_4_7_2 || GCC_VERSION_4_7_LINARO)
-
-if !TOOLCHAINOPTS
-
- config GCC_VERSION_4_4_7
- default y if GCC_DEFAULT_VERSION_4_4_7
- bool
-
- config GCC_VERSION_4_6_LINARO
- default y if GCC_DEFAULT_VERSION_4_6_LINARO
- bool
+ default y if (GCC_VERSION_4_8_0 || GCC_VERSION_4_8_LINARO)
-endif
diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk
index 86394ca83..9544133bd 100644
--- a/toolchain/gcc/common.mk
+++ b/toolchain/gcc/common.mk
@@ -2,7 +2,7 @@
# Copyright (C) 2002-2003 Erik Andersen <andersen@uclibc.org>
# Copyright (C) 2004 Manuel Novoa III <mjn3@uclibc.org>
# Copyright (C) 2005-2006 Felix Fietkau <nbd@openwrt.org>
-# Copyright (C) 2006-2012 OpenWrt.org
+# Copyright (C) 2006-2013 OpenWrt.org
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,35 +25,18 @@ GCC_VERSION:=$(call qstrip,$(CONFIG_GCC_VERSION))
PKG_VERSION:=$(firstword $(subst +, ,$(GCC_VERSION)))
GCC_DIR:=$(PKG_NAME)-$(PKG_VERSION)
-ifdef CONFIG_GCC_VERSION_LLVM
- PKG_SOURCE_VERSION:=c98c494b72ff875884c0c7286be67f16f9f6d7ab
- PKG_REV:=83504
- GCC_DIR:=llvm-gcc-4.2-r$(PKG_REV)
- PKG_VERSION:=4.2.1
- PKG_SOURCE:=$(GCC_DIR).tar.gz
- PKG_SOURCE_PROTO:=git
- PKG_SOURCE_URL:=git://repo.or.cz/llvm-gcc-4.2.git
- PKG_SOURCE_SUBDIR:=$(GCC_DIR)
- HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(GCC_DIR)
-else
ifeq ($(findstring linaro, $(CONFIG_GCC_VERSION)),linaro)
- ifeq ($(CONFIG_GCC_VERSION),"4.5-linaro")
- PKG_REV:=4.5-2012.03
- PKG_VERSION:=4.5.4
- PKG_VERSION_MAJOR:=4.5
- PKG_MD5SUM:=0c25f93e15e362e352c933e4649a7fc6
- endif
ifeq ($(CONFIG_GCC_VERSION),"4.6-linaro")
- PKG_REV:=4.6-2012.11
+ PKG_REV:=4.6-2012.12
PKG_VERSION:=4.6.4
PKG_VERSION_MAJOR:=4.6
- PKG_MD5SUM:=d2632b8d3c0e44025dd1c8661db0c201
+ PKG_MD5SUM:=6b6c6a4faa026edd1193cf6426309039
endif
- ifeq ($(CONFIG_GCC_VERSION),"4.7-linaro")
- PKG_REV:=4.7-2012.11
- PKG_VERSION:=4.7.3
- PKG_VERSION_MAJOR:=4.7
- PKG_MD5SUM:=590481ff4aff1a9e0f9a206516248877
+ ifeq ($(CONFIG_GCC_VERSION),"4.8-linaro")
+ PKG_REV:=4.8-2013.04
+ PKG_VERSION:=4.8.1
+ PKG_VERSION_MAJOR:=4.8
+ PKG_MD5SUM:=b6b8195019c7cb93629727ad14eaf7ca
endif
PKG_SOURCE_URL:=http://launchpad.net/gcc-linaro/$(PKG_VERSION_MAJOR)/$(PKG_REV)/+download/
PKG_SOURCE:=$(PKG_NAME)-linaro-$(PKG_REV).tar.bz2
@@ -66,21 +49,22 @@ else
ifeq ($(PKG_VERSION),4.4.7)
PKG_MD5SUM:=295709feb4441b04e87dea3f1bab4281
endif
- ifeq ($(PKG_VERSION),4.6.2)
- PKG_MD5SUM:=028115c4fbfb6cfd75d6369f4a90d87e
- endif
ifeq ($(PKG_VERSION),4.6.3)
PKG_MD5SUM:=773092fe5194353b02bb0110052a972e
endif
- ifeq ($(PKG_VERSION),4.7.2)
- PKG_MD5SUM:=cc308a0891e778cfda7a151ab8a6e762
+ ifeq ($(PKG_VERSION),4.8.0)
+ PKG_MD5SUM:=e6040024eb9e761c3bea348d1fa5abb0
endif
endif
-endif
PATCH_DIR=../patches/$(GCC_VERSION)
BUGURL=https://dev.openwrt.org/
+ifeq ($(findstring linaro, $(CONFIG_GCC_VERSION)),linaro)
+ PKGVERSION=OpenWrt/Linaro GCC $(PKG_REV) $(REVISION)
+else
+ PKGVERSION=OpenWrt GCC $(PKG_VERSION) $(REVISION)
+endif
HOST_BUILD_PARALLEL:=1
@@ -100,7 +84,7 @@ HOST_STAMP_CONFIGURED:=$(GCC_BUILD_DIR)/.configured
HOST_STAMP_INSTALLED:=$(STAGING_DIR_HOST)/stamp/.gcc_$(GCC_VARIANT)_installed
SEP:=,
-TARGET_LANGUAGES:="c$(if $(CONFIG_INSTALL_LIBSTDCPP),$(SEP)c++)$(if $(CONFIG_INSTALL_LIBGCJ),$(SEP)java)$(if $(CONFIG_INSTALL_GFORTRAN),$(SEP)fortran)"
+TARGET_LANGUAGES:="c,c++$(if $(CONFIG_INSTALL_LIBGCJ),$(SEP)java)$(if $(CONFIG_INSTALL_GFORTRAN),$(SEP)fortran)"
export libgcc_cv_fixed_point=no
ifdef CONFIG_USE_UCLIBC
@@ -110,6 +94,8 @@ endif
GCC_CONFIGURE:= \
SHELL="$(BASH)" \
$(HOST_SOURCE_DIR)/configure \
+ --with-bugurl=$(BUGURL) \
+ --with-pkgversion="$(PKGVERSION)" \
--prefix=$(TOOLCHAIN_DIR) \
--build=$(GNU_HOST_NAME) \
--host=$(GNU_HOST_NAME) \
@@ -124,22 +110,16 @@ GCC_CONFIGURE:= \
--with-host-libstdcxx=-lstdc++ \
$(SOFT_FLOAT_CONFIG_OPTION) \
$(call qstrip,$(CONFIG_EXTRA_GCC_CONFIG_OPTIONS)) \
- $(if $(CONFIG_mips64)$(CONFIG_mips64el),--with-arch=mips64 --with-abi=64) \
- $(if $(CONFIG_GCC_VERSION_LLVM),--enable-llvm=$(BUILD_DIR_BASE)/host/llvm) \
- $(if $(CONFIG_sparc),--with-long-double-128) \
-
-ifeq ($(CONFIG_GCC_LLVM),)
- GCC_BUILD_TARGET_LIBGCC:=y
- GCC_CONFIGURE+= \
+ $(if $(CONFIG_mips64)$(CONFIG_mips64el),--with-arch=mips64 \
+ --with-abi=$(subst ",,$(CONFIG_MIPS64_ABI))) \
--with-gmp=$(TOPDIR)/staging_dir/host \
--with-mpfr=$(TOPDIR)/staging_dir/host \
--disable-decimal-float
- ifneq ($(CONFIG_mips)$(CONFIG_mipsel),)
- GCC_CONFIGURE += --with-mips-plt
- endif
+ifneq ($(CONFIG_mips)$(CONFIG_mipsel),)
+ GCC_CONFIGURE += --with-mips-plt
endif
-ifneq ($(CONFIG_GCC_VERSION_4_5)$(CONFIG_GCC_VERSION_4_6),)
+ifeq ($(CONFIG_GCC_VERSION_4_4),)
GCC_CONFIGURE+= \
--with-mpc=$(TOPDIR)/staging_dir/host
endif
@@ -159,7 +139,9 @@ ifneq ($(CONFIG_EXTRA_TARGET_ARCH),)
endif
ifdef CONFIG_sparc
- GCC_CONFIGURE+= --enable-targets=all
+ GCC_CONFIGURE+= \
+ --enable-targets=all \
+ --with-long-double-128
endif
ifeq ($(LIBC),uClibc)
diff --git a/toolchain/gcc/final/Makefile b/toolchain/gcc/final/Makefile
index a667266a0..2c25263db 100644
--- a/toolchain/gcc/final/Makefile
+++ b/toolchain/gcc/final/Makefile
@@ -15,14 +15,6 @@ ifneq ($(CONFIG_GCC_VERSION_4_5)$(CONFIG_GCC_VERSION_4_6),)
--with-libelf=$(TOPDIR)/staging_dir/host
endif
-ifneq ($(CONFIG_TLS_SUPPORT),)
- GCC_CONFIGURE += \
- --enable-tls
-else
- GCC_CONFIGURE += \
- --disable-tls
-endif
-
ifneq ($(CONFIG_SJLJ_EXCEPTIONS),)
GCC_CONFIGURE += \
--enable-sjlj-exceptions
@@ -35,7 +27,7 @@ define CleanupToolchain
ln -sf ../include $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include
rm -rf $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/lib
ln -sf ../lib $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/lib
- $(if $(CONFIG_mips64)$(CONFIG_mips64el)$(CONFIG_x86_64),ln -sf ../lib64 $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/lib64)
+ $(if $(CONFIG_ARCH_64BIT),ln -sf ../lib64 $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/lib64)
endef
define Host/Configure
diff --git a/toolchain/gcc/initial/Makefile b/toolchain/gcc/initial/Makefile
index d1481e0a3..f0c65b528 100644
--- a/toolchain/gcc/initial/Makefile
+++ b/toolchain/gcc/initial/Makefile
@@ -14,14 +14,14 @@ define Host/Compile
+$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) \
all-build-libiberty \
all-gcc \
- $(if $(GCC_BUILD_TARGET_LIBGCC),all-target-libgcc)
+ all-target-libgcc
endef
define Host/Install
$(GCC_MAKE) -C $(GCC_BUILD_DIR) \
prefix="$(TOOLCHAIN_DIR)/initial" \
install-gcc \
- $(if $(GCC_BUILD_TARGET_LIBGCC),install-target-libgcc)
+ install-target-libgcc
# XXX: glibc insists on linking against libgcc_eh
( cd $(TOOLCHAIN_DIR)/initial/lib/gcc/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION) ; \
diff --git a/toolchain/gcc/minimal/Makefile b/toolchain/gcc/minimal/Makefile
index ee8291606..6b4a9c526 100644
--- a/toolchain/gcc/minimal/Makefile
+++ b/toolchain/gcc/minimal/Makefile
@@ -21,9 +21,8 @@ define Host/Prepare
ln -snf $(GCC_DIR) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
$(CP) $(SCRIPT_DIR)/config.{guess,sub} $(HOST_BUILD_DIR)/
$(SED) 's,^MULTILIB_OSDIRNAMES,# MULTILIB_OSDIRNAMES,' $(HOST_BUILD_DIR)/gcc/config/*/t-*
- $(SED) 's,\(version_string.. = "[0-9\.]*\).*\(";\),\1 (OpenWrt-2.0)\2,' $(HOST_BUILD_DIR)/gcc/version.c
- $(SED) 's,\(bug_report_url.. = "\).*\(";\),\1<URL:$(BUGURL)>\2,' $(HOST_BUILD_DIR)/gcc/version.c
- $(SED) 's,http://gcc.gnu.org/bugs.html,$(BUGURL),' $(HOST_BUILD_DIR)/gcc/configure
+ $(SED) 'd' $(HOST_BUILD_DIR)/gcc/DATESTAMP
+ $(SED) 'd' $(HOST_BUILD_DIR)/gcc/DEV-PHASE
#(cd $(HOST_BUILD_DIR)/libstdc++-v3; autoconf;);
$(SED) 's,gcc_no_link=yes,gcc_no_link=no,' $(HOST_BUILD_DIR)/libstdc++-v3/configure
mkdir -p $(GCC_BUILD_DIR)
diff --git a/toolchain/gcc/patches/4.5-linaro/100-uclibc-conf.patch b/toolchain/gcc/patches/4.5-linaro/100-uclibc-conf.patch
deleted file mode 100644
index 5c77de9b4..000000000
--- a/toolchain/gcc/patches/4.5-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
-
-@@ -1251,7 +1251,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.5-linaro/200-musl.patch b/toolchain/gcc/patches/4.5-linaro/200-musl.patch
deleted file mode 100644
index f29097c8b..000000000
--- a/toolchain/gcc/patches/4.5-linaro/200-musl.patch
+++ /dev/null
@@ -1,242 +0,0 @@
-diff -urN gcc-linaro-4.5-2012.03/config.sub gcc-linaro-4.5-2012.03.new/config.sub
---- gcc-linaro-4.5-2012.03/config.sub 2012-03-12 12:29:55.000000000 +0100
-+++ gcc-linaro-4.5-2012.03.new/config.sub 2012-11-29 15:45:43.802377940 +0100
-@@ -125,6 +125,7 @@
- maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
- case $maybe_os in
- nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
-+ linux-musl* | \
- linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
- knetbsd*-gnu* | netbsd*-gnu* | \
- kopensolaris*-gnu* | \
-@@ -1310,6 +1311,7 @@
- | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -linux-android* \
- | -linux-newlib* | -linux-uclibc* \
-+ | -linux-musl* \
- | -uxpv* | -beos* | -mpeix* | -udk* \
- | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
- | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
-diff -urN gcc-linaro-4.5-2012.03/gcc/config/arm/linux-eabi.h gcc-linaro-4.5-2012.03.new/gcc/config/arm/linux-eabi.h
---- gcc-linaro-4.5-2012.03/gcc/config/arm/linux-eabi.h 2012-03-12 12:29:55.000000000 +0100
-+++ gcc-linaro-4.5-2012.03.new/gcc/config/arm/linux-eabi.h 2012-11-29 15:45:43.802377940 +0100
-@@ -63,6 +63,10 @@
- #undef GLIBC_DYNAMIC_LINKER
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
-
-+/* musl has no "classic" (i.e. broken) mode */
-+#undef MUSL_DYNAMIC_LINKER
-+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-arm.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
-diff -urN gcc-linaro-4.5-2012.03/gcc/config/i386/linux.h gcc-linaro-4.5-2012.03.new/gcc/config/i386/linux.h
---- gcc-linaro-4.5-2012.03/gcc/config/i386/linux.h 2012-03-12 12:29:55.000000000 +0100
-+++ gcc-linaro-4.5-2012.03.new/gcc/config/i386/linux.h 2012-11-29 15:45:43.802377940 +0100
-@@ -101,6 +101,7 @@
- /* These macros may be overridden in k*bsd-gnu.h and i386/k*bsd-gnu.h. */
- #define LINK_EMULATION "elf_i386"
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
-+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
-
- #undef ASM_SPEC
- #define ASM_SPEC \
-diff -urN gcc-linaro-4.5-2012.03/gcc/config/i386/linux64.h gcc-linaro-4.5-2012.03.new/gcc/config/i386/linux64.h
---- gcc-linaro-4.5-2012.03/gcc/config/i386/linux64.h 2012-03-12 12:29:55.000000000 +0100
-+++ gcc-linaro-4.5-2012.03.new/gcc/config/i386/linux64.h 2012-11-29 15:45:43.802377940 +0100
-@@ -61,6 +61,9 @@
- #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
- #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
-
-+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
-+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
-+
- #if TARGET_64BIT_DEFAULT
- #define SPEC_32 "m32"
- #define SPEC_64 "!m32"
-diff -urN gcc-linaro-4.5-2012.03/gcc/config/linux.h gcc-linaro-4.5-2012.03.new/gcc/config/linux.h
---- gcc-linaro-4.5-2012.03/gcc/config/linux.h 2012-03-12 12:29:55.000000000 +0100
-+++ gcc-linaro-4.5-2012.03.new/gcc/config/linux.h 2012-11-29 15:46:48.982379607 +0100
-@@ -86,6 +86,7 @@
- #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)
-
- #define LINUX_TARGET_OS_CPP_BUILTINS() \
- do { \
-@@ -120,18 +121,21 @@
- 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 */
-@@ -149,13 +153,13 @@
-
- #define LINUX_DYNAMIC_LINKER \
- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
-- BIONIC_DYNAMIC_LINKER)
-+ BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
- #define LINUX_DYNAMIC_LINKER32 \
- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
-- BIONIC_DYNAMIC_LINKER32)
-+ BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
- #define LINUX_DYNAMIC_LINKER64 \
- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
-- BIONIC_DYNAMIC_LINKER64)
-+ BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
-
- /* Determine whether the entire c99 runtime
- is present in the runtime library. */
-diff -urN gcc-linaro-4.5-2012.03/gcc/config/linux.opt gcc-linaro-4.5-2012.03.new/gcc/config/linux.opt
---- gcc-linaro-4.5-2012.03/gcc/config/linux.opt 2012-03-12 12:29:55.000000000 +0100
-+++ gcc-linaro-4.5-2012.03.new/gcc/config/linux.opt 2012-11-29 15:45:43.802377940 +0100
-@@ -30,3 +30,7 @@
- muclibc
- Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) VarExists Negative(mbionic)
- Use uClibc C library
-+
-+mmusl
-+Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
-+Use musl C library
-diff -urN gcc-linaro-4.5-2012.03/gcc/config/mips/linux.h gcc-linaro-4.5-2012.03.new/gcc/config/mips/linux.h
---- gcc-linaro-4.5-2012.03/gcc/config/mips/linux.h 2012-03-12 12:29:55.000000000 +0100
-+++ gcc-linaro-4.5-2012.03.new/gcc/config/mips/linux.h 2012-11-29 15:45:43.802377940 +0100
-@@ -66,6 +66,8 @@
-
- #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
-
-+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips.so.1"
-+
- /* Borrowed from sparc/linux.h */
- #undef LINK_SPEC
- #define LINK_SPEC \
-diff -urN gcc-linaro-4.5-2012.03/gcc/config/mips/linux64.h gcc-linaro-4.5-2012.03.new/gcc/config/mips/linux64.h
---- gcc-linaro-4.5-2012.03/gcc/config/mips/linux64.h 2012-03-12 12:29:55.000000000 +0100
-+++ gcc-linaro-4.5-2012.03.new/gcc/config/mips/linux64.h 2012-11-29 15:48:10.542381697 +0100
-@@ -39,8 +39,11 @@
- #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld.so.1"
- #define GLIBC_DYNAMIC_LINKERN32 "/lib32/ld.so.1"
- #define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
-+#define MUSL_DYNAMIC_LINKERN32 "/lib32/ld-musl-mips.so.1"
-+#define MUSL_DYNAMIC_LINKER32 "/lib32/ld-musl-mips.so.1"
-+#define MUSL_DYNAMIC_LINKER64 "/lib64/ld-musl-mips.so.1"
- #define LINUX_DYNAMIC_LINKERN32 \
-- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32)
-+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32)
-
- #undef LINK_SPEC
- #define LINK_SPEC "\
-diff -urN gcc-linaro-4.5-2012.03/gcc/config.gcc gcc-linaro-4.5-2012.03.new/gcc/config.gcc
---- gcc-linaro-4.5-2012.03/gcc/config.gcc 2012-03-12 12:29:55.000000000 +0100
-+++ gcc-linaro-4.5-2012.03.new/gcc/config.gcc 2012-11-29 15:46:18.474378826 +0100
-@@ -514,7 +514,7 @@
- tmake_file="$tmake_file t-gnu";;
- 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"
- # glibc / uclibc / bionic switch.
- # uclibc and bionic aren't usable for GNU/Hurd and neither for GNU/k*BSD.
- case $target in
-@@ -530,6 +530,9 @@
- *-*-*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"
- ;;
-diff -urN gcc-linaro-4.5-2012.03/gcc/ginclude/stddef.h gcc-linaro-4.5-2012.03.new/gcc/ginclude/stddef.h
---- gcc-linaro-4.5-2012.03/gcc/ginclude/stddef.h 2012-03-12 12:29:55.000000000 +0100
-+++ gcc-linaro-4.5-2012.03.new/gcc/ginclude/stddef.h 2012-11-29 15:45:43.802377940 +0100
-@@ -183,6 +183,7 @@
- #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
-@@ -199,6 +200,7 @@
- #define ___int_size_t_h
- #define _GCC_SIZE_T
- #define _SIZET_
-+#define __DEFINED_size_t /* musl */
- #if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
- /* __size_t is a typedef on FreeBSD 5!, must not trash it. */
- #else
-@@ -213,6 +215,7 @@
- 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 -urN gcc-linaro-4.5-2012.03/libgomp/config/posix/time.c gcc-linaro-4.5-2012.03.new/libgomp/config/posix/time.c
---- gcc-linaro-4.5-2012.03/libgomp/config/posix/time.c 2012-03-12 12:29:55.000000000 +0100
-+++ gcc-linaro-4.5-2012.03.new/libgomp/config/posix/time.c 2012-11-29 15:45:43.802377940 +0100
-@@ -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 -urN gcc-linaro-4.5-2012.03/libstdc++-v3/configure.host gcc-linaro-4.5-2012.03.new/libstdc++-v3/configure.host
---- gcc-linaro-4.5-2012.03/libstdc++-v3/configure.host 2012-03-12 12:29:55.000000000 +0100
-+++ gcc-linaro-4.5-2012.03.new/libstdc++-v3/configure.host 2012-11-29 15:45:43.806377939 +0100
-@@ -236,6 +236,13 @@
- 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
-@@ -244,6 +251,9 @@
- os_include_dir="os/gnu-linux"
- fi
- ;;
-+
-+ esac
-+ ;;
- hpux*)
- os_include_dir="os/hpux"
- ;;
diff --git a/toolchain/gcc/patches/4.5-linaro/200-ppc_include_config_linux_h.patch b/toolchain/gcc/patches/4.5-linaro/200-ppc_include_config_linux_h.patch
deleted file mode 100644
index 09b4a3e04..000000000
--- a/toolchain/gcc/patches/4.5-linaro/200-ppc_include_config_linux_h.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/gcc/config.gcc
-+++ b/gcc/config.gcc
-@@ -2028,7 +2028,7 @@ powerpc-*-rtems*)
- tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-rtems t-rtems rs6000/t-ppccomm"
- ;;
- powerpc-*-linux* | powerpc64-*-linux*)
-- tm_file="${tm_file} dbxelf.h elfos.h linux.h freebsd-spec.h rs6000/sysv4.h"
-+ tm_file="${tm_file} dbxelf.h elfos.h svr4.h linux.h freebsd-spec.h rs6000/sysv4.h"
- extra_options="${extra_options} rs6000/sysv4.opt"
- tmake_file="t-dfprules rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm"
- maybe_biarch=yes
diff --git a/toolchain/gcc/patches/4.5-linaro/301-missing-execinfo_h.patch b/toolchain/gcc/patches/4.5-linaro/301-missing-execinfo_h.patch
deleted file mode 100644
index b3f1e68d3..000000000
--- a/toolchain/gcc/patches/4.5-linaro/301-missing-execinfo_h.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/boehm-gc/include/gc.h
-+++ b/boehm-gc/include/gc.h
-@@ -503,7 +503,7 @@ GC_API GC_PTR GC_malloc_atomic_ignore_of
- #if defined(__linux__) || defined(__GLIBC__)
- # include <features.h>
- # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
-- && !defined(__ia64__)
-+ && !defined(__ia64__) && !defined(__UCLIBC__)
- # ifndef GC_HAVE_BUILTIN_BACKTRACE
- # define GC_HAVE_BUILTIN_BACKTRACE
- # endif
diff --git a/toolchain/gcc/patches/4.5-linaro/302-c99-snprintf.patch b/toolchain/gcc/patches/4.5-linaro/302-c99-snprintf.patch
deleted file mode 100644
index ddbe43d81..000000000
--- a/toolchain/gcc/patches/4.5-linaro/302-c99-snprintf.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/libstdc++-v3/include/c_global/cstdio
-+++ b/libstdc++-v3/include/c_global/cstdio
-@@ -139,7 +139,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
-
- _GLIBCXX_END_NAMESPACE
-
--#if _GLIBCXX_USE_C99
-+#if _GLIBCXX_USE_C99 || defined __UCLIBC__
-
- #undef snprintf
- #undef vfscanf
diff --git a/toolchain/gcc/patches/4.5-linaro/305-libmudflap-susv3-legacy.patch b/toolchain/gcc/patches/4.5-linaro/305-libmudflap-susv3-legacy.patch
deleted file mode 100644
index 8e2d15f81..000000000
--- a/toolchain/gcc/patches/4.5-linaro/305-libmudflap-susv3-legacy.patch
+++ /dev/null
@@ -1,47 +0,0 @@
---- a/libmudflap/mf-hooks2.c
-+++ b/libmudflap/mf-hooks2.c
-@@ -421,7 +421,7 @@ WRAPPER2(void, bzero, void *s, size_t n)
- {
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
-- bzero (s, n);
-+ memset (s, 0, n);
- }
-
-
-@@ -431,7 +431,7 @@ WRAPPER2(void, bcopy, const void *src, v
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
- MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
-- bcopy (src, dest, n);
-+ memmove (dest, src, n);
- }
-
-
-@@ -441,7 +441,7 @@ WRAPPER2(int, bcmp, const void *s1, cons
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
- MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
-- return bcmp (s1, s2, n);
-+ return n == 0 ? 0 : memcmp (s1, s2, n);
- }
-
-
-@@ -450,7 +450,7 @@ WRAPPER2(char *, index, const char *s, i
- size_t n = strlen (s);
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
-- return index (s, c);
-+ return strchr (s, c);
- }
-
-
-@@ -459,7 +459,7 @@ WRAPPER2(char *, rindex, const char *s,
- size_t n = strlen (s);
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
-- return rindex (s, c);
-+ return strrchr (s, c);
- }
-
- /* XXX: stpcpy, memccpy */
diff --git a/toolchain/gcc/patches/4.5-linaro/810-arm-softfloat-libgcc.patch b/toolchain/gcc/patches/4.5-linaro/810-arm-softfloat-libgcc.patch
deleted file mode 100644
index 60cfde407..000000000
--- a/toolchain/gcc/patches/4.5-linaro/810-arm-softfloat-libgcc.patch
+++ /dev/null
@@ -1,26 +0,0 @@
---- 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}}"
-
--#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc"
-+#define LIBGCC_SPEC "-lgcc"
-
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
-
---- a/gcc/config/arm/t-linux
-+++ b/gcc/config/arm/t-linux
-@@ -23,7 +23,11 @@ TARGET_LIBGCC2_CFLAGS = -fomit-frame-poi
-
- LIB1ASMSRC = arm/lib1funcs.asm
- LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
-- _arm_addsubdf3 _arm_addsubsf3
-+ _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
-
- # MULTILIB_OPTIONS = mhard-float/msoft-float
- # MULTILIB_DIRNAMES = hard-float soft-float
diff --git a/toolchain/gcc/patches/4.5-linaro/820-libgcc_pic.patch b/toolchain/gcc/patches/4.5-linaro/820-libgcc_pic.patch
deleted file mode 100644
index 7cde82acc..000000000
--- a/toolchain/gcc/patches/4.5-linaro/820-libgcc_pic.patch
+++ /dev/null
@@ -1,36 +0,0 @@
---- a/libgcc/Makefile.in
-+++ b/libgcc/Makefile.in
-@@ -746,11 +746,12 @@ $(libgcov-objects): %$(objext): $(gcc_sr
-
- # 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)"; \
-@@ -772,7 +773,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
-@@ -945,6 +946,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.5-linaro/830-arm_unbreak_armv4t.patch b/toolchain/gcc/patches/4.5-linaro/830-arm_unbreak_armv4t.patch
deleted file mode 100644
index 0788b63ae..000000000
--- a/toolchain/gcc/patches/4.5-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
-@@ -44,7 +44,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.5-linaro/840-armv4_pass_fix-v4bx_to_ld.patch b/toolchain/gcc/patches/4.5-linaro/840-armv4_pass_fix-v4bx_to_ld.patch
deleted file mode 100644
index e2e33c2b3..000000000
--- a/toolchain/gcc/patches/4.5-linaro/840-armv4_pass_fix-v4bx_to_ld.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/gcc/config/arm/linux-eabi.h
-+++ b/gcc/config/arm/linux-eabi.h
-@@ -63,10 +63,14 @@
- #undef GLIBC_DYNAMIC_LINKER
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
-
-+/* 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:--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 BE8_LINK_SPEC \
-+#define LINK_SPEC BE8_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.5-linaro/910-mbsd_multi.patch b/toolchain/gcc/patches/4.5-linaro/910-mbsd_multi.patch
deleted file mode 100644
index b9d5ffa24..000000000
--- a/toolchain/gcc/patches/4.5-linaro/910-mbsd_multi.patch
+++ /dev/null
@@ -1,253 +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.
- * Make -fno-strict-aliasing and -fno-delete-null-pointer-checks
- the default for -O2/-Os, because they trigger gcc bugs
- and can delete code with security implications.
-
- This patch was authored by Thorsten Glaser <tg at mirbsd.de>
- with copyright assignment to the FSF in effect.
-
---- a/gcc/c-opts.c
-+++ b/gcc/c-opts.c
-@@ -106,6 +106,9 @@ static size_t deferred_count;
- /* Number of deferred options scanned for -include. */
- static size_t include_cursor;
-
-+/* Check if a port honours COPTS. */
-+static int honour_copts = 0;
-+
- static void set_Wimplicit (int);
- static void handle_OPT_d (const char *);
- static void set_std_cxx98 (int);
-@@ -472,6 +475,9 @@ c_common_handle_option (size_t scode, co
- enable_warning_as_error ("implicit-function-declaration", value, CL_C | CL_ObjC);
- break;
-
-+ case OPT_Werror_maybe_reset:
-+ break;
-+
- case OPT_Wformat:
- set_Wformat (value);
- break;
-@@ -704,6 +710,12 @@ c_common_handle_option (size_t scode, co
- flag_exceptions = value;
- break;
-
-+ case OPT_fhonour_copts:
-+ if (c_language == clk_c) {
-+ honour_copts++;
-+ }
-+ break;
-+
- case OPT_fimplement_inlines:
- flag_implement_inlines = value;
- break;
-@@ -1240,6 +1252,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.opt
-+++ b/gcc/c.opt
-@@ -219,6 +219,10 @@ Werror-implicit-function-declaration
- C ObjC RejectNegative Warning
- This switch is deprecated; use -Werror=implicit-function-declaration instead
-
-+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
-@@ -637,6 +641,9 @@ C++ ObjC++ Optimization
- fhonor-std
- C++ ObjC++
-
-+fhonour-copts
-+C ObjC C++ ObjC++ RejectNegative
-+
- fhosted
- C ObjC
- Assume normal C execution environment
---- a/gcc/common.opt
-+++ b/gcc/common.opt
-@@ -105,6 +105,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
-@@ -625,6 +629,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
-@@ -897,8 +897,6 @@ decode_options (unsigned int argc, const
- flag_schedule_insns_after_reload = opt2;
- #endif
- flag_regmove = opt2;
-- flag_strict_aliasing = opt2;
-- flag_strict_overflow = opt2;
- flag_reorder_blocks = opt2;
- flag_reorder_functions = opt2;
- flag_tree_vrp = opt2;
-@@ -920,6 +918,8 @@ decode_options (unsigned int argc, const
-
- /* -O3 optimizations. */
- opt3 = (optimize >= 3);
-+ flag_strict_aliasing = opt3;
-+ flag_strict_overflow = opt3;
- flag_predictive_commoning = opt3;
- flag_inline_functions = opt3;
- flag_unswitch_loops = opt3;
-@@ -1648,6 +1648,17 @@ common_handle_option (size_t scode, cons
- enable_warning_as_error (arg, value, lang_mask);
- 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_:
- /* This form corresponds to -Wlarger-than-.
- Kept for backward compatibility.
---- a/gcc/doc/cppopts.texi
-+++ b/gcc/doc/cppopts.texi
-@@ -164,6 +164,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
-@@ -235,7 +235,7 @@ Objective-C and Objective-C++ Dialects}.
- -Wconversion -Wcoverage-mismatch -Wno-deprecated @gol
- -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
-@@ -4360,6 +4360,22 @@ This option is only supported for C and
- @option{-Wall} and by @option{-pedantic}, 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
-@@ -6114,7 +6130,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
-@@ -667,6 +667,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.5-linaro/920-specs_nonfatal_getenv.patch b/toolchain/gcc/patches/4.5-linaro/920-specs_nonfatal_getenv.patch
deleted file mode 100644
index 001088a25..000000000
--- a/toolchain/gcc/patches/4.5-linaro/920-specs_nonfatal_getenv.patch
+++ /dev/null
@@ -1,14 +0,0 @@
---- a/gcc/gcc.c
-+++ b/gcc/gcc.c
-@@ -8583,7 +8583,10 @@ getenv_spec_function (int argc, const ch
-
- value = getenv (argv[0]);
- if (!value)
-- fatal ("environment variable \"%s\" not defined", argv[0]);
-+ {
-+ error ("warning: environment variable \"%s\" 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.5-linaro/993-arm_insn-opinit-RTX_CODE-fixup.patch b/toolchain/gcc/patches/4.5-linaro/993-arm_insn-opinit-RTX_CODE-fixup.patch
deleted file mode 100644
index 57feb328f..000000000
--- a/toolchain/gcc/patches/4.5-linaro/993-arm_insn-opinit-RTX_CODE-fixup.patch
+++ /dev/null
@@ -1,14 +0,0 @@
---- a/gcc/config/arm/arm-protos.h
-+++ b/gcc/config/arm/arm-protos.h
-@@ -44,10 +44,10 @@ extern unsigned int arm_dbx_register_num
- extern void arm_output_fn_unwind (FILE *, bool);
-
-
--#ifdef RTX_CODE
- extern bool arm_vector_mode_supported_p (enum machine_mode);
- extern int arm_hard_regno_mode_ok (unsigned int, enum machine_mode);
- extern int const_ok_for_arm (HOST_WIDE_INT);
-+#ifdef RTX_CODE
- extern int arm_split_constant (RTX_CODE, enum machine_mode, rtx,
- HOST_WIDE_INT, rtx, rtx, int);
- extern RTX_CODE arm_canonicalize_comparison (RTX_CODE, rtx *, rtx *);
diff --git a/toolchain/gcc/patches/4.5-linaro/995-fa526.patch b/toolchain/gcc/patches/4.5-linaro/995-fa526.patch
deleted file mode 100644
index 700bb4a90..000000000
--- a/toolchain/gcc/patches/4.5-linaro/995-fa526.patch
+++ /dev/null
@@ -1,257 +0,0 @@
---- a/gcc/config/arm/arm-cores.def
-+++ b/gcc/config/arm/arm-cores.def
-@@ -74,6 +74,7 @@ ARM_CORE("strongarm", strongarm, 4,
- ARM_CORE("strongarm110", strongarm110, 4, FL_MODE26 | FL_LDSCHED | FL_STRONG, fastmul)
- ARM_CORE("strongarm1100", strongarm1100, 4, FL_MODE26 | FL_LDSCHED | FL_STRONG, fastmul)
- ARM_CORE("strongarm1110", strongarm1110, 4, FL_MODE26 | FL_LDSCHED | FL_STRONG, fastmul)
-+ARM_CORE("fa526", fa526, 4, FL_LDSCHED, fastmul)
-
- /* V4T Architecture Processors */
- ARM_CORE("arm7tdmi", arm7tdmi, 4T, FL_CO_PROC , fastmul)
---- a/gcc/config/arm/arm.md
-+++ b/gcc/config/arm/arm.md
-@@ -435,7 +435,7 @@
-
- (define_attr "generic_sched" "yes,no"
- (const (if_then_else
-- (ior (eq_attr "tune" "arm926ejs,arm1020e,arm1026ejs,arm1136js,arm1136jfs,cortexa5,cortexa8,cortexa9,cortexm4")
-+ (ior (eq_attr "tune" "fa526,arm926ejs,arm1020e,arm1026ejs,arm1136js,arm1136jfs,cortexa5,cortexa8,cortexa9,cortexm4")
- (eq_attr "tune_cortexr4" "yes"))
- (const_string "no")
- (const_string "yes"))))
-@@ -467,6 +467,7 @@
- (include "arm1020e.md")
- (include "arm1026ejs.md")
- (include "arm1136jfs.md")
-+(include "fa526.md")
- (include "cortex-a5.md")
- (include "cortex-a8.md")
- (include "cortex-a9.md")
---- a/gcc/config/arm/arm-tune.md
-+++ b/gcc/config/arm/arm-tune.md
-@@ -1,5 +1,5 @@
- ;; -*- buffer-read-only: t -*-
- ;; Generated automatically by gentune.sh from arm-cores.def
- (define_attr "tune"
-- "arm2,arm250,arm3,arm6,arm60,arm600,arm610,arm620,arm7,arm7d,arm7di,arm70,arm700,arm700i,arm710,arm720,arm710c,arm7100,arm7500,arm7500fe,arm7m,arm7dm,arm7dmi,arm8,arm810,strongarm,strongarm110,strongarm1100,strongarm1110,arm7tdmi,arm7tdmis,arm710t,arm720t,arm740t,arm9,arm9tdmi,arm920,arm920t,arm922t,arm940t,ep9312,arm10tdmi,arm1020t,arm9e,arm946es,arm966es,arm968es,arm10e,arm1020e,arm1022e,xscale,iwmmxt,iwmmxt2,arm926ejs,arm1026ejs,arm1136js,arm1136jfs,arm1176jzs,arm1176jzfs,mpcorenovfp,mpcore,arm1156t2s,arm1156t2fs,cortexa5,cortexa8,cortexa9,cortexr4,cortexr4f,cortexm4,cortexm3,cortexm1,cortexm0"
-+ "arm2,arm250,arm3,arm6,arm60,arm600,arm610,arm620,arm7,arm7d,arm7di,arm70,arm700,arm700i,arm710,arm720,arm710c,arm7100,arm7500,arm7500fe,arm7m,arm7dm,arm7dmi,arm8,arm810,strongarm,strongarm110,strongarm1100,strongarm1110,fa526,arm7tdmi,arm7tdmis,arm710t,arm720t,arm740t,arm9,arm9tdmi,arm920,arm920t,arm922t,arm940t,ep9312,arm10tdmi,arm1020t,arm9e,arm946es,arm966es,arm968es,arm10e,arm1020e,arm1022e,xscale,iwmmxt,iwmmxt2,arm926ejs,arm1026ejs,arm1136js,arm1136jfs,arm1176jzs,arm1176jzfs,mpcorenovfp,mpcore,arm1156t2s,arm1156t2fs,cortexa5,cortexa8,cortexa9,cortexr4,cortexr4f,cortexm4,cortexm3,cortexm1,cortexm0"
- (const (symbol_ref "((enum attr_tune) arm_tune)")))
---- a/gcc/config/arm/bpabi.h
-+++ b/gcc/config/arm/bpabi.h
-@@ -52,7 +52,8 @@
- /* The BPABI integer comparison routines return { -1, 0, 1 }. */
- #define TARGET_LIB_INT_CMP_BIASED !TARGET_BPABI
-
--#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4:--fix-v4bx}"
-+#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*\
-+|march=armv4|mcpu=fa526:--fix-v4bx}"
-
- #define BE8_LINK_SPEC " %{mbig-endian:%{march=armv7-a|mcpu=cortex-a5|mcpu=cortex-a8|mcpu=cortex-a9:%{!r:--be8}}}"
-
---- /dev/null
-+++ b/gcc/config/arm/fa526.md
-@@ -0,0 +1,161 @@
-+;; Faraday FA526 Pipeline Description
-+;; Copyright (C) 2010 Free Software Foundation, Inc.
-+;; Written by I-Jui Sung, based on ARM926EJ-S Pipeline Description.
-+
-+;; 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/>. */
-+
-+;; These descriptions are based on the information contained in the
-+;; FA526 Core Design Note, Copyright (c) 2010 Faraday Technology Corp.
-+;;
-+;; Modeled pipeline characteristics:
-+;; LD -> any use: latency = 3 (2 cycle penalty).
-+;; ALU -> any use: latency = 2 (1 cycle penalty).
-+
-+;; This automaton provides a pipeline description for the Faraday
-+;; FA526 core.
-+;;
-+;; The model given here assumes that the condition for all conditional
-+;; instructions is "true", i.e., that all of the instructions are
-+;; actually executed.
-+
-+(define_automaton "fa526")
-+
-+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-+;; Pipelines
-+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-+
-+;; There is a single pipeline
-+;;
-+;; The ALU pipeline has fetch, decode, execute, memory, and
-+;; write stages. We only need to model the execute, memory and write
-+;; stages.
-+
-+;; S E M W
-+
-+(define_cpu_unit "fa526_core" "fa526")
-+
-+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-+;; ALU Instructions
-+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-+
-+;; ALU instructions require two cycles to execute, and use the ALU
-+;; pipeline in each of the three stages. The results are available
-+;; after the execute stage stage has finished.
-+;;
-+;; If the destination register is the PC, the pipelines are stalled
-+;; for several cycles. That case is not modeled here.
-+
-+;; ALU operations
-+(define_insn_reservation "526_alu_op" 1
-+ (and (eq_attr "tune" "fa526")
-+ (eq_attr "type" "alu"))
-+ "fa526_core")
-+
-+(define_insn_reservation "526_alu_shift_op" 2
-+ (and (eq_attr "tune" "fa526")
-+ (eq_attr "type" "alu_shift,alu_shift_reg"))
-+ "fa526_core")
-+
-+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-+;; Multiplication Instructions
-+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-+
-+(define_insn_reservation "526_mult1" 2
-+ (and (eq_attr "tune" "fa526")
-+ (eq_attr "insn" "smlalxy,smulxy,smlaxy,smlalxy"))
-+ "fa526_core")
-+
-+(define_insn_reservation "526_mult2" 5
-+ (and (eq_attr "tune" "fa526")
-+ (eq_attr "insn" "mul,mla,muls,mlas,umull,umlal,smull,smlal,umulls,\
-+ umlals,smulls,smlals,smlawx"))
-+ "fa526_core*4")
-+
-+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-+;; Load/Store Instructions
-+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-+
-+;; The models for load/store instructions do not accurately describe
-+;; the difference between operations with a base register writeback
-+;; (such as "ldm!"). These models assume that all memory references
-+;; hit in dcache.
-+
-+(define_insn_reservation "526_load1_op" 3
-+ (and (eq_attr "tune" "fa526")
-+ (eq_attr "type" "load1,load_byte"))
-+ "fa526_core")
-+
-+(define_insn_reservation "526_load2_op" 4
-+ (and (eq_attr "tune" "fa526")
-+ (eq_attr "type" "load2"))
-+ "fa526_core*2")
-+
-+(define_insn_reservation "526_load3_op" 5
-+ (and (eq_attr "tune" "fa526")
-+ (eq_attr "type" "load3"))
-+ "fa526_core*3")
-+
-+(define_insn_reservation "526_load4_op" 6
-+ (and (eq_attr "tune" "fa526")
-+ (eq_attr "type" "load4"))
-+ "fa526_core*4")
-+
-+(define_insn_reservation "526_store1_op" 0
-+ (and (eq_attr "tune" "fa526")
-+ (eq_attr "type" "store1"))
-+ "fa526_core")
-+
-+(define_insn_reservation "526_store2_op" 1
-+ (and (eq_attr "tune" "fa526")
-+ (eq_attr "type" "store2"))
-+ "fa526_core*2")
-+
-+(define_insn_reservation "526_store3_op" 2
-+ (and (eq_attr "tune" "fa526")
-+ (eq_attr "type" "store3"))
-+ "fa526_core*3")
-+
-+(define_insn_reservation "526_store4_op" 3
-+ (and (eq_attr "tune" "fa526")
-+ (eq_attr "type" "store4"))
-+ "fa526_core*4")
-+
-+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-+;; Branch and Call Instructions
-+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-+
-+;; Branch instructions are difficult to model accurately. The FA526
-+;; core can predict most branches. If the branch is predicted
-+;; correctly, and predicted early enough, the branch can be completely
-+;; eliminated from the instruction stream. Some branches can
-+;; therefore appear to require zero cycle to execute. We assume that
-+;; all branches are predicted correctly, and that the latency is
-+;; therefore the minimum value.
-+
-+(define_insn_reservation "526_branch_op" 0
-+ (and (eq_attr "tune" "fa526")
-+ (eq_attr "type" "branch"))
-+ "fa526_core")
-+
-+;; The latency for a call is actually the latency when the result is available.
-+;; i.e. R0 ready for int return value. For most cases, the return value is set
-+;; by a mov instruction, which has 1 cycle latency.
-+(define_insn_reservation "526_call_op" 1
-+ (and (eq_attr "tune" "fa526")
-+ (eq_attr "type" "call"))
-+ "fa526_core")
-+
---- a/gcc/config/arm/t-arm
-+++ b/gcc/config/arm/t-arm
-@@ -23,6 +23,7 @@ MD_INCLUDES= $(srcdir)/config/arm/arm-tu
- $(srcdir)/config/arm/arm-generic.md \
- $(srcdir)/config/arm/arm1020e.md \
- $(srcdir)/config/arm/arm1026ejs.md \
-+ $(srcdir)/config/arm/fa526.md \
- $(srcdir)/config/arm/arm1136jfs.md \
- $(srcdir)/config/arm/arm926ejs.md \
- $(srcdir)/config/arm/cirrus.md \
---- a/gcc/config/arm/t-arm-elf
-+++ b/gcc/config/arm/t-arm-elf
-@@ -36,6 +36,10 @@ MULTILIB_DIRNAMES = arm thumb
- MULTILIB_EXCEPTIONS =
- MULTILIB_MATCHES =
-
-+#MULTILIB_OPTIONS += mcpu=fa526
-+#MULTILIB_DIRNAMES += fa526
-+#MULTILIB_EXCEPTIONS += *mthumb*/*mcpu=fa526
-+
- #MULTILIB_OPTIONS += march=armv7
- #MULTILIB_DIRNAMES += thumb2
- #MULTILIB_EXCEPTIONS += march=armv7* marm/*march=armv7*
-@@ -52,6 +56,7 @@ MULTILIB_MATCHES =
- MULTILIB_OPTIONS += mfloat-abi=hard
- MULTILIB_DIRNAMES += fpu
- MULTILIB_EXCEPTIONS += *mthumb/*mfloat-abi=hard*
-+MULTILIB_EXCEPTIONS += *mcpu=fa526/*mfloat-abi=hard*
-
- # MULTILIB_OPTIONS += mcpu=ep9312
- # MULTILIB_DIRNAMES += ep9312
---- a/gcc/doc/invoke.texi
-+++ b/gcc/doc/invoke.texi
-@@ -9923,7 +9923,8 @@ assembly code. Permissible names are: @
- @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-m4}, @samp{cortex-m3},
- @samp{cortex-m1},
- @samp{cortex-m0},
--@samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
-+@samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
-+@samp{fa526}.
-
- @item -mtune=@var{name}
- @opindex mtune
diff --git a/toolchain/gcc/patches/4.5-linaro/999-coldfire.patch b/toolchain/gcc/patches/4.5-linaro/999-coldfire.patch
deleted file mode 100644
index c8e4bd03a..000000000
--- a/toolchain/gcc/patches/4.5-linaro/999-coldfire.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/gcc/config.gcc
-+++ b/gcc/config.gcc
-@@ -1690,6 +1690,7 @@ m68k-*-linux*) # Motorola m68k's runnin
- if test x$sjlj != x1; then
- tmake_file="$tmake_file m68k/t-slibgcc-elf-ver"
- fi
-+ tmake_file="m68k/t-floatlib m68k/t-m68kbare m68k/t-m68kelf"
- ;;
- m68k-*-rtems*)
- default_m68k_cpu=68020
diff --git a/toolchain/gcc/patches/4.6-linaro/010-documentation.patch b/toolchain/gcc/patches/4.6-linaro/010-documentation.patch
new file mode 100644
index 000000000..25773a3d3
--- /dev/null
+++ b/toolchain/gcc/patches/4.6-linaro/010-documentation.patch
@@ -0,0 +1,23 @@
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -4251,18 +4251,10 @@
+ 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.6-linaro/020-gcc_bug_54295.patch b/toolchain/gcc/patches/4.6-linaro/020-gcc_bug_54295.patch
new file mode 100644
index 000000000..5bef9eab0
--- /dev/null
+++ b/toolchain/gcc/patches/4.6-linaro/020-gcc_bug_54295.patch
@@ -0,0 +1,70 @@
+diff -urN a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
+--- a/gcc/tree-ssa-math-opts.c 2012-12-12 18:05:23.000000000 +0100
++++ b/gcc/tree-ssa-math-opts.c 2013-04-29 15:54:00.051998936 +0200
+@@ -1280,6 +1280,47 @@
+ return result;
+ }
+
++/* Return true if stmt is a type conversion operation that can be stripped
++ when used in a widening multiply operation. */
++static bool
++widening_mult_conversion_strippable_p (tree result_type, gimple stmt)
++{
++ enum tree_code rhs_code = gimple_assign_rhs_code (stmt);
++
++ if (TREE_CODE (result_type) == INTEGER_TYPE)
++ {
++ tree op_type;
++ tree inner_op_type;
++
++ if (!CONVERT_EXPR_CODE_P (rhs_code))
++ return false;
++
++ op_type = TREE_TYPE (gimple_assign_lhs (stmt));
++
++ /* If the type of OP has the same precision as the result, then
++ we can strip this conversion. The multiply operation will be
++ selected to create the correct extension as a by-product. */
++ if (TYPE_PRECISION (result_type) == TYPE_PRECISION (op_type))
++ return true;
++
++ /* We can also strip a conversion if it preserves the signed-ness of
++ the operation and doesn't narrow the range. */
++ inner_op_type = TREE_TYPE (gimple_assign_rhs1 (stmt));
++
++ /* If the inner-most type is unsigned, then we can strip any
++ intermediate widening operation. If it's signed, then the
++ intermediate widening operation must also be signed. */
++ if ((TYPE_UNSIGNED (inner_op_type)
++ || TYPE_UNSIGNED (op_type) == TYPE_UNSIGNED (inner_op_type))
++ && TYPE_PRECISION (op_type) > TYPE_PRECISION (inner_op_type))
++ return true;
++
++ return false;
++ }
++
++ return rhs_code == FIXED_CONVERT_EXPR;
++}
++
+ /* Return true if RHS is a suitable operand for a widening multiplication,
+ assuming a target type of TYPE.
+ There are two cases:
+@@ -1296,17 +1337,13 @@
+ {
+ gimple stmt;
+ tree type1, rhs1;
+- enum tree_code rhs_code;
+
+ if (TREE_CODE (rhs) == SSA_NAME)
+ {
+ stmt = SSA_NAME_DEF_STMT (rhs);
+ if (is_gimple_assign (stmt))
+ {
+- rhs_code = gimple_assign_rhs_code (stmt);
+- if (TREE_CODE (type) == INTEGER_TYPE
+- ? !CONVERT_EXPR_CODE_P (rhs_code)
+- : rhs_code != FIXED_CONVERT_EXPR)
++ if (! widening_mult_conversion_strippable_p (type, stmt))
+ rhs1 = rhs;
+ else
+ {
diff --git a/toolchain/gcc/patches/4.6-linaro/200-musl.patch b/toolchain/gcc/patches/4.6-linaro/200-musl.patch
index cee994809..f861e0b51 100644
--- a/toolchain/gcc/patches/4.6-linaro/200-musl.patch
+++ b/toolchain/gcc/patches/4.6-linaro/200-musl.patch
@@ -1,4 +1,3 @@
-diff --git a/config.sub b/config.sub
--- a/config.sub
+++ b/config.sub
@@ -125,6 +125,7 @@ esac
@@ -9,18 +8,9 @@ diff --git a/config.sub b/config.sub
linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
-@@ -1310,6 +1311,7 @@ case $os in
- | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -linux-android* \
- | -linux-newlib* | -linux-uclibc* \
-+ | -linux-musl* \
- | -uxpv* | -beos* | -mpeix* | -udk* \
- | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
- | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
-diff --git a/gcc/config.gcc b/gcc/config.gcc
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
-@@ -478,7 +478,7 @@ case ${target} in
+@@ -485,7 +485,7 @@ case ${target} in
esac
# Common C libraries.
@@ -29,7 +19,7 @@ diff --git a/gcc/config.gcc b/gcc/config.gcc
# Common parts for widely ported systems.
case ${target} in
-@@ -591,6 +591,9 @@ case ${target} in
+@@ -598,6 +598,9 @@ case ${target} in
*-*-*uclibc*)
tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
;;
@@ -39,12 +29,11 @@ diff --git a/gcc/config.gcc b/gcc/config.gcc
*)
tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
;;
-diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
-@@ -64,6 +64,10 @@
- #undef GLIBC_DYNAMIC_LINKER
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
+@@ -78,6 +78,10 @@
+ %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
+ %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
+/* musl has no "classic" (i.e. broken) mode */
+#undef MUSL_DYNAMIC_LINKER
@@ -53,10 +42,9 @@ diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
/* 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
-diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
--- a/gcc/config/i386/linux.h
+++ b/gcc/config/i386/linux.h
-@@ -93,6 +93,7 @@ along with GCC; see the file COPYING3. If not see
+@@ -93,6 +93,7 @@ along with GCC; see the file COPYING3.
/* These macros may be overridden in k*bsd-gnu.h and i386/k*bsd-gnu.h. */
#define LINK_EMULATION "elf_i386"
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
@@ -64,10 +52,9 @@ diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
#undef ASM_SPEC
#define ASM_SPEC \
-diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
--- a/gcc/config/i386/linux64.h
+++ b/gcc/config/i386/linux64.h
-@@ -65,6 +65,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+@@ -65,6 +65,9 @@ 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"
@@ -77,10 +64,9 @@ diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
#if TARGET_64BIT_DEFAULT
#define SPEC_32 "m32"
#define SPEC_64 "!m32"
-diff --git a/gcc/config/linux.h b/gcc/config/linux.h
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
-@@ -33,10 +33,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+@@ -33,10 +33,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)
@@ -93,7 +79,7 @@ diff --git a/gcc/config/linux.h b/gcc/config/linux.h
#endif
#define LINUX_TARGET_OS_CPP_BUILTINS() \
-@@ -54,18 +56,21 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+@@ -54,18 +56,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. */
@@ -123,7 +109,7 @@ diff --git a/gcc/config/linux.h b/gcc/config/linux.h
#else
#error "Unsupported DEFAULT_LIBC"
#endif /* DEFAULT_LIBC */
-@@ -83,13 +88,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+@@ -83,13 +88,13 @@ see the files COPYING3 and COPYING.RUNTI
#define LINUX_DYNAMIC_LINKER \
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
@@ -140,7 +126,6 @@ diff --git a/gcc/config/linux.h b/gcc/config/linux.h
/* Determine whether the entire c99 runtime
is present in the runtime library. */
-diff --git a/gcc/config/linux.opt b/gcc/config/linux.opt
--- a/gcc/config/linux.opt
+++ b/gcc/config/linux.opt
@@ -30,3 +30,7 @@ Use GNU C library
@@ -151,10 +136,9 @@ diff --git a/gcc/config/linux.opt b/gcc/config/linux.opt
+mmusl
+Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
+Use musl C library
-diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
--- a/gcc/config/mips/linux.h
+++ b/gcc/config/mips/linux.h
-@@ -63,6 +63,8 @@ along with GCC; see the file COPYING3. If not see
+@@ -63,6 +63,8 @@ along with GCC; see the file COPYING3.
#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
@@ -163,7 +147,6 @@ diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
/* Borrowed from sparc/linux.h */
#undef LINK_SPEC
#define LINK_SPEC \
-diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
--- a/gcc/ginclude/stddef.h
+++ b/gcc/ginclude/stddef.h
@@ -184,6 +184,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
@@ -190,7 +173,6 @@ diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
#endif /* __size_t */
#endif /* _SIZET_ */
#endif /* _GCC_SIZE_T */
-diff --git a/libgomp/config/posix/time.c b/libgomp/config/posix/time.c
--- a/libgomp/config/posix/time.c
+++ b/libgomp/config/posix/time.c
@@ -28,6 +28,8 @@
@@ -202,7 +184,6 @@ diff --git a/libgomp/config/posix/time.c b/libgomp/config/posix/time.c
#include "libgomp.h"
#include <unistd.h>
#if TIME_WITH_SYS_TIME
-diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
--- a/libstdc++-v3/configure.host
+++ b/libstdc++-v3/configure.host
@@ -237,6 +237,13 @@ case "${host_os}" in
@@ -229,3 +210,19 @@ diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
hpux*)
os_include_dir="os/hpux"
;;
+--- a/gcc/config/mips/linux64.h
++++ b/gcc/config/mips/linux64.h
+@@ -40,9 +40,12 @@ along with GCC; see the file COPYING3.
+ #define GLIBC_DYNAMIC_LINKERN32 "/lib32/ld.so.1"
+ #define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
+ #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
++#define MUSL_DYNAMIC_LINKERN32 "/lib/ld-musl-mips.so.1"
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-mips.so.1"
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-mips.so.1"
+ #define LINUX_DYNAMIC_LINKERN32 \
+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
+- BIONIC_DYNAMIC_LINKERN32)
++ BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32)
+
+ #undef LINK_SPEC
+ #define LINK_SPEC "\
diff --git a/toolchain/gcc/patches/4.6-linaro/830-arm_unbreak_armv4t.patch b/toolchain/gcc/patches/4.6-linaro/830-arm_unbreak_armv4t.patch
index 37f8f2a54..7e2ed6987 100644
--- a/toolchain/gcc/patches/4.6-linaro/830-arm_unbreak_armv4t.patch
+++ b/toolchain/gcc/patches/4.6-linaro/830-arm_unbreak_armv4t.patch
@@ -2,7 +2,7 @@ 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 @@
+@@ -46,7 +46,7 @@
The ARM10TDMI core is the default for armv5t, so set
SUBTARGET_CPU_DEFAULT to achieve this. */
#undef SUBTARGET_CPU_DEFAULT
diff --git a/toolchain/gcc/patches/4.6-linaro/840-armv4_pass_fix-v4bx_to_ld.patch b/toolchain/gcc/patches/4.6-linaro/840-armv4_pass_fix-v4bx_to_ld.patch
index 67c374d9a..3be371be6 100644
--- a/toolchain/gcc/patches/4.6-linaro/840-armv4_pass_fix-v4bx_to_ld.patch
+++ b/toolchain/gcc/patches/4.6-linaro/840-armv4_pass_fix-v4bx_to_ld.patch
@@ -1,8 +1,8 @@
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
-@@ -64,10 +64,15 @@
- #undef GLIBC_DYNAMIC_LINKER
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
+@@ -82,10 +82,15 @@
+ #undef MUSL_DYNAMIC_LINKER
+ #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-arm.so.1"
+/* For armv4 we pass --fix-v4bx to linker to support EABI */
+#undef TARGET_FIX_V4BX_SPEC
diff --git a/toolchain/gcc/patches/4.6-linaro/850-use_shared_libgcc.patch b/toolchain/gcc/patches/4.6-linaro/850-use_shared_libgcc.patch
index a197bed7a..1a7f62a7e 100644
--- a/toolchain/gcc/patches/4.6-linaro/850-use_shared_libgcc.patch
+++ b/toolchain/gcc/patches/4.6-linaro/850-use_shared_libgcc.patch
@@ -1,6 +1,6 @@
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
-@@ -96,10 +96,6 @@
+@@ -115,10 +115,6 @@
#define ENDFILE_SPEC \
LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC)
@@ -24,7 +24,7 @@
#define LINUX_TARGET_LINK_SPEC "%{h*} \
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
-@@ -50,6 +50,10 @@ see the files COPYING3 and COPYING.RUNTI
+@@ -52,6 +52,10 @@ see the files COPYING3 and COPYING.RUNTI
builtin_assert ("system=posix"); \
} while (0)
diff --git a/toolchain/gcc/patches/4.6-linaro/860-uclibc_use_eh_frame.patch b/toolchain/gcc/patches/4.6-linaro/860-uclibc_use_eh_frame.patch
index 6b85d4913..381a14bc9 100644
--- a/toolchain/gcc/patches/4.6-linaro/860-uclibc_use_eh_frame.patch
+++ b/toolchain/gcc/patches/4.6-linaro/860-uclibc_use_eh_frame.patch
@@ -1,6 +1,6 @@
--- a/gcc/crtstuff.c
+++ b/gcc/crtstuff.c
-@@ -100,15 +100,20 @@
+@@ -100,15 +100,20 @@ call_ ## FUNC (void) \
#if defined(OBJECT_FORMAT_ELF) \
&& !defined(OBJECT_FORMAT_FLAT) \
&& defined(HAVE_LD_EH_FRAME_HDR) \
diff --git a/toolchain/gcc/patches/4.6-linaro/870-ppc_no_crtsavres.patch b/toolchain/gcc/patches/4.6-linaro/870-ppc_no_crtsavres.patch
index 874774348..0e15ffc39 100644
--- a/toolchain/gcc/patches/4.6-linaro/870-ppc_no_crtsavres.patch
+++ b/toolchain/gcc/patches/4.6-linaro/870-ppc_no_crtsavres.patch
@@ -1,6 +1,6 @@
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
-@@ -248,13 +248,13 @@
+@@ -248,13 +248,13 @@ do { \
/* Define cutoff for using external functions to save floating point.
When optimizing for size, use external functions when profitable. */
diff --git a/toolchain/gcc/patches/4.6-linaro/900-bad-mips16-crt b/toolchain/gcc/patches/4.6-linaro/900-bad-mips16-crt
new file mode 100644
index 000000000..5bb2ffb48
--- /dev/null
+++ b/toolchain/gcc/patches/4.6-linaro/900-bad-mips16-crt
@@ -0,0 +1,9 @@
+--- gcc/gcc/config/mips/t-libgcc-mips16~ 2013-03-26 09:09:34.209077496 -0400
++++ gcc/gcc/config/mips/t-libgcc-mips16 2013-03-26 18:21:01.717303669 -0400
+@@ -43,3 +43,6 @@
+
+ # 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.6-linaro/910-mbsd_multi.patch b/toolchain/gcc/patches/4.6-linaro/910-mbsd_multi.patch
index 45a551e6e..51bbc7f2b 100644
--- a/toolchain/gcc/patches/4.6-linaro/910-mbsd_multi.patch
+++ b/toolchain/gcc/patches/4.6-linaro/910-mbsd_multi.patch
@@ -209,7 +209,7 @@
-Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
-Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
-Wformat-security -Wformat-y2k @gol
-@@ -4497,6 +4497,22 @@ This option is only supported for C and
+@@ -4498,6 +4498,22 @@ This option is only supported for C and
@option{-Wall} and by @option{-pedantic}, which can be disabled with
@option{-Wno-pointer-sign}.
@@ -232,7 +232,7 @@
@item -Wstack-protector
@opindex Wstack-protector
@opindex Wno-stack-protector
-@@ -6319,7 +6335,7 @@ so, the first branch is redirected to ei
+@@ -6317,7 +6333,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.
diff --git a/toolchain/gcc/patches/4.6-linaro/999-coldfire.patch b/toolchain/gcc/patches/4.6-linaro/999-coldfire.patch
index e14561b89..0913f3497 100644
--- a/toolchain/gcc/patches/4.6-linaro/999-coldfire.patch
+++ b/toolchain/gcc/patches/4.6-linaro/999-coldfire.patch
@@ -1,6 +1,6 @@
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
-@@ -1795,7 +1795,7 @@
+@@ -1805,7 +1805,7 @@ m68k-*-linux*) # Motorola m68k's runnin
default_m68k_cpu=68020
default_cf_cpu=5475
with_arch=${with_arch:-m68k}
diff --git a/toolchain/gcc/patches/4.6.2/000-gcc-bug-54369.patch b/toolchain/gcc/patches/4.6.2/000-gcc-bug-54369.patch
deleted file mode 100644
index b91f0eb62..000000000
--- a/toolchain/gcc/patches/4.6.2/000-gcc-bug-54369.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-Author: ebotcazou
-Date: Sun Sep 2 10:37:49 2012
-New Revision: 190860
-
-URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190860
-Log:
- PR rtl-optimization/54369
- * config/mips/mips.c (mips_reorg): Invoke cleanup_barriers before
- calling dbr_schedule.
- * config/sparc/sparc.c (sparc_reorg): Likewise.
-
-Modified:
- branches/gcc-4_6-branch/gcc/ChangeLog
- branches/gcc-4_6-branch/gcc/config/mips/mips.c
- branches/gcc-4_6-branch/gcc/config/sparc/sparc.c
----
---- gcc-4_6-branch/gcc/config/mips/mips.c 2012/09/02 10:36:54 190859
-+++ gcc-4_6-branch/gcc/config/mips/mips.c 2012/09/02 10:37:49 190860
-@@ -15083,7 +15083,10 @@
- }
-
- if (optimize > 0 && flag_delayed_branch)
-- dbr_schedule (get_insns ());
-+ {
-+ cleanup_barriers ();
-+ dbr_schedule (get_insns ());
-+ }
- mips_reorg_process_insns ();
- if (!TARGET_MIPS16
- && TARGET_EXPLICIT_RELOCS
---- gcc-4_6-branch/gcc/config/sparc/sparc.c 2012/09/02 10:36:54 190859
-+++ gcc-4_6-branch/gcc/config/sparc/sparc.c 2012/09/02 10:37:49 190860
-@@ -9456,7 +9456,10 @@
- /* We need to have the (essentially) final form of the insn stream in order
- to properly detect the various hazards. Run delay slot scheduling. */
- if (optimize > 0 && flag_delayed_branch)
-- dbr_schedule (get_insns ());
-+ {
-+ cleanup_barriers ();
-+ dbr_schedule (get_insns ());
-+ }
-
- /* Now look for specific patterns in the insn stream. */
- for (insn = get_insns (); insn; insn = next)
-
diff --git a/toolchain/gcc/patches/4.6.2/002-siginfo_t.patch b/toolchain/gcc/patches/4.6.2/002-siginfo_t.patch
deleted file mode 100644
index a19b7f221..000000000
--- a/toolchain/gcc/patches/4.6.2/002-siginfo_t.patch
+++ /dev/null
@@ -1,157 +0,0 @@
-There is one usage in boehm-gc/os_dep.c, but it is only used if
-SUNOS5SIGS is defined, which it is only if one of SUNOS5, DRSNX, HPUX, or
-FREEBSD is defined, which are all not using Linux-based glibc ports.
-
-Likewise, gcc/ada/init.c has a struct __siginfo occurence, but only for
-__FreeBSD__.
-
-config/rs6000/linux-unwind.h uses ``char siginfo[128]'', and
-config/s390/linux-unwind.h also uses a constant.
-
-I tested the following patch for sh-linux-gnu. This only covers one
-configuration, but the change is pretty mechanic anyway and every place
-that used to refer to struct siginfo already must have had <signal.h> in
-its include path, which is the same file that declares siginfo_t.
-
-OK to commit? This should probably also go into any active release
-branches, to keep them buildable once this glibc change ripples through?
-
-gcc/
- * config/alpha/linux-unwind.h (alpha_fallback_frame_state): Use
- siginfo_t instead of struct siginfo.
- * config/bfin/linux-unwind.h (bfin_fallback_frame_state): Likewise.
- * config/i386/linux-unwind.h (x86_fallback_frame_state): Likewise.
- * config/ia64/linux-unwind.h (ia64_fallback_frame_state)
- (ia64_handle_unwabi): Likewise.
- * config/mips/linux-unwind.h (mips_fallback_frame_state): Likewise.
- * config/pa/linux-unwind.h (pa32_fallback_frame_state): Likewise.
- * config/sh/linux-unwind.h (shmedia_fallback_frame_state)
- (sh_fallback_frame_state): Likewise.
- * config/tilepro/linux-unwind.h (tile_fallback_frame_state): Likewise.
- * config/xtensa/linux-unwind.h (xtensa_fallback_frame_state): Likewise.
-
----
-diff -urN gcc-linaro-4.6-2012.02/gcc/config/alpha/linux-unwind.h gcc-linaro-4.6-2012.02.new/gcc/config/alpha/linux-unwind.h
---- gcc-linaro-4.6-2012.02/gcc/config/alpha/linux-unwind.h 2012-02-07 11:33:31.000000000 +0100
-+++ gcc-linaro-4.6-2012.02.new/gcc/config/alpha/linux-unwind.h 2012-09-13 10:25:52.919072751 +0200
-@@ -49,7 +49,7 @@
- else if (pc[1] == 0x201f015f) /* lda $0,NR_rt_sigreturn */
- {
- struct rt_sigframe {
-- struct siginfo info;
-+ siginfo_t info;
- struct ucontext uc;
- } *rt_ = context->cfa;
- sc = &rt_->uc.uc_mcontext;
-diff -urN gcc-linaro-4.6-2012.02/gcc/config/bfin/linux-unwind.h gcc-linaro-4.6-2012.02.new/gcc/config/bfin/linux-unwind.h
---- gcc-linaro-4.6-2012.02/gcc/config/bfin/linux-unwind.h 2012-02-07 11:33:31.000000000 +0100
-+++ gcc-linaro-4.6-2012.02.new/gcc/config/bfin/linux-unwind.h 2012-09-13 10:26:14.819073313 +0200
-@@ -48,10 +48,10 @@
- {
- struct rt_sigframe {
- int sig;
-- struct siginfo *pinfo;
-+ siginfo_t *pinfo;
- void *puc;
- char retcode[8];
-- struct siginfo info;
-+ siginfo_t info;
- struct ucontext uc;
- } *rt_ = context->cfa;
-
-diff -urN gcc-linaro-4.6-2012.02/gcc/config/i386/linux-unwind.h gcc-linaro-4.6-2012.02.new/gcc/config/i386/linux-unwind.h
---- gcc-linaro-4.6-2012.02/gcc/config/i386/linux-unwind.h 2012-02-07 11:33:31.000000000 +0100
-+++ gcc-linaro-4.6-2012.02.new/gcc/config/i386/linux-unwind.h 2012-09-13 10:26:41.891074005 +0200
-@@ -133,9 +133,9 @@
- {
- struct rt_sigframe {
- int sig;
-- struct siginfo *pinfo;
-+ siginfo_t *pinfo;
- void *puc;
-- struct siginfo info;
-+ siginfo_t info;
- struct ucontext uc;
- } *rt_ = context->cfa;
- /* The void * cast is necessary to avoid an aliasing warning.
-diff -urN gcc-linaro-4.6-2012.02/gcc/config/ia64/linux-unwind.h gcc-linaro-4.6-2012.02.new/gcc/config/ia64/linux-unwind.h
---- gcc-linaro-4.6-2012.02/gcc/config/ia64/linux-unwind.h 2012-02-07 11:33:31.000000000 +0100
-+++ gcc-linaro-4.6-2012.02.new/gcc/config/ia64/linux-unwind.h 2012-09-13 10:26:59.251074450 +0200
-@@ -47,7 +47,7 @@
- struct sigframe {
- char scratch[16];
- unsigned long sig_number;
-- struct siginfo *info;
-+ siginfo_t *info;
- struct sigcontext *sc;
- } *frame_ = (struct sigframe *)context->psp;
- struct sigcontext *sc = frame_->sc;
-@@ -137,7 +137,7 @@
- struct sigframe {
- char scratch[16];
- unsigned long sig_number;
-- struct siginfo *info;
-+ siginfo_t *info;
- struct sigcontext *sc;
- } *frame = (struct sigframe *)context->psp;
- struct sigcontext *sc = frame->sc;
-diff -urN gcc-linaro-4.6-2012.02/gcc/config/mips/linux-unwind.h gcc-linaro-4.6-2012.02.new/gcc/config/mips/linux-unwind.h
---- gcc-linaro-4.6-2012.02/gcc/config/mips/linux-unwind.h 2012-02-07 11:33:31.000000000 +0100
-+++ gcc-linaro-4.6-2012.02.new/gcc/config/mips/linux-unwind.h 2012-09-13 10:27:17.947074929 +0200
-@@ -75,7 +75,7 @@
- struct rt_sigframe {
- u_int32_t ass[4]; /* Argument save space for o32. */
- u_int32_t trampoline[2];
-- struct siginfo info;
-+ siginfo_t info;
- _sig_ucontext_t uc;
- } *rt_ = context->cfa;
- sc = &rt_->uc.uc_mcontext;
-diff -urN gcc-linaro-4.6-2012.02/gcc/config/pa/linux-unwind.h gcc-linaro-4.6-2012.02.new/gcc/config/pa/linux-unwind.h
---- gcc-linaro-4.6-2012.02/gcc/config/pa/linux-unwind.h 2012-02-07 11:33:31.000000000 +0100
-+++ gcc-linaro-4.6-2012.02.new/gcc/config/pa/linux-unwind.h 2012-09-13 10:27:27.491075173 +0200
-@@ -63,7 +63,7 @@
- int i;
- struct sigcontext *sc;
- struct rt_sigframe {
-- struct siginfo info;
-+ siginfo_t info;
- struct ucontext uc;
- } *frame;
-
-diff -urN gcc-linaro-4.6-2012.02/gcc/config/sh/linux-unwind.h gcc-linaro-4.6-2012.02.new/gcc/config/sh/linux-unwind.h
---- gcc-linaro-4.6-2012.02/gcc/config/sh/linux-unwind.h 2012-02-07 11:33:31.000000000 +0100
-+++ gcc-linaro-4.6-2012.02.new/gcc/config/sh/linux-unwind.h 2012-09-13 10:27:58.551075969 +0200
-@@ -80,9 +80,9 @@
- && (*(unsigned long *) (pc+11) == 0x6ff0fff0))
- {
- struct rt_sigframe {
-- struct siginfo *pinfo;
-+ siginfo_t *pinfo;
- void *puc;
-- struct siginfo info;
-+ siginfo_t info;
- struct ucontext uc;
- } *rt_ = context->cfa;
- /* The void * cast is necessary to avoid an aliasing warning.
-@@ -179,7 +179,7 @@
- && (*(unsigned short *) (pc+14) == 0x00ad))))
- {
- struct rt_sigframe {
-- struct siginfo info;
-+ siginfo_t info;
- struct ucontext uc;
- } *rt_ = context->cfa;
- /* The void * cast is necessary to avoid an aliasing warning.
-diff -urN gcc-linaro-4.6-2012.02/gcc/config/xtensa/linux-unwind.h gcc-linaro-4.6-2012.02.new/gcc/config/xtensa/linux-unwind.h
---- gcc-linaro-4.6-2012.02/gcc/config/xtensa/linux-unwind.h 2012-02-07 11:33:31.000000000 +0100
-+++ gcc-linaro-4.6-2012.02.new/gcc/config/xtensa/linux-unwind.h 2012-09-13 10:28:13.827076359 +0200
-@@ -62,7 +62,7 @@
- struct sigcontext *sc;
-
- struct rt_sigframe {
-- struct siginfo info;
-+ siginfo_t info;
- struct ucontext uc;
- } *rt_;
-
diff --git a/toolchain/gcc/patches/4.6.2/200-musl.patch b/toolchain/gcc/patches/4.6.2/200-musl.patch
deleted file mode 100644
index cee994809..000000000
--- a/toolchain/gcc/patches/4.6.2/200-musl.patch
+++ /dev/null
@@ -1,231 +0,0 @@
-diff --git a/config.sub b/config.sub
---- a/config.sub
-+++ b/config.sub
-@@ -125,6 +125,7 @@ esac
- maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
- case $maybe_os in
- nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
-+ linux-musl* | \
- linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
- knetbsd*-gnu* | netbsd*-gnu* | \
- kopensolaris*-gnu* | \
-@@ -1310,6 +1311,7 @@ case $os in
- | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -linux-android* \
- | -linux-newlib* | -linux-uclibc* \
-+ | -linux-musl* \
- | -uxpv* | -beos* | -mpeix* | -udk* \
- | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
- | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
-diff --git a/gcc/config.gcc b/gcc/config.gcc
---- a/gcc/config.gcc
-+++ b/gcc/config.gcc
-@@ -478,7 +478,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"
-
- # Common parts for widely ported systems.
- case ${target} in
-@@ -591,6 +591,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"
- ;;
-diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
---- a/gcc/config/arm/linux-eabi.h
-+++ b/gcc/config/arm/linux-eabi.h
-@@ -64,6 +64,10 @@
- #undef GLIBC_DYNAMIC_LINKER
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
-
-+/* musl has no "classic" (i.e. broken) mode */
-+#undef MUSL_DYNAMIC_LINKER
-+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-arm.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
-diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
---- a/gcc/config/i386/linux.h
-+++ b/gcc/config/i386/linux.h
-@@ -93,6 +93,7 @@ along with GCC; see the file COPYING3. If not see
- /* These macros may be overridden in k*bsd-gnu.h and i386/k*bsd-gnu.h. */
- #define LINK_EMULATION "elf_i386"
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
-+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
-
- #undef ASM_SPEC
- #define ASM_SPEC \
-diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
---- a/gcc/config/i386/linux64.h
-+++ b/gcc/config/i386/linux64.h
-@@ -65,6 +65,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
- #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
-
-+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
-+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
-+
- #if TARGET_64BIT_DEFAULT
- #define SPEC_32 "m32"
- #define SPEC_64 "!m32"
-diff --git a/gcc/config/linux.h b/gcc/config/linux.h
---- a/gcc/config/linux.h
-+++ b/gcc/config/linux.h
-@@ -33,10 +33,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- #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 LINUX_TARGET_OS_CPP_BUILTINS() \
-@@ -54,18 +56,21 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- 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 */
-@@ -83,13 +88,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-
- #define LINUX_DYNAMIC_LINKER \
- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
-- BIONIC_DYNAMIC_LINKER)
-+ BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
- #define LINUX_DYNAMIC_LINKER32 \
- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
-- BIONIC_DYNAMIC_LINKER32)
-+ BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
- #define LINUX_DYNAMIC_LINKER64 \
- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
-- BIONIC_DYNAMIC_LINKER64)
-+ BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
-
- /* Determine whether the entire c99 runtime
- is present in the runtime library. */
-diff --git a/gcc/config/linux.opt b/gcc/config/linux.opt
---- 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
-diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
---- a/gcc/config/mips/linux.h
-+++ b/gcc/config/mips/linux.h
-@@ -63,6 +63,8 @@ along with GCC; see the file COPYING3. If not see
-
- #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
-
-+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips.so.1"
-+
- /* Borrowed from sparc/linux.h */
- #undef LINK_SPEC
- #define LINK_SPEC \
-diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
---- a/gcc/ginclude/stddef.h
-+++ b/gcc/ginclude/stddef.h
-@@ -184,6 +184,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
-@@ -200,6 +201,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)
- /* __size_t is a typedef on FreeBSD 5!, must not trash it. */
- #else
-@@ -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/libgomp/config/posix/time.c b/libgomp/config/posix/time.c
---- 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/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
---- a/libstdc++-v3/configure.host
-+++ b/libstdc++-v3/configure.host
-@@ -237,6 +237,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
-@@ -245,6 +252,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.6.2/301-missing-execinfo_h.patch b/toolchain/gcc/patches/4.6.2/301-missing-execinfo_h.patch
deleted file mode 100644
index b3f1e68d3..000000000
--- a/toolchain/gcc/patches/4.6.2/301-missing-execinfo_h.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/boehm-gc/include/gc.h
-+++ b/boehm-gc/include/gc.h
-@@ -503,7 +503,7 @@ GC_API GC_PTR GC_malloc_atomic_ignore_of
- #if defined(__linux__) || defined(__GLIBC__)
- # include <features.h>
- # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
-- && !defined(__ia64__)
-+ && !defined(__ia64__) && !defined(__UCLIBC__)
- # ifndef GC_HAVE_BUILTIN_BACKTRACE
- # define GC_HAVE_BUILTIN_BACKTRACE
- # endif
diff --git a/toolchain/gcc/patches/4.6.2/302-c99-snprintf.patch b/toolchain/gcc/patches/4.6.2/302-c99-snprintf.patch
deleted file mode 100644
index eda1854df..000000000
--- a/toolchain/gcc/patches/4.6.2/302-c99-snprintf.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/libstdc++-v3/include/c_global/cstdio
-+++ b/libstdc++-v3/include/c_global/cstdio
-@@ -137,7 +137,7 @@ namespace std
- using ::vsprintf;
- } // namespace
-
--#if _GLIBCXX_USE_C99
-+#if _GLIBCXX_USE_C99 || defined __UCLIBC__
-
- #undef snprintf
- #undef vfscanf
diff --git a/toolchain/gcc/patches/4.6.2/305-libmudflap-susv3-legacy.patch b/toolchain/gcc/patches/4.6.2/305-libmudflap-susv3-legacy.patch
deleted file mode 100644
index 8e2d15f81..000000000
--- a/toolchain/gcc/patches/4.6.2/305-libmudflap-susv3-legacy.patch
+++ /dev/null
@@ -1,47 +0,0 @@
---- a/libmudflap/mf-hooks2.c
-+++ b/libmudflap/mf-hooks2.c
-@@ -421,7 +421,7 @@ WRAPPER2(void, bzero, void *s, size_t n)
- {
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
-- bzero (s, n);
-+ memset (s, 0, n);
- }
-
-
-@@ -431,7 +431,7 @@ WRAPPER2(void, bcopy, const void *src, v
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
- MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
-- bcopy (src, dest, n);
-+ memmove (dest, src, n);
- }
-
-
-@@ -441,7 +441,7 @@ WRAPPER2(int, bcmp, const void *s1, cons
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
- MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
-- return bcmp (s1, s2, n);
-+ return n == 0 ? 0 : memcmp (s1, s2, n);
- }
-
-
-@@ -450,7 +450,7 @@ WRAPPER2(char *, index, const char *s, i
- size_t n = strlen (s);
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
-- return index (s, c);
-+ return strchr (s, c);
- }
-
-
-@@ -459,7 +459,7 @@ WRAPPER2(char *, rindex, const char *s,
- size_t n = strlen (s);
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
-- return rindex (s, c);
-+ return strrchr (s, c);
- }
-
- /* XXX: stpcpy, memccpy */
diff --git a/toolchain/gcc/patches/4.6.2/810-arm-softfloat-libgcc.patch b/toolchain/gcc/patches/4.6.2/810-arm-softfloat-libgcc.patch
deleted file mode 100644
index 60cfde407..000000000
--- a/toolchain/gcc/patches/4.6.2/810-arm-softfloat-libgcc.patch
+++ /dev/null
@@ -1,26 +0,0 @@
---- 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}}"
-
--#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc"
-+#define LIBGCC_SPEC "-lgcc"
-
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
-
---- a/gcc/config/arm/t-linux
-+++ b/gcc/config/arm/t-linux
-@@ -23,7 +23,11 @@ TARGET_LIBGCC2_CFLAGS = -fomit-frame-poi
-
- LIB1ASMSRC = arm/lib1funcs.asm
- LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
-- _arm_addsubdf3 _arm_addsubsf3
-+ _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
-
- # MULTILIB_OPTIONS = mhard-float/msoft-float
- # MULTILIB_DIRNAMES = hard-float soft-float
diff --git a/toolchain/gcc/patches/4.6.2/910-mbsd_multi.patch b/toolchain/gcc/patches/4.6.2/910-mbsd_multi.patch
deleted file mode 100644
index 3623d3872..000000000
--- a/toolchain/gcc/patches/4.6.2/910-mbsd_multi.patch
+++ /dev/null
@@ -1,253 +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.
- * Make -fno-strict-aliasing and -fno-delete-null-pointer-checks
- the default for -O2/-Os, because they trigger gcc bugs
- and can delete code with security implications.
-
- 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
-@@ -103,6 +103,9 @@ static size_t deferred_count;
- /* Number of deferred options scanned for -include. */
- static size_t include_cursor;
-
-+/* 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_cxx0x (int);
-@@ -441,6 +444,9 @@ c_common_handle_option (size_t scode, co
- global_dc->warning_as_error_requested = value;
- break;
-
-+ case OPT_Werror_maybe_reset:
-+ break;
-+
- case OPT_Wformat:
- set_Wformat (value);
- break;
-@@ -584,6 +590,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;
-@@ -1058,6 +1070,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
-@@ -363,6 +363,10 @@ Werror-implicit-function-declaration
- C ObjC RejectNegative Warning Alias(Werror=, implicit-function-declaration)
- This switch is deprecated; use -Werror=implicit-function-declaration instead
-
-+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
-@@ -794,6 +798,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
-@@ -520,6 +520,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
-@@ -1156,6 +1160,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
-@@ -477,8 +477,6 @@ static const struct default_options defa
- { OPT_LEVELS_2_PLUS, OPT_fschedule_insns2, NULL, 1 },
- #endif
- { OPT_LEVELS_2_PLUS, OPT_fregmove, NULL, 1 },
-- { OPT_LEVELS_2_PLUS, OPT_fstrict_aliasing, NULL, 1 },
-- { OPT_LEVELS_2_PLUS, OPT_fstrict_overflow, NULL, 1 },
- { OPT_LEVELS_2_PLUS, OPT_freorder_blocks, NULL, 1 },
- { OPT_LEVELS_2_PLUS, OPT_freorder_functions, NULL, 1 },
- { OPT_LEVELS_2_PLUS, OPT_ftree_vrp, NULL, 1 },
-@@ -494,6 +492,8 @@ static const struct default_options defa
- { OPT_LEVELS_2_PLUS, OPT_falign_functions, NULL, 1 },
-
- /* -O3 optimizations. */
-+ { OPT_LEVELS_3_PLUS, OPT_fstrict_aliasing, NULL, 1 },
-+ { OPT_LEVELS_3_PLUS, OPT_fstrict_overflow, NULL, 1 },
- { OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribute_patterns, NULL, 1 },
- { OPT_LEVELS_3_PLUS, OPT_fpredictive_commoning, NULL, 1 },
- /* Inlining of functions reducing size is a good idea with -Os
-@@ -1399,6 +1399,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
-@@ -164,6 +164,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
-@@ -240,7 +240,7 @@ Objective-C and Objective-C++ Dialects}.
- -Wconversion -Wcoverage-mismatch -Wno-cpp -Wno-deprecated @gol
- -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
-@@ -4497,6 +4497,22 @@ This option is only supported for C and
- @option{-Wall} and by @option{-pedantic}, 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
-@@ -6319,7 +6335,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
-@@ -627,6 +627,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.6.2/920-specs_nonfatal_getenv.patch b/toolchain/gcc/patches/4.6.2/920-specs_nonfatal_getenv.patch
deleted file mode 100644
index 5055ae898..000000000
--- a/toolchain/gcc/patches/4.6.2/920-specs_nonfatal_getenv.patch
+++ /dev/null
@@ -1,14 +0,0 @@
---- a/gcc/gcc.c
-+++ b/gcc/gcc.c
-@@ -7772,7 +7772,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.6.2/993-arm_insn-opinit-RTX_CODE-fixup.patch b/toolchain/gcc/patches/4.6.2/993-arm_insn-opinit-RTX_CODE-fixup.patch
deleted file mode 100644
index 864f972d1..000000000
--- a/toolchain/gcc/patches/4.6.2/993-arm_insn-opinit-RTX_CODE-fixup.patch
+++ /dev/null
@@ -1,15 +0,0 @@
---- a/gcc/config/arm/arm-protos.h
-+++ b/gcc/config/arm/arm-protos.h
-@@ -41,11 +41,11 @@ extern unsigned int arm_dbx_register_num
- extern void arm_output_fn_unwind (FILE *, bool);
-
-
--#ifdef RTX_CODE
- extern bool arm_vector_mode_supported_p (enum machine_mode);
- extern bool arm_small_register_classes_for_mode_p (enum machine_mode);
- extern int arm_hard_regno_mode_ok (unsigned int, enum machine_mode);
- extern int const_ok_for_arm (HOST_WIDE_INT);
-+#ifdef RTX_CODE
- extern int arm_split_constant (RTX_CODE, enum machine_mode, rtx,
- HOST_WIDE_INT, rtx, rtx, int);
- extern RTX_CODE arm_canonicalize_comparison (RTX_CODE, rtx *, rtx *);
diff --git a/toolchain/gcc/patches/4.6.2/999-coldfire.patch b/toolchain/gcc/patches/4.6.2/999-coldfire.patch
deleted file mode 100644
index 6083e0bf8..000000000
--- a/toolchain/gcc/patches/4.6.2/999-coldfire.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/gcc/config.gcc
-+++ b/gcc/config.gcc
-@@ -1804,6 +1804,7 @@ m68k-*-linux*) # Motorola m68k's runnin
- if test x$sjlj != x1; then
- tmake_file="$tmake_file m68k/t-slibgcc-elf-ver"
- fi
-+ tmake_file="m68k/t-floatlib m68k/t-m68kbare m68k/t-m68kelf"
- ;;
- m68k-*-rtems*)
- default_m68k_cpu=68020
diff --git a/toolchain/gcc/patches/4.6.3/000-gcc-bug-54369.patch b/toolchain/gcc/patches/4.6.3/000-gcc-bug-54369.patch
index b91f0eb62..936b7410e 100644
--- a/toolchain/gcc/patches/4.6.3/000-gcc-bug-54369.patch
+++ b/toolchain/gcc/patches/4.6.3/000-gcc-bug-54369.patch
@@ -14,9 +14,9 @@ Modified:
branches/gcc-4_6-branch/gcc/config/mips/mips.c
branches/gcc-4_6-branch/gcc/config/sparc/sparc.c
---
---- gcc-4_6-branch/gcc/config/mips/mips.c 2012/09/02 10:36:54 190859
-+++ gcc-4_6-branch/gcc/config/mips/mips.c 2012/09/02 10:37:49 190860
-@@ -15083,7 +15083,10 @@
+--- a/gcc/config/mips/mips.c
++++ b/gcc/config/mips/mips.c
+@@ -15083,7 +15083,10 @@ mips_reorg (void)
}
if (optimize > 0 && flag_delayed_branch)
@@ -28,9 +28,9 @@ Modified:
mips_reorg_process_insns ();
if (!TARGET_MIPS16
&& TARGET_EXPLICIT_RELOCS
---- gcc-4_6-branch/gcc/config/sparc/sparc.c 2012/09/02 10:36:54 190859
-+++ gcc-4_6-branch/gcc/config/sparc/sparc.c 2012/09/02 10:37:49 190860
-@@ -9456,7 +9456,10 @@
+--- a/gcc/config/sparc/sparc.c
++++ b/gcc/config/sparc/sparc.c
+@@ -9452,7 +9452,10 @@ sparc_reorg (void)
/* We need to have the (essentially) final form of the insn stream in order
to properly detect the various hazards. Run delay slot scheduling. */
if (optimize > 0 && flag_delayed_branch)
@@ -42,4 +42,3 @@ Modified:
/* Now look for specific patterns in the insn stream. */
for (insn = get_insns (); insn; insn = next)
-
diff --git a/toolchain/gcc/patches/4.6.3/002-siginfo_t.patch b/toolchain/gcc/patches/4.6.3/002-siginfo_t.patch
index a19b7f221..5fc29bb27 100644
--- a/toolchain/gcc/patches/4.6.3/002-siginfo_t.patch
+++ b/toolchain/gcc/patches/4.6.3/002-siginfo_t.patch
@@ -31,10 +31,9 @@ gcc/
* config/xtensa/linux-unwind.h (xtensa_fallback_frame_state): Likewise.
---
-diff -urN gcc-linaro-4.6-2012.02/gcc/config/alpha/linux-unwind.h gcc-linaro-4.6-2012.02.new/gcc/config/alpha/linux-unwind.h
---- gcc-linaro-4.6-2012.02/gcc/config/alpha/linux-unwind.h 2012-02-07 11:33:31.000000000 +0100
-+++ gcc-linaro-4.6-2012.02.new/gcc/config/alpha/linux-unwind.h 2012-09-13 10:25:52.919072751 +0200
-@@ -49,7 +49,7 @@
+--- a/gcc/config/alpha/linux-unwind.h
++++ b/gcc/config/alpha/linux-unwind.h
+@@ -49,7 +49,7 @@ alpha_fallback_frame_state (struct _Unwi
else if (pc[1] == 0x201f015f) /* lda $0,NR_rt_sigreturn */
{
struct rt_sigframe {
@@ -43,10 +42,9 @@ diff -urN gcc-linaro-4.6-2012.02/gcc/config/alpha/linux-unwind.h gcc-linaro-4.6-
struct ucontext uc;
} *rt_ = context->cfa;
sc = &rt_->uc.uc_mcontext;
-diff -urN gcc-linaro-4.6-2012.02/gcc/config/bfin/linux-unwind.h gcc-linaro-4.6-2012.02.new/gcc/config/bfin/linux-unwind.h
---- gcc-linaro-4.6-2012.02/gcc/config/bfin/linux-unwind.h 2012-02-07 11:33:31.000000000 +0100
-+++ gcc-linaro-4.6-2012.02.new/gcc/config/bfin/linux-unwind.h 2012-09-13 10:26:14.819073313 +0200
-@@ -48,10 +48,10 @@
+--- a/gcc/config/bfin/linux-unwind.h
++++ b/gcc/config/bfin/linux-unwind.h
+@@ -48,10 +48,10 @@ bfin_fallback_frame_state (struct _Unwin
{
struct rt_sigframe {
int sig;
@@ -59,10 +57,9 @@ diff -urN gcc-linaro-4.6-2012.02/gcc/config/bfin/linux-unwind.h gcc-linaro-4.6-2
struct ucontext uc;
} *rt_ = context->cfa;
-diff -urN gcc-linaro-4.6-2012.02/gcc/config/i386/linux-unwind.h gcc-linaro-4.6-2012.02.new/gcc/config/i386/linux-unwind.h
---- gcc-linaro-4.6-2012.02/gcc/config/i386/linux-unwind.h 2012-02-07 11:33:31.000000000 +0100
-+++ gcc-linaro-4.6-2012.02.new/gcc/config/i386/linux-unwind.h 2012-09-13 10:26:41.891074005 +0200
-@@ -133,9 +133,9 @@
+--- a/gcc/config/i386/linux-unwind.h
++++ b/gcc/config/i386/linux-unwind.h
+@@ -133,9 +133,9 @@ x86_fallback_frame_state (struct _Unwind
{
struct rt_sigframe {
int sig;
@@ -74,10 +71,9 @@ diff -urN gcc-linaro-4.6-2012.02/gcc/config/i386/linux-unwind.h gcc-linaro-4.6-2
struct ucontext uc;
} *rt_ = context->cfa;
/* The void * cast is necessary to avoid an aliasing warning.
-diff -urN gcc-linaro-4.6-2012.02/gcc/config/ia64/linux-unwind.h gcc-linaro-4.6-2012.02.new/gcc/config/ia64/linux-unwind.h
---- gcc-linaro-4.6-2012.02/gcc/config/ia64/linux-unwind.h 2012-02-07 11:33:31.000000000 +0100
-+++ gcc-linaro-4.6-2012.02.new/gcc/config/ia64/linux-unwind.h 2012-09-13 10:26:59.251074450 +0200
-@@ -47,7 +47,7 @@
+--- a/gcc/config/ia64/linux-unwind.h
++++ b/gcc/config/ia64/linux-unwind.h
+@@ -47,7 +47,7 @@ ia64_fallback_frame_state (struct _Unwin
struct sigframe {
char scratch[16];
unsigned long sig_number;
@@ -86,7 +82,7 @@ diff -urN gcc-linaro-4.6-2012.02/gcc/config/ia64/linux-unwind.h gcc-linaro-4.6-2
struct sigcontext *sc;
} *frame_ = (struct sigframe *)context->psp;
struct sigcontext *sc = frame_->sc;
-@@ -137,7 +137,7 @@
+@@ -137,7 +137,7 @@ ia64_handle_unwabi (struct _Unwind_Conte
struct sigframe {
char scratch[16];
unsigned long sig_number;
@@ -95,10 +91,9 @@ diff -urN gcc-linaro-4.6-2012.02/gcc/config/ia64/linux-unwind.h gcc-linaro-4.6-2
struct sigcontext *sc;
} *frame = (struct sigframe *)context->psp;
struct sigcontext *sc = frame->sc;
-diff -urN gcc-linaro-4.6-2012.02/gcc/config/mips/linux-unwind.h gcc-linaro-4.6-2012.02.new/gcc/config/mips/linux-unwind.h
---- gcc-linaro-4.6-2012.02/gcc/config/mips/linux-unwind.h 2012-02-07 11:33:31.000000000 +0100
-+++ gcc-linaro-4.6-2012.02.new/gcc/config/mips/linux-unwind.h 2012-09-13 10:27:17.947074929 +0200
-@@ -75,7 +75,7 @@
+--- a/gcc/config/mips/linux-unwind.h
++++ b/gcc/config/mips/linux-unwind.h
+@@ -75,7 +75,7 @@ mips_fallback_frame_state (struct _Unwin
struct rt_sigframe {
u_int32_t ass[4]; /* Argument save space for o32. */
u_int32_t trampoline[2];
@@ -107,10 +102,9 @@ diff -urN gcc-linaro-4.6-2012.02/gcc/config/mips/linux-unwind.h gcc-linaro-4.6-2
_sig_ucontext_t uc;
} *rt_ = context->cfa;
sc = &rt_->uc.uc_mcontext;
-diff -urN gcc-linaro-4.6-2012.02/gcc/config/pa/linux-unwind.h gcc-linaro-4.6-2012.02.new/gcc/config/pa/linux-unwind.h
---- gcc-linaro-4.6-2012.02/gcc/config/pa/linux-unwind.h 2012-02-07 11:33:31.000000000 +0100
-+++ gcc-linaro-4.6-2012.02.new/gcc/config/pa/linux-unwind.h 2012-09-13 10:27:27.491075173 +0200
-@@ -63,7 +63,7 @@
+--- a/gcc/config/pa/linux-unwind.h
++++ b/gcc/config/pa/linux-unwind.h
+@@ -63,7 +63,7 @@ pa32_fallback_frame_state (struct _Unwin
int i;
struct sigcontext *sc;
struct rt_sigframe {
@@ -119,10 +113,9 @@ diff -urN gcc-linaro-4.6-2012.02/gcc/config/pa/linux-unwind.h gcc-linaro-4.6-201
struct ucontext uc;
} *frame;
-diff -urN gcc-linaro-4.6-2012.02/gcc/config/sh/linux-unwind.h gcc-linaro-4.6-2012.02.new/gcc/config/sh/linux-unwind.h
---- gcc-linaro-4.6-2012.02/gcc/config/sh/linux-unwind.h 2012-02-07 11:33:31.000000000 +0100
-+++ gcc-linaro-4.6-2012.02.new/gcc/config/sh/linux-unwind.h 2012-09-13 10:27:58.551075969 +0200
-@@ -80,9 +80,9 @@
+--- a/gcc/config/sh/linux-unwind.h
++++ b/gcc/config/sh/linux-unwind.h
+@@ -80,9 +80,9 @@ shmedia_fallback_frame_state (struct _Un
&& (*(unsigned long *) (pc+11) == 0x6ff0fff0))
{
struct rt_sigframe {
@@ -134,7 +127,7 @@ diff -urN gcc-linaro-4.6-2012.02/gcc/config/sh/linux-unwind.h gcc-linaro-4.6-201
struct ucontext uc;
} *rt_ = context->cfa;
/* The void * cast is necessary to avoid an aliasing warning.
-@@ -179,7 +179,7 @@
+@@ -179,7 +179,7 @@ sh_fallback_frame_state (struct _Unwind_
&& (*(unsigned short *) (pc+14) == 0x00ad))))
{
struct rt_sigframe {
@@ -143,10 +136,9 @@ diff -urN gcc-linaro-4.6-2012.02/gcc/config/sh/linux-unwind.h gcc-linaro-4.6-201
struct ucontext uc;
} *rt_ = context->cfa;
/* The void * cast is necessary to avoid an aliasing warning.
-diff -urN gcc-linaro-4.6-2012.02/gcc/config/xtensa/linux-unwind.h gcc-linaro-4.6-2012.02.new/gcc/config/xtensa/linux-unwind.h
---- gcc-linaro-4.6-2012.02/gcc/config/xtensa/linux-unwind.h 2012-02-07 11:33:31.000000000 +0100
-+++ gcc-linaro-4.6-2012.02.new/gcc/config/xtensa/linux-unwind.h 2012-09-13 10:28:13.827076359 +0200
-@@ -62,7 +62,7 @@
+--- a/gcc/config/xtensa/linux-unwind.h
++++ b/gcc/config/xtensa/linux-unwind.h
+@@ -62,7 +62,7 @@ xtensa_fallback_frame_state (struct _Unw
struct sigcontext *sc;
struct rt_sigframe {
diff --git a/toolchain/gcc/patches/4.6.3/010-documentation.patch b/toolchain/gcc/patches/4.6.3/010-documentation.patch
new file mode 100644
index 000000000..cfbfaa460
--- /dev/null
+++ b/toolchain/gcc/patches/4.6.3/010-documentation.patch
@@ -0,0 +1,23 @@
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -4245,18 +4245,10 @@
+ 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.6.3/200-musl.patch b/toolchain/gcc/patches/4.6.3/200-musl.patch
index cee994809..d18abbe45 100644
--- a/toolchain/gcc/patches/4.6.3/200-musl.patch
+++ b/toolchain/gcc/patches/4.6.3/200-musl.patch
@@ -1,4 +1,3 @@
-diff --git a/config.sub b/config.sub
--- a/config.sub
+++ b/config.sub
@@ -125,6 +125,7 @@ esac
@@ -9,15 +8,6 @@ diff --git a/config.sub b/config.sub
linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
-@@ -1310,6 +1311,7 @@ case $os in
- | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -linux-android* \
- | -linux-newlib* | -linux-uclibc* \
-+ | -linux-musl* \
- | -uxpv* | -beos* | -mpeix* | -udk* \
- | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
- | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
-diff --git a/gcc/config.gcc b/gcc/config.gcc
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -478,7 +478,7 @@ case ${target} in
@@ -39,7 +29,6 @@ diff --git a/gcc/config.gcc b/gcc/config.gcc
*)
tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
;;
-diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -64,6 +64,10 @@
@@ -53,10 +42,9 @@ diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
/* 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
-diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
--- a/gcc/config/i386/linux.h
+++ b/gcc/config/i386/linux.h
-@@ -93,6 +93,7 @@ along with GCC; see the file COPYING3. If not see
+@@ -93,6 +93,7 @@ along with GCC; see the file COPYING3.
/* These macros may be overridden in k*bsd-gnu.h and i386/k*bsd-gnu.h. */
#define LINK_EMULATION "elf_i386"
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
@@ -64,10 +52,9 @@ diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
#undef ASM_SPEC
#define ASM_SPEC \
-diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
--- a/gcc/config/i386/linux64.h
+++ b/gcc/config/i386/linux64.h
-@@ -65,6 +65,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+@@ -65,6 +65,9 @@ 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"
@@ -77,10 +64,9 @@ diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
#if TARGET_64BIT_DEFAULT
#define SPEC_32 "m32"
#define SPEC_64 "!m32"
-diff --git a/gcc/config/linux.h b/gcc/config/linux.h
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
-@@ -33,10 +33,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+@@ -33,10 +33,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)
@@ -93,7 +79,7 @@ diff --git a/gcc/config/linux.h b/gcc/config/linux.h
#endif
#define LINUX_TARGET_OS_CPP_BUILTINS() \
-@@ -54,18 +56,21 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+@@ -54,18 +56,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. */
@@ -123,7 +109,7 @@ diff --git a/gcc/config/linux.h b/gcc/config/linux.h
#else
#error "Unsupported DEFAULT_LIBC"
#endif /* DEFAULT_LIBC */
-@@ -83,13 +88,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+@@ -83,13 +88,13 @@ see the files COPYING3 and COPYING.RUNTI
#define LINUX_DYNAMIC_LINKER \
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
@@ -140,7 +126,6 @@ diff --git a/gcc/config/linux.h b/gcc/config/linux.h
/* Determine whether the entire c99 runtime
is present in the runtime library. */
-diff --git a/gcc/config/linux.opt b/gcc/config/linux.opt
--- a/gcc/config/linux.opt
+++ b/gcc/config/linux.opt
@@ -30,3 +30,7 @@ Use GNU C library
@@ -151,10 +136,9 @@ diff --git a/gcc/config/linux.opt b/gcc/config/linux.opt
+mmusl
+Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
+Use musl C library
-diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
--- a/gcc/config/mips/linux.h
+++ b/gcc/config/mips/linux.h
-@@ -63,6 +63,8 @@ along with GCC; see the file COPYING3. If not see
+@@ -63,6 +63,8 @@ along with GCC; see the file COPYING3.
#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
@@ -163,7 +147,6 @@ diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
/* Borrowed from sparc/linux.h */
#undef LINK_SPEC
#define LINK_SPEC \
-diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
--- a/gcc/ginclude/stddef.h
+++ b/gcc/ginclude/stddef.h
@@ -184,6 +184,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
@@ -190,7 +173,6 @@ diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
#endif /* __size_t */
#endif /* _SIZET_ */
#endif /* _GCC_SIZE_T */
-diff --git a/libgomp/config/posix/time.c b/libgomp/config/posix/time.c
--- a/libgomp/config/posix/time.c
+++ b/libgomp/config/posix/time.c
@@ -28,6 +28,8 @@
@@ -202,7 +184,6 @@ diff --git a/libgomp/config/posix/time.c b/libgomp/config/posix/time.c
#include "libgomp.h"
#include <unistd.h>
#if TIME_WITH_SYS_TIME
-diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
--- a/libstdc++-v3/configure.host
+++ b/libstdc++-v3/configure.host
@@ -237,6 +237,13 @@ case "${host_os}" in
@@ -229,3 +210,19 @@ diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
hpux*)
os_include_dir="os/hpux"
;;
+--- a/gcc/config/mips/linux64.h
++++ b/gcc/config/mips/linux64.h
+@@ -40,9 +40,12 @@ along with GCC; see the file COPYING3.
+ #define GLIBC_DYNAMIC_LINKERN32 "/lib32/ld.so.1"
+ #define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
+ #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
++#define MUSL_DYNAMIC_LINKERN32 "/lib/ld-musl-mips.so.1"
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-mips.so.1"
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-mips.so.1"
+ #define LINUX_DYNAMIC_LINKERN32 \
+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
+- BIONIC_DYNAMIC_LINKERN32)
++ BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32)
+
+ #undef LINK_SPEC
+ #define LINK_SPEC "\
diff --git a/toolchain/gcc/patches/4.6.3/840-armv4_pass_fix-v4bx_to_ld.patch b/toolchain/gcc/patches/4.6.3/840-armv4_pass_fix-v4bx_to_ld.patch
index 67c374d9a..5be6b9edf 100644
--- a/toolchain/gcc/patches/4.6.3/840-armv4_pass_fix-v4bx_to_ld.patch
+++ b/toolchain/gcc/patches/4.6.3/840-armv4_pass_fix-v4bx_to_ld.patch
@@ -1,8 +1,8 @@
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
-@@ -64,10 +64,15 @@
- #undef GLIBC_DYNAMIC_LINKER
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
+@@ -68,10 +68,15 @@
+ #undef MUSL_DYNAMIC_LINKER
+ #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-arm.so.1"
+/* For armv4 we pass --fix-v4bx to linker to support EABI */
+#undef TARGET_FIX_V4BX_SPEC
diff --git a/toolchain/gcc/patches/4.6.3/999-coldfire.patch b/toolchain/gcc/patches/4.6.3/999-coldfire.patch
index 6083e0bf8..29a98bf03 100644
--- a/toolchain/gcc/patches/4.6.3/999-coldfire.patch
+++ b/toolchain/gcc/patches/4.6.3/999-coldfire.patch
@@ -1,6 +1,6 @@
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
-@@ -1804,6 +1804,7 @@ m68k-*-linux*) # Motorola m68k's runnin
+@@ -1807,6 +1807,7 @@ m68k-*-linux*) # Motorola m68k's runnin
if test x$sjlj != x1; then
tmake_file="$tmake_file m68k/t-slibgcc-elf-ver"
fi
diff --git a/toolchain/gcc/patches/4.7-linaro/301-missing-execinfo_h.patch b/toolchain/gcc/patches/4.7-linaro/301-missing-execinfo_h.patch
deleted file mode 100644
index b3f1e68d3..000000000
--- a/toolchain/gcc/patches/4.7-linaro/301-missing-execinfo_h.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/boehm-gc/include/gc.h
-+++ b/boehm-gc/include/gc.h
-@@ -503,7 +503,7 @@ GC_API GC_PTR GC_malloc_atomic_ignore_of
- #if defined(__linux__) || defined(__GLIBC__)
- # include <features.h>
- # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
-- && !defined(__ia64__)
-+ && !defined(__ia64__) && !defined(__UCLIBC__)
- # ifndef GC_HAVE_BUILTIN_BACKTRACE
- # define GC_HAVE_BUILTIN_BACKTRACE
- # endif
diff --git a/toolchain/gcc/patches/4.7-linaro/302-c99-snprintf.patch b/toolchain/gcc/patches/4.7-linaro/302-c99-snprintf.patch
deleted file mode 100644
index fb382b9d2..000000000
--- a/toolchain/gcc/patches/4.7-linaro/302-c99-snprintf.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/libstdc++-v3/include/c_global/cstdio
-+++ b/libstdc++-v3/include/c_global/cstdio
-@@ -140,7 +140,7 @@ namespace std
- using ::vsprintf;
- } // namespace
-
--#if _GLIBCXX_USE_C99
-+#if _GLIBCXX_USE_C99 || defined __UCLIBC__
-
- #undef snprintf
- #undef vfscanf
diff --git a/toolchain/gcc/patches/4.7-linaro/305-libmudflap-susv3-legacy.patch b/toolchain/gcc/patches/4.7-linaro/305-libmudflap-susv3-legacy.patch
deleted file mode 100644
index d3543cfa2..000000000
--- a/toolchain/gcc/patches/4.7-linaro/305-libmudflap-susv3-legacy.patch
+++ /dev/null
@@ -1,47 +0,0 @@
---- a/libmudflap/mf-hooks2.c
-+++ b/libmudflap/mf-hooks2.c
-@@ -424,7 +424,7 @@ WRAPPER2(void, bzero, void *s, size_t n)
- {
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
-- bzero (s, n);
-+ memset (s, 0, n);
- }
-
-
-@@ -434,7 +434,7 @@ WRAPPER2(void, bcopy, const void *src, v
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
- MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
-- bcopy (src, dest, n);
-+ memmove (dest, src, n);
- }
-
-
-@@ -444,7 +444,7 @@ WRAPPER2(int, bcmp, const void *s1, cons
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
- MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
-- return bcmp (s1, s2, n);
-+ return n == 0 ? 0 : memcmp (s1, s2, n);
- }
-
-
-@@ -453,7 +453,7 @@ WRAPPER2(char *, index, const char *s, i
- size_t n = strlen (s);
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
-- return index (s, c);
-+ return strchr (s, c);
- }
-
-
-@@ -462,7 +462,7 @@ WRAPPER2(char *, rindex, const char *s,
- size_t n = strlen (s);
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
-- return rindex (s, c);
-+ return strrchr (s, c);
- }
-
- /* XXX: stpcpy, memccpy */
diff --git a/toolchain/gcc/patches/4.7-linaro/820-libgcc_pic.patch b/toolchain/gcc/patches/4.7-linaro/820-libgcc_pic.patch
deleted file mode 100644
index 187e6bf11..000000000
--- a/toolchain/gcc/patches/4.7-linaro/820-libgcc_pic.patch
+++ /dev/null
@@ -1,36 +0,0 @@
---- a/libgcc/Makefile.in
-+++ b/libgcc/Makefile.in
-@@ -862,11 +862,12 @@ $(libgcov-objects): %$(objext): $(srcdir
-
- # 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)"; \
-@@ -888,7 +889,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
-@@ -1043,6 +1044,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.7-linaro/870-ppc_no_crtsavres.patch b/toolchain/gcc/patches/4.7-linaro/870-ppc_no_crtsavres.patch
deleted file mode 100644
index feaf02d6a..000000000
--- a/toolchain/gcc/patches/4.7-linaro/870-ppc_no_crtsavres.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/gcc/config/rs6000/sysv4.h
-+++ b/gcc/config/rs6000/sysv4.h
-@@ -246,13 +246,13 @@ do { \
-
- /* Define cutoff for using external functions to save floating point.
- When optimizing for size, use external functions when profitable. */
--#define FP_SAVE_INLINE(FIRST_REG) (optimize_size \
-+#define FP_SAVE_INLINE(FIRST_REG) (1 || (optimize_size \
- ? ((FIRST_REG) == 62 \
- || (FIRST_REG) == 63) \
-- : (FIRST_REG) < 64)
-+ : (FIRST_REG) < 64))
- /* And similarly for general purpose registers. */
--#define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 32 \
-- && !optimize_size)
-+#define GP_SAVE_INLINE(FIRST_REG) (1 || ((FIRST_REG) < 32 \
-+ && !optimize_size))
-
- /* Put jump tables in read-only memory, rather than in .text. */
- #define JUMP_TABLES_IN_TEXT_SECTION 0
diff --git a/toolchain/gcc/patches/4.7-linaro/993-arm_insn-opinit-RTX_CODE-fixup.patch b/toolchain/gcc/patches/4.7-linaro/993-arm_insn-opinit-RTX_CODE-fixup.patch
deleted file mode 100644
index 9f8da4c4c..000000000
--- a/toolchain/gcc/patches/4.7-linaro/993-arm_insn-opinit-RTX_CODE-fixup.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- a/gcc/config/arm/arm-protos.h
-+++ b/gcc/config/arm/arm-protos.h
-@@ -42,12 +42,12 @@ extern unsigned int arm_dbx_register_num
- extern void arm_output_fn_unwind (FILE *, bool);
-
-
--#ifdef RTX_CODE
- extern bool arm_vector_mode_supported_p (enum machine_mode);
- extern bool arm_small_register_classes_for_mode_p (enum machine_mode);
- extern int arm_hard_regno_mode_ok (unsigned int, enum machine_mode);
- extern bool arm_modes_tieable_p (enum machine_mode, enum machine_mode);
- extern int const_ok_for_arm (HOST_WIDE_INT);
-+#ifdef RTX_CODE
- extern int const_ok_for_op (HOST_WIDE_INT, enum rtx_code);
- extern int arm_split_constant (RTX_CODE, enum machine_mode, rtx,
- HOST_WIDE_INT, rtx, rtx, int);
diff --git a/toolchain/gcc/patches/4.7-linaro/999-coldfire.patch b/toolchain/gcc/patches/4.7-linaro/999-coldfire.patch
deleted file mode 100644
index a72b9fdfb..000000000
--- a/toolchain/gcc/patches/4.7-linaro/999-coldfire.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/gcc/config.gcc
-+++ b/gcc/config.gcc
-@@ -1610,6 +1610,7 @@ m32rle-*-linux*)
- if test x$enable_threads = xyes; then
- thread_file='posix'
- fi
-+ tmake_file="m68k/t-floatlib m68k/t-m68kbare m68k/t-m68kelf"
- ;;
- m68k-*-elf* | fido-*-elf*)
- case ${target} in
diff --git a/toolchain/gcc/patches/4.7.2/100-uclibc-conf.patch b/toolchain/gcc/patches/4.7.2/100-uclibc-conf.patch
deleted file mode 100644
index ff9ad94f6..000000000
--- a/toolchain/gcc/patches/4.7.2/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.7.2/301-missing-execinfo_h.patch b/toolchain/gcc/patches/4.7.2/301-missing-execinfo_h.patch
deleted file mode 100644
index b3f1e68d3..000000000
--- a/toolchain/gcc/patches/4.7.2/301-missing-execinfo_h.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/boehm-gc/include/gc.h
-+++ b/boehm-gc/include/gc.h
-@@ -503,7 +503,7 @@ GC_API GC_PTR GC_malloc_atomic_ignore_of
- #if defined(__linux__) || defined(__GLIBC__)
- # include <features.h>
- # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
-- && !defined(__ia64__)
-+ && !defined(__ia64__) && !defined(__UCLIBC__)
- # ifndef GC_HAVE_BUILTIN_BACKTRACE
- # define GC_HAVE_BUILTIN_BACKTRACE
- # endif
diff --git a/toolchain/gcc/patches/4.7.2/302-c99-snprintf.patch b/toolchain/gcc/patches/4.7.2/302-c99-snprintf.patch
deleted file mode 100644
index fb382b9d2..000000000
--- a/toolchain/gcc/patches/4.7.2/302-c99-snprintf.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/libstdc++-v3/include/c_global/cstdio
-+++ b/libstdc++-v3/include/c_global/cstdio
-@@ -140,7 +140,7 @@ namespace std
- using ::vsprintf;
- } // namespace
-
--#if _GLIBCXX_USE_C99
-+#if _GLIBCXX_USE_C99 || defined __UCLIBC__
-
- #undef snprintf
- #undef vfscanf
diff --git a/toolchain/gcc/patches/4.7.2/305-libmudflap-susv3-legacy.patch b/toolchain/gcc/patches/4.7.2/305-libmudflap-susv3-legacy.patch
deleted file mode 100644
index d3543cfa2..000000000
--- a/toolchain/gcc/patches/4.7.2/305-libmudflap-susv3-legacy.patch
+++ /dev/null
@@ -1,47 +0,0 @@
---- a/libmudflap/mf-hooks2.c
-+++ b/libmudflap/mf-hooks2.c
-@@ -424,7 +424,7 @@ WRAPPER2(void, bzero, void *s, size_t n)
- {
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
-- bzero (s, n);
-+ memset (s, 0, n);
- }
-
-
-@@ -434,7 +434,7 @@ WRAPPER2(void, bcopy, const void *src, v
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
- MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
-- bcopy (src, dest, n);
-+ memmove (dest, src, n);
- }
-
-
-@@ -444,7 +444,7 @@ WRAPPER2(int, bcmp, const void *s1, cons
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
- MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
-- return bcmp (s1, s2, n);
-+ return n == 0 ? 0 : memcmp (s1, s2, n);
- }
-
-
-@@ -453,7 +453,7 @@ WRAPPER2(char *, index, const char *s, i
- size_t n = strlen (s);
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
-- return index (s, c);
-+ return strchr (s, c);
- }
-
-
-@@ -462,7 +462,7 @@ WRAPPER2(char *, rindex, const char *s,
- size_t n = strlen (s);
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
-- return rindex (s, c);
-+ return strrchr (s, c);
- }
-
- /* XXX: stpcpy, memccpy */
diff --git a/toolchain/gcc/patches/4.7.2/830-arm_unbreak_armv4t.patch b/toolchain/gcc/patches/4.7.2/830-arm_unbreak_armv4t.patch
deleted file mode 100644
index 37f8f2a54..000000000
--- a/toolchain/gcc/patches/4.7.2/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.7.2/840-armv4_pass_fix-v4bx_to_ld.patch b/toolchain/gcc/patches/4.7.2/840-armv4_pass_fix-v4bx_to_ld.patch
deleted file mode 100644
index 67c374d9a..000000000
--- a/toolchain/gcc/patches/4.7.2/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
-@@ -64,10 +64,15 @@
- #undef GLIBC_DYNAMIC_LINKER
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
-
-+/* 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 BE8_LINK_SPEC \
-+#define LINK_SPEC BE8_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.7.2/870-ppc_no_crtsavres.patch b/toolchain/gcc/patches/4.7.2/870-ppc_no_crtsavres.patch
deleted file mode 100644
index feaf02d6a..000000000
--- a/toolchain/gcc/patches/4.7.2/870-ppc_no_crtsavres.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/gcc/config/rs6000/sysv4.h
-+++ b/gcc/config/rs6000/sysv4.h
-@@ -246,13 +246,13 @@ do { \
-
- /* Define cutoff for using external functions to save floating point.
- When optimizing for size, use external functions when profitable. */
--#define FP_SAVE_INLINE(FIRST_REG) (optimize_size \
-+#define FP_SAVE_INLINE(FIRST_REG) (1 || (optimize_size \
- ? ((FIRST_REG) == 62 \
- || (FIRST_REG) == 63) \
-- : (FIRST_REG) < 64)
-+ : (FIRST_REG) < 64))
- /* And similarly for general purpose registers. */
--#define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 32 \
-- && !optimize_size)
-+#define GP_SAVE_INLINE(FIRST_REG) (1 || ((FIRST_REG) < 32 \
-+ && !optimize_size))
-
- /* Put jump tables in read-only memory, rather than in .text. */
- #define JUMP_TABLES_IN_TEXT_SECTION 0
diff --git a/toolchain/gcc/patches/4.7.2/993-arm_insn-opinit-RTX_CODE-fixup.patch b/toolchain/gcc/patches/4.7.2/993-arm_insn-opinit-RTX_CODE-fixup.patch
deleted file mode 100644
index 9f8da4c4c..000000000
--- a/toolchain/gcc/patches/4.7.2/993-arm_insn-opinit-RTX_CODE-fixup.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- a/gcc/config/arm/arm-protos.h
-+++ b/gcc/config/arm/arm-protos.h
-@@ -42,12 +42,12 @@ extern unsigned int arm_dbx_register_num
- extern void arm_output_fn_unwind (FILE *, bool);
-
-
--#ifdef RTX_CODE
- extern bool arm_vector_mode_supported_p (enum machine_mode);
- extern bool arm_small_register_classes_for_mode_p (enum machine_mode);
- extern int arm_hard_regno_mode_ok (unsigned int, enum machine_mode);
- extern bool arm_modes_tieable_p (enum machine_mode, enum machine_mode);
- extern int const_ok_for_arm (HOST_WIDE_INT);
-+#ifdef RTX_CODE
- extern int const_ok_for_op (HOST_WIDE_INT, enum rtx_code);
- extern int arm_split_constant (RTX_CODE, enum machine_mode, rtx,
- HOST_WIDE_INT, rtx, rtx, int);
diff --git a/toolchain/gcc/patches/4.7.2/999-coldfire.patch b/toolchain/gcc/patches/4.7.2/999-coldfire.patch
deleted file mode 100644
index a72b9fdfb..000000000
--- a/toolchain/gcc/patches/4.7.2/999-coldfire.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/gcc/config.gcc
-+++ b/gcc/config.gcc
-@@ -1610,6 +1610,7 @@ m32rle-*-linux*)
- if test x$enable_threads = xyes; then
- thread_file='posix'
- fi
-+ tmake_file="m68k/t-floatlib m68k/t-m68kbare m68k/t-m68kelf"
- ;;
- m68k-*-elf* | fido-*-elf*)
- case ${target} in
diff --git a/toolchain/gcc/patches/4.8-linaro/010-documentation.patch b/toolchain/gcc/patches/4.8-linaro/010-documentation.patch
new file mode 100644
index 000000000..3f604ee47
--- /dev/null
+++ b/toolchain/gcc/patches/4.8-linaro/010-documentation.patch
@@ -0,0 +1,23 @@
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -4326,18 +4326,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.6.2/100-uclibc-conf.patch b/toolchain/gcc/patches/4.8-linaro/100-uclibc-conf.patch
index ff9ad94f6..ff9ad94f6 100644
--- a/toolchain/gcc/patches/4.6.2/100-uclibc-conf.patch
+++ b/toolchain/gcc/patches/4.8-linaro/100-uclibc-conf.patch
diff --git a/toolchain/gcc/patches/4.7.2/200-musl.patch b/toolchain/gcc/patches/4.8-linaro/200-musl.patch
index 5d0d49ba6..8cf45eb61 100644
--- a/toolchain/gcc/patches/4.7.2/200-musl.patch
+++ b/toolchain/gcc/patches/4.8-linaro/200-musl.patch
@@ -1,26 +1,6 @@
-diff --git a/config.sub b/config.sub
---- a/config.sub
-+++ b/config.sub
-@@ -125,6 +125,7 @@
- maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
- case $maybe_os in
- nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
-+ linux-musl* | \
- linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
- knetbsd*-gnu* | netbsd*-gnu* | \
- kopensolaris*-gnu* | \
-@@ -1346,6 +1347,7 @@
- | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -linux-android* \
- | -linux-newlib* | -linux-uclibc* \
-+ | -linux-musl* \
- | -uxpv* | -beos* | -mpeix* | -udk* \
- | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
- | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
-diff --git a/gcc/config.gcc b/gcc/config.gcc
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
-@@ -522,7 +522,7 @@
+@@ -549,7 +549,7 @@ case ${target} in
esac
# Common C libraries.
@@ -29,7 +9,7 @@ diff --git a/gcc/config.gcc b/gcc/config.gcc
# Common parts for widely ported systems.
case ${target} in
-@@ -625,6 +625,9 @@
+@@ -652,6 +652,9 @@ case ${target} in
*-*-*uclibc*)
tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
;;
@@ -39,20 +19,11 @@ diff --git a/gcc/config.gcc b/gcc/config.gcc
*)
tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
;;
-@@ -1722,6 +1725,7 @@
- tm_file="${tm_file} dbxelf.h gnu-user.h linux.h microblaze/linux.h"
- c_target_objs="${c_target_objs} microblaze-c.o"
- cxx_target_objs="${cxx_target_objs} microblaze-c.o"
-+ tmake_file="${tmake_file} microblaze/t-microblaze"
- ;;
- microblaze*-*-*)
- tm_file="${tm_file} dbxelf.h"
-diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
-@@ -64,6 +64,10 @@
- #undef GLIBC_DYNAMIC_LINKER
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
+@@ -77,6 +77,10 @@
+ %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
+ %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
+/* musl has no "classic" (i.e. broken) mode */
+#undef MUSL_DYNAMIC_LINKER
@@ -61,18 +32,16 @@ diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
/* 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
-diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
--- a/gcc/config/i386/linux.h
+++ b/gcc/config/i386/linux.h
-@@ -22,3 +22,4 @@
+@@ -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"
-diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
--- a/gcc/config/i386/linux64.h
+++ b/gcc/config/i386/linux64.h
-@@ -31,3 +31,7 @@
+@@ -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"
@@ -80,10 +49,9 @@ diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
+#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"
-diff --git a/gcc/config/linux.h b/gcc/config/linux.h
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
-@@ -33,10 +33,12 @@
+@@ -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)
@@ -96,7 +64,7 @@ diff --git a/gcc/config/linux.h b/gcc/config/linux.h
#endif
#define GNU_USER_TARGET_OS_CPP_BUILTINS() \
-@@ -54,18 +56,21 @@
+@@ -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. */
@@ -126,7 +94,7 @@ diff --git a/gcc/config/linux.h b/gcc/config/linux.h
#else
#error "Unsupported DEFAULT_LIBC"
#endif /* DEFAULT_LIBC */
-@@ -85,16 +90,16 @@
+@@ -84,16 +89,16 @@ see the files COPYING3 and COPYING.RUNTI
#define GNU_USER_DYNAMIC_LINKER \
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
@@ -147,10 +115,9 @@ diff --git a/gcc/config/linux.h b/gcc/config/linux.h
/* Determine whether the entire c99 runtime
is present in the runtime library. */
-diff --git a/gcc/config/linux.opt b/gcc/config/linux.opt
--- a/gcc/config/linux.opt
+++ b/gcc/config/linux.opt
-@@ -30,3 +30,7 @@
+@@ -30,3 +30,7 @@ Use GNU C library
muclibc
Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
Use uClibc C library
@@ -158,19 +125,17 @@ diff --git a/gcc/config/linux.opt b/gcc/config/linux.opt
+mmusl
+Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
+Use musl C library
-diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
--- a/gcc/config/mips/linux.h
+++ b/gcc/config/mips/linux.h
-@@ -19,3 +19,5 @@
+@@ -18,3 +18,5 @@ along with GCC; see the file COPYING3.
<http://www.gnu.org/licenses/>. */
#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+
+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips.so.1"
-diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
-@@ -362,17 +362,21 @@
+@@ -364,17 +364,21 @@ extern int dot_symbols;
#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
@@ -196,10 +161,9 @@ diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
#define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux %{!shared: %{!static: \
-diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
-@@ -804,15 +804,18 @@
+@@ -789,15 +789,18 @@ extern int fixuplabelno;
#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
@@ -221,10 +185,9 @@ diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
#define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
%{rdynamic:-export-dynamic} \
-diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
--- a/gcc/ginclude/stddef.h
+++ b/gcc/ginclude/stddef.h
-@@ -184,6 +184,7 @@
+@@ -181,6 +181,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
#ifndef _GCC_SIZE_T
#ifndef _SIZET_
#ifndef __size_t
@@ -232,7 +195,7 @@ diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
#define __size_t__ /* BeOS */
#define __SIZE_T__ /* Cray Unicos/Mk */
#define _SIZE_T
-@@ -200,6 +201,7 @@
+@@ -197,6 +198,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
#define ___int_size_t_h
#define _GCC_SIZE_T
#define _SIZET_
@@ -240,7 +203,7 @@ diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
#if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
|| defined(__FreeBSD_kernel__)
/* __size_t is a typedef on FreeBSD 5, must not trash it. */
-@@ -215,6 +217,7 @@
+@@ -214,6 +216,7 @@ typedef __SIZE_TYPE__ size_t;
typedef long ssize_t;
#endif /* __BEOS__ */
#endif /* !(defined (__GNUG__) && defined (size_t)) */
@@ -248,7 +211,6 @@ diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
#endif /* __size_t */
#endif /* _SIZET_ */
#endif /* _GCC_SIZE_T */
-diff --git a/libgomp/config/posix/time.c b/libgomp/config/posix/time.c
--- a/libgomp/config/posix/time.c
+++ b/libgomp/config/posix/time.c
@@ -28,6 +28,8 @@
@@ -260,10 +222,9 @@ diff --git a/libgomp/config/posix/time.c b/libgomp/config/posix/time.c
#include "libgomp.h"
#include <unistd.h>
#if TIME_WITH_SYS_TIME
-diff --git a/libitm/config/arm/hwcap.cc b/libitm/config/arm/hwcap.cc
--- a/libitm/config/arm/hwcap.cc
+++ b/libitm/config/arm/hwcap.cc
-@@ -40,7 +40,11 @@
+@@ -40,7 +40,11 @@ int GTM_hwcap HIDDEN = 0
#ifdef __linux__
#include <unistd.h>
@@ -275,7 +236,6 @@ diff --git a/libitm/config/arm/hwcap.cc b/libitm/config/arm/hwcap.cc
#include <elf.h>
static void __attribute__((constructor))
-diff --git a/libitm/config/linux/x86/tls.h b/libitm/config/linux/x86/tls.h
--- a/libitm/config/linux/x86/tls.h
+++ b/libitm/config/linux/x86/tls.h
@@ -25,16 +25,19 @@
@@ -300,17 +260,16 @@ diff --git a/libitm/config/linux/x86/tls.h b/libitm/config/linux/x86/tls.h
namespace GTM HIDDEN {
#ifdef __x86_64__
-@@ -101,5 +104,6 @@
+@@ -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/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
--- a/libstdc++-v3/configure.host
+++ b/libstdc++-v3/configure.host
-@@ -243,6 +243,13 @@
+@@ -264,6 +264,13 @@ case "${host_os}" in
os_include_dir="os/bsd/freebsd"
;;
gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
@@ -324,7 +283,7 @@ diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
if [ "$uclibc" = "yes" ]; then
os_include_dir="os/uclibc"
elif [ "$bionic" = "yes" ]; then
-@@ -251,6 +258,9 @@
+@@ -272,6 +279,9 @@ case "${host_os}" in
os_include_dir="os/gnu-linux"
fi
;;
@@ -334,3 +293,16 @@ diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
hpux*)
os_include_dir="os/hpux"
;;
+--- a/gcc/config/mips/linux64.h
++++ b/gcc/config/mips/linux64.h
+@@ -27,6 +27,9 @@ along with GCC; see the file COPYING3.
+ #define GLIBC_DYNAMIC_LINKERN32 "/lib32/ld.so.1"
+ #define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
+ #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
++#define MUSL_DYNAMIC_LINKERN32 "/lib/ld-musl-mips.so.1"
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-mips.so.1"
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-mips.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.7-linaro/810-arm-softfloat-libgcc.patch b/toolchain/gcc/patches/4.8-linaro/810-arm-softfloat-libgcc.patch
index 89cd81e3a..a3816a17f 100644
--- a/toolchain/gcc/patches/4.7-linaro/810-arm-softfloat-libgcc.patch
+++ b/toolchain/gcc/patches/4.8-linaro/810-arm-softfloat-libgcc.patch
@@ -1,14 +1,3 @@
---- a/gcc/config/arm/linux-elf.h
-+++ b/gcc/config/arm/linux-elf.h
-@@ -57,7 +57,7 @@
- %{shared:-lc} \
- %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
-
--#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
-+#define LIBGCC_SPEC "-lgcc"
-
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
-
--- a/libgcc/config/arm/t-linux
+++ b/libgcc/config/arm/t-linux
@@ -1,6 +1,10 @@
diff --git a/toolchain/gcc/patches/4.7.2/820-libgcc_pic.patch b/toolchain/gcc/patches/4.8-linaro/820-libgcc_pic.patch
index 187e6bf11..7a0ac7353 100644
--- a/toolchain/gcc/patches/4.7.2/820-libgcc_pic.patch
+++ b/toolchain/gcc/patches/4.8-linaro/820-libgcc_pic.patch
@@ -1,6 +1,6 @@
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
-@@ -862,11 +862,12 @@ $(libgcov-objects): %$(objext): $(srcdir
+@@ -865,11 +865,12 @@ $(libgcov-objects): %$(objext): $(srcdir
# Static libraries.
libgcc.a: $(libgcc-objects)
@@ -14,7 +14,7 @@
-rm -f $@
objects="$(objects)"; \
-@@ -888,7 +889,7 @@ libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_E
+@@ -891,7 +892,7 @@ libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_E
endif
ifeq ($(enable_shared),yes)
@@ -23,7 +23,7 @@
ifneq ($(LIBUNWIND),)
all: libunwind$(SHLIB_EXT)
endif
-@@ -1043,6 +1044,10 @@ install-shared:
+@@ -1058,6 +1059,10 @@ install-shared:
chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
diff --git a/toolchain/gcc/patches/4.6.2/830-arm_unbreak_armv4t.patch b/toolchain/gcc/patches/4.8-linaro/830-arm_unbreak_armv4t.patch
index 37f8f2a54..37f8f2a54 100644
--- a/toolchain/gcc/patches/4.6.2/830-arm_unbreak_armv4t.patch
+++ b/toolchain/gcc/patches/4.8-linaro/830-arm_unbreak_armv4t.patch
diff --git a/toolchain/gcc/patches/4.7-linaro/840-armv4_pass_fix-v4bx_to_ld.patch b/toolchain/gcc/patches/4.8-linaro/840-armv4_pass_fix-v4bx_to_ld.patch
index 67c374d9a..e938905ab 100644
--- a/toolchain/gcc/patches/4.7-linaro/840-armv4_pass_fix-v4bx_to_ld.patch
+++ b/toolchain/gcc/patches/4.8-linaro/840-armv4_pass_fix-v4bx_to_ld.patch
@@ -1,8 +1,8 @@
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
-@@ -64,10 +64,15 @@
- #undef GLIBC_DYNAMIC_LINKER
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
+@@ -81,10 +81,15 @@
+ #undef MUSL_DYNAMIC_LINKER
+ #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-arm.so.1"
+/* For armv4 we pass --fix-v4bx to linker to support EABI */
+#undef TARGET_FIX_V4BX_SPEC
diff --git a/toolchain/gcc/patches/4.5-linaro/850-use_shared_libgcc.patch b/toolchain/gcc/patches/4.8-linaro/850-use_shared_libgcc.patch
index 902edf58b..4a77b86c1 100644
--- a/toolchain/gcc/patches/4.5-linaro/850-use_shared_libgcc.patch
+++ b/toolchain/gcc/patches/4.8-linaro/850-use_shared_libgcc.patch
@@ -1,32 +1,21 @@
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
-@@ -95,10 +95,6 @@
+@@ -114,10 +114,6 @@
#define ENDFILE_SPEC \
- LINUX_OR_ANDROID_LD (LINUX_TARGET_ENDFILE_SPEC, ANDROID_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.asm, so ensure an error if this definition
+ implemented in lib1funcs.S, so ensure an error if this definition
is used. */
---- 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 "-lgcc"
--
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
-
- #define LINUX_TARGET_LINK_SPEC "%{h*} %{version:-v} \
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
-@@ -116,6 +116,10 @@ see the files COPYING3 and COPYING.RUNTI
- #define USE_LD_AS_NEEDED 1
- #endif
+@@ -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}}"
@@ -35,8 +24,8 @@
/* 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/gcc/mkmap-symver.awk
-+++ b/gcc/mkmap-symver.awk
+--- 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]);
@@ -46,7 +35,7 @@
}
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
-@@ -265,7 +265,7 @@ ifeq ($(enable_shared),yes)
+@@ -368,7 +368,7 @@ endif
# For -fvisibility=hidden. We need both a -fvisibility=hidden on
# the command line, and a #define to prevent libgcc2.h etc from
# overriding that with #pragmas.
@@ -57,12 +46,13 @@
--- a/gcc/config/rs6000/linux.h
+++ b/gcc/config/rs6000/linux.h
-@@ -85,6 +85,8 @@
- #define USE_LD_AS_NEEDED 1
- #endif
+@@ -61,6 +61,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 TARGET_VERSION
- #define TARGET_VERSION fprintf (stderr, " (PowerPC GNU/Linux)");
+ #undef LINK_SHLIB_SPEC
+ #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
diff --git a/toolchain/gcc/patches/4.8-linaro/860-uclibc_use_eh_frame.patch b/toolchain/gcc/patches/4.8-linaro/860-uclibc_use_eh_frame.patch
new file mode 100644
index 000000000..0464bd7d2
--- /dev/null
+++ b/toolchain/gcc/patches/4.8-linaro/860-uclibc_use_eh_frame.patch
@@ -0,0 +1,29 @@
+--- a/libgcc/crtstuff.c
++++ b/libgcc/crtstuff.c
+@@ -100,15 +100,20 @@ call_ ## FUNC (void) \
+ #if defined(OBJECT_FORMAT_ELF) \
+ && !defined(OBJECT_FORMAT_FLAT) \
+ && defined(HAVE_LD_EH_FRAME_HDR) \
+- && !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \
+- && defined(__GLIBC__) && __GLIBC__ >= 2
++ && !defined(inhibit_libc) && !defined(CRTSTUFFT_O)
+ #include <link.h>
+ /* uClibc pretends to be glibc 2.2 and DT_CONFIG is defined in its link.h.
+ But it doesn't use PT_GNU_EH_FRAME ELF segment currently. */
+-# if !defined(__UCLIBC__) \
+- && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
+- || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
+-# define USE_PT_GNU_EH_FRAME
++# if defined(__UCLIBC__)
++# if (__UCLIBC_MAJOR__ > 0 || __UCLIBC_MINOR__ > 9 || \
++ (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ >= 33))
++# define USE_PT_GNU_EH_FRAME
++# endif
++# elif defined(__GLIBC__)
++# if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
++ || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
++# define USE_PT_GNU_EH_FRAME
++# endif
+ # endif
+ #endif
+
diff --git a/toolchain/gcc/patches/4.8-linaro/870-ppc_no_crtsavres.patch b/toolchain/gcc/patches/4.8-linaro/870-ppc_no_crtsavres.patch
new file mode 100644
index 000000000..d8c460a92
--- /dev/null
+++ b/toolchain/gcc/patches/4.8-linaro/870-ppc_no_crtsavres.patch
@@ -0,0 +1,11 @@
+--- a/gcc/config/rs6000/rs6000.c
++++ b/gcc/config/rs6000/rs6000.c
+@@ -17653,7 +17653,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.8-linaro/900-bad-mips16-crt.patch b/toolchain/gcc/patches/4.8-linaro/900-bad-mips16-crt.patch
new file mode 100644
index 000000000..dd6e9dc88
--- /dev/null
+++ b/toolchain/gcc/patches/4.8-linaro/900-bad-mips16-crt.patch
@@ -0,0 +1,9 @@
+--- 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.7-linaro/910-mbsd_multi.patch b/toolchain/gcc/patches/4.8-linaro/910-mbsd_multi.patch
index 605545dfe..3b37a3f8f 100644
--- a/toolchain/gcc/patches/4.7-linaro/910-mbsd_multi.patch
+++ b/toolchain/gcc/patches/4.8-linaro/910-mbsd_multi.patch
@@ -19,9 +19,9 @@
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
-@@ -108,6 +108,9 @@ static size_t deferred_count;
- /* Number of deferred options scanned for -include. */
- static size_t include_cursor;
+@@ -104,6 +104,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;
@@ -29,17 +29,17 @@
static void handle_OPT_d (const char *);
static void set_std_cxx98 (int);
static void set_std_cxx11 (int);
-@@ -449,6 +452,9 @@ c_common_handle_option (size_t scode, co
+@@ -383,6 +386,9 @@ c_common_handle_option (size_t scode, co
cpp_opts->warn_endif_labels = value;
break;
+ case OPT_Werror_maybe_reset:
+ break;
+
- case OPT_Wformat:
- set_Wformat (value);
+ case OPT_Winvalid_pch:
+ cpp_opts->warn_invalid_pch = value;
break;
-@@ -592,6 +598,12 @@ c_common_handle_option (size_t scode, co
+@@ -491,6 +497,12 @@ c_common_handle_option (size_t scode, co
flag_no_builtin = !value;
break;
@@ -52,7 +52,7 @@
case OPT_fconstant_string_class_:
constant_string_class_name = arg;
break;
-@@ -1098,6 +1110,47 @@ c_common_init (void)
+@@ -1027,6 +1039,47 @@ c_common_init (void)
return false;
}
@@ -102,7 +102,7 @@
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
-@@ -371,6 +371,10 @@ Werror-implicit-function-declaration
+@@ -379,6 +379,10 @@ Werror-implicit-function-declaration
C ObjC RejectNegative Warning Alias(Werror=, implicit-function-declaration)
This switch is deprecated; use -Werror=implicit-function-declaration instead
@@ -113,7 +113,7 @@
Wfloat-equal
C ObjC C++ ObjC++ Var(warn_float_equal) Warning
Warn if testing floating point numbers for equality
-@@ -830,6 +834,9 @@ C++ ObjC++ Optimization Alias(fexception
+@@ -949,6 +953,9 @@ C++ ObjC++ Optimization Alias(fexception
fhonor-std
C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
@@ -125,7 +125,7 @@
Assume normal C execution environment
--- a/gcc/common.opt
+++ b/gcc/common.opt
-@@ -531,6 +531,10 @@ Werror=
+@@ -541,6 +541,10 @@ Werror=
Common Joined
Treat specified warning as error
@@ -136,7 +136,7 @@
Wextra
Common Var(extra_warnings) Warning
Print extra (possibly unwanted) warnings
-@@ -1209,6 +1213,9 @@ fguess-branch-probability
+@@ -1242,6 +1246,9 @@ fguess-branch-probability
Common Report Var(flag_guess_branch_prob) Optimization
Enable guessing of branch probabilities
@@ -148,7 +148,7 @@
; On SVR4 targets, it also controls whether or not to emit a
--- a/gcc/opts.c
+++ b/gcc/opts.c
-@@ -470,8 +470,6 @@ static const struct default_options defa
+@@ -468,8 +468,6 @@ static const struct default_options defa
{ OPT_LEVELS_2_PLUS, OPT_fschedule_insns2, NULL, 1 },
#endif
{ OPT_LEVELS_2_PLUS, OPT_fregmove, NULL, 1 },
@@ -157,8 +157,8 @@
{ OPT_LEVELS_2_PLUS, OPT_freorder_blocks, NULL, 1 },
{ OPT_LEVELS_2_PLUS, OPT_freorder_functions, NULL, 1 },
{ OPT_LEVELS_2_PLUS, OPT_ftree_vrp, NULL, 1 },
-@@ -489,6 +487,8 @@ static const struct default_options defa
- { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_foptimize_strlen, NULL, 1 },
+@@ -488,6 +486,8 @@ static const struct default_options defa
+ { OPT_LEVELS_2_PLUS, OPT_fhoist_adjacent_loads, NULL, 1 },
/* -O3 optimizations. */
+ { OPT_LEVELS_3_PLUS, OPT_fstrict_aliasing, NULL, 1 },
@@ -166,7 +166,7 @@
{ OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribute_patterns, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_fpredictive_commoning, NULL, 1 },
/* Inlining of functions reducing size is a good idea with -Os
-@@ -1432,6 +1432,17 @@ common_handle_option (struct gcc_options
+@@ -1423,6 +1423,17 @@ common_handle_option (struct gcc_options
opts, opts_set, loc, dc);
break;
@@ -186,7 +186,7 @@
opts->x_warn_larger_than = value != -1;
--- a/gcc/doc/cppopts.texi
+++ b/gcc/doc/cppopts.texi
-@@ -164,6 +164,11 @@ in older programs. This warning is on b
+@@ -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.
@@ -200,7 +200,7 @@
Issue warnings for code in system headers. These are normally unhelpful
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
-@@ -242,7 +242,7 @@ Objective-C and Objective-C++ Dialects}.
+@@ -240,7 +240,7 @@ Objective-C and Objective-C++ Dialects}.
-Wconversion -Wcoverage-mismatch -Wno-cpp -Wno-deprecated @gol
-Wno-deprecated-declarations -Wdisabled-optimization @gol
-Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol
@@ -209,8 +209,8 @@
-Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
-Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
-Wformat-security -Wformat-y2k @gol
-@@ -4649,6 +4649,22 @@ This option is only supported for C and
- @option{-Wall} and by @option{-pedantic}, which can be disabled with
+@@ -4808,6 +4808,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
@@ -232,7 +232,7 @@
@item -Wstack-protector
@opindex Wstack-protector
@opindex Wno-stack-protector
-@@ -6571,7 +6587,7 @@ so, the first branch is redirected to ei
+@@ -6919,7 +6935,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.
@@ -243,7 +243,7 @@
@opindex fsplit-wide-types
--- a/gcc/java/jvspec.c
+++ b/gcc/java/jvspec.c
-@@ -627,6 +627,7 @@ lang_specific_pre_link (void)
+@@ -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));
diff --git a/toolchain/gcc/patches/4.7-linaro/920-specs_nonfatal_getenv.patch b/toolchain/gcc/patches/4.8-linaro/920-specs_nonfatal_getenv.patch
index 0f2a8704f..4baa96693 100644
--- a/toolchain/gcc/patches/4.7-linaro/920-specs_nonfatal_getenv.patch
+++ b/toolchain/gcc/patches/4.8-linaro/920-specs_nonfatal_getenv.patch
@@ -1,6 +1,6 @@
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
-@@ -7814,7 +7814,10 @@ getenv_spec_function (int argc, const ch
+@@ -8003,7 +8003,10 @@ getenv_spec_function (int argc, const ch
value = getenv (argv[0]);
if (!value)
diff --git a/toolchain/gcc/patches/4.8.0/010-documentation.patch b/toolchain/gcc/patches/4.8.0/010-documentation.patch
new file mode 100644
index 000000000..3f604ee47
--- /dev/null
+++ b/toolchain/gcc/patches/4.8.0/010-documentation.patch
@@ -0,0 +1,23 @@
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -4326,18 +4326,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.7-linaro/100-uclibc-conf.patch b/toolchain/gcc/patches/4.8.0/100-uclibc-conf.patch
index ff9ad94f6..ff9ad94f6 100644
--- a/toolchain/gcc/patches/4.7-linaro/100-uclibc-conf.patch
+++ b/toolchain/gcc/patches/4.8.0/100-uclibc-conf.patch
diff --git a/toolchain/gcc/patches/4.7-linaro/200-musl.patch b/toolchain/gcc/patches/4.8.0/200-musl.patch
index a3f0757f2..94a45e217 100644
--- a/toolchain/gcc/patches/4.7-linaro/200-musl.patch
+++ b/toolchain/gcc/patches/4.8.0/200-musl.patch
@@ -1,7 +1,6 @@
-diff --git a/gcc/config.gcc b/gcc/config.gcc
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
-@@ -522,7 +522,7 @@
+@@ -549,7 +549,7 @@ case ${target} in
esac
# Common C libraries.
@@ -10,7 +9,7 @@ diff --git a/gcc/config.gcc b/gcc/config.gcc
# Common parts for widely ported systems.
case ${target} in
-@@ -625,6 +625,9 @@
+@@ -652,6 +652,9 @@ case ${target} in
*-*-*uclibc*)
tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
;;
@@ -20,20 +19,11 @@ diff --git a/gcc/config.gcc b/gcc/config.gcc
*)
tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
;;
-@@ -1722,6 +1725,7 @@
- tm_file="${tm_file} dbxelf.h gnu-user.h linux.h microblaze/linux.h"
- c_target_objs="${c_target_objs} microblaze-c.o"
- cxx_target_objs="${cxx_target_objs} microblaze-c.o"
-+ tmake_file="${tmake_file} microblaze/t-microblaze"
- ;;
- microblaze*-*-*)
- tm_file="${tm_file} dbxelf.h"
-diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
-@@ -64,6 +64,10 @@
- #undef GLIBC_DYNAMIC_LINKER
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
+@@ -77,6 +77,10 @@
+ %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
+ %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
+/* musl has no "classic" (i.e. broken) mode */
+#undef MUSL_DYNAMIC_LINKER
@@ -42,18 +32,16 @@ diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
/* 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
-diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
--- a/gcc/config/i386/linux.h
+++ b/gcc/config/i386/linux.h
-@@ -22,3 +22,4 @@
+@@ -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"
-diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
--- a/gcc/config/i386/linux64.h
+++ b/gcc/config/i386/linux64.h
-@@ -31,3 +31,7 @@
+@@ -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"
@@ -61,10 +49,9 @@ diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
+#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"
-diff --git a/gcc/config/linux.h b/gcc/config/linux.h
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
-@@ -33,10 +33,12 @@
+@@ -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)
@@ -77,7 +64,7 @@ diff --git a/gcc/config/linux.h b/gcc/config/linux.h
#endif
#define GNU_USER_TARGET_OS_CPP_BUILTINS() \
-@@ -54,18 +56,21 @@
+@@ -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. */
@@ -107,7 +94,7 @@ diff --git a/gcc/config/linux.h b/gcc/config/linux.h
#else
#error "Unsupported DEFAULT_LIBC"
#endif /* DEFAULT_LIBC */
-@@ -85,16 +90,16 @@
+@@ -84,16 +89,16 @@ see the files COPYING3 and COPYING.RUNTI
#define GNU_USER_DYNAMIC_LINKER \
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
@@ -128,10 +115,9 @@ diff --git a/gcc/config/linux.h b/gcc/config/linux.h
/* Determine whether the entire c99 runtime
is present in the runtime library. */
-diff --git a/gcc/config/linux.opt b/gcc/config/linux.opt
--- a/gcc/config/linux.opt
+++ b/gcc/config/linux.opt
-@@ -30,3 +30,7 @@
+@@ -30,3 +30,7 @@ Use GNU C library
muclibc
Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
Use uClibc C library
@@ -139,19 +125,17 @@ diff --git a/gcc/config/linux.opt b/gcc/config/linux.opt
+mmusl
+Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
+Use musl C library
-diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
--- a/gcc/config/mips/linux.h
+++ b/gcc/config/mips/linux.h
-@@ -19,3 +19,5 @@
+@@ -18,3 +18,5 @@ along with GCC; see the file COPYING3.
<http://www.gnu.org/licenses/>. */
#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+
+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips.so.1"
-diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
-@@ -362,17 +362,21 @@
+@@ -364,17 +364,21 @@ extern int dot_symbols;
#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
@@ -177,10 +161,9 @@ diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
#define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux %{!shared: %{!static: \
-diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
-@@ -804,15 +804,18 @@
+@@ -789,15 +789,18 @@ extern int fixuplabelno;
#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
@@ -202,10 +185,9 @@ diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
#define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
%{rdynamic:-export-dynamic} \
-diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
--- a/gcc/ginclude/stddef.h
+++ b/gcc/ginclude/stddef.h
-@@ -184,6 +184,7 @@
+@@ -181,6 +181,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
#ifndef _GCC_SIZE_T
#ifndef _SIZET_
#ifndef __size_t
@@ -213,7 +195,7 @@ diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
#define __size_t__ /* BeOS */
#define __SIZE_T__ /* Cray Unicos/Mk */
#define _SIZE_T
-@@ -200,6 +201,7 @@
+@@ -197,6 +198,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
#define ___int_size_t_h
#define _GCC_SIZE_T
#define _SIZET_
@@ -221,7 +203,7 @@ diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
#if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
|| defined(__FreeBSD_kernel__)
/* __size_t is a typedef on FreeBSD 5, must not trash it. */
-@@ -215,6 +217,7 @@
+@@ -214,6 +216,7 @@ typedef __SIZE_TYPE__ size_t;
typedef long ssize_t;
#endif /* __BEOS__ */
#endif /* !(defined (__GNUG__) && defined (size_t)) */
@@ -229,7 +211,6 @@ diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
#endif /* __size_t */
#endif /* _SIZET_ */
#endif /* _GCC_SIZE_T */
-diff --git a/libgomp/config/posix/time.c b/libgomp/config/posix/time.c
--- a/libgomp/config/posix/time.c
+++ b/libgomp/config/posix/time.c
@@ -28,6 +28,8 @@
@@ -241,10 +222,9 @@ diff --git a/libgomp/config/posix/time.c b/libgomp/config/posix/time.c
#include "libgomp.h"
#include <unistd.h>
#if TIME_WITH_SYS_TIME
-diff --git a/libitm/config/arm/hwcap.cc b/libitm/config/arm/hwcap.cc
--- a/libitm/config/arm/hwcap.cc
+++ b/libitm/config/arm/hwcap.cc
-@@ -40,7 +40,11 @@
+@@ -40,7 +40,11 @@ int GTM_hwcap HIDDEN = 0
#ifdef __linux__
#include <unistd.h>
@@ -256,7 +236,6 @@ diff --git a/libitm/config/arm/hwcap.cc b/libitm/config/arm/hwcap.cc
#include <elf.h>
static void __attribute__((constructor))
-diff --git a/libitm/config/linux/x86/tls.h b/libitm/config/linux/x86/tls.h
--- a/libitm/config/linux/x86/tls.h
+++ b/libitm/config/linux/x86/tls.h
@@ -25,16 +25,19 @@
@@ -281,17 +260,16 @@ diff --git a/libitm/config/linux/x86/tls.h b/libitm/config/linux/x86/tls.h
namespace GTM HIDDEN {
#ifdef __x86_64__
-@@ -101,5 +104,6 @@
+@@ -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/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
--- a/libstdc++-v3/configure.host
+++ b/libstdc++-v3/configure.host
-@@ -243,6 +243,13 @@
+@@ -264,6 +264,13 @@ case "${host_os}" in
os_include_dir="os/bsd/freebsd"
;;
gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
@@ -305,7 +283,7 @@ diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
if [ "$uclibc" = "yes" ]; then
os_include_dir="os/uclibc"
elif [ "$bionic" = "yes" ]; then
-@@ -251,6 +258,9 @@
+@@ -272,6 +279,9 @@ case "${host_os}" in
os_include_dir="os/gnu-linux"
fi
;;
@@ -315,3 +293,16 @@ diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
hpux*)
os_include_dir="os/hpux"
;;
+--- a/gcc/config/mips/linux64.h
++++ b/gcc/config/mips/linux64.h
+@@ -27,6 +27,9 @@ along with GCC; see the file COPYING3.
+ #define GLIBC_DYNAMIC_LINKERN32 "/lib32/ld.so.1"
+ #define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
+ #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
++#define MUSL_DYNAMIC_LINKERN32 "/lib/ld-musl-mips.so.1"
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-mips.so.1"
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-mips.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.7.2/810-arm-softfloat-libgcc.patch b/toolchain/gcc/patches/4.8.0/810-arm-softfloat-libgcc.patch
index a3d7db014..a3816a17f 100644
--- a/toolchain/gcc/patches/4.7.2/810-arm-softfloat-libgcc.patch
+++ b/toolchain/gcc/patches/4.8.0/810-arm-softfloat-libgcc.patch
@@ -1,21 +1,10 @@
---- a/gcc/config/arm/linux-elf.h
-+++ b/gcc/config/arm/linux-elf.h
-@@ -57,7 +57,7 @@
- %{shared:-lc} \
- %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
-
--#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
-+#define LIBGCC_SPEC "-lgcc"
-
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
-
--- 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 \
-- _arm_addsubdf3 _arm_addsubsf3
-+ _arm_addsubdf3 _arm_addsubsf3 \
+- _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 \
diff --git a/toolchain/gcc/patches/4.6.2/820-libgcc_pic.patch b/toolchain/gcc/patches/4.8.0/820-libgcc_pic.patch
index 3760ac2b9..7a0ac7353 100644
--- a/toolchain/gcc/patches/4.6.2/820-libgcc_pic.patch
+++ b/toolchain/gcc/patches/4.8.0/820-libgcc_pic.patch
@@ -1,6 +1,6 @@
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
-@@ -747,11 +747,12 @@ $(libgcov-objects): %$(objext): $(gcc_sr
+@@ -865,11 +865,12 @@ $(libgcov-objects): %$(objext): $(srcdir
# Static libraries.
libgcc.a: $(libgcc-objects)
@@ -14,7 +14,7 @@
-rm -f $@
objects="$(objects)"; \
-@@ -773,7 +774,7 @@ libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_E
+@@ -891,7 +892,7 @@ libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_E
endif
ifeq ($(enable_shared),yes)
@@ -23,7 +23,7 @@
ifneq ($(LIBUNWIND),)
all: libunwind$(SHLIB_EXT)
endif
-@@ -954,6 +955,10 @@ install-shared:
+@@ -1058,6 +1059,10 @@ install-shared:
chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
diff --git a/toolchain/gcc/patches/4.7-linaro/830-arm_unbreak_armv4t.patch b/toolchain/gcc/patches/4.8.0/830-arm_unbreak_armv4t.patch
index 37f8f2a54..37f8f2a54 100644
--- a/toolchain/gcc/patches/4.7-linaro/830-arm_unbreak_armv4t.patch
+++ b/toolchain/gcc/patches/4.8.0/830-arm_unbreak_armv4t.patch
diff --git a/toolchain/gcc/patches/4.6.2/840-armv4_pass_fix-v4bx_to_ld.patch b/toolchain/gcc/patches/4.8.0/840-armv4_pass_fix-v4bx_to_ld.patch
index 67c374d9a..e938905ab 100644
--- a/toolchain/gcc/patches/4.6.2/840-armv4_pass_fix-v4bx_to_ld.patch
+++ b/toolchain/gcc/patches/4.8.0/840-armv4_pass_fix-v4bx_to_ld.patch
@@ -1,8 +1,8 @@
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
-@@ -64,10 +64,15 @@
- #undef GLIBC_DYNAMIC_LINKER
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
+@@ -81,10 +81,15 @@
+ #undef MUSL_DYNAMIC_LINKER
+ #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-arm.so.1"
+/* For armv4 we pass --fix-v4bx to linker to support EABI */
+#undef TARGET_FIX_V4BX_SPEC
diff --git a/toolchain/gcc/patches/4.8.0/850-use_shared_libgcc.patch b/toolchain/gcc/patches/4.8.0/850-use_shared_libgcc.patch
new file mode 100644
index 000000000..4a77b86c1
--- /dev/null
+++ b/toolchain/gcc/patches/4.8.0/850-use_shared_libgcc.patch
@@ -0,0 +1,58 @@
+--- a/gcc/config/arm/linux-eabi.h
++++ b/gcc/config/arm/linux-eabi.h
+@@ -114,10 +114,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/libgcc/Makefile.in
++++ b/libgcc/Makefile.in
+@@ -368,7 +368,7 @@ endif
+ # For -fvisibility=hidden. We need both a -fvisibility=hidden on
+ # the command line, and a #define to prevent libgcc2.h etc from
+ # overriding that with #pragmas.
+-vis_hide = @vis_hide@
++vis_hide =
+
+ ifneq (,$(vis_hide))
+
+--- a/gcc/config/rs6000/linux.h
++++ b/gcc/config/rs6000/linux.h
+@@ -61,6 +61,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.8.0/860-uclibc_use_eh_frame.patch b/toolchain/gcc/patches/4.8.0/860-uclibc_use_eh_frame.patch
new file mode 100644
index 000000000..0464bd7d2
--- /dev/null
+++ b/toolchain/gcc/patches/4.8.0/860-uclibc_use_eh_frame.patch
@@ -0,0 +1,29 @@
+--- a/libgcc/crtstuff.c
++++ b/libgcc/crtstuff.c
+@@ -100,15 +100,20 @@ call_ ## FUNC (void) \
+ #if defined(OBJECT_FORMAT_ELF) \
+ && !defined(OBJECT_FORMAT_FLAT) \
+ && defined(HAVE_LD_EH_FRAME_HDR) \
+- && !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \
+- && defined(__GLIBC__) && __GLIBC__ >= 2
++ && !defined(inhibit_libc) && !defined(CRTSTUFFT_O)
+ #include <link.h>
+ /* uClibc pretends to be glibc 2.2 and DT_CONFIG is defined in its link.h.
+ But it doesn't use PT_GNU_EH_FRAME ELF segment currently. */
+-# if !defined(__UCLIBC__) \
+- && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
+- || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
+-# define USE_PT_GNU_EH_FRAME
++# if defined(__UCLIBC__)
++# if (__UCLIBC_MAJOR__ > 0 || __UCLIBC_MINOR__ > 9 || \
++ (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ >= 33))
++# define USE_PT_GNU_EH_FRAME
++# endif
++# elif defined(__GLIBC__)
++# if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
++ || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
++# define USE_PT_GNU_EH_FRAME
++# endif
+ # endif
+ #endif
+
diff --git a/toolchain/gcc/patches/4.8.0/870-ppc_no_crtsavres.patch b/toolchain/gcc/patches/4.8.0/870-ppc_no_crtsavres.patch
new file mode 100644
index 000000000..d8c460a92
--- /dev/null
+++ b/toolchain/gcc/patches/4.8.0/870-ppc_no_crtsavres.patch
@@ -0,0 +1,11 @@
+--- a/gcc/config/rs6000/rs6000.c
++++ b/gcc/config/rs6000/rs6000.c
+@@ -17653,7 +17653,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.8.0/900-bad-mips16-crt.patch b/toolchain/gcc/patches/4.8.0/900-bad-mips16-crt.patch
new file mode 100644
index 000000000..dd6e9dc88
--- /dev/null
+++ b/toolchain/gcc/patches/4.8.0/900-bad-mips16-crt.patch
@@ -0,0 +1,9 @@
+--- 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.7.2/910-mbsd_multi.patch b/toolchain/gcc/patches/4.8.0/910-mbsd_multi.patch
index 605545dfe..d04dc7d91 100644
--- a/toolchain/gcc/patches/4.7.2/910-mbsd_multi.patch
+++ b/toolchain/gcc/patches/4.8.0/910-mbsd_multi.patch
@@ -19,9 +19,9 @@
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
-@@ -108,6 +108,9 @@ static size_t deferred_count;
- /* Number of deferred options scanned for -include. */
- static size_t include_cursor;
+@@ -104,6 +104,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;
@@ -29,17 +29,17 @@
static void handle_OPT_d (const char *);
static void set_std_cxx98 (int);
static void set_std_cxx11 (int);
-@@ -449,6 +452,9 @@ c_common_handle_option (size_t scode, co
+@@ -383,6 +386,9 @@ c_common_handle_option (size_t scode, co
cpp_opts->warn_endif_labels = value;
break;
+ case OPT_Werror_maybe_reset:
+ break;
+
- case OPT_Wformat:
- set_Wformat (value);
+ case OPT_Winvalid_pch:
+ cpp_opts->warn_invalid_pch = value;
break;
-@@ -592,6 +598,12 @@ c_common_handle_option (size_t scode, co
+@@ -491,6 +497,12 @@ c_common_handle_option (size_t scode, co
flag_no_builtin = !value;
break;
@@ -52,7 +52,7 @@
case OPT_fconstant_string_class_:
constant_string_class_name = arg;
break;
-@@ -1098,6 +1110,47 @@ c_common_init (void)
+@@ -1027,6 +1039,47 @@ c_common_init (void)
return false;
}
@@ -102,7 +102,7 @@
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
-@@ -371,6 +371,10 @@ Werror-implicit-function-declaration
+@@ -379,6 +379,10 @@ Werror-implicit-function-declaration
C ObjC RejectNegative Warning Alias(Werror=, implicit-function-declaration)
This switch is deprecated; use -Werror=implicit-function-declaration instead
@@ -113,7 +113,7 @@
Wfloat-equal
C ObjC C++ ObjC++ Var(warn_float_equal) Warning
Warn if testing floating point numbers for equality
-@@ -830,6 +834,9 @@ C++ ObjC++ Optimization Alias(fexception
+@@ -949,6 +953,9 @@ C++ ObjC++ Optimization Alias(fexception
fhonor-std
C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
@@ -125,7 +125,7 @@
Assume normal C execution environment
--- a/gcc/common.opt
+++ b/gcc/common.opt
-@@ -531,6 +531,10 @@ Werror=
+@@ -541,6 +541,10 @@ Werror=
Common Joined
Treat specified warning as error
@@ -136,7 +136,7 @@
Wextra
Common Var(extra_warnings) Warning
Print extra (possibly unwanted) warnings
-@@ -1209,6 +1213,9 @@ fguess-branch-probability
+@@ -1242,6 +1246,9 @@ fguess-branch-probability
Common Report Var(flag_guess_branch_prob) Optimization
Enable guessing of branch probabilities
@@ -148,7 +148,7 @@
; On SVR4 targets, it also controls whether or not to emit a
--- a/gcc/opts.c
+++ b/gcc/opts.c
-@@ -470,8 +470,6 @@ static const struct default_options defa
+@@ -468,8 +468,6 @@ static const struct default_options defa
{ OPT_LEVELS_2_PLUS, OPT_fschedule_insns2, NULL, 1 },
#endif
{ OPT_LEVELS_2_PLUS, OPT_fregmove, NULL, 1 },
@@ -157,8 +157,8 @@
{ OPT_LEVELS_2_PLUS, OPT_freorder_blocks, NULL, 1 },
{ OPT_LEVELS_2_PLUS, OPT_freorder_functions, NULL, 1 },
{ OPT_LEVELS_2_PLUS, OPT_ftree_vrp, NULL, 1 },
-@@ -489,6 +487,8 @@ static const struct default_options defa
- { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_foptimize_strlen, NULL, 1 },
+@@ -488,6 +486,8 @@ static const struct default_options defa
+ { OPT_LEVELS_2_PLUS, OPT_fhoist_adjacent_loads, NULL, 1 },
/* -O3 optimizations. */
+ { OPT_LEVELS_3_PLUS, OPT_fstrict_aliasing, NULL, 1 },
@@ -166,7 +166,7 @@
{ OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribute_patterns, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_fpredictive_commoning, NULL, 1 },
/* Inlining of functions reducing size is a good idea with -Os
-@@ -1432,6 +1432,17 @@ common_handle_option (struct gcc_options
+@@ -1423,6 +1423,17 @@ common_handle_option (struct gcc_options
opts, opts_set, loc, dc);
break;
@@ -186,7 +186,7 @@
opts->x_warn_larger_than = value != -1;
--- a/gcc/doc/cppopts.texi
+++ b/gcc/doc/cppopts.texi
-@@ -164,6 +164,11 @@ in older programs. This warning is on b
+@@ -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.
@@ -200,7 +200,7 @@
Issue warnings for code in system headers. These are normally unhelpful
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
-@@ -242,7 +242,7 @@ Objective-C and Objective-C++ Dialects}.
+@@ -240,7 +240,7 @@ Objective-C and Objective-C++ Dialects}.
-Wconversion -Wcoverage-mismatch -Wno-cpp -Wno-deprecated @gol
-Wno-deprecated-declarations -Wdisabled-optimization @gol
-Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol
@@ -209,8 +209,8 @@
-Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
-Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
-Wformat-security -Wformat-y2k @gol
-@@ -4649,6 +4649,22 @@ This option is only supported for C and
- @option{-Wall} and by @option{-pedantic}, which can be disabled with
+@@ -4808,6 +4808,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
@@ -232,7 +232,7 @@
@item -Wstack-protector
@opindex Wstack-protector
@opindex Wno-stack-protector
-@@ -6571,7 +6587,7 @@ so, the first branch is redirected to ei
+@@ -6919,7 +6935,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.
@@ -243,7 +243,7 @@
@opindex fsplit-wide-types
--- a/gcc/java/jvspec.c
+++ b/gcc/java/jvspec.c
-@@ -627,6 +627,7 @@ lang_specific_pre_link (void)
+@@ -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));
diff --git a/toolchain/gcc/patches/4.7.2/920-specs_nonfatal_getenv.patch b/toolchain/gcc/patches/4.8.0/920-specs_nonfatal_getenv.patch
index 0f2a8704f..4baa96693 100644
--- a/toolchain/gcc/patches/4.7.2/920-specs_nonfatal_getenv.patch
+++ b/toolchain/gcc/patches/4.8.0/920-specs_nonfatal_getenv.patch
@@ -1,6 +1,6 @@
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
-@@ -7814,7 +7814,10 @@ getenv_spec_function (int argc, const ch
+@@ -8003,7 +8003,10 @@ getenv_spec_function (int argc, const ch
value = getenv (argv[0]);
if (!value)
diff --git a/toolchain/gcc/patches/llvm/100-uclibc-conf.patch b/toolchain/gcc/patches/llvm/100-uclibc-conf.patch
deleted file mode 100644
index 655e9ed96..000000000
--- a/toolchain/gcc/patches/llvm/100-uclibc-conf.patch
+++ /dev/null
@@ -1,200 +0,0 @@
---- a/libgomp/configure
-+++ b/libgomp/configure
-@@ -3893,7 +3893,7 @@ irix5* | irix6*)
- ;;
-
- # This must be Linux ELF.
--linux-gnu*)
-+linux*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
---- a/gcc/config/cris/linux.h
-+++ b/gcc/config/cris/linux.h
-@@ -74,7 +74,11 @@ Boston, MA 02110-1301, USA. */
- #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
-
- #undef CRIS_SUBTARGET_VERSION
--#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
-+#if UCLIBC_DEFAULT
-+# define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc"
-+#else
-+# define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
-+#endif
-
- #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
-
---- a/libstdc++-v3/configure
-+++ b/libstdc++-v3/configure
-@@ -4283,7 +4283,7 @@ irix5* | irix6*)
- ;;
-
- # This must be Linux ELF.
--linux-gnu*)
-+linux*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
---- a/zlib/configure
-+++ b/zlib/configure
-@@ -3429,7 +3429,7 @@ irix5* | irix6*)
- ;;
-
- # This must be Linux ELF.
--linux-gnu*)
-+linux*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
---- a/libobjc/configure
-+++ b/libobjc/configure
-@@ -3314,7 +3314,7 @@ irix5* | irix6*)
- ;;
-
- # This must be Linux ELF.
--linux-gnu*)
-+linux*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
---- a/libgfortran/configure
-+++ b/libgfortran/configure
-@@ -3721,7 +3721,7 @@ irix5* | irix6*)
- ;;
-
- # This must be Linux ELF.
--linux-gnu*)
-+linux*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
---- a/libmudflap/configure
-+++ b/libmudflap/configure
-@@ -5394,7 +5394,7 @@ irix5* | irix6*)
- ;;
-
- # This must be Linux ELF.
--linux-gnu*)
-+linux*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
---- a/boehm-gc/configure
-+++ b/boehm-gc/configure
-@@ -4323,7 +4323,7 @@ irix5* | irix6*)
- ;;
-
- # This must be Linux ELF.
--linux-gnu*)
-+linux*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
---- a/libffi/configure
-+++ b/libffi/configure
-@@ -3460,7 +3460,7 @@ irix5* | irix6*)
- ;;
-
- # This must be Linux ELF.
--linux-gnu*)
-+linux*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
---- a/libssp/configure
-+++ b/libssp/configure
-@@ -4482,7 +4482,7 @@ irix5* | irix6*)
- ;;
-
- # This must be Linux ELF.
--linux-gnu*)
-+linux*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
---- a/contrib/regression/objs-gcc.sh
-+++ b/contrib/regression/objs-gcc.sh
-@@ -105,6 +105,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
-
-@@ -1251,7 +1251,7 @@ linux-gnuoldld* | linux-gnuaout* | linux
- ;;
-
- # This must be Linux ELF.
--linux-gnu*)
-+linux*)
- version_type=linux
- need_lib_prefix=no
- need_version=no
---- a/libjava/classpath/configure
-+++ b/libjava/classpath/configure
-@@ -5307,7 +5307,7 @@ irix5* | irix6*)
- ;;
-
- # This must be Linux ELF.
--linux-gnu*)
-+linux*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
---- a/libjava/configure
-+++ b/libjava/configure
-@@ -5424,7 +5424,7 @@ irix5* | irix6*)
- ;;
-
- # This must be Linux ELF.
--linux-gnu*)
-+linux*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
---- a/libtool.m4
-+++ b/libtool.m4
-@@ -739,7 +739,7 @@ irix5* | irix6*)
- ;;
-
- # This must be Linux ELF.
--linux-gnu*)
-+linux*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
---- a/ltconfig
-+++ b/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
-
-@@ -1253,7 +1253,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/llvm/200-uclibc-locale.patch b/toolchain/gcc/patches/llvm/200-uclibc-locale.patch
deleted file mode 100644
index 2fb494af7..000000000
--- a/toolchain/gcc/patches/llvm/200-uclibc-locale.patch
+++ /dev/null
@@ -1,2790 +0,0 @@
---- a/libstdc++-v3/acinclude.m4
-+++ b/libstdc++-v3/acinclude.m4
-@@ -1334,7 +1334,7 @@ dnl
- AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
- GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
- [use MODEL for target locale package],
-- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
-+ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto])
-
- # Deal with gettext issues. Default to not using it (=no) until we detect
- # support for it later. Let the user turn it off via --e/d, but let that
-@@ -1355,6 +1355,9 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
- # Default to "generic".
- if test $enable_clocale_flag = auto; then
- case ${target_os} in
-+ *-uclibc*)
-+ enable_clocale_flag=uclibc
-+ ;;
- linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
- enable_clocale_flag=gnu
- ;;
-@@ -1524,6 +1527,40 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
- CTIME_CC=config/locale/generic/time_members.cc
- CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
- ;;
-+ uclibc)
-+ AC_MSG_RESULT(uclibc)
-+
-+ # Declare intention to use gettext, and add support for specific
-+ # languages.
-+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
-+ ALL_LINGUAS="de fr"
-+
-+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
-+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
-+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
-+ USE_NLS=yes
-+ fi
-+ # Export the build objects.
-+ for ling in $ALL_LINGUAS; do \
-+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
-+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
-+ done
-+ AC_SUBST(glibcxx_MOFILES)
-+ AC_SUBST(glibcxx_POFILES)
-+
-+ CLOCALE_H=config/locale/uclibc/c_locale.h
-+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
-+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
-+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
-+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
-+ CMESSAGES_H=config/locale/uclibc/messages_members.h
-+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
-+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
-+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
-+ CTIME_H=config/locale/uclibc/time_members.h
-+ CTIME_CC=config/locale/uclibc/time_members.cc
-+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
-+ ;;
- esac
-
- # This is where the testsuite looks for locale catalogs, using the
---- /dev/null
-+++ b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
-@@ -0,0 +1,63 @@
-+// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
-+
-+// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
-+//
-+// This file is part of the GNU ISO C++ Library. This library 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 2, or (at your option)
-+// any later version.
-+
-+// This library 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 this library; see the file COPYING. If not, write to the Free
-+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-+// USA.
-+
-+// As a special exception, you may use this file as part of a free software
-+// library without restriction. Specifically, if other files instantiate
-+// templates or use macros or inline functions from this file, or you compile
-+// this file and link it with other files to produce an executable, this
-+// file does not by itself cause the resulting executable to be covered by
-+// the GNU General Public License. This exception does not however
-+// invalidate any other reasons why the executable file might be covered by
-+// the GNU General Public License.
-+
-+// Written by Jakub Jelinek <jakub@redhat.com>
-+
-+#include <bits/c++config.h>
-+#include <clocale>
-+
-+#ifdef __UCLIBC_MJN3_ONLY__
-+#warning clean this up
-+#endif
-+
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+
-+extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
-+extern "C" __typeof(strcoll_l) __strcoll_l;
-+extern "C" __typeof(strftime_l) __strftime_l;
-+extern "C" __typeof(strtod_l) __strtod_l;
-+extern "C" __typeof(strtof_l) __strtof_l;
-+extern "C" __typeof(strtold_l) __strtold_l;
-+extern "C" __typeof(strxfrm_l) __strxfrm_l;
-+extern "C" __typeof(newlocale) __newlocale;
-+extern "C" __typeof(freelocale) __freelocale;
-+extern "C" __typeof(duplocale) __duplocale;
-+extern "C" __typeof(uselocale) __uselocale;
-+
-+#ifdef _GLIBCXX_USE_WCHAR_T
-+extern "C" __typeof(iswctype_l) __iswctype_l;
-+extern "C" __typeof(towlower_l) __towlower_l;
-+extern "C" __typeof(towupper_l) __towupper_l;
-+extern "C" __typeof(wcscoll_l) __wcscoll_l;
-+extern "C" __typeof(wcsftime_l) __wcsftime_l;
-+extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
-+extern "C" __typeof(wctype_l) __wctype_l;
-+#endif
-+
-+#endif // GLIBC 2.3 and later
---- /dev/null
-+++ b/libstdc++-v3/config/locale/uclibc/c_locale.cc
-@@ -0,0 +1,160 @@
-+// Wrapper for underlying C-language localization -*- C++ -*-
-+
-+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
-+//
-+// This file is part of the GNU ISO C++ Library. This library 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 2, or (at your option)
-+// any later version.
-+
-+// This library 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 this library; see the file COPYING. If not, write to the Free
-+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-+// USA.
-+
-+// As a special exception, you may use this file as part of a free software
-+// library without restriction. Specifically, if other files instantiate
-+// templates or use macros or inline functions from this file, or you compile
-+// this file and link it with other files to produce an executable, this
-+// file does not by itself cause the resulting executable to be covered by
-+// the GNU General Public License. This exception does not however
-+// invalidate any other reasons why the executable file might be covered by
-+// the GNU General Public License.
-+
-+//
-+// ISO C++ 14882: 22.8 Standard locale categories.
-+//
-+
-+// Written by Benjamin Kosnik <bkoz@redhat.com>
-+
-+#include <cerrno> // For errno
-+#include <locale>
-+#include <stdexcept>
-+#include <langinfo.h>
-+#include <bits/c++locale_internal.h>
-+
-+#ifndef __UCLIBC_HAS_XLOCALE__
-+#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
-+#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
-+#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
-+#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
-+#define __strtof_l(S, E, L) strtof((S), (E))
-+#define __strtod_l(S, E, L) strtod((S), (E))
-+#define __strtold_l(S, E, L) strtold((S), (E))
-+#warning should dummy __newlocale check for C|POSIX ?
-+#define __newlocale(a, b, c) NULL
-+#define __freelocale(a) ((void)0)
-+#define __duplocale(a) __c_locale()
-+#endif
-+
-+namespace std
-+{
-+ template<>
-+ void
-+ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
-+ const __c_locale& __cloc)
-+ {
-+ if (!(__err & ios_base::failbit))
-+ {
-+ char* __sanity;
-+ errno = 0;
-+ float __f = __strtof_l(__s, &__sanity, __cloc);
-+ if (__sanity != __s && errno != ERANGE)
-+ __v = __f;
-+ else
-+ __err |= ios_base::failbit;
-+ }
-+ }
-+
-+ template<>
-+ void
-+ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
-+ const __c_locale& __cloc)
-+ {
-+ if (!(__err & ios_base::failbit))
-+ {
-+ char* __sanity;
-+ errno = 0;
-+ double __d = __strtod_l(__s, &__sanity, __cloc);
-+ if (__sanity != __s && errno != ERANGE)
-+ __v = __d;
-+ else
-+ __err |= ios_base::failbit;
-+ }
-+ }
-+
-+ template<>
-+ void
-+ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
-+ const __c_locale& __cloc)
-+ {
-+ if (!(__err & ios_base::failbit))
-+ {
-+ char* __sanity;
-+ errno = 0;
-+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
-+ if (__sanity != __s && errno != ERANGE)
-+ __v = __ld;
-+ else
-+ __err |= ios_base::failbit;
-+ }
-+ }
-+
-+ void
-+ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
-+ __c_locale __old)
-+ {
-+ __cloc = __newlocale(1 << LC_ALL, __s, __old);
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ if (!__cloc)
-+ {
-+ // This named locale is not supported by the underlying OS.
-+ __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
-+ "name not valid"));
-+ }
-+#endif
-+ }
-+
-+ void
-+ locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
-+ {
-+ if (_S_get_c_locale() != __cloc)
-+ __freelocale(__cloc);
-+ }
-+
-+ __c_locale
-+ locale::facet::_S_clone_c_locale(__c_locale& __cloc)
-+ { return __duplocale(__cloc); }
-+} // namespace std
-+
-+namespace __gnu_cxx
-+{
-+ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
-+ {
-+ "LC_CTYPE",
-+ "LC_NUMERIC",
-+ "LC_TIME",
-+ "LC_COLLATE",
-+ "LC_MONETARY",
-+ "LC_MESSAGES",
-+#if _GLIBCXX_NUM_CATEGORIES != 0
-+ "LC_PAPER",
-+ "LC_NAME",
-+ "LC_ADDRESS",
-+ "LC_TELEPHONE",
-+ "LC_MEASUREMENT",
-+ "LC_IDENTIFICATION"
-+#endif
-+ };
-+}
-+
-+namespace std
-+{
-+ const char* const* const locale::_S_categories = __gnu_cxx::category_names;
-+} // namespace std
---- /dev/null
-+++ b/libstdc++-v3/config/locale/uclibc/c_locale.h
-@@ -0,0 +1,117 @@
-+// Wrapper for underlying C-language localization -*- C++ -*-
-+
-+// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-+//
-+// This file is part of the GNU ISO C++ Library. This library 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 2, or (at your option)
-+// any later version.
-+
-+// This library 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 this library; see the file COPYING. If not, write to the Free
-+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-+// USA.
-+
-+// As a special exception, you may use this file as part of a free software
-+// library without restriction. Specifically, if other files instantiate
-+// templates or use macros or inline functions from this file, or you compile
-+// this file and link it with other files to produce an executable, this
-+// file does not by itself cause the resulting executable to be covered by
-+// the GNU General Public License. This exception does not however
-+// invalidate any other reasons why the executable file might be covered by
-+// the GNU General Public License.
-+
-+//
-+// ISO C++ 14882: 22.8 Standard locale categories.
-+//
-+
-+// Written by Benjamin Kosnik <bkoz@redhat.com>
-+
-+#ifndef _C_LOCALE_H
-+#define _C_LOCALE_H 1
-+
-+#pragma GCC system_header
-+
-+#include <cstring> // get std::strlen
-+#include <cstdio> // get std::snprintf or std::sprintf
-+#include <clocale>
-+#include <langinfo.h> // For codecvt
-+#ifdef __UCLIBC_MJN3_ONLY__
-+#warning fix this
-+#endif
-+#ifdef __UCLIBC_HAS_LOCALE__
-+#include <iconv.h> // For codecvt using iconv, iconv_t
-+#endif
-+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
-+#include <libintl.h> // For messages
-+#endif
-+
-+#ifdef __UCLIBC_MJN3_ONLY__
-+#warning what is _GLIBCXX_C_LOCALE_GNU for
-+#endif
-+#define _GLIBCXX_C_LOCALE_GNU 1
-+
-+#ifdef __UCLIBC_MJN3_ONLY__
-+#warning fix categories
-+#endif
-+// #define _GLIBCXX_NUM_CATEGORIES 6
-+#define _GLIBCXX_NUM_CATEGORIES 0
-+
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+namespace __gnu_cxx
-+{
-+ extern "C" __typeof(uselocale) __uselocale;
-+}
-+#endif
-+
-+namespace std
-+{
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ typedef __locale_t __c_locale;
-+#else
-+ typedef int* __c_locale;
-+#endif
-+
-+ // Convert numeric value of type _Tv to string and return length of
-+ // string. If snprintf is available use it, otherwise fall back to
-+ // the unsafe sprintf which, in general, can be dangerous and should
-+ // be avoided.
-+ template<typename _Tv>
-+ int
-+ __convert_from_v(char* __out,
-+ const int __size __attribute__ ((__unused__)),
-+ const char* __fmt,
-+#ifdef __UCLIBC_HAS_XCLOCALE__
-+ _Tv __v, const __c_locale& __cloc, int __prec)
-+ {
-+ __c_locale __old = __gnu_cxx::__uselocale(__cloc);
-+#else
-+ _Tv __v, const __c_locale&, int __prec)
-+ {
-+# ifdef __UCLIBC_HAS_LOCALE__
-+ char* __old = std::setlocale(LC_ALL, NULL);
-+ char* __sav = new char[std::strlen(__old) + 1];
-+ std::strcpy(__sav, __old);
-+ std::setlocale(LC_ALL, "C");
-+# endif
-+#endif
-+
-+ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
-+
-+#ifdef __UCLIBC_HAS_XCLOCALE__
-+ __gnu_cxx::__uselocale(__old);
-+#elif defined __UCLIBC_HAS_LOCALE__
-+ std::setlocale(LC_ALL, __sav);
-+ delete [] __sav;
-+#endif
-+ return __ret;
-+ }
-+}
-+
-+#endif
---- /dev/null
-+++ b/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
-@@ -0,0 +1,306 @@
-+// std::codecvt implementation details, GNU version -*- C++ -*-
-+
-+// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
-+//
-+// This file is part of the GNU ISO C++ Library. This library 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 2, or (at your option)
-+// any later version.
-+
-+// This library 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 this library; see the file COPYING. If not, write to the Free
-+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-+// USA.
-+
-+// As a special exception, you may use this file as part of a free software
-+// library without restriction. Specifically, if other files instantiate
-+// templates or use macros or inline functions from this file, or you compile
-+// this file and link it with other files to produce an executable, this
-+// file does not by itself cause the resulting executable to be covered by
-+// the GNU General Public License. This exception does not however
-+// invalidate any other reasons why the executable file might be covered by
-+// the GNU General Public License.
-+
-+//
-+// ISO C++ 14882: 22.2.1.5 - Template class codecvt
-+//
-+
-+// Written by Benjamin Kosnik <bkoz@redhat.com>
-+
-+#include <locale>
-+#include <bits/c++locale_internal.h>
-+
-+namespace std
-+{
-+ // Specializations.
-+#ifdef _GLIBCXX_USE_WCHAR_T
-+ codecvt_base::result
-+ codecvt<wchar_t, char, mbstate_t>::
-+ do_out(state_type& __state, const intern_type* __from,
-+ const intern_type* __from_end, const intern_type*& __from_next,
-+ extern_type* __to, extern_type* __to_end,
-+ extern_type*& __to_next) const
-+ {
-+ result __ret = ok;
-+ state_type __tmp_state(__state);
-+
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
-+#endif
-+
-+ // wcsnrtombs is *very* fast but stops if encounters NUL characters:
-+ // in case we fall back to wcrtomb and then continue, in a loop.
-+ // NB: wcsnrtombs is a GNU extension
-+ for (__from_next = __from, __to_next = __to;
-+ __from_next < __from_end && __to_next < __to_end
-+ && __ret == ok;)
-+ {
-+ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
-+ __from_end - __from_next);
-+ if (!__from_chunk_end)
-+ __from_chunk_end = __from_end;
-+
-+ __from = __from_next;
-+ const size_t __conv = wcsnrtombs(__to_next, &__from_next,
-+ __from_chunk_end - __from_next,
-+ __to_end - __to_next, &__state);
-+ if (__conv == static_cast<size_t>(-1))
-+ {
-+ // In case of error, in order to stop at the exact place we
-+ // have to start again from the beginning with a series of
-+ // wcrtomb.
-+ for (; __from < __from_next; ++__from)
-+ __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
-+ __state = __tmp_state;
-+ __ret = error;
-+ }
-+ else if (__from_next && __from_next < __from_chunk_end)
-+ {
-+ __to_next += __conv;
-+ __ret = partial;
-+ }
-+ else
-+ {
-+ __from_next = __from_chunk_end;
-+ __to_next += __conv;
-+ }
-+
-+ if (__from_next < __from_end && __ret == ok)
-+ {
-+ extern_type __buf[MB_LEN_MAX];
-+ __tmp_state = __state;
-+ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
-+ if (__conv > static_cast<size_t>(__to_end - __to_next))
-+ __ret = partial;
-+ else
-+ {
-+ memcpy(__to_next, __buf, __conv);
-+ __state = __tmp_state;
-+ __to_next += __conv;
-+ ++__from_next;
-+ }
-+ }
-+ }
-+
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ __uselocale(__old);
-+#endif
-+
-+ return __ret;
-+ }
-+
-+ codecvt_base::result
-+ codecvt<wchar_t, char, mbstate_t>::
-+ do_in(state_type& __state, const extern_type* __from,
-+ const extern_type* __from_end, const extern_type*& __from_next,
-+ intern_type* __to, intern_type* __to_end,
-+ intern_type*& __to_next) const
-+ {
-+ result __ret = ok;
-+ state_type __tmp_state(__state);
-+
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
-+#endif
-+
-+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
-+ // in case we store a L'\0' and then continue, in a loop.
-+ // NB: mbsnrtowcs is a GNU extension
-+ for (__from_next = __from, __to_next = __to;
-+ __from_next < __from_end && __to_next < __to_end
-+ && __ret == ok;)
-+ {
-+ const extern_type* __from_chunk_end;
-+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
-+ __from_end
-+ - __from_next));
-+ if (!__from_chunk_end)
-+ __from_chunk_end = __from_end;
-+
-+ __from = __from_next;
-+ size_t __conv = mbsnrtowcs(__to_next, &__from_next,
-+ __from_chunk_end - __from_next,
-+ __to_end - __to_next, &__state);
-+ if (__conv == static_cast<size_t>(-1))
-+ {
-+ // In case of error, in order to stop at the exact place we
-+ // have to start again from the beginning with a series of
-+ // mbrtowc.
-+ for (;; ++__to_next, __from += __conv)
-+ {
-+ __conv = mbrtowc(__to_next, __from, __from_end - __from,
-+ &__tmp_state);
-+ if (__conv == static_cast<size_t>(-1)
-+ || __conv == static_cast<size_t>(-2))
-+ break;
-+ }
-+ __from_next = __from;
-+ __state = __tmp_state;
-+ __ret = error;
-+ }
-+ else if (__from_next && __from_next < __from_chunk_end)
-+ {
-+ // It is unclear what to return in this case (see DR 382).
-+ __to_next += __conv;
-+ __ret = partial;
-+ }
-+ else
-+ {
-+ __from_next = __from_chunk_end;
-+ __to_next += __conv;
-+ }
-+
-+ if (__from_next < __from_end && __ret == ok)
-+ {
-+ if (__to_next < __to_end)
-+ {
-+ // XXX Probably wrong for stateful encodings
-+ __tmp_state = __state;
-+ ++__from_next;
-+ *__to_next++ = L'\0';
-+ }
-+ else
-+ __ret = partial;
-+ }
-+ }
-+
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ __uselocale(__old);
-+#endif
-+
-+ return __ret;
-+ }
-+
-+ int
-+ codecvt<wchar_t, char, mbstate_t>::
-+ do_encoding() const throw()
-+ {
-+ // XXX This implementation assumes that the encoding is
-+ // stateless and is either single-byte or variable-width.
-+ int __ret = 0;
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
-+#endif
-+ if (MB_CUR_MAX == 1)
-+ __ret = 1;
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ __uselocale(__old);
-+#endif
-+ return __ret;
-+ }
-+
-+ int
-+ codecvt<wchar_t, char, mbstate_t>::
-+ do_max_length() const throw()
-+ {
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
-+#endif
-+ // XXX Probably wrong for stateful encodings.
-+ int __ret = MB_CUR_MAX;
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ __uselocale(__old);
-+#endif
-+ return __ret;
-+ }
-+
-+ int
-+ codecvt<wchar_t, char, mbstate_t>::
-+ do_length(state_type& __state, const extern_type* __from,
-+ const extern_type* __end, size_t __max) const
-+ {
-+ int __ret = 0;
-+ state_type __tmp_state(__state);
-+
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
-+#endif
-+
-+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
-+ // in case we advance past it and then continue, in a loop.
-+ // NB: mbsnrtowcs is a GNU extension
-+
-+ // A dummy internal buffer is needed in order for mbsnrtocws to consider
-+ // its fourth parameter (it wouldn't with NULL as first parameter).
-+ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
-+ * __max));
-+ while (__from < __end && __max)
-+ {
-+ const extern_type* __from_chunk_end;
-+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
-+ __end
-+ - __from));
-+ if (!__from_chunk_end)
-+ __from_chunk_end = __end;
-+
-+ const extern_type* __tmp_from = __from;
-+ size_t __conv = mbsnrtowcs(__to, &__from,
-+ __from_chunk_end - __from,
-+ __max, &__state);
-+ if (__conv == static_cast<size_t>(-1))
-+ {
-+ // In case of error, in order to stop at the exact place we
-+ // have to start again from the beginning with a series of
-+ // mbrtowc.
-+ for (__from = __tmp_from;; __from += __conv)
-+ {
-+ __conv = mbrtowc(NULL, __from, __end - __from,
-+ &__tmp_state);
-+ if (__conv == static_cast<size_t>(-1)
-+ || __conv == static_cast<size_t>(-2))
-+ break;
-+ }
-+ __state = __tmp_state;
-+ __ret += __from - __tmp_from;
-+ break;
-+ }
-+ if (!__from)
-+ __from = __from_chunk_end;
-+
-+ __ret += __from - __tmp_from;
-+ __max -= __conv;
-+
-+ if (__from < __end && __max)
-+ {
-+ // XXX Probably wrong for stateful encodings
-+ __tmp_state = __state;
-+ ++__from;
-+ ++__ret;
-+ --__max;
-+ }
-+ }
-+
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ __uselocale(__old);
-+#endif
-+
-+ return __ret;
-+ }
-+#endif
-+}
---- /dev/null
-+++ b/libstdc++-v3/config/locale/uclibc/collate_members.cc
-@@ -0,0 +1,80 @@
-+// std::collate implementation details, GNU version -*- C++ -*-
-+
-+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
-+//
-+// This file is part of the GNU ISO C++ Library. This library 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 2, or (at your option)
-+// any later version.
-+
-+// This library 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 this library; see the file COPYING. If not, write to the Free
-+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-+// USA.
-+
-+// As a special exception, you may use this file as part of a free software
-+// library without restriction. Specifically, if other files instantiate
-+// templates or use macros or inline functions from this file, or you compile
-+// this file and link it with other files to produce an executable, this
-+// file does not by itself cause the resulting executable to be covered by
-+// the GNU General Public License. This exception does not however
-+// invalidate any other reasons why the executable file might be covered by
-+// the GNU General Public License.
-+
-+//
-+// ISO C++ 14882: 22.2.4.1.2 collate virtual functions
-+//
-+
-+// Written by Benjamin Kosnik <bkoz@redhat.com>
-+
-+#include <locale>
-+#include <bits/c++locale_internal.h>
-+
-+#ifndef __UCLIBC_HAS_XLOCALE__
-+#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
-+#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
-+#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
-+#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
-+#endif
-+
-+namespace std
-+{
-+ // These are basically extensions to char_traits, and perhaps should
-+ // be put there instead of here.
-+ template<>
-+ int
-+ collate<char>::_M_compare(const char* __one, const char* __two) const
-+ {
-+ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
-+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
-+ }
-+
-+ template<>
-+ size_t
-+ collate<char>::_M_transform(char* __to, const char* __from,
-+ size_t __n) const
-+ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
-+
-+#ifdef _GLIBCXX_USE_WCHAR_T
-+ template<>
-+ int
-+ collate<wchar_t>::_M_compare(const wchar_t* __one,
-+ const wchar_t* __two) const
-+ {
-+ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
-+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
-+ }
-+
-+ template<>
-+ size_t
-+ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
-+ size_t __n) const
-+ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
-+#endif
-+}
---- /dev/null
-+++ b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
-@@ -0,0 +1,300 @@
-+// std::ctype implementation details, GNU version -*- C++ -*-
-+
-+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-+//
-+// This file is part of the GNU ISO C++ Library. This library 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 2, or (at your option)
-+// any later version.
-+
-+// This library 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 this library; see the file COPYING. If not, write to the Free
-+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-+// USA.
-+
-+// As a special exception, you may use this file as part of a free software
-+// library without restriction. Specifically, if other files instantiate
-+// templates or use macros or inline functions from this file, or you compile
-+// this file and link it with other files to produce an executable, this
-+// file does not by itself cause the resulting executable to be covered by
-+// the GNU General Public License. This exception does not however
-+// invalidate any other reasons why the executable file might be covered by
-+// the GNU General Public License.
-+
-+//
-+// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
-+//
-+
-+// Written by Benjamin Kosnik <bkoz@redhat.com>
-+
-+#define _LIBC
-+#include <locale>
-+#undef _LIBC
-+#include <bits/c++locale_internal.h>
-+
-+#ifndef __UCLIBC_HAS_XLOCALE__
-+#define __wctype_l(S, L) wctype((S))
-+#define __towupper_l(C, L) towupper((C))
-+#define __towlower_l(C, L) towlower((C))
-+#define __iswctype_l(C, M, L) iswctype((C), (M))
-+#endif
-+
-+namespace std
-+{
-+ // NB: The other ctype<char> specializations are in src/locale.cc and
-+ // various /config/os/* files.
-+ template<>
-+ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
-+ : ctype<char>(0, false, __refs)
-+ {
-+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
-+ {
-+ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
-+ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
-+ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
-+ this->_M_table = this->_M_c_locale_ctype->__ctype_b;
-+#endif
-+ }
-+ }
-+
-+#ifdef _GLIBCXX_USE_WCHAR_T
-+ ctype<wchar_t>::__wmask_type
-+ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
-+ {
-+ __wmask_type __ret;
-+ switch (__m)
-+ {
-+ case space:
-+ __ret = __wctype_l("space", _M_c_locale_ctype);
-+ break;
-+ case print:
-+ __ret = __wctype_l("print", _M_c_locale_ctype);
-+ break;
-+ case cntrl:
-+ __ret = __wctype_l("cntrl", _M_c_locale_ctype);
-+ break;
-+ case upper:
-+ __ret = __wctype_l("upper", _M_c_locale_ctype);
-+ break;
-+ case lower:
-+ __ret = __wctype_l("lower", _M_c_locale_ctype);
-+ break;
-+ case alpha:
-+ __ret = __wctype_l("alpha", _M_c_locale_ctype);
-+ break;
-+ case digit:
-+ __ret = __wctype_l("digit", _M_c_locale_ctype);
-+ break;
-+ case punct:
-+ __ret = __wctype_l("punct", _M_c_locale_ctype);
-+ break;
-+ case xdigit:
-+ __ret = __wctype_l("xdigit", _M_c_locale_ctype);
-+ break;
-+ case alnum:
-+ __ret = __wctype_l("alnum", _M_c_locale_ctype);
-+ break;
-+ case graph:
-+ __ret = __wctype_l("graph", _M_c_locale_ctype);
-+ break;
-+ default:
-+ __ret = __wmask_type();
-+ }
-+ return __ret;
-+ }
-+
-+ wchar_t
-+ ctype<wchar_t>::do_toupper(wchar_t __c) const
-+ { return __towupper_l(__c, _M_c_locale_ctype); }
-+
-+ const wchar_t*
-+ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
-+ {
-+ while (__lo < __hi)
-+ {
-+ *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
-+ ++__lo;
-+ }
-+ return __hi;
-+ }
-+
-+ wchar_t
-+ ctype<wchar_t>::do_tolower(wchar_t __c) const
-+ { return __towlower_l(__c, _M_c_locale_ctype); }
-+
-+ const wchar_t*
-+ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
-+ {
-+ while (__lo < __hi)
-+ {
-+ *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
-+ ++__lo;
-+ }
-+ return __hi;
-+ }
-+
-+ bool
-+ ctype<wchar_t>::
-+ do_is(mask __m, wchar_t __c) const
-+ {
-+ // Highest bitmask in ctype_base == 10, but extra in "C"
-+ // library for blank.
-+ bool __ret = false;
-+ const size_t __bitmasksize = 11;
-+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
-+ if (__m & _M_bit[__bitcur]
-+ && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
-+ {
-+ __ret = true;
-+ break;
-+ }
-+ return __ret;
-+ }
-+
-+ const wchar_t*
-+ ctype<wchar_t>::
-+ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
-+ {
-+ for (; __lo < __hi; ++__vec, ++__lo)
-+ {
-+ // Highest bitmask in ctype_base == 10, but extra in "C"
-+ // library for blank.
-+ const size_t __bitmasksize = 11;
-+ mask __m = 0;
-+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
-+ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
-+ __m |= _M_bit[__bitcur];
-+ *__vec = __m;
-+ }
-+ return __hi;
-+ }
-+
-+ const wchar_t*
-+ ctype<wchar_t>::
-+ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
-+ {
-+ while (__lo < __hi && !this->do_is(__m, *__lo))
-+ ++__lo;
-+ return __lo;
-+ }
-+
-+ const wchar_t*
-+ ctype<wchar_t>::
-+ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
-+ {
-+ while (__lo < __hi && this->do_is(__m, *__lo) != 0)
-+ ++__lo;
-+ return __lo;
-+ }
-+
-+ wchar_t
-+ ctype<wchar_t>::
-+ do_widen(char __c) const
-+ { return _M_widen[static_cast<unsigned char>(__c)]; }
-+
-+ const char*
-+ ctype<wchar_t>::
-+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
-+ {
-+ while (__lo < __hi)
-+ {
-+ *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
-+ ++__lo;
-+ ++__dest;
-+ }
-+ return __hi;
-+ }
-+
-+ char
-+ ctype<wchar_t>::
-+ do_narrow(wchar_t __wc, char __dfault) const
-+ {
-+ if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
-+ return _M_narrow[__wc];
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ __c_locale __old = __uselocale(_M_c_locale_ctype);
-+#endif
-+ const int __c = wctob(__wc);
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ __uselocale(__old);
-+#endif
-+ return (__c == EOF ? __dfault : static_cast<char>(__c));
-+ }
-+
-+ const wchar_t*
-+ ctype<wchar_t>::
-+ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
-+ char* __dest) const
-+ {
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ __c_locale __old = __uselocale(_M_c_locale_ctype);
-+#endif
-+ if (_M_narrow_ok)
-+ while (__lo < __hi)
-+ {
-+ if (*__lo >= 0 && *__lo < 128)
-+ *__dest = _M_narrow[*__lo];
-+ else
-+ {
-+ const int __c = wctob(*__lo);
-+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
-+ }
-+ ++__lo;
-+ ++__dest;
-+ }
-+ else
-+ while (__lo < __hi)
-+ {
-+ const int __c = wctob(*__lo);
-+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
-+ ++__lo;
-+ ++__dest;
-+ }
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ __uselocale(__old);
-+#endif
-+ return __hi;
-+ }
-+
-+ void
-+ ctype<wchar_t>::_M_initialize_ctype()
-+ {
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ __c_locale __old = __uselocale(_M_c_locale_ctype);
-+#endif
-+ wint_t __i;
-+ for (__i = 0; __i < 128; ++__i)
-+ {
-+ const int __c = wctob(__i);
-+ if (__c == EOF)
-+ break;
-+ else
-+ _M_narrow[__i] = static_cast<char>(__c);
-+ }
-+ if (__i == 128)
-+ _M_narrow_ok = true;
-+ else
-+ _M_narrow_ok = false;
-+ for (size_t __j = 0;
-+ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
-+ _M_widen[__j] = btowc(__j);
-+
-+ for (size_t __k = 0; __k <= 11; ++__k)
-+ {
-+ _M_bit[__k] = static_cast<mask>(_ISbit(__k));
-+ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
-+ }
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ __uselocale(__old);
-+#endif
-+ }
-+#endif // _GLIBCXX_USE_WCHAR_T
-+}
---- /dev/null
-+++ b/libstdc++-v3/config/locale/uclibc/messages_members.cc
-@@ -0,0 +1,100 @@
-+// std::messages implementation details, GNU version -*- C++ -*-
-+
-+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
-+//
-+// This file is part of the GNU ISO C++ Library. This library 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 2, or (at your option)
-+// any later version.
-+
-+// This library 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 this library; see the file COPYING. If not, write to the Free
-+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-+// USA.
-+
-+// As a special exception, you may use this file as part of a free software
-+// library without restriction. Specifically, if other files instantiate
-+// templates or use macros or inline functions from this file, or you compile
-+// this file and link it with other files to produce an executable, this
-+// file does not by itself cause the resulting executable to be covered by
-+// the GNU General Public License. This exception does not however
-+// invalidate any other reasons why the executable file might be covered by
-+// the GNU General Public License.
-+
-+//
-+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
-+//
-+
-+// Written by Benjamin Kosnik <bkoz@redhat.com>
-+
-+#include <locale>
-+#include <bits/c++locale_internal.h>
-+
-+#ifdef __UCLIBC_MJN3_ONLY__
-+#warning fix gettext stuff
-+#endif
-+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
-+extern "C" char *__dcgettext(const char *domainname,
-+ const char *msgid, int category);
-+#undef gettext
-+#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
-+#else
-+#undef gettext
-+#define gettext(msgid) (msgid)
-+#endif
-+
-+namespace std
-+{
-+ // Specializations.
-+ template<>
-+ string
-+ messages<char>::do_get(catalog, int, int, const string& __dfault) const
-+ {
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ __c_locale __old = __uselocale(_M_c_locale_messages);
-+ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
-+ __uselocale(__old);
-+ return string(__msg);
-+#elif defined __UCLIBC_HAS_LOCALE__
-+ char* __old = strdup(setlocale(LC_ALL, NULL));
-+ setlocale(LC_ALL, _M_name_messages);
-+ const char* __msg = gettext(__dfault.c_str());
-+ setlocale(LC_ALL, __old);
-+ free(__old);
-+ return string(__msg);
-+#else
-+ const char* __msg = gettext(__dfault.c_str());
-+ return string(__msg);
-+#endif
-+ }
-+
-+#ifdef _GLIBCXX_USE_WCHAR_T
-+ template<>
-+ wstring
-+ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
-+ {
-+# ifdef __UCLIBC_HAS_XLOCALE__
-+ __c_locale __old = __uselocale(_M_c_locale_messages);
-+ char* __msg = gettext(_M_convert_to_char(__dfault));
-+ __uselocale(__old);
-+ return _M_convert_from_char(__msg);
-+# elif defined __UCLIBC_HAS_LOCALE__
-+ char* __old = strdup(setlocale(LC_ALL, NULL));
-+ setlocale(LC_ALL, _M_name_messages);
-+ char* __msg = gettext(_M_convert_to_char(__dfault));
-+ setlocale(LC_ALL, __old);
-+ free(__old);
-+ return _M_convert_from_char(__msg);
-+# else
-+ char* __msg = gettext(_M_convert_to_char(__dfault));
-+ return _M_convert_from_char(__msg);
-+# endif
-+ }
-+#endif
-+}
---- /dev/null
-+++ b/libstdc++-v3/config/locale/uclibc/messages_members.h
-@@ -0,0 +1,118 @@
-+// std::messages implementation details, GNU version -*- C++ -*-
-+
-+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-+//
-+// This file is part of the GNU ISO C++ Library. This library 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 2, or (at your option)
-+// any later version.
-+
-+// This library 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 this library; see the file COPYING. If not, write to the Free
-+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-+// USA.
-+
-+// As a special exception, you may use this file as part of a free software
-+// library without restriction. Specifically, if other files instantiate
-+// templates or use macros or inline functions from this file, or you compile
-+// this file and link it with other files to produce an executable, this
-+// file does not by itself cause the resulting executable to be covered by
-+// the GNU General Public License. This exception does not however
-+// invalidate any other reasons why the executable file might be covered by
-+// the GNU General Public License.
-+
-+//
-+// ISO C++ 14882: 22.2.7.1.2 messages functions
-+//
-+
-+// Written by Benjamin Kosnik <bkoz@redhat.com>
-+
-+#ifdef __UCLIBC_MJN3_ONLY__
-+#warning fix prototypes for *textdomain funcs
-+#endif
-+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
-+extern "C" char *__textdomain(const char *domainname);
-+extern "C" char *__bindtextdomain(const char *domainname,
-+ const char *dirname);
-+#else
-+#undef __textdomain
-+#undef __bindtextdomain
-+#define __textdomain(D) ((void)0)
-+#define __bindtextdomain(D,P) ((void)0)
-+#endif
-+
-+ // Non-virtual member functions.
-+ template<typename _CharT>
-+ messages<_CharT>::messages(size_t __refs)
-+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
-+ _M_name_messages(_S_get_c_name())
-+ { }
-+
-+ template<typename _CharT>
-+ messages<_CharT>::messages(__c_locale __cloc, const char* __s,
-+ size_t __refs)
-+ : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
-+ _M_name_messages(__s)
-+ {
-+ char* __tmp = new char[std::strlen(__s) + 1];
-+ std::strcpy(__tmp, __s);
-+ _M_name_messages = __tmp;
-+ }
-+
-+ template<typename _CharT>
-+ typename messages<_CharT>::catalog
-+ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
-+ const char* __dir) const
-+ {
-+ __bindtextdomain(__s.c_str(), __dir);
-+ return this->do_open(__s, __loc);
-+ }
-+
-+ // Virtual member functions.
-+ template<typename _CharT>
-+ messages<_CharT>::~messages()
-+ {
-+ if (_M_name_messages != _S_get_c_name())
-+ delete [] _M_name_messages;
-+ _S_destroy_c_locale(_M_c_locale_messages);
-+ }
-+
-+ template<typename _CharT>
-+ typename messages<_CharT>::catalog
-+ messages<_CharT>::do_open(const basic_string<char>& __s,
-+ const locale&) const
-+ {
-+ // No error checking is done, assume the catalog exists and can
-+ // be used.
-+ __textdomain(__s.c_str());
-+ return 0;
-+ }
-+
-+ template<typename _CharT>
-+ void
-+ messages<_CharT>::do_close(catalog) const
-+ { }
-+
-+ // messages_byname
-+ template<typename _CharT>
-+ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
-+ : messages<_CharT>(__refs)
-+ {
-+ if (this->_M_name_messages != locale::facet::_S_get_c_name())
-+ delete [] this->_M_name_messages;
-+ char* __tmp = new char[std::strlen(__s) + 1];
-+ std::strcpy(__tmp, __s);
-+ this->_M_name_messages = __tmp;
-+
-+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
-+ {
-+ this->_S_destroy_c_locale(this->_M_c_locale_messages);
-+ this->_S_create_c_locale(this->_M_c_locale_messages, __s);
-+ }
-+ }
---- /dev/null
-+++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
-@@ -0,0 +1,692 @@
-+// std::moneypunct implementation details, GNU version -*- C++ -*-
-+
-+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-+//
-+// This file is part of the GNU ISO C++ Library. This library 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 2, or (at your option)
-+// any later version.
-+
-+// This library 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 this library; see the file COPYING. If not, write to the Free
-+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-+// USA.
-+
-+// As a special exception, you may use this file as part of a free software
-+// library without restriction. Specifically, if other files instantiate
-+// templates or use macros or inline functions from this file, or you compile
-+// this file and link it with other files to produce an executable, this
-+// file does not by itself cause the resulting executable to be covered by
-+// the GNU General Public License. This exception does not however
-+// invalidate any other reasons why the executable file might be covered by
-+// the GNU General Public License.
-+
-+//
-+// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
-+//
-+
-+// Written by Benjamin Kosnik <bkoz@redhat.com>
-+
-+#define _LIBC
-+#include <locale>
-+#undef _LIBC
-+#include <bits/c++locale_internal.h>
-+
-+#ifdef __UCLIBC_MJN3_ONLY__
-+#warning optimize this for uclibc
-+#warning tailor for stub locale support
-+#endif
-+
-+#ifndef __UCLIBC_HAS_XLOCALE__
-+#define __nl_langinfo_l(N, L) nl_langinfo((N))
-+#endif
-+
-+namespace std
-+{
-+ // Construct and return valid pattern consisting of some combination of:
-+ // space none symbol sign value
-+ money_base::pattern
-+ money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
-+ {
-+ pattern __ret;
-+
-+ // This insanely complicated routine attempts to construct a valid
-+ // pattern for use with monyepunct. A couple of invariants:
-+
-+ // if (__precedes) symbol -> value
-+ // else value -> symbol
-+
-+ // if (__space) space
-+ // else none
-+
-+ // none == never first
-+ // space never first or last
-+
-+ // Any elegant implementations of this are welcome.
-+ switch (__posn)
-+ {
-+ case 0:
-+ case 1:
-+ // 1 The sign precedes the value and symbol.
-+ __ret.field[0] = sign;
-+ if (__space)
-+ {
-+ // Pattern starts with sign.
-+ if (__precedes)
-+ {
-+ __ret.field[1] = symbol;
-+ __ret.field[3] = value;
-+ }
-+ else
-+ {
-+ __ret.field[1] = value;
-+ __ret.field[3] = symbol;
-+ }
-+ __ret.field[2] = space;
-+ }
-+ else
-+ {
-+ // Pattern starts with sign and ends with none.
-+ if (__precedes)
-+ {
-+ __ret.field[1] = symbol;
-+ __ret.field[2] = value;
-+ }
-+ else
-+ {
-+ __ret.field[1] = value;
-+ __ret.field[2] = symbol;
-+ }
-+ __ret.field[3] = none;
-+ }
-+ break;
-+ case 2:
-+ // 2 The sign follows the value and symbol.
-+ if (__space)
-+ {
-+ // Pattern either ends with sign.
-+ if (__precedes)
-+ {
-+ __ret.field[0] = symbol;
-+ __ret.field[2] = value;
-+ }
-+ else
-+ {
-+ __ret.field[0] = value;
-+ __ret.field[2] = symbol;
-+ }
-+ __ret.field[1] = space;
-+ __ret.field[3] = sign;
-+ }
-+ else
-+ {
-+ // Pattern ends with sign then none.
-+ if (__precedes)
-+ {
-+ __ret.field[0] = symbol;
-+ __ret.field[1] = value;
-+ }
-+ else
-+ {
-+ __ret.field[0] = value;
-+ __ret.field[1] = symbol;
-+ }
-+ __ret.field[2] = sign;
-+ __ret.field[3] = none;
-+ }
-+ break;
-+ case 3:
-+ // 3 The sign immediately precedes the symbol.
-+ if (__precedes)
-+ {
-+ __ret.field[0] = sign;
-+ __ret.field[1] = symbol;
-+ if (__space)
-+ {
-+ __ret.field[2] = space;
-+ __ret.field[3] = value;
-+ }
-+ else
-+ {
-+ __ret.field[2] = value;
-+ __ret.field[3] = none;
-+ }
-+ }
-+ else
-+ {
-+ __ret.field[0] = value;
-+ if (__space)
-+ {
-+ __ret.field[1] = space;
-+ __ret.field[2] = sign;
-+ __ret.field[3] = symbol;
-+ }
-+ else
-+ {
-+ __ret.field[1] = sign;
-+ __ret.field[2] = symbol;
-+ __ret.field[3] = none;
-+ }
-+ }
-+ break;
-+ case 4:
-+ // 4 The sign immediately follows the symbol.
-+ if (__precedes)
-+ {
-+ __ret.field[0] = symbol;
-+ __ret.field[1] = sign;
-+ if (__space)
-+ {
-+ __ret.field[2] = space;
-+ __ret.field[3] = value;
-+ }
-+ else
-+ {
-+ __ret.field[2] = value;
-+ __ret.field[3] = none;
-+ }
-+ }
-+ else
-+ {
-+ __ret.field[0] = value;
-+ if (__space)
-+ {
-+ __ret.field[1] = space;
-+ __ret.field[2] = symbol;
-+ __ret.field[3] = sign;
-+ }
-+ else
-+ {
-+ __ret.field[1] = symbol;
-+ __ret.field[2] = sign;
-+ __ret.field[3] = none;
-+ }
-+ }
-+ break;
-+ default:
-+ ;
-+ }
-+ return __ret;
-+ }
-+
-+ template<>
-+ void
-+ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
-+ const char*)
-+ {
-+ if (!_M_data)
-+ _M_data = new __moneypunct_cache<char, true>;
-+
-+ if (!__cloc)
-+ {
-+ // "C" locale
-+ _M_data->_M_decimal_point = '.';
-+ _M_data->_M_thousands_sep = ',';
-+ _M_data->_M_grouping = "";
-+ _M_data->_M_grouping_size = 0;
-+ _M_data->_M_curr_symbol = "";
-+ _M_data->_M_curr_symbol_size = 0;
-+ _M_data->_M_positive_sign = "";
-+ _M_data->_M_positive_sign_size = 0;
-+ _M_data->_M_negative_sign = "";
-+ _M_data->_M_negative_sign_size = 0;
-+ _M_data->_M_frac_digits = 0;
-+ _M_data->_M_pos_format = money_base::_S_default_pattern;
-+ _M_data->_M_neg_format = money_base::_S_default_pattern;
-+
-+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
-+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
-+ }
-+ else
-+ {
-+ // Named locale.
-+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
-+ __cloc));
-+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
-+ __cloc));
-+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
-+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
-+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
-+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
-+
-+ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
-+ if (!__nposn)
-+ _M_data->_M_negative_sign = "()";
-+ else
-+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
-+ __cloc);
-+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
-+
-+ // _Intl == true
-+ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
-+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
-+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
-+ __cloc));
-+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
-+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
-+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
-+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
-+ __pposn);
-+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
-+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
-+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
-+ __nposn);
-+ }
-+ }
-+
-+ template<>
-+ void
-+ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
-+ const char*)
-+ {
-+ if (!_M_data)
-+ _M_data = new __moneypunct_cache<char, false>;
-+
-+ if (!__cloc)
-+ {
-+ // "C" locale
-+ _M_data->_M_decimal_point = '.';
-+ _M_data->_M_thousands_sep = ',';
-+ _M_data->_M_grouping = "";
-+ _M_data->_M_grouping_size = 0;
-+ _M_data->_M_curr_symbol = "";
-+ _M_data->_M_curr_symbol_size = 0;
-+ _M_data->_M_positive_sign = "";
-+ _M_data->_M_positive_sign_size = 0;
-+ _M_data->_M_negative_sign = "";
-+ _M_data->_M_negative_sign_size = 0;
-+ _M_data->_M_frac_digits = 0;
-+ _M_data->_M_pos_format = money_base::_S_default_pattern;
-+ _M_data->_M_neg_format = money_base::_S_default_pattern;
-+
-+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
-+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
-+ }
-+ else
-+ {
-+ // Named locale.
-+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
-+ __cloc));
-+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
-+ __cloc));
-+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
-+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
-+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
-+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
-+
-+ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
-+ if (!__nposn)
-+ _M_data->_M_negative_sign = "()";
-+ else
-+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
-+ __cloc);
-+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
-+
-+ // _Intl == false
-+ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
-+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
-+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
-+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
-+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
-+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
-+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
-+ __pposn);
-+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
-+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
-+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
-+ __nposn);
-+ }
-+ }
-+
-+ template<>
-+ moneypunct<char, true>::~moneypunct()
-+ { delete _M_data; }
-+
-+ template<>
-+ moneypunct<char, false>::~moneypunct()
-+ { delete _M_data; }
-+
-+#ifdef _GLIBCXX_USE_WCHAR_T
-+ template<>
-+ void
-+ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ const char*)
-+#else
-+ const char* __name)
-+#endif
-+ {
-+ if (!_M_data)
-+ _M_data = new __moneypunct_cache<wchar_t, true>;
-+
-+ if (!__cloc)
-+ {
-+ // "C" locale
-+ _M_data->_M_decimal_point = L'.';
-+ _M_data->_M_thousands_sep = L',';
-+ _M_data->_M_grouping = "";
-+ _M_data->_M_grouping_size = 0;
-+ _M_data->_M_curr_symbol = L"";
-+ _M_data->_M_curr_symbol_size = 0;
-+ _M_data->_M_positive_sign = L"";
-+ _M_data->_M_positive_sign_size = 0;
-+ _M_data->_M_negative_sign = L"";
-+ _M_data->_M_negative_sign_size = 0;
-+ _M_data->_M_frac_digits = 0;
-+ _M_data->_M_pos_format = money_base::_S_default_pattern;
-+ _M_data->_M_neg_format = money_base::_S_default_pattern;
-+
-+ // Use ctype::widen code without the facet...
-+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
-+ _M_data->_M_atoms[__i] =
-+ static_cast<wchar_t>(money_base::_S_atoms[__i]);
-+ }
-+ else
-+ {
-+ // Named locale.
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ __c_locale __old = __uselocale(__cloc);
-+#else
-+ // Switch to named locale so that mbsrtowcs will work.
-+ char* __old = strdup(setlocale(LC_ALL, NULL));
-+ setlocale(LC_ALL, __name);
-+#endif
-+
-+#ifdef __UCLIBC_MJN3_ONLY__
-+#warning fix this... should be monetary
-+#endif
-+#ifdef __UCLIBC__
-+# ifdef __UCLIBC_HAS_XLOCALE__
-+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
-+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
-+# else
-+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
-+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
-+# endif
-+#else
-+ union { char *__s; wchar_t __w; } __u;
-+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
-+ _M_data->_M_decimal_point = __u.__w;
-+
-+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
-+ _M_data->_M_thousands_sep = __u.__w;
-+#endif
-+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
-+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
-+
-+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
-+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
-+ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
-+
-+ wchar_t* __wcs_ps = 0;
-+ wchar_t* __wcs_ns = 0;
-+ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
-+ try
-+ {
-+ mbstate_t __state;
-+ size_t __len = strlen(__cpossign);
-+ if (__len)
-+ {
-+ ++__len;
-+ memset(&__state, 0, sizeof(mbstate_t));
-+ __wcs_ps = new wchar_t[__len];
-+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
-+ _M_data->_M_positive_sign = __wcs_ps;
-+ }
-+ else
-+ _M_data->_M_positive_sign = L"";
-+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
-+
-+ __len = strlen(__cnegsign);
-+ if (!__nposn)
-+ _M_data->_M_negative_sign = L"()";
-+ else if (__len)
-+ {
-+ ++__len;
-+ memset(&__state, 0, sizeof(mbstate_t));
-+ __wcs_ns = new wchar_t[__len];
-+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
-+ _M_data->_M_negative_sign = __wcs_ns;
-+ }
-+ else
-+ _M_data->_M_negative_sign = L"";
-+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
-+
-+ // _Intl == true.
-+ __len = strlen(__ccurr);
-+ if (__len)
-+ {
-+ ++__len;
-+ memset(&__state, 0, sizeof(mbstate_t));
-+ wchar_t* __wcs = new wchar_t[__len];
-+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
-+ _M_data->_M_curr_symbol = __wcs;
-+ }
-+ else
-+ _M_data->_M_curr_symbol = L"";
-+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
-+ }
-+ catch (...)
-+ {
-+ delete _M_data;
-+ _M_data = 0;
-+ delete __wcs_ps;
-+ delete __wcs_ns;
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ __uselocale(__old);
-+#else
-+ setlocale(LC_ALL, __old);
-+ free(__old);
-+#endif
-+ __throw_exception_again;
-+ }
-+
-+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
-+ __cloc));
-+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
-+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
-+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
-+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
-+ __pposn);
-+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
-+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
-+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
-+ __nposn);
-+
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ __uselocale(__old);
-+#else
-+ setlocale(LC_ALL, __old);
-+ free(__old);
-+#endif
-+ }
-+ }
-+
-+ template<>
-+ void
-+ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ const char*)
-+#else
-+ const char* __name)
-+#endif
-+ {
-+ if (!_M_data)
-+ _M_data = new __moneypunct_cache<wchar_t, false>;
-+
-+ if (!__cloc)
-+ {
-+ // "C" locale
-+ _M_data->_M_decimal_point = L'.';
-+ _M_data->_M_thousands_sep = L',';
-+ _M_data->_M_grouping = "";
-+ _M_data->_M_grouping_size = 0;
-+ _M_data->_M_curr_symbol = L"";
-+ _M_data->_M_curr_symbol_size = 0;
-+ _M_data->_M_positive_sign = L"";
-+ _M_data->_M_positive_sign_size = 0;
-+ _M_data->_M_negative_sign = L"";
-+ _M_data->_M_negative_sign_size = 0;
-+ _M_data->_M_frac_digits = 0;
-+ _M_data->_M_pos_format = money_base::_S_default_pattern;
-+ _M_data->_M_neg_format = money_base::_S_default_pattern;
-+
-+ // Use ctype::widen code without the facet...
-+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
-+ _M_data->_M_atoms[__i] =
-+ static_cast<wchar_t>(money_base::_S_atoms[__i]);
-+ }
-+ else
-+ {
-+ // Named locale.
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ __c_locale __old = __uselocale(__cloc);
-+#else
-+ // Switch to named locale so that mbsrtowcs will work.
-+ char* __old = strdup(setlocale(LC_ALL, NULL));
-+ setlocale(LC_ALL, __name);
-+#endif
-+
-+#ifdef __UCLIBC_MJN3_ONLY__
-+#warning fix this... should be monetary
-+#endif
-+#ifdef __UCLIBC__
-+# ifdef __UCLIBC_HAS_XLOCALE__
-+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
-+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
-+# else
-+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
-+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
-+# endif
-+#else
-+ union { char *__s; wchar_t __w; } __u;
-+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
-+ _M_data->_M_decimal_point = __u.__w;
-+
-+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
-+ _M_data->_M_thousands_sep = __u.__w;
-+#endif
-+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
-+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
-+
-+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
-+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
-+ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
-+
-+ wchar_t* __wcs_ps = 0;
-+ wchar_t* __wcs_ns = 0;
-+ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
-+ try
-+ {
-+ mbstate_t __state;
-+ size_t __len;
-+ __len = strlen(__cpossign);
-+ if (__len)
-+ {
-+ ++__len;
-+ memset(&__state, 0, sizeof(mbstate_t));
-+ __wcs_ps = new wchar_t[__len];
-+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
-+ _M_data->_M_positive_sign = __wcs_ps;
-+ }
-+ else
-+ _M_data->_M_positive_sign = L"";
-+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
-+
-+ __len = strlen(__cnegsign);
-+ if (!__nposn)
-+ _M_data->_M_negative_sign = L"()";
-+ else if (__len)
-+ {
-+ ++__len;
-+ memset(&__state, 0, sizeof(mbstate_t));
-+ __wcs_ns = new wchar_t[__len];
-+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
-+ _M_data->_M_negative_sign = __wcs_ns;
-+ }
-+ else
-+ _M_data->_M_negative_sign = L"";
-+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
-+
-+ // _Intl == true.
-+ __len = strlen(__ccurr);
-+ if (__len)
-+ {
-+ ++__len;
-+ memset(&__state, 0, sizeof(mbstate_t));
-+ wchar_t* __wcs = new wchar_t[__len];
-+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
-+ _M_data->_M_curr_symbol = __wcs;
-+ }
-+ else
-+ _M_data->_M_curr_symbol = L"";
-+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
-+ }
-+ catch (...)
-+ {
-+ delete _M_data;
-+ _M_data = 0;
-+ delete __wcs_ps;
-+ delete __wcs_ns;
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ __uselocale(__old);
-+#else
-+ setlocale(LC_ALL, __old);
-+ free(__old);
-+#endif
-+ __throw_exception_again;
-+ }
-+
-+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
-+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
-+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
-+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
-+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
-+ __pposn);
-+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
-+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
-+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
-+ __nposn);
-+
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ __uselocale(__old);
-+#else
-+ setlocale(LC_ALL, __old);
-+ free(__old);
-+#endif
-+ }
-+ }
-+
-+ template<>
-+ moneypunct<wchar_t, true>::~moneypunct()
-+ {
-+ if (_M_data->_M_positive_sign_size)
-+ delete [] _M_data->_M_positive_sign;
-+ if (_M_data->_M_negative_sign_size
-+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
-+ delete [] _M_data->_M_negative_sign;
-+ if (_M_data->_M_curr_symbol_size)
-+ delete [] _M_data->_M_curr_symbol;
-+ delete _M_data;
-+ }
-+
-+ template<>
-+ moneypunct<wchar_t, false>::~moneypunct()
-+ {
-+ if (_M_data->_M_positive_sign_size)
-+ delete [] _M_data->_M_positive_sign;
-+ if (_M_data->_M_negative_sign_size
-+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
-+ delete [] _M_data->_M_negative_sign;
-+ if (_M_data->_M_curr_symbol_size)
-+ delete [] _M_data->_M_curr_symbol;
-+ delete _M_data;
-+ }
-+#endif
-+}
---- /dev/null
-+++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
-@@ -0,0 +1,160 @@
-+// std::numpunct implementation details, GNU version -*- C++ -*-
-+
-+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-+//
-+// This file is part of the GNU ISO C++ Library. This library 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 2, or (at your option)
-+// any later version.
-+
-+// This library 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 this library; see the file COPYING. If not, write to the Free
-+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-+// USA.
-+
-+// As a special exception, you may use this file as part of a free software
-+// library without restriction. Specifically, if other files instantiate
-+// templates or use macros or inline functions from this file, or you compile
-+// this file and link it with other files to produce an executable, this
-+// file does not by itself cause the resulting executable to be covered by
-+// the GNU General Public License. This exception does not however
-+// invalidate any other reasons why the executable file might be covered by
-+// the GNU General Public License.
-+
-+//
-+// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
-+//
-+
-+// Written by Benjamin Kosnik <bkoz@redhat.com>
-+
-+#define _LIBC
-+#include <locale>
-+#undef _LIBC
-+#include <bits/c++locale_internal.h>
-+
-+#ifdef __UCLIBC_MJN3_ONLY__
-+#warning tailor for stub locale support
-+#endif
-+#ifndef __UCLIBC_HAS_XLOCALE__
-+#define __nl_langinfo_l(N, L) nl_langinfo((N))
-+#endif
-+
-+namespace std
-+{
-+ template<>
-+ void
-+ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
-+ {
-+ if (!_M_data)
-+ _M_data = new __numpunct_cache<char>;
-+
-+ if (!__cloc)
-+ {
-+ // "C" locale
-+ _M_data->_M_grouping = "";
-+ _M_data->_M_grouping_size = 0;
-+ _M_data->_M_use_grouping = false;
-+
-+ _M_data->_M_decimal_point = '.';
-+ _M_data->_M_thousands_sep = ',';
-+
-+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
-+ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
-+
-+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
-+ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
-+ }
-+ else
-+ {
-+ // Named locale.
-+ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
-+ __cloc));
-+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
-+ __cloc));
-+
-+ // Check for NULL, which implies no grouping.
-+ if (_M_data->_M_thousands_sep == '\0')
-+ _M_data->_M_grouping = "";
-+ else
-+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
-+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
-+ }
-+
-+ // NB: There is no way to extact this info from posix locales.
-+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
-+ _M_data->_M_truename = "true";
-+ _M_data->_M_truename_size = 4;
-+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
-+ _M_data->_M_falsename = "false";
-+ _M_data->_M_falsename_size = 5;
-+ }
-+
-+ template<>
-+ numpunct<char>::~numpunct()
-+ { delete _M_data; }
-+
-+#ifdef _GLIBCXX_USE_WCHAR_T
-+ template<>
-+ void
-+ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
-+ {
-+ if (!_M_data)
-+ _M_data = new __numpunct_cache<wchar_t>;
-+
-+ if (!__cloc)
-+ {
-+ // "C" locale
-+ _M_data->_M_grouping = "";
-+ _M_data->_M_grouping_size = 0;
-+ _M_data->_M_use_grouping = false;
-+
-+ _M_data->_M_decimal_point = L'.';
-+ _M_data->_M_thousands_sep = L',';
-+
-+ // Use ctype::widen code without the facet...
-+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
-+ _M_data->_M_atoms_out[__i] =
-+ static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
-+
-+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
-+ _M_data->_M_atoms_in[__j] =
-+ static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
-+ }
-+ else
-+ {
-+ // Named locale.
-+ // NB: In the GNU model wchar_t is always 32 bit wide.
-+ union { char *__s; wchar_t __w; } __u;
-+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
-+ _M_data->_M_decimal_point = __u.__w;
-+
-+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
-+ _M_data->_M_thousands_sep = __u.__w;
-+
-+ if (_M_data->_M_thousands_sep == L'\0')
-+ _M_data->_M_grouping = "";
-+ else
-+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
-+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
-+ }
-+
-+ // NB: There is no way to extact this info from posix locales.
-+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
-+ _M_data->_M_truename = L"true";
-+ _M_data->_M_truename_size = 4;
-+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
-+ _M_data->_M_falsename = L"false";
-+ _M_data->_M_falsename_size = 5;
-+ }
-+
-+ template<>
-+ numpunct<wchar_t>::~numpunct()
-+ { delete _M_data; }
-+ #endif
-+}
---- /dev/null
-+++ b/libstdc++-v3/config/locale/uclibc/time_members.cc
-@@ -0,0 +1,406 @@
-+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
-+
-+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-+//
-+// This file is part of the GNU ISO C++ Library. This library 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 2, or (at your option)
-+// any later version.
-+
-+// This library 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 this library; see the file COPYING. If not, write to the Free
-+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-+// USA.
-+
-+// As a special exception, you may use this file as part of a free software
-+// library without restriction. Specifically, if other files instantiate
-+// templates or use macros or inline functions from this file, or you compile
-+// this file and link it with other files to produce an executable, this
-+// file does not by itself cause the resulting executable to be covered by
-+// the GNU General Public License. This exception does not however
-+// invalidate any other reasons why the executable file might be covered by
-+// the GNU General Public License.
-+
-+//
-+// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
-+// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
-+//
-+
-+// Written by Benjamin Kosnik <bkoz@redhat.com>
-+
-+#include <locale>
-+#include <bits/c++locale_internal.h>
-+
-+#ifdef __UCLIBC_MJN3_ONLY__
-+#warning tailor for stub locale support
-+#endif
-+#ifndef __UCLIBC_HAS_XLOCALE__
-+#define __nl_langinfo_l(N, L) nl_langinfo((N))
-+#endif
-+
-+namespace std
-+{
-+ template<>
-+ void
-+ __timepunct<char>::
-+ _M_put(char* __s, size_t __maxlen, const char* __format,
-+ const tm* __tm) const
-+ {
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
-+ _M_c_locale_timepunct);
-+#else
-+ char* __old = strdup(setlocale(LC_ALL, NULL));
-+ setlocale(LC_ALL, _M_name_timepunct);
-+ const size_t __len = strftime(__s, __maxlen, __format, __tm);
-+ setlocale(LC_ALL, __old);
-+ free(__old);
-+#endif
-+ // Make sure __s is null terminated.
-+ if (__len == 0)
-+ __s[0] = '\0';
-+ }
-+
-+ template<>
-+ void
-+ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
-+ {
-+ if (!_M_data)
-+ _M_data = new __timepunct_cache<char>;
-+
-+ if (!__cloc)
-+ {
-+ // "C" locale
-+ _M_c_locale_timepunct = _S_get_c_locale();
-+
-+ _M_data->_M_date_format = "%m/%d/%y";
-+ _M_data->_M_date_era_format = "%m/%d/%y";
-+ _M_data->_M_time_format = "%H:%M:%S";
-+ _M_data->_M_time_era_format = "%H:%M:%S";
-+ _M_data->_M_date_time_format = "";
-+ _M_data->_M_date_time_era_format = "";
-+ _M_data->_M_am = "AM";
-+ _M_data->_M_pm = "PM";
-+ _M_data->_M_am_pm_format = "";
-+
-+ // Day names, starting with "C"'s Sunday.
-+ _M_data->_M_day1 = "Sunday";
-+ _M_data->_M_day2 = "Monday";
-+ _M_data->_M_day3 = "Tuesday";
-+ _M_data->_M_day4 = "Wednesday";
-+ _M_data->_M_day5 = "Thursday";
-+ _M_data->_M_day6 = "Friday";
-+ _M_data->_M_day7 = "Saturday";
-+
-+ // Abbreviated day names, starting with "C"'s Sun.
-+ _M_data->_M_aday1 = "Sun";
-+ _M_data->_M_aday2 = "Mon";
-+ _M_data->_M_aday3 = "Tue";
-+ _M_data->_M_aday4 = "Wed";
-+ _M_data->_M_aday5 = "Thu";
-+ _M_data->_M_aday6 = "Fri";
-+ _M_data->_M_aday7 = "Sat";
-+
-+ // Month names, starting with "C"'s January.
-+ _M_data->_M_month01 = "January";
-+ _M_data->_M_month02 = "February";
-+ _M_data->_M_month03 = "March";
-+ _M_data->_M_month04 = "April";
-+ _M_data->_M_month05 = "May";
-+ _M_data->_M_month06 = "June";
-+ _M_data->_M_month07 = "July";
-+ _M_data->_M_month08 = "August";
-+ _M_data->_M_month09 = "September";
-+ _M_data->_M_month10 = "October";
-+ _M_data->_M_month11 = "November";
-+ _M_data->_M_month12 = "December";
-+
-+ // Abbreviated month names, starting with "C"'s Jan.
-+ _M_data->_M_amonth01 = "Jan";
-+ _M_data->_M_amonth02 = "Feb";
-+ _M_data->_M_amonth03 = "Mar";
-+ _M_data->_M_amonth04 = "Apr";
-+ _M_data->_M_amonth05 = "May";
-+ _M_data->_M_amonth06 = "Jun";
-+ _M_data->_M_amonth07 = "Jul";
-+ _M_data->_M_amonth08 = "Aug";
-+ _M_data->_M_amonth09 = "Sep";
-+ _M_data->_M_amonth10 = "Oct";
-+ _M_data->_M_amonth11 = "Nov";
-+ _M_data->_M_amonth12 = "Dec";
-+ }
-+ else
-+ {
-+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
-+
-+ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
-+ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
-+ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
-+ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
-+ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
-+ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
-+ __cloc);
-+ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
-+ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
-+ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
-+
-+ // Day names, starting with "C"'s Sunday.
-+ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
-+ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
-+ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
-+ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
-+ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
-+ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
-+ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
-+
-+ // Abbreviated day names, starting with "C"'s Sun.
-+ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
-+ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
-+ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
-+ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
-+ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
-+ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
-+ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
-+
-+ // Month names, starting with "C"'s January.
-+ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
-+ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
-+ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
-+ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
-+ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
-+ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
-+ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
-+ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
-+ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
-+ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
-+ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
-+ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
-+
-+ // Abbreviated month names, starting with "C"'s Jan.
-+ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
-+ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
-+ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
-+ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
-+ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
-+ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
-+ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
-+ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
-+ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
-+ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
-+ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
-+ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
-+ }
-+ }
-+
-+#ifdef _GLIBCXX_USE_WCHAR_T
-+ template<>
-+ void
-+ __timepunct<wchar_t>::
-+ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
-+ const tm* __tm) const
-+ {
-+#ifdef __UCLIBC_HAS_XLOCALE__
-+ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
-+ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
-+ _M_c_locale_timepunct);
-+#else
-+ char* __old = strdup(setlocale(LC_ALL, NULL));
-+ setlocale(LC_ALL, _M_name_timepunct);
-+ const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
-+ setlocale(LC_ALL, __old);
-+ free(__old);
-+#endif
-+ // Make sure __s is null terminated.
-+ if (__len == 0)
-+ __s[0] = L'\0';
-+ }
-+
-+ template<>
-+ void
-+ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
-+ {
-+ if (!_M_data)
-+ _M_data = new __timepunct_cache<wchar_t>;
-+
-+#warning wide time stuff
-+// if (!__cloc)
-+ {
-+ // "C" locale
-+ _M_c_locale_timepunct = _S_get_c_locale();
-+
-+ _M_data->_M_date_format = L"%m/%d/%y";
-+ _M_data->_M_date_era_format = L"%m/%d/%y";
-+ _M_data->_M_time_format = L"%H:%M:%S";
-+ _M_data->_M_time_era_format = L"%H:%M:%S";
-+ _M_data->_M_date_time_format = L"";
-+ _M_data->_M_date_time_era_format = L"";
-+ _M_data->_M_am = L"AM";
-+ _M_data->_M_pm = L"PM";
-+ _M_data->_M_am_pm_format = L"";
-+
-+ // Day names, starting with "C"'s Sunday.
-+ _M_data->_M_day1 = L"Sunday";
-+ _M_data->_M_day2 = L"Monday";
-+ _M_data->_M_day3 = L"Tuesday";
-+ _M_data->_M_day4 = L"Wednesday";
-+ _M_data->_M_day5 = L"Thursday";
-+ _M_data->_M_day6 = L"Friday";
-+ _M_data->_M_day7 = L"Saturday";
-+
-+ // Abbreviated day names, starting with "C"'s Sun.
-+ _M_data->_M_aday1 = L"Sun";
-+ _M_data->_M_aday2 = L"Mon";
-+ _M_data->_M_aday3 = L"Tue";
-+ _M_data->_M_aday4 = L"Wed";
-+ _M_data->_M_aday5 = L"Thu";
-+ _M_data->_M_aday6 = L"Fri";
-+ _M_data->_M_aday7 = L"Sat";
-+
-+ // Month names, starting with "C"'s January.
-+ _M_data->_M_month01 = L"January";
-+ _M_data->_M_month02 = L"February";
-+ _M_data->_M_month03 = L"March";
-+ _M_data->_M_month04 = L"April";
-+ _M_data->_M_month05 = L"May";
-+ _M_data->_M_month06 = L"June";
-+ _M_data->_M_month07 = L"July";
-+ _M_data->_M_month08 = L"August";
-+ _M_data->_M_month09 = L"September";
-+ _M_data->_M_month10 = L"October";
-+ _M_data->_M_month11 = L"November";
-+ _M_data->_M_month12 = L"December";
-+
-+ // Abbreviated month names, starting with "C"'s Jan.
-+ _M_data->_M_amonth01 = L"Jan";
-+ _M_data->_M_amonth02 = L"Feb";
-+ _M_data->_M_amonth03 = L"Mar";
-+ _M_data->_M_amonth04 = L"Apr";
-+ _M_data->_M_amonth05 = L"May";
-+ _M_data->_M_amonth06 = L"Jun";
-+ _M_data->_M_amonth07 = L"Jul";
-+ _M_data->_M_amonth08 = L"Aug";
-+ _M_data->_M_amonth09 = L"Sep";
-+ _M_data->_M_amonth10 = L"Oct";
-+ _M_data->_M_amonth11 = L"Nov";
-+ _M_data->_M_amonth12 = L"Dec";
-+ }
-+#if 0
-+ else
-+ {
-+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
-+
-+ union { char *__s; wchar_t *__w; } __u;
-+
-+ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
-+ _M_data->_M_date_format = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
-+ _M_data->_M_date_era_format = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
-+ _M_data->_M_time_format = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
-+ _M_data->_M_time_era_format = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
-+ _M_data->_M_date_time_format = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
-+ _M_data->_M_date_time_era_format = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
-+ _M_data->_M_am = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
-+ _M_data->_M_pm = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
-+ _M_data->_M_am_pm_format = __u.__w;
-+
-+ // Day names, starting with "C"'s Sunday.
-+ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
-+ _M_data->_M_day1 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
-+ _M_data->_M_day2 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
-+ _M_data->_M_day3 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
-+ _M_data->_M_day4 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
-+ _M_data->_M_day5 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
-+ _M_data->_M_day6 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
-+ _M_data->_M_day7 = __u.__w;
-+
-+ // Abbreviated day names, starting with "C"'s Sun.
-+ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
-+ _M_data->_M_aday1 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
-+ _M_data->_M_aday2 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
-+ _M_data->_M_aday3 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
-+ _M_data->_M_aday4 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
-+ _M_data->_M_aday5 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
-+ _M_data->_M_aday6 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
-+ _M_data->_M_aday7 = __u.__w;
-+
-+ // Month names, starting with "C"'s January.
-+ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
-+ _M_data->_M_month01 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
-+ _M_data->_M_month02 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
-+ _M_data->_M_month03 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
-+ _M_data->_M_month04 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
-+ _M_data->_M_month05 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
-+ _M_data->_M_month06 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
-+ _M_data->_M_month07 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
-+ _M_data->_M_month08 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
-+ _M_data->_M_month09 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
-+ _M_data->_M_month10 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
-+ _M_data->_M_month11 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
-+ _M_data->_M_month12 = __u.__w;
-+
-+ // Abbreviated month names, starting with "C"'s Jan.
-+ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
-+ _M_data->_M_amonth01 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
-+ _M_data->_M_amonth02 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
-+ _M_data->_M_amonth03 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
-+ _M_data->_M_amonth04 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
-+ _M_data->_M_amonth05 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
-+ _M_data->_M_amonth06 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
-+ _M_data->_M_amonth07 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
-+ _M_data->_M_amonth08 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
-+ _M_data->_M_amonth09 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
-+ _M_data->_M_amonth10 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
-+ _M_data->_M_amonth11 = __u.__w;
-+ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
-+ _M_data->_M_amonth12 = __u.__w;
-+ }
-+#endif // 0
-+ }
-+#endif
-+}
---- /dev/null
-+++ b/libstdc++-v3/config/locale/uclibc/time_members.h
-@@ -0,0 +1,68 @@
-+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
-+
-+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-+//
-+// This file is part of the GNU ISO C++ Library. This library 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 2, or (at your option)
-+// any later version.
-+
-+// This library 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 this library; see the file COPYING. If not, write to the Free
-+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-+// USA.
-+
-+// As a special exception, you may use this file as part of a free software
-+// library without restriction. Specifically, if other files instantiate
-+// templates or use macros or inline functions from this file, or you compile
-+// this file and link it with other files to produce an executable, this
-+// file does not by itself cause the resulting executable to be covered by
-+// the GNU General Public License. This exception does not however
-+// invalidate any other reasons why the executable file might be covered by
-+// the GNU General Public License.
-+
-+//
-+// ISO C++ 14882: 22.2.5.1.2 - time_get functions
-+// ISO C++ 14882: 22.2.5.3.2 - time_put functions
-+//
-+
-+// Written by Benjamin Kosnik <bkoz@redhat.com>
-+
-+ template<typename _CharT>
-+ __timepunct<_CharT>::__timepunct(size_t __refs)
-+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
-+ _M_name_timepunct(_S_get_c_name())
-+ { _M_initialize_timepunct(); }
-+
-+ template<typename _CharT>
-+ __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
-+ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
-+ _M_name_timepunct(_S_get_c_name())
-+ { _M_initialize_timepunct(); }
-+
-+ template<typename _CharT>
-+ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
-+ size_t __refs)
-+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
-+ _M_name_timepunct(__s)
-+ {
-+ char* __tmp = new char[std::strlen(__s) + 1];
-+ std::strcpy(__tmp, __s);
-+ _M_name_timepunct = __tmp;
-+ _M_initialize_timepunct(__cloc);
-+ }
-+
-+ template<typename _CharT>
-+ __timepunct<_CharT>::~__timepunct()
-+ {
-+ if (_M_name_timepunct != _S_get_c_name())
-+ delete [] _M_name_timepunct;
-+ delete _M_data;
-+ _S_destroy_c_locale(_M_c_locale_timepunct);
-+ }
---- a/libstdc++-v3/configure
-+++ b/libstdc++-v3/configure
-@@ -5773,7 +5773,7 @@ if test "${enable_clocale+set}" = set; t
- enableval="$enable_clocale"
-
- case "$enableval" in
-- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;;
-+ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;;
- *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5
- echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;}
- { (exit 1); exit 1; }; } ;;
-@@ -5806,6 +5806,9 @@ fi;
- # Default to "generic".
- if test $enable_clocale_flag = auto; then
- case ${target_os} in
-+ linux-uclibc*)
-+ enable_clocale_flag=uclibc
-+ ;;
- linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
- enable_clocale_flag=gnu
- ;;
-@@ -6192,6 +6195,76 @@ echo "${ECHO_T}IEEE 1003.1" >&6
- CTIME_CC=config/locale/generic/time_members.cc
- CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
- ;;
-+ uclibc)
-+ echo "$as_me:$LINENO: result: uclibc" >&5
-+echo "${ECHO_T}uclibc" >&6
-+
-+ # Declare intention to use gettext, and add support for specific
-+ # languages.
-+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
-+ ALL_LINGUAS="de fr"
-+
-+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
-+ # Extract the first word of "msgfmt", so it can be a program name with args.
-+set dummy msgfmt; ac_word=$2
-+echo "$as_me:$LINENO: checking for $ac_word" >&5
-+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-+if test "${ac_cv_prog_check_msgfmt+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ if test -n "$check_msgfmt"; then
-+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
-+else
-+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-+for as_dir in $PATH
-+do
-+ IFS=$as_save_IFS
-+ test -z "$as_dir" && as_dir=.
-+ for ac_exec_ext in '' $ac_executable_extensions; do
-+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-+ ac_cv_prog_check_msgfmt="yes"
-+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-+ break 2
-+ fi
-+done
-+done
-+
-+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
-+fi
-+fi
-+check_msgfmt=$ac_cv_prog_check_msgfmt
-+if test -n "$check_msgfmt"; then
-+ echo "$as_me:$LINENO: result: $check_msgfmt" >&5
-+echo "${ECHO_T}$check_msgfmt" >&6
-+else
-+ echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
-+fi
-+
-+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
-+ USE_NLS=yes
-+ fi
-+ # Export the build objects.
-+ for ling in $ALL_LINGUAS; do \
-+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
-+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
-+ done
-+
-+
-+
-+ CLOCALE_H=config/locale/uclibc/c_locale.h
-+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
-+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
-+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
-+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
-+ CMESSAGES_H=config/locale/uclibc/messages_members.h
-+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
-+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
-+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
-+ CTIME_H=config/locale/uclibc/time_members.h
-+ CTIME_CC=config/locale/uclibc/time_members.cc
-+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
-+ ;;
- esac
-
- # This is where the testsuite looks for locale catalogs, using the
---- a/libstdc++-v3/include/c_compatibility/wchar.h
-+++ b/libstdc++-v3/include/c_compatibility/wchar.h
-@@ -101,7 +101,9 @@ using std::wmemcmp;
- using std::wmemcpy;
- using std::wmemmove;
- using std::wmemset;
-+#if _GLIBCXX_HAVE_WCSFTIME
- using std::wcsftime;
-+#endif
-
- #if _GLIBCXX_USE_C99
- using std::wcstold;
---- a/libstdc++-v3/include/c_std/std_cwchar.h
-+++ b/libstdc++-v3/include/c_std/std_cwchar.h
-@@ -182,7 +182,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
- using ::wcscoll;
- using ::wcscpy;
- using ::wcscspn;
-+#if _GLIBCXX_HAVE_WCSFTIME
- using ::wcsftime;
-+#endif
- using ::wcslen;
- using ::wcsncat;
- using ::wcsncmp;
diff --git a/toolchain/gcc/patches/llvm/203-uclibc-locale-no__x.patch b/toolchain/gcc/patches/llvm/203-uclibc-locale-no__x.patch
deleted file mode 100644
index 924089b1c..000000000
--- a/toolchain/gcc/patches/llvm/203-uclibc-locale-no__x.patch
+++ /dev/null
@@ -1,213 +0,0 @@
---- a/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
-+++ b/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
-@@ -60,4 +60,49 @@ extern "C" __typeof(wcsxfrm_l) __wcsxfrm
- extern "C" __typeof(wctype_l) __wctype_l;
- #endif
-
-+# define __nl_langinfo_l nl_langinfo_l
-+# define __strcoll_l strcoll_l
-+# define __strftime_l strftime_l
-+# define __strtod_l strtod_l
-+# define __strtof_l strtof_l
-+# define __strtold_l strtold_l
-+# define __strxfrm_l strxfrm_l
-+# define __newlocale newlocale
-+# define __freelocale freelocale
-+# define __duplocale duplocale
-+# define __uselocale uselocale
-+
-+# ifdef _GLIBCXX_USE_WCHAR_T
-+# define __iswctype_l iswctype_l
-+# define __towlower_l towlower_l
-+# define __towupper_l towupper_l
-+# define __wcscoll_l wcscoll_l
-+# define __wcsftime_l wcsftime_l
-+# define __wcsxfrm_l wcsxfrm_l
-+# define __wctype_l wctype_l
-+# endif
-+
-+#else
-+# define __nl_langinfo_l(N, L) nl_langinfo((N))
-+# define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
-+# define __strtod_l(S, E, L) strtod((S), (E))
-+# define __strtof_l(S, E, L) strtof((S), (E))
-+# define __strtold_l(S, E, L) strtold((S), (E))
-+# define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
-+# warning should dummy __newlocale check for C|POSIX ?
-+# define __newlocale(a, b, c) NULL
-+# define __freelocale(a) ((void)0)
-+# define __duplocale(a) __c_locale()
-+//# define __uselocale ?
-+//
-+# ifdef _GLIBCXX_USE_WCHAR_T
-+# define __iswctype_l(C, M, L) iswctype((C), (M))
-+# define __towlower_l(C, L) towlower((C))
-+# define __towupper_l(C, L) towupper((C))
-+# define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
-+//# define __wcsftime_l(S, M, F, T, L) wcsftime((S), (M), (F), (T))
-+# define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
-+# define __wctype_l(S, L) wctype((S))
-+# endif
-+
- #endif // GLIBC 2.3 and later
---- a/libstdc++-v3/config/locale/uclibc/c_locale.cc
-+++ b/libstdc++-v3/config/locale/uclibc/c_locale.cc
-@@ -39,20 +39,6 @@
- #include <langinfo.h>
- #include <bits/c++locale_internal.h>
-
--#ifndef __UCLIBC_HAS_XLOCALE__
--#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
--#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
--#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
--#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
--#define __strtof_l(S, E, L) strtof((S), (E))
--#define __strtod_l(S, E, L) strtod((S), (E))
--#define __strtold_l(S, E, L) strtold((S), (E))
--#warning should dummy __newlocale check for C|POSIX ?
--#define __newlocale(a, b, c) NULL
--#define __freelocale(a) ((void)0)
--#define __duplocale(a) __c_locale()
--#endif
--
- namespace std
- {
- template<>
---- a/libstdc++-v3/config/locale/uclibc/collate_members.cc
-+++ b/libstdc++-v3/config/locale/uclibc/collate_members.cc
-@@ -36,13 +36,6 @@
- #include <locale>
- #include <bits/c++locale_internal.h>
-
--#ifndef __UCLIBC_HAS_XLOCALE__
--#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
--#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
--#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
--#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
--#endif
--
- namespace std
- {
- // These are basically extensions to char_traits, and perhaps should
---- a/libstdc++-v3/config/locale/uclibc/monetary_members.cc
-+++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
-@@ -43,10 +43,6 @@
- #warning tailor for stub locale support
- #endif
-
--#ifndef __UCLIBC_HAS_XLOCALE__
--#define __nl_langinfo_l(N, L) nl_langinfo((N))
--#endif
--
- namespace std
- {
- // Construct and return valid pattern consisting of some combination of:
---- a/libstdc++-v3/config/locale/uclibc/numeric_members.cc
-+++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
-@@ -41,9 +41,6 @@
- #ifdef __UCLIBC_MJN3_ONLY__
- #warning tailor for stub locale support
- #endif
--#ifndef __UCLIBC_HAS_XLOCALE__
--#define __nl_langinfo_l(N, L) nl_langinfo((N))
--#endif
-
- namespace std
- {
---- a/libstdc++-v3/config/locale/uclibc/time_members.cc
-+++ b/libstdc++-v3/config/locale/uclibc/time_members.cc
-@@ -40,9 +40,6 @@
- #ifdef __UCLIBC_MJN3_ONLY__
- #warning tailor for stub locale support
- #endif
--#ifndef __UCLIBC_HAS_XLOCALE__
--#define __nl_langinfo_l(N, L) nl_langinfo((N))
--#endif
-
- namespace std
- {
---- a/libstdc++-v3/config/locale/uclibc/ctype_members.cc
-+++ b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
-@@ -38,13 +38,6 @@
- #undef _LIBC
- #include <bits/c++locale_internal.h>
-
--#ifndef __UCLIBC_HAS_XLOCALE__
--#define __wctype_l(S, L) wctype((S))
--#define __towupper_l(C, L) towupper((C))
--#define __towlower_l(C, L) towlower((C))
--#define __iswctype_l(C, M, L) iswctype((C), (M))
--#endif
--
- namespace std
- {
- // NB: The other ctype<char> specializations are in src/locale.cc and
---- a/libstdc++-v3/config/locale/uclibc/messages_members.cc
-+++ b/libstdc++-v3/config/locale/uclibc/messages_members.cc
-@@ -39,13 +39,10 @@
- #ifdef __UCLIBC_MJN3_ONLY__
- #warning fix gettext stuff
- #endif
--#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
--extern "C" char *__dcgettext(const char *domainname,
-- const char *msgid, int category);
- #undef gettext
--#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
-+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
-+#define gettext(msgid) dcgettext(NULL, msgid, LC_MESSAGES)
- #else
--#undef gettext
- #define gettext(msgid) (msgid)
- #endif
-
---- a/libstdc++-v3/config/locale/uclibc/messages_members.h
-+++ b/libstdc++-v3/config/locale/uclibc/messages_members.h
-@@ -36,15 +36,11 @@
- #ifdef __UCLIBC_MJN3_ONLY__
- #warning fix prototypes for *textdomain funcs
- #endif
--#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
--extern "C" char *__textdomain(const char *domainname);
--extern "C" char *__bindtextdomain(const char *domainname,
-- const char *dirname);
--#else
--#undef __textdomain
--#undef __bindtextdomain
--#define __textdomain(D) ((void)0)
--#define __bindtextdomain(D,P) ((void)0)
-+#ifndef __UCLIBC_HAS_GETTEXT_AWARENESS__
-+#undef textdomain
-+#undef bindtextdomain
-+#define textdomain(D) ((void)0)
-+#define bindtextdomain(D,P) ((void)0)
- #endif
-
- // Non-virtual member functions.
-@@ -70,7 +66,7 @@ extern "C" char *__bindtextdomain(const
- messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
- const char* __dir) const
- {
-- __bindtextdomain(__s.c_str(), __dir);
-+ bindtextdomain(__s.c_str(), __dir);
- return this->do_open(__s, __loc);
- }
-
-@@ -90,7 +86,7 @@ extern "C" char *__bindtextdomain(const
- {
- // No error checking is done, assume the catalog exists and can
- // be used.
-- __textdomain(__s.c_str());
-+ textdomain(__s.c_str());
- return 0;
- }
-
---- a/libstdc++-v3/config/locale/uclibc/c_locale.h
-+++ b/libstdc++-v3/config/locale/uclibc/c_locale.h
-@@ -68,6 +68,7 @@ namespace __gnu_cxx
- {
- extern "C" __typeof(uselocale) __uselocale;
- }
-+#define __uselocale uselocale
- #endif
-
- namespace std
diff --git a/toolchain/gcc/patches/llvm/204-uclibc-locale-wchar_fix.patch b/toolchain/gcc/patches/llvm/204-uclibc-locale-wchar_fix.patch
deleted file mode 100644
index d62c3c433..000000000
--- a/toolchain/gcc/patches/llvm/204-uclibc-locale-wchar_fix.patch
+++ /dev/null
@@ -1,48 +0,0 @@
---- a/libstdc++-v3/config/locale/uclibc/monetary_members.cc
-+++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
-@@ -401,7 +401,7 @@ namespace std
- # ifdef __UCLIBC_HAS_XLOCALE__
- _M_data->_M_decimal_point = __cloc->decimal_point_wc;
- _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
--# else
-+# elif defined __UCLIBC_HAS_LOCALE__
- _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
- _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
- # endif
-@@ -556,7 +556,7 @@ namespace std
- # ifdef __UCLIBC_HAS_XLOCALE__
- _M_data->_M_decimal_point = __cloc->decimal_point_wc;
- _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
--# else
-+# elif defined __UCLIBC_HAS_LOCALE__
- _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
- _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
- # endif
---- a/libstdc++-v3/config/locale/uclibc/numeric_members.cc
-+++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
-@@ -127,12 +127,25 @@ namespace std
- {
- // Named locale.
- // NB: In the GNU model wchar_t is always 32 bit wide.
-+#ifdef __UCLIBC_MJN3_ONLY__
-+#warning fix this... should be numeric
-+#endif
-+#ifdef __UCLIBC__
-+# ifdef __UCLIBC_HAS_XLOCALE__
-+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
-+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
-+# elif defined __UCLIBC_HAS_LOCALE__
-+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
-+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
-+# endif
-+#else
- union { char *__s; wchar_t __w; } __u;
- __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
- _M_data->_M_decimal_point = __u.__w;
-
- __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
- _M_data->_M_thousands_sep = __u.__w;
-+#endif
-
- if (_M_data->_M_thousands_sep == L'\0')
- _M_data->_M_grouping = "";
diff --git a/toolchain/gcc/patches/llvm/205-uclibc-locale-update.patch b/toolchain/gcc/patches/llvm/205-uclibc-locale-update.patch
deleted file mode 100644
index 631f39886..000000000
--- a/toolchain/gcc/patches/llvm/205-uclibc-locale-update.patch
+++ /dev/null
@@ -1,347 +0,0 @@
---- a/libstdc++-v3/config/locale/uclibc/c_locale.cc
-+++ b/libstdc++-v3/config/locale/uclibc/c_locale.cc
-@@ -46,16 +46,13 @@ namespace std
- __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
- const __c_locale& __cloc)
- {
-- if (!(__err & ios_base::failbit))
-- {
-- char* __sanity;
-- errno = 0;
-- float __f = __strtof_l(__s, &__sanity, __cloc);
-- if (__sanity != __s && errno != ERANGE)
-- __v = __f;
-- else
-- __err |= ios_base::failbit;
-- }
-+ char* __sanity;
-+ errno = 0;
-+ float __f = __strtof_l(__s, &__sanity, __cloc);
-+ if (__sanity != __s && errno != ERANGE)
-+ __v = __f;
-+ else
-+ __err |= ios_base::failbit;
- }
-
- template<>
-@@ -63,16 +60,13 @@ namespace std
- __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
- const __c_locale& __cloc)
- {
-- if (!(__err & ios_base::failbit))
-- {
-- char* __sanity;
-- errno = 0;
-- double __d = __strtod_l(__s, &__sanity, __cloc);
-- if (__sanity != __s && errno != ERANGE)
-- __v = __d;
-- else
-- __err |= ios_base::failbit;
-- }
-+ char* __sanity;
-+ errno = 0;
-+ double __d = __strtod_l(__s, &__sanity, __cloc);
-+ if (__sanity != __s && errno != ERANGE)
-+ __v = __d;
-+ else
-+ __err |= ios_base::failbit;
- }
-
- template<>
-@@ -80,16 +74,13 @@ namespace std
- __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
- const __c_locale& __cloc)
- {
-- if (!(__err & ios_base::failbit))
-- {
-- char* __sanity;
-- errno = 0;
-- long double __ld = __strtold_l(__s, &__sanity, __cloc);
-- if (__sanity != __s && errno != ERANGE)
-- __v = __ld;
-- else
-- __err |= ios_base::failbit;
-- }
-+ char* __sanity;
-+ errno = 0;
-+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
-+ if (__sanity != __s && errno != ERANGE)
-+ __v = __ld;
-+ else
-+ __err |= ios_base::failbit;
- }
-
- void
-@@ -110,7 +101,7 @@ namespace std
- void
- locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
- {
-- if (_S_get_c_locale() != __cloc)
-+ if (__cloc && _S_get_c_locale() != __cloc)
- __freelocale(__cloc);
- }
-
---- a/libstdc++-v3/config/locale/uclibc/ctype_members.cc
-+++ b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
-@@ -33,9 +33,14 @@
-
- // Written by Benjamin Kosnik <bkoz@redhat.com>
-
-+#include <features.h>
-+#ifdef __UCLIBC_HAS_LOCALE__
- #define _LIBC
- #include <locale>
- #undef _LIBC
-+#else
-+#include <locale>
-+#endif
- #include <bits/c++locale_internal.h>
-
- namespace std
-@@ -138,20 +143,34 @@ namespace std
- ctype<wchar_t>::
- do_is(mask __m, wchar_t __c) const
- {
-- // Highest bitmask in ctype_base == 10, but extra in "C"
-- // library for blank.
-+ // The case of __m == ctype_base::space is particularly important,
-+ // due to its use in many istream functions. Therefore we deal with
-+ // it first, exploiting the knowledge that on GNU systems _M_bit[5]
-+ // is the mask corresponding to ctype_base::space. NB: an encoding
-+ // change would not affect correctness!
- bool __ret = false;
-- const size_t __bitmasksize = 11;
-- for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
-- if (__m & _M_bit[__bitcur]
-- && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
-- {
-- __ret = true;
-- break;
-- }
-+ if (__m == _M_bit[5])
-+ __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype);
-+ else
-+ {
-+ // Highest bitmask in ctype_base == 10, but extra in "C"
-+ // library for blank.
-+ const size_t __bitmasksize = 11;
-+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
-+ if (__m & _M_bit[__bitcur])
-+ {
-+ if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
-+ {
-+ __ret = true;
-+ break;
-+ }
-+ else if (__m == _M_bit[__bitcur])
-+ break;
-+ }
-+ }
- return __ret;
- }
--
-+
- const wchar_t*
- ctype<wchar_t>::
- do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
---- a/libstdc++-v3/config/locale/uclibc/messages_members.h
-+++ b/libstdc++-v3/config/locale/uclibc/messages_members.h
-@@ -47,18 +47,21 @@
- template<typename _CharT>
- messages<_CharT>::messages(size_t __refs)
- : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
-- _M_name_messages(_S_get_c_name())
-+ _M_name_messages(_S_get_c_name())
- { }
-
- template<typename _CharT>
- messages<_CharT>::messages(__c_locale __cloc, const char* __s,
- size_t __refs)
-- : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
-- _M_name_messages(__s)
-+ : facet(__refs), _M_c_locale_messages(NULL), _M_name_messages(NULL)
- {
-- char* __tmp = new char[std::strlen(__s) + 1];
-- std::strcpy(__tmp, __s);
-+ const size_t __len = std::strlen(__s) + 1;
-+ char* __tmp = new char[__len];
-+ std::memcpy(__tmp, __s, __len);
- _M_name_messages = __tmp;
-+
-+ // Last to avoid leaking memory if new throws.
-+ _M_c_locale_messages = _S_clone_c_locale(__cloc);
- }
-
- template<typename _CharT>
---- a/libstdc++-v3/config/locale/uclibc/monetary_members.cc
-+++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
-@@ -33,9 +33,14 @@
-
- // Written by Benjamin Kosnik <bkoz@redhat.com>
-
-+#include <features.h>
-+#ifdef __UCLIBC_HAS_LOCALE__
- #define _LIBC
- #include <locale>
- #undef _LIBC
-+#else
-+#include <locale>
-+#endif
- #include <bits/c++locale_internal.h>
-
- #ifdef __UCLIBC_MJN3_ONLY__
-@@ -206,7 +211,7 @@ namespace std
- }
- break;
- default:
-- ;
-+ __ret = pattern();
- }
- return __ret;
- }
---- a/libstdc++-v3/config/locale/uclibc/numeric_members.cc
-+++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
-@@ -33,9 +33,14 @@
-
- // Written by Benjamin Kosnik <bkoz@redhat.com>
-
-+#include <features.h>
-+#ifdef __UCLIBC_HAS_LOCALE__
- #define _LIBC
- #include <locale>
- #undef _LIBC
-+#else
-+#include <locale>
-+#endif
- #include <bits/c++locale_internal.h>
-
- #ifdef __UCLIBC_MJN3_ONLY__
---- a/libstdc++-v3/config/locale/uclibc/time_members.h
-+++ b/libstdc++-v3/config/locale/uclibc/time_members.h
-@@ -37,25 +37,33 @@
- template<typename _CharT>
- __timepunct<_CharT>::__timepunct(size_t __refs)
- : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
-- _M_name_timepunct(_S_get_c_name())
-+ _M_name_timepunct(_S_get_c_name())
- { _M_initialize_timepunct(); }
-
- template<typename _CharT>
- __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
- : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
-- _M_name_timepunct(_S_get_c_name())
-+ _M_name_timepunct(_S_get_c_name())
- { _M_initialize_timepunct(); }
-
- template<typename _CharT>
- __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
- size_t __refs)
- : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
-- _M_name_timepunct(__s)
-+ _M_name_timepunct(NULL)
- {
-- char* __tmp = new char[std::strlen(__s) + 1];
-- std::strcpy(__tmp, __s);
-+ const size_t __len = std::strlen(__s) + 1;
-+ char* __tmp = new char[__len];
-+ std::memcpy(__tmp, __s, __len);
- _M_name_timepunct = __tmp;
-- _M_initialize_timepunct(__cloc);
-+
-+ try
-+ { _M_initialize_timepunct(__cloc); }
-+ catch(...)
-+ {
-+ delete [] _M_name_timepunct;
-+ __throw_exception_again;
-+ }
- }
-
- template<typename _CharT>
---- a/libstdc++-v3/config/locale/uclibc/c_locale.h
-+++ b/libstdc++-v3/config/locale/uclibc/c_locale.h
-@@ -39,21 +39,23 @@
- #pragma GCC system_header
-
- #include <cstring> // get std::strlen
--#include <cstdio> // get std::snprintf or std::sprintf
-+#include <cstdio> // get std::vsnprintf or std::vsprintf
- #include <clocale>
- #include <langinfo.h> // For codecvt
- #ifdef __UCLIBC_MJN3_ONLY__
- #warning fix this
- #endif
--#ifdef __UCLIBC_HAS_LOCALE__
-+#ifdef _GLIBCXX_USE_ICONV
- #include <iconv.h> // For codecvt using iconv, iconv_t
- #endif
--#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
--#include <libintl.h> // For messages
-+#ifdef HAVE_LIBINTL_H
-+#include <libintl.h> // For messages
- #endif
-+#include <cstdarg>
-
- #ifdef __UCLIBC_MJN3_ONLY__
- #warning what is _GLIBCXX_C_LOCALE_GNU for
-+// psm: used in os/gnu-linux/ctype_noninline.h
- #endif
- #define _GLIBCXX_C_LOCALE_GNU 1
-
-@@ -62,7 +64,7 @@
- #endif
- // #define _GLIBCXX_NUM_CATEGORIES 6
- #define _GLIBCXX_NUM_CATEGORIES 0
--
-+
- #ifdef __UCLIBC_HAS_XLOCALE__
- namespace __gnu_cxx
- {
-@@ -79,22 +81,24 @@ namespace std
- typedef int* __c_locale;
- #endif
-
-- // Convert numeric value of type _Tv to string and return length of
-- // string. If snprintf is available use it, otherwise fall back to
-- // the unsafe sprintf which, in general, can be dangerous and should
-+ // Convert numeric value of type double to string and return length of
-+ // string. If vsnprintf is available use it, otherwise fall back to
-+ // the unsafe vsprintf which, in general, can be dangerous and should
- // be avoided.
-- template<typename _Tv>
-- int
-- __convert_from_v(char* __out,
-- const int __size __attribute__ ((__unused__)),
-- const char* __fmt,
--#ifdef __UCLIBC_HAS_XCLOCALE__
-- _Tv __v, const __c_locale& __cloc, int __prec)
-+ inline int
-+ __convert_from_v(const __c_locale&
-+#ifndef __UCLIBC_HAS_XCLOCALE__
-+ __cloc __attribute__ ((__unused__))
-+#endif
-+ ,
-+ char* __out,
-+ const int __size,
-+ const char* __fmt, ...)
- {
-+ va_list __args;
-+#ifdef __UCLIBC_HAS_XCLOCALE__
- __c_locale __old = __gnu_cxx::__uselocale(__cloc);
- #else
-- _Tv __v, const __c_locale&, int __prec)
-- {
- # ifdef __UCLIBC_HAS_LOCALE__
- char* __old = std::setlocale(LC_ALL, NULL);
- char* __sav = new char[std::strlen(__old) + 1];
-@@ -103,7 +107,9 @@ namespace std
- # endif
- #endif
-
-- const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
-+ va_start(__args, __fmt);
-+ const int __ret = std::vsnprintf(__out, __size, __fmt, __args);
-+ va_end(__args);
-
- #ifdef __UCLIBC_HAS_XCLOCALE__
- __gnu_cxx::__uselocale(__old);
diff --git a/toolchain/gcc/patches/llvm/300-libstdc++-pic.patch b/toolchain/gcc/patches/llvm/300-libstdc++-pic.patch
deleted file mode 100644
index 165dc3708..000000000
--- a/toolchain/gcc/patches/llvm/300-libstdc++-pic.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-# DP: Build and install libstdc++_pic.a library.
-
---- a/libstdc++-v3/src/Makefile.am
-+++ b/libstdc++-v3/src/Makefile.am
-@@ -257,6 +257,12 @@ CXXLINK = $(LIBTOOL) --tag CXX --mode=li
- $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
-
-
-+install-exec-local:
-+ifeq ($(enable_shared),yes)
-+ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o
-+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
-+endif
-+
- # Added bits to build debug library.
- if GLIBCXX_BUILD_DEBUG
- all-local: build_debug
---- a/libstdc++-v3/src/Makefile.in
-+++ b/libstdc++-v3/src/Makefile.in
-@@ -657,7 +657,7 @@ info-am:
-
- install-data-am: install-data-local
-
--install-exec-am: install-toolexeclibLTLIBRARIES
-+install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local
-
- install-info: install-info-am
-
-@@ -690,6 +690,7 @@ uninstall-am: uninstall-info-am uninstal
- distclean-libtool distclean-tags distdir dvi dvi-am html \
- html-am info info-am install install-am install-data \
- install-data-am install-data-local install-exec \
-+ install-exec-local \
- install-exec-am install-info install-info-am install-man \
- install-strip install-toolexeclibLTLIBRARIES installcheck \
- installcheck-am installdirs maintainer-clean \
-@@ -799,6 +800,13 @@ build_debug: stamp-debug
- install_debug:
- (cd ${debugdir} && $(MAKE) \
- toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
-+
-+install-exec-local:
-+ifeq ($(enable_shared),yes)
-+ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o
-+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
-+endif
-+
- # Tell versions [3.59,3.63) of GNU make to not export all variables.
- # Otherwise a system limit (for SysV at least) may be exceeded.
- .NOEXPORT:
diff --git a/toolchain/gcc/patches/llvm/301-missing-execinfo_h.patch b/toolchain/gcc/patches/llvm/301-missing-execinfo_h.patch
deleted file mode 100644
index 4a041225d..000000000
--- a/toolchain/gcc/patches/llvm/301-missing-execinfo_h.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/boehm-gc/include/gc.h
-+++ b/boehm-gc/include/gc.h
-@@ -502,7 +502,7 @@ GC_API GC_PTR GC_malloc_atomic_ignore_of
- #if defined(__linux__) || defined(__GLIBC__)
- # include <features.h>
- # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
-- && !defined(__ia64__)
-+ && !defined(__ia64__) && !defined(__UCLIBC__)
- # ifndef GC_HAVE_BUILTIN_BACKTRACE
- # define GC_HAVE_BUILTIN_BACKTRACE
- # endif
diff --git a/toolchain/gcc/patches/llvm/302-c99-snprintf.patch b/toolchain/gcc/patches/llvm/302-c99-snprintf.patch
deleted file mode 100644
index adde594a0..000000000
--- a/toolchain/gcc/patches/llvm/302-c99-snprintf.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/libstdc++-v3/include/c_std/std_cstdio.h
-+++ b/libstdc++-v3/include/c_std/std_cstdio.h
-@@ -144,7 +144,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
-
- _GLIBCXX_END_NAMESPACE
-
--#if _GLIBCXX_USE_C99
-+#if _GLIBCXX_USE_C99 || defined(__UCLIBC__)
-
- #undef snprintf
- #undef vfscanf
diff --git a/toolchain/gcc/patches/llvm/303-c99-complex-ugly-hack.patch b/toolchain/gcc/patches/llvm/303-c99-complex-ugly-hack.patch
deleted file mode 100644
index 6846e6afd..000000000
--- a/toolchain/gcc/patches/llvm/303-c99-complex-ugly-hack.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/libstdc++-v3/configure
-+++ b/libstdc++-v3/configure
-@@ -7516,6 +7516,9 @@ cat confdefs.h >>conftest.$ac_ext
- cat >>conftest.$ac_ext <<_ACEOF
- /* end confdefs.h. */
- #include <complex.h>
-+#ifdef __UCLIBC__
-+#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs
-+#endif
- int
- main ()
- {
diff --git a/toolchain/gcc/patches/llvm/304-index_macro.patch b/toolchain/gcc/patches/llvm/304-index_macro.patch
deleted file mode 100644
index ddb3bfa5f..000000000
--- a/toolchain/gcc/patches/llvm/304-index_macro.patch
+++ /dev/null
@@ -1,24 +0,0 @@
---- a/libstdc++-v3/include/ext/rope
-+++ b/libstdc++-v3/include/ext/rope
-@@ -58,6 +58,9 @@
- #include <bits/allocator.h>
- #include <ext/hash_fun.h>
-
-+/* cope w/ index defined as macro, SuSv3 proposal */
-+#undef index
-+
- # ifdef __GC
- # define __GC_CONST const
- # else
---- a/libstdc++-v3/include/ext/ropeimpl.h
-+++ b/libstdc++-v3/include/ext/ropeimpl.h
-@@ -54,6 +54,9 @@
- #include <ext/memory> // For uninitialized_copy_n
- #include <ext/numeric> // For power
-
-+/* cope w/ index defined as macro, SuSv3 proposal */
-+#undef index
-+
- _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
-
- using std::size_t;
diff --git a/toolchain/gcc/patches/llvm/305-libmudflap-susv3-legacy.patch b/toolchain/gcc/patches/llvm/305-libmudflap-susv3-legacy.patch
deleted file mode 100644
index e1ee900a2..000000000
--- a/toolchain/gcc/patches/llvm/305-libmudflap-susv3-legacy.patch
+++ /dev/null
@@ -1,47 +0,0 @@
---- a/libmudflap/mf-hooks2.c
-+++ b/libmudflap/mf-hooks2.c
-@@ -427,7 +427,7 @@ WRAPPER2(void, bzero, void *s, size_t n)
- {
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
-- bzero (s, n);
-+ memset (s, 0, n);
- }
-
-
-@@ -437,7 +437,7 @@ WRAPPER2(void, bcopy, const void *src, v
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
- MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
-- bcopy (src, dest, n);
-+ memmove (dest, src, n);
- }
-
-
-@@ -447,7 +447,7 @@ WRAPPER2(int, bcmp, const void *s1, cons
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
- MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
-- return bcmp (s1, s2, n);
-+ return n == 0 ? 0 : memcmp (s1, s2, n);
- }
-
-
-@@ -456,7 +456,7 @@ WRAPPER2(char *, index, const char *s, i
- size_t n = strlen (s);
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
-- return index (s, c);
-+ return strchr (s, c);
- }
-
-
-@@ -465,7 +465,7 @@ WRAPPER2(char *, rindex, const char *s,
- size_t n = strlen (s);
- TRACE ("%s\n", __PRETTY_FUNCTION__);
- MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
-- return rindex (s, c);
-+ return strrchr (s, c);
- }
-
- /* XXX: stpcpy, memccpy */
diff --git a/toolchain/gcc/patches/llvm/306-libstdc++-namespace.patch b/toolchain/gcc/patches/llvm/306-libstdc++-namespace.patch
deleted file mode 100644
index 34b68790d..000000000
--- a/toolchain/gcc/patches/llvm/306-libstdc++-namespace.patch
+++ /dev/null
@@ -1,34 +0,0 @@
---- a/libstdc++-v3/config/locale/uclibc/messages_members.h
-+++ b/libstdc++-v3/config/locale/uclibc/messages_members.h
-@@ -32,7 +32,8 @@
- //
-
- // Written by Benjamin Kosnik <bkoz@redhat.com>
--
-+namespace std
-+{
- #ifdef __UCLIBC_MJN3_ONLY__
- #warning fix prototypes for *textdomain funcs
- #endif
-@@ -115,3 +116,4 @@
- this->_S_create_c_locale(this->_M_c_locale_messages, __s);
- }
- }
-+}
---- a/libstdc++-v3/config/locale/uclibc/time_members.h
-+++ b/libstdc++-v3/config/locale/uclibc/time_members.h
-@@ -33,7 +33,8 @@
- //
-
- // Written by Benjamin Kosnik <bkoz@redhat.com>
--
-+namespace std
-+{
- template<typename _CharT>
- __timepunct<_CharT>::__timepunct(size_t __refs)
- : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
-@@ -74,3 +75,4 @@
- delete _M_data;
- _S_destroy_c_locale(_M_c_locale_timepunct);
- }
-+}
diff --git a/toolchain/gcc/patches/llvm/307-locale_facets.patch b/toolchain/gcc/patches/llvm/307-locale_facets.patch
deleted file mode 100644
index 42d7c5a0a..000000000
--- a/toolchain/gcc/patches/llvm/307-locale_facets.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-This patch fixes a bug into ostream::operator<<(double) due to the wrong size
-passed into the __convert_from_v method. The wrong size is then passed to
-std::snprintf function, that, on uClibc, doens't handle sized 0 buffer.
-
-Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
-
---- a/libstdc++-v3/include/bits/locale_facets.tcc
-+++ b/libstdc++-v3/include/bits/locale_facets.tcc
-@@ -1149,7 +1149,7 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
- const int __cs_size = __fixed ? __max_exp + __prec + 4
- : __max_digits * 2 + __prec;
- char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
-- __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, __fbuf,
-+ __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, __fbuf,
- __prec, __v);
- #endif
-
-@@ -1789,7 +1789,7 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
- // max_exponent10 + 1 for the integer part, + 2 for sign and '\0'.
- const int __cs_size = numeric_limits<long double>::max_exponent10 + 3;
- char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
-- int __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, "%.*Lf",
-+ int __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, "%.*Lf",
- 0, __units);
- #endif
- string_type __digits(__len, char_type());
diff --git a/toolchain/gcc/patches/llvm/402-libbackend_dep_gcov-iov.h.patch b/toolchain/gcc/patches/llvm/402-libbackend_dep_gcov-iov.h.patch
deleted file mode 100644
index b70f536f1..000000000
--- a/toolchain/gcc/patches/llvm/402-libbackend_dep_gcov-iov.h.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/gcc/Makefile.in
-+++ b/gcc/Makefile.in
-@@ -3001,7 +3001,7 @@ ifeq ($(LLVMOBJDIR),)
- # LLVM LOCAL
- libbackend.o : $(OBJS-common:.o=.c) $(out_file) $(out_cxx_file) \
- insn-config.h insn-flags.h insn-codes.h insn-constants.h \
-- insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE)
-+ insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) gcov-iov.h
- $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
- -DTARGET_NAME=\"$(target_noncanonical)\" \
- -DLOCALEDIR=\"$(localedir)\" \
diff --git a/toolchain/gcc/patches/llvm/800-arm-bigendian.patch b/toolchain/gcc/patches/llvm/800-arm-bigendian.patch
deleted file mode 100644
index 6d0356be1..000000000
--- a/toolchain/gcc/patches/llvm/800-arm-bigendian.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-By Lennert Buytenhek <buytenh@wantstofly.org>
-Adds support for arm*b-linux* big-endian ARM targets
-
-See http://gcc.gnu.org/PR16350
-
---- a/gcc/config/arm/linux-elf.h
-+++ b/gcc/config/arm/linux-elf.h
-@@ -28,19 +28,33 @@
- #undef TARGET_VERSION
- #define TARGET_VERSION fputs (" (ARM GNU/Linux with ELF)", stderr);
-
-+/*
-+ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
-+ * (big endian) configurations.
-+ */
-+#if TARGET_BIG_ENDIAN_DEFAULT
-+#define TARGET_ENDIAN_DEFAULT MASK_BIG_END
-+#define TARGET_ENDIAN_OPTION "mbig-endian"
-+#define TARGET_LINKER_EMULATION "armelfb_linux"
-+#else
-+#define TARGET_ENDIAN_DEFAULT 0
-+#define TARGET_ENDIAN_OPTION "mlittle-endian"
-+#define TARGET_LINKER_EMULATION "armelf_linux"
-+#endif
-+
- #undef TARGET_DEFAULT_FLOAT_ABI
- #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
-
- #undef TARGET_DEFAULT
--#define TARGET_DEFAULT (0)
-+#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
-
- #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
-
--#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
-+#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
-
- #undef MULTILIB_DEFAULTS
- #define MULTILIB_DEFAULTS \
-- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
-+ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
-
- /* Now we define the strings used to build the spec file. */
- #undef LIB_SPEC
-@@ -61,7 +75,7 @@
- %{rdynamic:-export-dynamic} \
- %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "} \
- -X \
-- %{mbig-endian:-EB}" \
-+ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
- SUBTARGET_EXTRA_LINK_SPEC
-
- #undef LINK_SPEC
---- a/gcc/config.gcc
-+++ b/gcc/config.gcc
-@@ -764,6 +764,11 @@ arm*-*-linux*) # ARM GNU/Linux with EL
- tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
- tmake_file="${tmake_file} t-linux arm/t-arm"
- case ${target} in
-+ arm*b-*)
-+ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
-+ ;;
-+ esac
-+ case ${target} in
- arm*-*-linux-*eabi)
- tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
- tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"
diff --git a/toolchain/gcc/patches/llvm/904-flatten-switch-stmt-00.patch b/toolchain/gcc/patches/llvm/904-flatten-switch-stmt-00.patch
deleted file mode 100644
index f3a6372b6..000000000
--- a/toolchain/gcc/patches/llvm/904-flatten-switch-stmt-00.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-Hi,
-
-The attached patch makes sure that we create smaller object code for
-simple switch statements. We just make sure to flatten the switch
-statement into an if-else chain, basically.
-
-This fixes a size-regression as compared to gcc-3.4, as can be seen
-below.
-
-2007-04-15 Bernhard Fischer <..>
-
- * stmt.c (expand_case): Do not create a complex binary tree when
- optimizing for size but rather use the simple ordered list.
- (emit_case_nodes): do not emit jumps to the default_label when
- optimizing for size.
-
-Not regtested so far.
-Comments?
-
-Attached is the test switch.c mentioned below.
-
-$ for i in 2.95 3.3 3.4 4.0 4.1 4.2.orig-HEAD 4.3.orig-HEAD 4.3-HEAD;do
-gcc-$i -DCHAIN -Os -o switch-CHAIN-$i.o -c switch.c ;done
-$ for i in 2.95 3.3 3.4 4.0 4.1 4.2.orig-HEAD 4.3.orig-HEAD 4.3-HEAD;do
-gcc-$i -UCHAIN -Os -o switch-$i.o -c switch.c ;done
-
-$ size switch-*.o
- text data bss dec hex filename
- 169 0 0 169 a9 switch-2.95.o
- 115 0 0 115 73 switch-3.3.o
- 103 0 0 103 67 switch-3.4.o
- 124 0 0 124 7c switch-4.0.o
- 124 0 0 124 7c switch-4.1.o
- 124 0 0 124 7c switch-4.2.orig-HEAD.o
- 95 0 0 95 5f switch-4.3-HEAD.o
- 124 0 0 124 7c switch-4.3.orig-HEAD.o
- 166 0 0 166 a6 switch-CHAIN-2.95.o
- 111 0 0 111 6f switch-CHAIN-3.3.o
- 95 0 0 95 5f switch-CHAIN-3.4.o
- 95 0 0 95 5f switch-CHAIN-4.0.o
- 95 0 0 95 5f switch-CHAIN-4.1.o
- 95 0 0 95 5f switch-CHAIN-4.2.orig-HEAD.o
- 95 0 0 95 5f switch-CHAIN-4.3-HEAD.o
- 95 0 0 95 5f switch-CHAIN-4.3.orig-HEAD.o
-
-
-Content-Type: text/x-diff; charset=us-ascii
-Content-Disposition: attachment; filename="gcc-4.3.gcc-flatten-switch-stmt.00.diff"
-
---- a/gcc/stmt.c
-+++ b/gcc/stmt.c
-@@ -2574,7 +2574,11 @@ expand_case (tree exp)
- use_cost_table
- = (TREE_CODE (orig_type) != ENUMERAL_TYPE
- && estimate_case_costs (case_list));
-- balance_case_nodes (&case_list, NULL);
-+ /* When optimizing for size, we want a straight list to avoid
-+ jumps as much as possible. This basically creates an if-else
-+ chain. */
-+ if (!optimize_size)
-+ balance_case_nodes (&case_list, NULL);
- emit_case_nodes (index, case_list, default_label, index_type);
- emit_jump (default_label);
- }
-@@ -3136,6 +3140,7 @@ emit_case_nodes (rtx index, case_node_pt
- {
- if (!node_has_low_bound (node, index_type))
- {
-+ if (!optimize_size) /* don't jl to the .default_label. */
- emit_cmp_and_jump_insns (index,
- convert_modes
- (mode, imode,
diff --git a/toolchain/gcc/patches/llvm/910-mbsd_multi.patch b/toolchain/gcc/patches/llvm/910-mbsd_multi.patch
deleted file mode 100644
index ef3b53236..000000000
--- a/toolchain/gcc/patches/llvm/910-mbsd_multi.patch
+++ /dev/null
@@ -1,278 +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.
- * Make -fno-strict-aliasing and -fno-delete-null-pointer-checks
- the default for -O2/-Os, because they trigger gcc bugs
- and can delete code with security implications.
-
- This patch was authored by Thorsten Glaser <tg@mirbsd.de>
- with copyright assignment to the FSF in effect.
-
---- a/gcc/c-opts.c
-+++ b/gcc/c-opts.c
-@@ -109,6 +109,9 @@ static size_t deferred_count;
- /* Number of deferred options scanned for -include. */
- static size_t include_cursor;
-
-+/* Check if a port honours COPTS. */
-+static int honour_copts = 0;
-+
- static void set_Wimplicit (int);
- static void handle_OPT_d (const char *);
- static void set_std_cxx98 (int);
-@@ -502,6 +505,14 @@ c_common_handle_option (size_t scode, co
- mesg_implicit_function_declaration = 2;
- break;
-
-+ case OPT_Werror_maybe_reset:
-+ {
-+ char *ev = getenv ("GCC_NO_WERROR");
-+ if ((ev != NULL) && (*ev != '0'))
-+ cpp_opts->warnings_are_errors = 0;
-+ }
-+ break;
-+
- case OPT_Wformat:
- set_Wformat (value);
- break;
-@@ -778,6 +789,12 @@ c_common_handle_option (size_t scode, co
- flag_exceptions = value;
- break;
-
-+ case OPT_fhonour_copts:
-+ if (c_language == clk_c) {
-+ honour_copts++;
-+ }
-+ break;
-+
- case OPT_fimplement_inlines:
- flag_implement_inlines = value;
- break;
-@@ -1295,6 +1312,47 @@ c_common_init (void)
- /* Has to wait until now so that cpplib has its hash table. */
- init_pragma ();
-
-+ 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 ("someone does not honour COPTS correctly, passed %d times",
-+ honour_copts);
-+ }
-+ }
-+
- return true;
- }
-
---- a/gcc/c.opt
-+++ b/gcc/c.opt
-@@ -220,6 +220,10 @@ C ObjC C++ ObjC++
- Warn about extra tokens at the end of prepreprocessor directives
- ; APPLE LOCAL end -Wextra-tokens
-
-+Werror-maybe-reset
-+C ObjC C++ ObjC++
-+; Documented in common.opt
-+
- Wfloat-equal
- C ObjC C++ ObjC++ Var(warn_float_equal)
- Warn if testing floating point numbers for equality
-@@ -675,6 +679,9 @@ C++ ObjC++
- fhonor-std
- C++ ObjC++
-
-+fhonour-copts
-+C ObjC C++ ObjC++ RejectNegative
-+
- fhosted
- C ObjC
- Assume normal C execution environment
---- a/gcc/common.opt
-+++ b/gcc/common.opt
-@@ -81,6 +81,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
- Print extra (possibly unwanted) warnings
-@@ -607,6 +611,9 @@ Common Report Var(flag_guess_branch_prob
- Enable guessing of branch probabilities
- ; APPLE LOCAL end optimization pragmas 3124235/3420242
-
-+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
-@@ -507,9 +507,6 @@ void set_flags_from_O (unsigned int cmdl
- #endif
- flag_regmove = 1;
- /* APPLE LOCAL optimization pragmas 3124235/3420242 */
-- if (cmdline) flag_strict_aliasing = 1;
-- flag_strict_overflow = 1;
-- flag_delete_null_pointer_checks = 1;
- flag_reorder_blocks = 1;
- /* APPLE LOCAL optimization pragmas 3124235/3420242 */
- if (cmdline) flag_reorder_functions = 1;
-@@ -536,6 +533,9 @@ void set_flags_from_O (unsigned int cmdl
-
- if (optimize >= 3)
- {
-+ if (cmdline) flag_strict_aliasing = 1;
-+ flag_strict_overflow = 1;
-+ flag_delete_null_pointer_checks = 1;
- if (cmdline)
- flag_inline_functions = 1;
- flag_unswitch_loops = 1;
-@@ -873,6 +873,17 @@ common_handle_option (size_t scode, cons
- }
- 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_Wextra:
- set_Wextra (value);
- break;
---- a/gcc/doc/cppopts.texi
-+++ b/gcc/doc/cppopts.texi
-@@ -166,6 +166,11 @@ in older programs. This warning is on b
- Make all warnings into hard errors. Source code which triggers warnings
- will be rejected.
-
-+@item -Werror-maybe-reset
-+@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
-@@ -282,7 +282,7 @@ Objective-C and Objective-C++ Dialects}.
- -Wc++-compat -Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment @gol
- -Wconversion -Wno-deprecated-declarations @gol
- -Wdisabled-optimization -Wno-div-by-zero -Wno-endif-labels @gol
---Werror -Werror=* -Werror-implicit-function-declaration @gol
-+-Werror -Werror-maybe-reset -Werror=* -Werror-implicit-function-declaration @gol
- @c APPLE LOCAL default to Wformat-security 5764921
- -Wfatal-errors -Wfloat-equal -Wno-format -Wformat=2 @gol
- -Wno-format-extra-args -Wformat-nonliteral @gol
-@@ -4031,6 +4031,22 @@ Note that specifying @option{-Werror=}@v
- @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
- imply anything.
-
-+@item -Werror-maybe-reset
-+@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 -fhonour-copts
-+@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
- This option is only active when @option{-fstack-protector} is active. It
-@@ -5533,7 +5549,7 @@ second branch or a point immediately fol
- the condition is known to be true or false.
-
- @c APPLE LOCAL 4231761 -Oz
--Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, @option{-Oz} (APPLE ONLY).
-+Enabled at levels @option{-O3}, @option{-Oz} (APPLE ONLY).
-
- @item -fcse-follow-jumps
- @opindex fcse-follow-jumps
-@@ -5659,7 +5675,7 @@ safely dereference null pointers. Use
- for programs which depend on that behavior.
-
- @c APPLE LOCAL 4231761 -Oz
--Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, @option{-Oz} (APPLE ONLY).
-+Enabled at levels @option{-O3}, @option{-Oz} (APPLE ONLY).
-
- @item -fexpensive-optimizations
- @opindex fexpensive-optimizations
-@@ -6103,7 +6119,7 @@ allowed to alias. For an example, see t
- @code{c_get_alias_set}.
-
- @c APPLE LOCAL 4231761 -Oz
--Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, @option{-Oz} (APPLE ONLY).
-+Enabled at levels @option{-O3}, @option{-Oz} (APPLE ONLY).
-
- @item -fstrict-overflow
- @opindex fstrict-overflow
---- a/gcc/java/jvspec.c
-+++ b/gcc/java/jvspec.c
-@@ -632,6 +632,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/llvm/910-soft-float.patch b/toolchain/gcc/patches/llvm/910-soft-float.patch
deleted file mode 100644
index d0ccd8d6b..000000000
--- a/toolchain/gcc/patches/llvm/910-soft-float.patch
+++ /dev/null
@@ -1,25 +0,0 @@
---- a/gcc/config/arm/linux-elf.h
-+++ b/gcc/config/arm/linux-elf.h
-@@ -63,7 +63,7 @@
- %{shared:-lc} \
- %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
-
--#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc"
-+#define LIBGCC_SPEC "-lgcc"
-
- #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
-
---- a/gcc/config/arm/t-linux
-+++ b/gcc/config/arm/t-linux
-@@ -4,7 +4,10 @@ TARGET_LIBGCC2_CFLAGS = -fomit-frame-poi
- LIBGCC2_DEBUG_CFLAGS = -g0
-
- LIB1ASMSRC = arm/lib1funcs.asm
--LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx
-+LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \
-+ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
-+ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
-+ _fixsfsi _fixunssfsi _floatdidf _floatundidf _floatdisf _floatundisf
-
- # MULTILIB_OPTIONS = mhard-float/msoft-float
- # MULTILIB_DIRNAMES = hard-float soft-float
diff --git a/toolchain/gcc/patches/llvm/920-soft-float.patch b/toolchain/gcc/patches/llvm/920-soft-float.patch
deleted file mode 100644
index c41836483..000000000
--- a/toolchain/gcc/patches/llvm/920-soft-float.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-http://bugs.uclibc.org/view.php?id=1588
-
---- a/gcc/config/rs6000/darwin-ldouble.c
-+++ b/gcc/config/rs6000/darwin-ldouble.c
-@@ -70,6 +70,8 @@ Software Foundation, 51 Franklin Street,
- but GCC currently generates poor code when a union is used to turn
- a long double into a pair of doubles. */
-
-+#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__)
-+
- long double __gcc_qadd (double, double, double, double);
- long double __gcc_qsub (double, double, double, double);
- long double __gcc_qmul (double, double, double, double);
-@@ -219,8 +221,6 @@ __gcc_qdiv (double a, double b, double c
- return z.ldval;
- }
-
--#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__)
--
- long double __gcc_qneg (double, double);
- int __gcc_qeq (double, double, double, double);
- int __gcc_qne (double, double, double, double);
diff --git a/toolchain/gcc/patches/llvm/930-eabi_fixes.patch b/toolchain/gcc/patches/llvm/930-eabi_fixes.patch
deleted file mode 100644
index 10d879c1d..000000000
--- a/toolchain/gcc/patches/llvm/930-eabi_fixes.patch
+++ /dev/null
@@ -1,32 +0,0 @@
---- a/gcc/config.gcc
-+++ b/gcc/config.gcc
-@@ -760,7 +760,7 @@ arm*-*-netbsd*)
- extra_parts=""
- use_collect2=yes
- ;;
--arm*-*-linux*) # ARM GNU/Linux with ELF
-+arm*-linux*) # ARM GNU/Linux with ELF
- tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
- tmake_file="${tmake_file} t-linux arm/t-arm"
- case ${target} in
-@@ -769,7 +769,7 @@ arm*-*-linux*) # ARM GNU/Linux with EL
- ;;
- esac
- case ${target} in
-- arm*-*-linux-*eabi)
-+ arm*-linux-*eabi)
- tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
- tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"
- # The BPABI long long divmod functions return a 128-bit value in
---- a/gcc/config/arm/linux-eabi.h
-+++ b/gcc/config/arm/linux-eabi.h
-@@ -48,7 +48,8 @@
- #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
-
- #undef SUBTARGET_EXTRA_LINK_SPEC
--#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi"
-+#define SUBTARGET_EXTRA_LINK_SPEC \
-+ " %{mbig-endian:-m armelfb_linux_eabi} %{mlittle-endian:-m armelf_linux_eabi} "
-
- /* Use ld-linux.so.3 so that it will be possible to run "classic"
- GNU/Linux binaries on an EABI system. */
diff --git a/toolchain/gcc/patches/llvm/951-bug_37014.patch b/toolchain/gcc/patches/llvm/951-bug_37014.patch
deleted file mode 100644
index 9f8aaf742..000000000
--- a/toolchain/gcc/patches/llvm/951-bug_37014.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37014
-
---- a/gcc/dojump.c
-+++ b/gcc/dojump.c
-@@ -307,8 +307,6 @@ do_jump (tree exp, rtx if_false_label, r
- break;
- }
-
-- case TRUTH_ANDIF_EXPR:
-- case TRUTH_ORIF_EXPR:
- case COMPOUND_EXPR:
- /* Lowered by gimplify.c. */
- gcc_unreachable ();
-@@ -518,6 +516,7 @@ do_jump (tree exp, rtx if_false_label, r
- if (BRANCH_COST >= 4 || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1)))
- goto normal;
-
-+ case TRUTH_ANDIF_EXPR:
- if (if_false_label == NULL_RTX)
- {
- drop_through_label = gen_label_rtx ();
-@@ -538,6 +537,7 @@ do_jump (tree exp, rtx if_false_label, r
- if (BRANCH_COST >= 4 || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1)))
- goto normal;
-
-+ case TRUTH_ORIF_EXPR:
- if (if_true_label == NULL_RTX)
- {
- drop_through_label = gen_label_rtx ();
---- a/gcc/expr.c
-+++ b/gcc/expr.c
-@@ -8634,7 +8634,10 @@ expand_expr_real_1 (tree exp, rtx target
- /* If no set-flag instruction, must generate a conditional store
- into a temporary variable. Drop through and handle this
- like && and ||. */
--
-+ /* Although TRUTH_{AND,OR}IF_EXPR aren't present in GIMPLE, they
-+ are occassionally created by folding during expansion. */
-+ case TRUTH_ANDIF_EXPR:
-+ case TRUTH_ORIF_EXPR:
- if (! ignore
- && (target == 0
- || modifier == EXPAND_STACK_PARM
-@@ -8832,8 +8835,6 @@ expand_expr_real_1 (tree exp, rtx target
- case POSTDECREMENT_EXPR:
- case LOOP_EXPR:
- case EXIT_EXPR:
-- case TRUTH_ANDIF_EXPR:
-- case TRUTH_ORIF_EXPR:
- /* Lowered by gimplify.c. */
- gcc_unreachable ();
-
---- /dev/null
-+++ b/gcc/testsuite/gcc.c-torture/compile/20080812-1.c
-@@ -0,0 +1,21 @@
-+/* PR middle-end/37014 */
-+
-+void bar (signed char *);
-+
-+void
-+foo (int x, int y)
-+{
-+ int i;
-+ signed char a[123], b[123], c;
-+ for (i = 0; i < 123; i++)
-+ {
-+ int e = y - x;
-+ int d = e < 0 ? -e : e;
-+ c = d < 75;
-+ a[y] = c;
-+ b[y] = c;
-+ y--;
-+ }
-+ bar (b);
-+ bar (a);
-+}
diff --git a/toolchain/gcc/patches/llvm/952-bug_34762.patch b/toolchain/gcc/patches/llvm/952-bug_34762.patch
deleted file mode 100644
index f17d8d2e2..000000000
--- a/toolchain/gcc/patches/llvm/952-bug_34762.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34762
-
---- a/gcc/reload.c
-+++ b/gcc/reload.c
-@@ -4817,7 +4817,7 @@ find_reloads_address (enum machine_mode
- find_reloads_address (GET_MODE (tem), &tem, XEXP (tem, 0),
- &XEXP (tem, 0), opnum,
- ADDR_TYPE (type), ind_levels, insn);
-- if (tem != orig)
-+ if (!rtx_equal_p (tem, orig))
- push_reg_equiv_alt_mem (regno, tem);
- }
- /* We can avoid a reload if the register's equivalent memory
-@@ -5617,7 +5617,7 @@ find_reloads_address_1 (enum machine_mod
- RELOAD_OTHER,
- ind_levels, insn);
-
-- if (tem != orig)
-+ if (!rtx_equal_p (tem, orig))
- push_reg_equiv_alt_mem (regno, tem);
-
- /* Then reload the memory location into a base
-@@ -5684,7 +5684,7 @@ find_reloads_address_1 (enum machine_mod
- find_reloads_address (GET_MODE (tem), &tem, XEXP (tem, 0),
- &XEXP (tem, 0), opnum, type,
- ind_levels, insn);
-- if (tem != orig)
-+ if (!rtx_equal_p (tem, orig))
- push_reg_equiv_alt_mem (regno, tem);
- /* Put this inside a new increment-expression. */
- x = gen_rtx_fmt_e (GET_CODE (x), GET_MODE (x), tem);
-@@ -5876,7 +5876,7 @@ find_reloads_address_1 (enum machine_mod
- find_reloads_address (GET_MODE (x), &x, XEXP (x, 0),
- &XEXP (x, 0), opnum, ADDR_TYPE (type),
- ind_levels, insn);
-- if (x != tem)
-+ if (!rtx_equal_p (x, tem))
- push_reg_equiv_alt_mem (regno, x);
- }
- }
-@@ -6104,7 +6104,7 @@ find_reloads_subreg_address (rtx x, int
- XEXP (tem, 0), &XEXP (tem, 0),
- opnum, type, ind_levels, insn);
- /* ??? Do we need to handle nonzero offsets somehow? */
-- if (!offset && tem != orig)
-+ if (!offset && !rtx_equal_p (tem, orig))
- push_reg_equiv_alt_mem (regno, tem);
-
- /* For some processors an address may be valid in the
diff --git a/toolchain/gcc/patches/llvm/960-apple_no_m32.patch b/toolchain/gcc/patches/llvm/960-apple_no_m32.patch
deleted file mode 100644
index 62376b381..000000000
--- a/toolchain/gcc/patches/llvm/960-apple_no_m32.patch
+++ /dev/null
@@ -1,28 +0,0 @@
---- a/configure
-+++ b/configure
-@@ -1833,11 +1833,6 @@ case "${host}" in
- # APPLE LOCAL begin dynamic-no-pic
- i[3456789]86-*-darwin*)
- host_makefile_frag="config/mh-x86-darwin"
-- # gcc can default to x86_64 code generation, avoid that
-- if test "${build}" = "${host}"; then
-- CC="${CC-gcc} -m32"
-- CXX="${CXX-g++} -m32"
-- fi
- ;;
- # APPLE LOCAL end dynamic-no-pic
- powerpc-*-aix*)
---- a/configure.in
-+++ b/configure.in
-@@ -993,11 +993,6 @@ case "${host}" in
- # APPLE LOCAL begin dynamic-no-pic
- i[[3456789]]86-*-darwin*)
- host_makefile_frag="config/mh-x86-darwin"
-- # gcc can default to x86_64 code generation, avoid that
-- if test "${build}" = "${host}"; then
-- CC="${CC-gcc} -m32"
-- CXX="${CXX-g++} -m32"
-- fi
- ;;
- # APPLE LOCAL end dynamic-no-pic
- powerpc-*-aix*)
diff --git a/toolchain/gcc/patches/llvm/961-llvm_mips_compile_fix.patch b/toolchain/gcc/patches/llvm/961-llvm_mips_compile_fix.patch
deleted file mode 100644
index 161bd33e9..000000000
--- a/toolchain/gcc/patches/llvm/961-llvm_mips_compile_fix.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- a/gcc/config/mips/llvm-mips-target.h
-+++ b/gcc/config/mips/llvm-mips-target.h
-@@ -27,11 +27,11 @@ extern bool llvm_mips_should_pass_aggreg
- #define LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR(X, TY) \
- llvm_mips_should_pass_aggregate_in_memory(X, TY)
-
-+#endif /* LLVM_ABI_H */
-+
- /* LLVM_TARGET_NAME - This specifies the name of the target, which correlates to
- * the llvm::InitializeXXXTarget() function.
- */
- #define LLVM_TARGET_NAME Mips
-
--#endif /* LLVM_ABI_H */
--
- /* LLVM LOCAL end (ENTIRE FILE!) */