diff --git a/config/Config-build.in b/config/Config-build.in
index d184d1febc8b89346547fe72286effde6473c7e4..213609b8b2bf277659cd2e4eb1bf6d5046d6ead6 100644
--- a/config/Config-build.in
+++ b/config/Config-build.in
@@ -135,7 +135,7 @@ menu "Global build settings"
 	choice
 		prompt "Binary stripping method"
 		default USE_STRIP   if EXTERNAL_TOOLCHAIN
-		default USE_STRIP   if USE_GLIBC || USE_EGLIBC || USE_MUSL
+		default USE_STRIP   if USE_GLIBC || USE_MUSL
 		default USE_SSTRIP
 		help
 		  Select the binary stripping method you wish to use.
@@ -156,7 +156,6 @@ menu "Global build settings"
 			bool "sstrip"
 			depends on !DEBUG
 			depends on !USE_GLIBC
-			depends on !USE_EGLIBC
 			help
 			  This will install binaries stripped using sstrip.
 	endchoice
@@ -187,7 +186,7 @@ menu "Global build settings"
 
 	choice
 		prompt "Preferred standard C++ library"
-		default USE_LIBSTDCXX if USE_EGLIBC
+		default USE_LIBSTDCXX if USE_GLIBC
 		default USE_UCLIBCXX
 		help
 		  Select the preferred standard C++ library for all packages that support this.
diff --git a/include/package-defaults.mk b/include/package-defaults.mk
index 6a345b6fb9eb1001d7f4d57e5d3d19a5a393e25d..a94f2a4c063a29d3f4b7fd16088bbb4cfb29c8de 100644
--- a/include/package-defaults.mk
+++ b/include/package-defaults.mk
@@ -5,7 +5,7 @@
 # See /LICENSE for more information.
 #
 
-PKG_DEFAULT_DEPENDS = +libc +USE_EGLIBC:librt +USE_EGLIBC:libpthread
+PKG_DEFAULT_DEPENDS = +libc +USE_GLIBC:librt +USE_GLIBC:libpthread
 
 ifneq ($(PKG_NAME),toolchain)
   PKG_FIXUP_DEPENDS = $(if $(filter kmod-%,$(1)),$(2),$(PKG_DEFAULT_DEPENDS) $(filter-out $(PKG_DEFAULT_DEPENDS),$(2)))
diff --git a/include/version.mk b/include/version.mk
index 99af96e1df693071ecde316c5217b7bc039fc630..5cfeae235c59b982b855b8eead5ab8080fd97fb5 100644
--- a/include/version.mk
+++ b/include/version.mk
@@ -55,7 +55,7 @@ endef
 VERSION_TAINT_SPECS := \
 	-ALL:no-all \
 	-IPV6:no-ipv6 \
-	+USE_EGLIBC:eglibc \
+	+USE_GLIBC:glibc \
 	+USE_MKLIBS:mklibs \
 	+BUSYBOX_CUSTOM:busybox \
 	+OVERRIDE_PKGS:override \
diff --git a/package/libs/toolchain/Makefile b/package/libs/toolchain/Makefile
index 42b9935148fff347f97823d83a8aeba633e25477..a3f8a9f6fbdcf2016583e71435ab9524a9c4ab5d 100644
--- a/package/libs/toolchain/Makefile
+++ b/package/libs/toolchain/Makefile
@@ -420,12 +420,12 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
 	$(CP) $(TOOLCHAIN_DIR)/lib/libstdc++.so.* $(1)/usr/lib/
   endef
 
-  use_libutil=$(if $(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),libutil)
-  use_libnsl=$(if $(CONFIG_EGLIBC_OPTION_EGLIBC_NIS),libnsl)
-  use_nsswitch=$(if $(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH),libnss_dns libnss_files)
+  use_libutil=$(if $(CONFIG_GLIBC_USE_VERSION_2_21)$(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),libutil)
+  use_libnsl=$(if $(CONFIG_GLIBC_USE_VERSION_2_21)$(CONFIG_EGLIBC_OPTION_EGLIBC_NIS),libnsl)
+  use_nsswitch=$(if $(CONFIG_GLIBC_USE_VERSION_2_21)$(CONFIG_EGLIBC_OPTION_EGLIBC_NSSWITCH),libnss_dns libnss_files)
 
-  define Package/eglibc/install
-	$(CP) ./eglibc-files/* $(1)/
+  define Package/glibc/install
+	$(CP) ./glibc-files/* $(1)/
 	rm -f $(1)/etc/localtime
 	$(LN) /tmp/localtime $(1)/etc/localtime
 	$(INSTALL_DIR) $(1)/lib
diff --git a/package/libs/toolchain/glibc-files/etc/nsswitch.conf b/package/libs/toolchain/glibc-files/etc/nsswitch.conf
new file mode 100644
index 0000000000000000000000000000000000000000..981c425da6c6f70203bc4258661a7bd69bfc1eb5
--- /dev/null
+++ b/package/libs/toolchain/glibc-files/etc/nsswitch.conf
@@ -0,0 +1,13 @@
+passwd:files
+shadow:files
+group:files
+hosts:dns files
+bootparams:files
+ethers:files
+netmasks:files
+networks:files
+protocols:files
+rpc:files
+services:files
+automount:files
+aliases:files
diff --git a/toolchain/Config.in b/toolchain/Config.in
index ecd9d200f177860d693fb95360b36d480c5cb6ff..0d03a2872b205bf11068fcfae1ef2dc478822c22 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -211,14 +211,13 @@ comment "C Library"
 
 choice
 	prompt "C Library implementation" if TOOLCHAINOPTS
-	default LIBC_USE_EGLIBC if (aarch64 || aarch64_be)
-	default LIBC_USE_UCLIBC
+	default LIBC_USE_GLIBC if (aarch64 || aarch64_be)
 	help
 	  Select the C library implementation.
 
-	config LIBC_USE_EGLIBC
-		bool "Use eglibc"
-		select USE_EGLIBC
+	config LIBC_USE_GLIBC
+		bool "Use glibc"
+		select USE_GLIBC
 		depends on !avr32
 
 	config LIBC_USE_UCLIBC
@@ -233,7 +232,7 @@ choice
 
 endchoice
 
-source "toolchain/eglibc/Config.in"
+source "toolchain/glibc/Config.in"
 source "toolchain/uClibc/Config.in"
 source "toolchain/musl/Config.in"
 
@@ -256,7 +255,7 @@ config INSIGHT
 	help
 	  Enable if you want to build insight-gdb.
 
-config USE_EGLIBC
+config USE_GLIBC
 	bool
 	default y if !TOOLCHAINOPTS && !EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN && (aarch64 || aarch64_be || octeon)
 
@@ -273,26 +272,26 @@ config USE_EXTERNAL_LIBC
 
 source "toolchain/gcc/Config.version"
 
-source "toolchain/eglibc/Config.version"
+source "toolchain/glibc/Config.version"
 source "toolchain/uClibc/Config.version"
 source "toolchain/musl/Config.version"
 
 config LIBC
 	string
-	default "eglibc"  if USE_EGLIBC
+	default "glibc"   if USE_GLIBC
 	default "uClibc"  if USE_UCLIBC
 	default "musl"	  if USE_MUSL
 
 config LIBC_VERSION
 	string
-	default EGLIBC_VERSION  if USE_EGLIBC
+	default GLIBC_VERSION   if USE_GLIBC
 	default UCLIBC_VERSION  if USE_UCLIBC
 	default MUSL_VERSION	if USE_MUSL
 
 config TARGET_SUFFIX
 	string
-	default "gnueabi"         if USE_EGLIBC && (arm || armeb)
-	default "gnu"             if USE_EGLIBC && !(arm || armeb)
+	default "gnueabi"         if USE_GLIBC && (arm || armeb)
+	default "gnu"             if USE_GLIBC && !(arm || armeb)
 	default "uclibcgnueabi"   if USE_UCLIBC && (arm || armeb)
 	default "uclibc"          if USE_UCLIBC && !(arm || armeb)
 	default "muslgnueabi"     if USE_MUSL && (arm || armeb)
diff --git a/toolchain/eglibc/Config.in b/toolchain/eglibc/Config.in
deleted file mode 100644
index da71bd9ebebb18e34f66b859a109973196c11cf8..0000000000000000000000000000000000000000
--- a/toolchain/eglibc/Config.in
+++ /dev/null
@@ -1,22 +0,0 @@
-choice
-	prompt "eglibc version"
-	depends on TOOLCHAINOPTS && USE_EGLIBC
-	default EGLIBC_USE_VERSION_2_19
-	help
-	  Select the version of eglibc you wish to use.
-
-	config EGLIBC_USE_VERSION_2_15
-		bool "eglibc 2.15"
-		select EGLIBC_VERSION_2_15
-		depends on BROKEN
-
-	config EGLIBC_USE_VERSION_2_19
-		bool "eglibc 2.19"
-		select EGLIBC_VERSION_2_19
-
-endchoice
-
-menu "eglibc configuration"
-	depends on TOOLCHAINOPTS && USE_EGLIBC
-	source toolchain/eglibc/config/Config.in
-endmenu
diff --git a/toolchain/glibc/Config.in b/toolchain/glibc/Config.in
new file mode 100644
index 0000000000000000000000000000000000000000..72d306e7a49ada2db0349582a7bca9382cd7c662
--- /dev/null
+++ b/toolchain/glibc/Config.in
@@ -0,0 +1,26 @@
+choice
+	prompt "(e)glibc version"
+	depends on TOOLCHAINOPTS && USE_GLIBC
+	default EGLIBC_USE_VERSION_2_19
+	help
+	  Select the version of glibc you wish to use.
+
+	config EGLIBC_USE_VERSION_2_15
+		bool "eglibc 2.15"
+		select EGLIBC_VERSION_2_15
+		depends on BROKEN
+
+	config EGLIBC_USE_VERSION_2_19
+		bool "eglibc 2.19"
+		select EGLIBC_VERSION_2_19
+
+	config GLIBC_USE_VERSION_2_21
+		bool "glibc 2.21"
+		select GLIBC_VERSION_2_21
+
+endchoice
+
+menu "eglibc configuration"
+	depends on TOOLCHAINOPTS && USE_GLIBC && (EGLIBC_USE_VERSION_2_15 || EGLIBC_USE_VERSION_2_19)
+	source toolchain/glibc/config/Config.in
+endmenu
diff --git a/toolchain/eglibc/Config.version b/toolchain/glibc/Config.version
similarity index 59%
rename from toolchain/eglibc/Config.version
rename to toolchain/glibc/Config.version
index 3c0f0efe3ccac7ebca531ef00c00eff300c96a1b..b4b2fcb4d221e7664e949ab1397ce6268f345399 100644
--- a/toolchain/eglibc/Config.version
+++ b/toolchain/glibc/Config.version
@@ -1,9 +1,10 @@
-if USE_EGLIBC
+if USE_GLIBC
 
-config EGLIBC_VERSION
+config GLIBC_VERSION
 	string
 	default "2.15" if EGLIBC_VERSION_2_15
 	default "2.19" if EGLIBC_VERSION_2_19
+	default "2.21" if GLIBC_VERSION_2_21
 
 config EGLIBC_VERSION_2_15
 	bool
@@ -12,15 +13,15 @@ config EGLIBC_VERSION_2_19
 	default y if !TOOLCHAINOPTS
 	bool
 
-config EGLIBC_REVISION
+config GLIBC_VERSION_2_21
+	default y if !TOOLCHAINOPTS
+	bool
+
+config GLIBC_REVISION
 	string
 	default "18909" if EGLIBC_VERSION_2_15
 	default "25243" if EGLIBC_VERSION_2_19
+	default "4e42b5b8f8" if GLIBC_VERSION_2_21
 	default ""
 
 endif
-
-menu "eglibc configuration"
-	depends on !TOOLCHAINOPTS && USE_EGLIBC
-	source toolchain/eglibc/config/Config.in
-endmenu
diff --git a/toolchain/eglibc/Makefile b/toolchain/glibc/Makefile
similarity index 100%
rename from toolchain/eglibc/Makefile
rename to toolchain/glibc/Makefile
diff --git a/toolchain/eglibc/common.mk b/toolchain/glibc/common.mk
similarity index 77%
rename from toolchain/eglibc/common.mk
rename to toolchain/glibc/common.mk
index 9ef92c6667af0f4e80189e997396638f25de43c6..e985de61b957f77492a8bd7b6a4d38bad17019f2 100644
--- a/toolchain/eglibc/common.mk
+++ b/toolchain/glibc/common.mk
@@ -6,19 +6,27 @@
 #
 include $(TOPDIR)/rules.mk
 
-PKG_NAME:=eglibc
-PKG_VERSION:=$(call qstrip,$(CONFIG_EGLIBC_VERSION))
-PKG_REVISION:=$(call qstrip,$(CONFIG_EGLIBC_REVISION))
+PKG_NAME:=glibc
+PKG_VERSION:=$(call qstrip,$(CONFIG_GLIBC_VERSION))
+PKG_REVISION:=$(call qstrip,$(CONFIG_GLIBC_REVISION))
 
-PKG_SOURCE_PROTO:=svn
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=git://sourceware.org/git/glibc.git
 PKG_SOURCE_VERSION:=$(PKG_REVISION)
 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-r$(PKG_REVISION)
 PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.bz2
 
+GLIBC_PATH:=
 ifneq ($(CONFIG_EGLIBC_VERSION_2_15),)
+  GLIBC_PATH:=libc/
+  PKG_SOURCE_PROTO:=svn
+  PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.bz2
   PKG_SOURCE_URL:=svn://svn.eglibc.org/branches/eglibc-2_15
 endif
 ifneq ($(CONFIG_EGLIBC_VERSION_2_19),)
+  GLIBC_PATH:=libc/
+  PKG_SOURCE_PROTO:=svn
+  PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.bz2
   PKG_SOURCE_URL:=svn://svn.eglibc.org/branches/eglibc-2_19
 endif
 
@@ -32,7 +40,7 @@ include $(INCLUDE_DIR)/toolchain-build.mk
 HOST_STAMP_PREPARED:=$(HOST_BUILD_DIR)/.prepared
 HOST_STAMP_CONFIGURED:=$(CUR_BUILD_DIR)/.configured
 HOST_STAMP_BUILT:=$(CUR_BUILD_DIR)/.built
-HOST_STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.eglibc_$(VARIANT)_installed
+HOST_STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.glibc_$(VARIANT)_installed
 
 ifeq ($(ARCH),mips64)
   ifdef CONFIG_MIPS64_ABI_N64
@@ -46,18 +54,19 @@ ifeq ($(ARCH),mips64)
   endif
 endif
 
-EGLIBC_CONFIGURE:= \
+GLIBC_CONFIGURE:= \
 	BUILD_CC="$(HOSTCC)" \
 	$(TARGET_CONFIGURE_OPTS) \
 	CFLAGS="$(TARGET_CFLAGS)" \
 	libc_cv_slibdir="/lib" \
 	use_ldconfig=no \
-	$(HOST_BUILD_DIR)/libc/configure \
+	$(HOST_BUILD_DIR)/$(GLIBC_PATH)configure \
 		--prefix= \
 		--build=$(GNU_HOST_NAME) \
 		--host=$(REAL_GNU_TARGET_NAME) \
 		--with-headers=$(TOOLCHAIN_DIR)/include \
 		--disable-profile \
+		--disable-werror \
 		--without-gd \
 		--without-cvs \
 		--enable-add-ons \
@@ -69,31 +78,37 @@ export HOST_CFLAGS := $(HOST_CFLAGS) -idirafter $(CURDIR)/$(PATH_PREFIX)/include
 
 define Host/SetToolchainInfo
 	$(SED) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR)/info.mk
+ifneq ($(CONFIG_GLIBC_VERSION_2_21),)
+	$(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.gnu.org/software/libc/,' $(TOOLCHAIN_DIR)/info.mk
+else
 	$(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.eglibc.org/,' $(TOOLCHAIN_DIR)/info.mk
+endif
 	$(SED) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
 	$(SED) 's,^\(LIBC_SO_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
 endef
 
 define Host/Configure
 	[ -f $(HOST_BUILD_DIR)/.autoconf ] || { \
-		cd $(HOST_BUILD_DIR)/libc; \
+		cd $(HOST_BUILD_DIR)/$(GLIBC_PATH); \
 		autoconf --force && \
 		touch $(HOST_BUILD_DIR)/.autoconf; \
 	}
 	mkdir -p $(CUR_BUILD_DIR)
 	grep 'CONFIG_EGLIBC_OPTION_' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_EGLIBC_\\(.*\\),\\1\\2,g" > $(CUR_BUILD_DIR)/option-groups.config
 	( cd $(CUR_BUILD_DIR); rm -f config.cache; \
-		$(EGLIBC_CONFIGURE) \
+		$(GLIBC_CONFIGURE) \
 	);
 endef
 
 define Host/Prepare
 	$(call Host/Prepare/Default)
 	ln -snf $(PKG_SOURCE_SUBDIR) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
+ifeq ($(CONFIG_GLIBC_VERSION_2_21),)
 	$(SED) 's,y,n,' $(HOST_BUILD_DIR)/libc/option-groups.defaults
 ifneq ($(CONFIG_EGLIBC_VERSION_2_15),)
 	ln -sf ../ports $(HOST_BUILD_DIR)/libc/
 endif
+endif
 endef
 
 define Host/Clean
diff --git a/toolchain/eglibc/config/Config.in b/toolchain/glibc/config/Config.in
similarity index 100%
rename from toolchain/eglibc/config/Config.in
rename to toolchain/glibc/config/Config.in
diff --git a/toolchain/eglibc/headers/Makefile b/toolchain/glibc/headers/Makefile
similarity index 100%
rename from toolchain/eglibc/headers/Makefile
rename to toolchain/glibc/headers/Makefile
diff --git a/toolchain/eglibc/include/libintl.h b/toolchain/glibc/include/libintl.h
similarity index 100%
rename from toolchain/eglibc/include/libintl.h
rename to toolchain/glibc/include/libintl.h
diff --git a/toolchain/eglibc/patches/2.15/001-fix_autoconf_macro.patch b/toolchain/glibc/patches/2.15/001-fix_autoconf_macro.patch
similarity index 100%
rename from toolchain/eglibc/patches/2.15/001-fix_autoconf_macro.patch
rename to toolchain/glibc/patches/2.15/001-fix_autoconf_macro.patch
diff --git a/toolchain/eglibc/patches/2.15/005-versions.patch b/toolchain/glibc/patches/2.15/005-versions.patch
similarity index 100%
rename from toolchain/eglibc/patches/2.15/005-versions.patch
rename to toolchain/glibc/patches/2.15/005-versions.patch
diff --git a/toolchain/eglibc/patches/2.15/050-all_glibc-2.14-leak-revert-crash.patch b/toolchain/glibc/patches/2.15/050-all_glibc-2.14-leak-revert-crash.patch
similarity index 100%
rename from toolchain/eglibc/patches/2.15/050-all_glibc-2.14-leak-revert-crash.patch
rename to toolchain/glibc/patches/2.15/050-all_glibc-2.14-leak-revert-crash.patch
diff --git a/toolchain/eglibc/patches/2.15/100-fix_cross_rpcgen.patch b/toolchain/glibc/patches/2.15/100-fix_cross_rpcgen.patch
similarity index 100%
rename from toolchain/eglibc/patches/2.15/100-fix_cross_rpcgen.patch
rename to toolchain/glibc/patches/2.15/100-fix_cross_rpcgen.patch
diff --git a/toolchain/eglibc/patches/2.15/110-fix_cross_zic.patch b/toolchain/glibc/patches/2.15/110-fix_cross_zic.patch
similarity index 100%
rename from toolchain/eglibc/patches/2.15/110-fix_cross_zic.patch
rename to toolchain/glibc/patches/2.15/110-fix_cross_zic.patch
diff --git a/toolchain/eglibc/patches/2.15/120-use_host_cflags.patch b/toolchain/glibc/patches/2.15/120-use_host_cflags.patch
similarity index 100%
rename from toolchain/eglibc/patches/2.15/120-use_host_cflags.patch
rename to toolchain/glibc/patches/2.15/120-use_host_cflags.patch
diff --git a/toolchain/eglibc/patches/2.15/200-add-dl-search-paths.patch b/toolchain/glibc/patches/2.15/200-add-dl-search-paths.patch
similarity index 100%
rename from toolchain/eglibc/patches/2.15/200-add-dl-search-paths.patch
rename to toolchain/glibc/patches/2.15/200-add-dl-search-paths.patch
diff --git a/toolchain/eglibc/patches/2.19/100-fix_cross_rpcgen.patch b/toolchain/glibc/patches/2.19/100-fix_cross_rpcgen.patch
similarity index 100%
rename from toolchain/eglibc/patches/2.19/100-fix_cross_rpcgen.patch
rename to toolchain/glibc/patches/2.19/100-fix_cross_rpcgen.patch
diff --git a/toolchain/eglibc/patches/2.19/200-add-dl-search-paths.patch b/toolchain/glibc/patches/2.19/200-add-dl-search-paths.patch
similarity index 100%
rename from toolchain/eglibc/patches/2.19/200-add-dl-search-paths.patch
rename to toolchain/glibc/patches/2.19/200-add-dl-search-paths.patch
diff --git a/toolchain/eglibc/patches/2.19/300-require-autoconf-2.69.patch b/toolchain/glibc/patches/2.19/300-require-autoconf-2.69.patch
similarity index 100%
rename from toolchain/eglibc/patches/2.19/300-require-autoconf-2.69.patch
rename to toolchain/glibc/patches/2.19/300-require-autoconf-2.69.patch
diff --git a/toolchain/glibc/patches/2.21/100-fix_cross_rpcgen.patch b/toolchain/glibc/patches/2.21/100-fix_cross_rpcgen.patch
new file mode 100644
index 0000000000000000000000000000000000000000..6a5e537b77a6a7c780b5ed44dbe5e9f172468a54
--- /dev/null
+++ b/toolchain/glibc/patches/2.21/100-fix_cross_rpcgen.patch
@@ -0,0 +1,52 @@
+--- a/sunrpc/rpc/types.h
++++ b/sunrpc/rpc/types.h
+@@ -75,18 +75,23 @@ typedef unsigned long rpcport_t;
+ #endif
+ 
+ #ifndef __u_char_defined
+-typedef __u_char u_char;
+-typedef __u_short u_short;
+-typedef __u_int u_int;
+-typedef __u_long u_long;
+-typedef __quad_t quad_t;
+-typedef __u_quad_t u_quad_t;
+-typedef __fsid_t fsid_t;
++typedef unsigned char u_char;
++typedef unsigned short u_short;
++typedef unsigned int u_int;
++typedef unsigned long u_long;
++#if __WORDSIZE == 64
++typedef long int quad_t;
++typedef unsigned long int u_quad_t;
++#elif defined __GLIBC_HAVE_LONG_LONG
++typedef long long int quad_t;
++typedef unsigned long long int u_quad_t;
++#endif
++typedef u_quad_t fsid_t;
+ # define __u_char_defined
+ #endif
+-#ifndef __daddr_t_defined
+-typedef __daddr_t daddr_t;
+-typedef __caddr_t caddr_t;
++#if !defined(__daddr_t_defined) && defined(linux)
++typedef long int daddr_t;
++typedef char *caddr_t;
+ # define __daddr_t_defined
+ #endif
+ 
+--- a/sunrpc/rpc_main.c
++++ b/sunrpc/rpc_main.c
+@@ -958,9 +958,10 @@ mkfile_output (struct commandline *cmd)
+ 	abort ();
+       temp = rindex (cmd->infile, '.');
+       cp = stpcpy (mkfilename, "Makefile.");
+-      if (temp != NULL)
+-	*((char *) stpncpy (cp, cmd->infile, temp - cmd->infile)) = '\0';
+-      else
++      if (temp != NULL) {
++        strncpy(cp, cmd->infile, temp - cmd->infile);
++        cp[temp - cmd->infile - 1] = 0;
++      } else
+ 	stpcpy (cp, cmd->infile);
+ 
+     }
diff --git a/toolchain/glibc/patches/2.21/200-add-dl-search-paths.patch b/toolchain/glibc/patches/2.21/200-add-dl-search-paths.patch
new file mode 100644
index 0000000000000000000000000000000000000000..a6200f783b7030c4a1459f2a0fb1755874df1c19
--- /dev/null
+++ b/toolchain/glibc/patches/2.21/200-add-dl-search-paths.patch
@@ -0,0 +1,14 @@
+add /usr/lib to default search path for the dynamic linker
+
+--- a/Makeconfig
++++ b/Makeconfig
+@@ -501,6 +501,9 @@ else
+ default-rpath = $(libdir)
+ endif
+ 
++# Add /usr/lib to default search path for the dynamic linker
++user-defined-trusted-dirs := /usr/lib
++
+ ifndef link-extra-libs
+ link-extra-libs = $(LDLIBS-$(@F))
+ link-extra-libs-static = $(link-extra-libs)
diff --git a/toolchain/patches/2.15/001-fix_autoconf_macro.patch b/toolchain/patches/2.15/001-fix_autoconf_macro.patch
new file mode 100644
index 0000000000000000000000000000000000000000..55b26c7dad97c08a2fb0826201762487981631e7
--- /dev/null
+++ b/toolchain/patches/2.15/001-fix_autoconf_macro.patch
@@ -0,0 +1,48 @@
+--- a/libc/aclocal.m4
++++ b/libc/aclocal.m4
+@@ -88,6 +88,12 @@
+ fi
+ rm -fr contest*])
+ 
++dnl Test a compiler option or options with an empty input file.
++dnl LIBC_TRY_CC_OPTION([options], [action-if-true], [action-if-false])
++AC_DEFUN([LIBC_TRY_CC_OPTION],
++[AS_IF([AC_TRY_COMMAND([${CC-cc} $1 -xc /dev/null -S -o /dev/null])],
++ [$2], [$3])])
++
+ AC_DEFUN([LIBC_PROG_BINUTILS],
+ [# Was a --with-binutils option given?
+ if test -n "$path_binutils"; then
+--- a/libc/configure
++++ b/libc/configure
+@@ -7404,7 +7404,14 @@
+ else
+   libc_cv_cc_nofma=
+ for opt in -ffp-contract=off -mno-fused-madd; do
+-  LIBC_TRY_CC_OPTION($opt, libc_cv_cc_nofma=$opt; break)
++  if { ac_try='${CC-cc} $opt -xc /dev/null -S -o /dev/null'
++  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
++  (eval $ac_try) 2>&5
++  ac_status=$?
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; }; then :
++  libc_cv_cc_nofma=$opt; break
++fi
+ done
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_nofma" >&5
+--- a/libc/configure.in
++++ b/libc/configure.in
+@@ -2238,10 +2238,9 @@
+ 		 libc_cv_cc_submachine, [dnl
+   libc_cv_cc_submachine=no
+   for opt in "-march=$submachine" "-mcpu=$submachine"; do
+-    if AC_TRY_COMMAND([${CC-cc} $opt -xc /dev/null -S -o /dev/null]); then
++    LIBC_TRY_CC_OPTION([$opt], [
+       libc_cv_cc_submachine="$opt"
+-      break
+-    fi
++      break], [])
+   done])
+   if test "x$libc_cv_cc_submachine" = xno; then
+     AC_MSG_ERROR([${CC-cc} does not support $submachine])
diff --git a/toolchain/patches/2.15/005-versions.patch b/toolchain/patches/2.15/005-versions.patch
new file mode 100644
index 0000000000000000000000000000000000000000..da9d2bacb59d5b2e03257c0433a2d25f4b57347b
--- /dev/null
+++ b/toolchain/patches/2.15/005-versions.patch
@@ -0,0 +1,11 @@
+--- a/libc/configure.in
++++ b/libc/configure.in
+@@ -1037,7 +1037,7 @@
+   critic_missing="$critic_missing gcc")
+ AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
+   [GNU Make[^0-9]*\([0-9][0-9.]*\)],
+-  [3.79* | 3.[89]*], critic_missing="$critic_missing make")
++  [3.79* | 3.[89]* | 4.* ], critic_missing="$critic_missing make")
+ 
+ AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
+   [GNU gettext.* \([0-9]*\.[0-9.]*\)],
diff --git a/toolchain/patches/2.15/050-all_glibc-2.14-leak-revert-crash.patch b/toolchain/patches/2.15/050-all_glibc-2.14-leak-revert-crash.patch
new file mode 100644
index 0000000000000000000000000000000000000000..d1e19aa448260223f767a57cc3e945eb4431a352
--- /dev/null
+++ b/toolchain/patches/2.15/050-all_glibc-2.14-leak-revert-crash.patch
@@ -0,0 +1,110 @@
+partially revert commit 4bff6e0175ed195871f4e01cc4c4c33274b8f6e3 - caused segmentation faults in dlopen
+
+References:
+http://comments.gmane.org/gmane.comp.lib.glibc.user/1227
+http://sourceware.org/ml/libc-alpha/2011-06/msg00006.html
+
+diff --git a/libc/elf/dl-close.c b/libc/elf/dl-close.c
+index 4b17bf8..733cc1b 100644
+--- a/libc/elf/dl-close.c
++++ b/libc/elf/dl-close.c
+@@ -119,17 +119,8 @@ _dl_close_worker (struct link_map *map)
+   if (map->l_direct_opencount > 0 || map->l_type != lt_loaded
+       || dl_close_state != not_pending)
+     {
+-      if (map->l_direct_opencount == 0)
+-	{
+-	  if (map->l_type == lt_loaded)
+-	    dl_close_state = rerun;
+-	  else if (map->l_type == lt_library)
+-	    {
+-	      struct link_map **oldp = map->l_initfini;
+-	      map->l_initfini = map->l_orig_initfini;
+-	      _dl_scope_free (oldp);
+-	    }
+-	}
++      if (map->l_direct_opencount == 0 && map->l_type == lt_loaded)
++	dl_close_state = rerun;
+ 
+       /* There are still references to this object.  Do nothing more.  */
+       if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_FILES, 0))
+diff --git a/libc/elf/dl-deps.c b/libc/elf/dl-deps.c
+index 51cb2fa..eddcbf0 100644
+--- a/libc/elf/dl-deps.c
++++ b/libc/elf/dl-deps.c
+@@ -489,6 +489,7 @@ _dl_map_object_deps (struct link_map *map,
+ 		  nneeded * sizeof needed[0]);
+ 	  atomic_write_barrier ();
+ 	  l->l_initfini = l_initfini;
++	  l->l_free_initfini = 1;
+ 	}
+ 
+       /* If we have no auxiliary objects just go on to the next map.  */
+@@ -689,6 +690,7 @@ Filters not supported with LD_TRACE_PRELINKING"));
+   l_initfini[nlist] = NULL;
+   atomic_write_barrier ();
+   map->l_initfini = l_initfini;
++  map->l_free_initfini = 1;
+   if (l_reldeps != NULL)
+     {
+       atomic_write_barrier ();
+@@ -697,7 +699,7 @@ Filters not supported with LD_TRACE_PRELINKING"));
+       _dl_scope_free (old_l_reldeps);
+     }
+   if (old_l_initfini != NULL)
+-      map->l_orig_initfini = old_l_initfini;
++    _dl_scope_free (old_l_initfini);
+ 
+   if (errno_reason)
+     _dl_signal_error (errno_reason == -1 ? 0 : errno_reason, objname,
+diff --git a/libc/elf/dl-libc.c b/libc/elf/dl-libc.c
+index f44fa10..7563093 100644
+--- a/libc/elf/dl-libc.c
++++ b/libc/elf/dl-libc.c
+@@ -284,6 +284,10 @@ libc_freeres_fn (free_mem)
+ 	      if (! old->dont_free)
+ 		free (old);
+ 	    }
++
++	  /* Free the initfini dependency list.  */
++	  if (l->l_free_initfini)
++	    free (l->l_initfini);
+ 	}
+ 
+       if (__builtin_expect (GL(dl_ns)[ns]._ns_global_scope_alloc, 0) != 0
+diff --git a/libc/elf/rtld.c b/libc/elf/rtld.c
+index b93a01f..2fc83ce 100644
+--- a/libc/elf/rtld.c
++++ b/libc/elf/rtld.c
+@@ -2277,6 +2277,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
+ 	      lnp->dont_free = 1;
+ 	      lnp = lnp->next;
+ 	    }
++	  l->l_free_initfini = 0;
+ 
+ 	  if (l != &GL(dl_rtld_map))
+ 	    _dl_relocate_object (l, l->l_scope, GLRO(dl_lazy) ? RTLD_LAZY : 0,
+diff --git a/libc/include/link.h b/libc/include/link.h
+index e877104..b1b4065 100644
+--- a/libc/include/link.h
++++ b/libc/include/link.h
+@@ -192,6 +192,9 @@ struct link_map
+ 						 during LD_TRACE_PRELINKING=1
+ 						 contains any DT_SYMBOLIC
+ 						 libraries.  */
++    unsigned int l_free_initfini:1; /* Nonzero if l_initfini can be
++				       freed, ie. not allocated with
++				       the dummy malloc in ld.so.  */
+ 
+     /* Collected information about own RPATH directories.  */
+     struct r_search_path_struct l_rpath_dirs;
+@@ -240,9 +243,6 @@ struct link_map
+ 
+     /* List of object in order of the init and fini calls.  */
+     struct link_map **l_initfini;
+-    /* The init and fini list generated at startup, saved when the
+-       object is also loaded dynamically.  */
+-    struct link_map **l_orig_initfini;
+ 
+     /* List of the dependencies introduced through symbol binding.  */
+     struct link_map_reldeps
diff --git a/toolchain/patches/2.15/100-fix_cross_rpcgen.patch b/toolchain/patches/2.15/100-fix_cross_rpcgen.patch
new file mode 100644
index 0000000000000000000000000000000000000000..8fe5cf3f7c233f8749982eaaaafd38b0c7532a33
--- /dev/null
+++ b/toolchain/patches/2.15/100-fix_cross_rpcgen.patch
@@ -0,0 +1,71 @@
+--- a/libc/sunrpc/proto.h
++++ b/libc/sunrpc/proto.h
+@@ -56,12 +56,14 @@ void add_type(int len, const char *type)
+    $build's C library and $host's GLIBC.  */
+ #ifdef _CROSS_RPCGEN_
+ 
++#undef stpcpy
++
+ /* Rather then defining _GNU_SOURCE before including $build's <string.h>
+    we just declare stpcpy here.  */
+ extern char *stpcpy (char *, const char *);
+ 
+-/* Use $build's i18n support as we can't use $host's.  */
+-#define _(X) (gettext (X))
++/* Do not use i18n support  */
++#define _(X) (X)
+ 
+ /* rpcgen sources check for __GNU_LIBRARY__ to tweak for GLIBC code
+    that rpcgen generates.  The proper fix would be to rename all those checks
+--- a/libc/sunrpc/rpc/types.h
++++ b/libc/sunrpc/rpc/types.h
+@@ -70,18 +70,23 @@ typedef unsigned long rpcport_t;
+ #endif
+ 
+ #ifndef __u_char_defined
+-typedef __u_char u_char;
+-typedef __u_short u_short;
+-typedef __u_int u_int;
+-typedef __u_long u_long;
+-typedef __quad_t quad_t;
+-typedef __u_quad_t u_quad_t;
+-typedef __fsid_t fsid_t;
++typedef unsigned char u_char;
++typedef unsigned short u_short;
++typedef unsigned int u_int;
++typedef unsigned long u_long;
++#if __WORDSIZE == 64
++typedef long int quad_t;
++typedef unsigned long int u_quad_t;
++#elif defined __GLIBC_HAVE_LONG_LONG
++typedef long long int quad_t;
++typedef unsigned long long int u_quad_t;
++#endif
++typedef u_quad_t fsid_t;
+ # define __u_char_defined
+ #endif
+-#ifndef __daddr_t_defined
+-typedef __daddr_t daddr_t;
+-typedef __caddr_t caddr_t;
++#if !defined(__daddr_t_defined) && defined(linux)
++typedef long int daddr_t;
++typedef char *caddr_t;
+ # define __daddr_t_defined
+ #endif
+ 
+--- a/libc/sunrpc/rpc_main.c
++++ b/libc/sunrpc/rpc_main.c
+@@ -997,9 +997,10 @@ mkfile_output (struct commandline *cmd)
+ 	abort ();
+       temp = rindex (cmd->infile, '.');
+       cp = stpcpy (mkfilename, "Makefile.");
+-      if (temp != NULL)
+-	*((char *) stpncpy (cp, cmd->infile, temp - cmd->infile)) = '\0';
+-      else
++      if (temp != NULL) {
++        strncpy(cp, cmd->infile, temp - cmd->infile);
++        cp[temp - cmd->infile - 1] = 0;
++      } else
+ 	stpcpy (cp, cmd->infile);
+ 
+     }
diff --git a/toolchain/patches/2.15/110-fix_cross_zic.patch b/toolchain/patches/2.15/110-fix_cross_zic.patch
new file mode 100644
index 0000000000000000000000000000000000000000..221eb28709af47c174b0262d9f5b04e29f3af748
--- /dev/null
+++ b/toolchain/patches/2.15/110-fix_cross_zic.patch
@@ -0,0 +1,27 @@
+--- a/libc/timezone/zic.c
++++ b/libc/timezone/zic.c
+@@ -8,6 +8,8 @@ static char	elsieid[] = "@(#)zic.c	8.19"
+ #ifdef CROSS_ZIC
+ #define REPORT_BUGS_TO ""
+ #define PKGVERSION ""
++#undef _
++#define _(X) (X)
+ #else
+ #include "config.h"
+ #endif
+@@ -490,6 +492,7 @@ char *	argv[];
+ #ifdef unix
+ 	(void) umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH));
+ #endif /* defined unix */
++#ifndef CROSS_ZIC
+ #if HAVE_GETTEXT
+ 	(void) setlocale(LC_ALL, "");
+ #ifdef TZ_DOMAINDIR
+@@ -497,6 +500,7 @@ char *	argv[];
+ #endif /* defined TEXTDOMAINDIR */
+ 	(void) textdomain(TZ_DOMAIN);
+ #endif /* HAVE_GETTEXT */
++#endif
+ 	progname = argv[0];
+ 	if (TYPE_BIT(zic_t) < 64) {
+ 		(void) fprintf(stderr, "%s: %s\n", progname,
diff --git a/toolchain/patches/2.15/120-use_host_cflags.patch b/toolchain/patches/2.15/120-use_host_cflags.patch
new file mode 100644
index 0000000000000000000000000000000000000000..4c58fb4fb4ab7899deabf6a83610f7161f7ea6f4
--- /dev/null
+++ b/toolchain/patches/2.15/120-use_host_cflags.patch
@@ -0,0 +1,22 @@
+--- a/libc/sunrpc/Makefile
++++ b/libc/sunrpc/Makefile
+@@ -175,7 +175,7 @@ $(objpfx)rpcgen: $(addprefix $(objpfx),$
+ 	$(+link)
+ 
+ $(addprefix $(objpfx)cross-,$(rpcgen-objs)): $(objpfx)cross-%.o: %.c
+-	gcc $< -c -D_RPC_THREAD_SAFE_ -D_CROSS_RPCGEN_ \
++	gcc $< -c -D_RPC_THREAD_SAFE_ -D_CROSS_RPCGEN_ $(HOST_CFLAGS) \
+ 		$(OUTPUT_OPTION) $(compile-mkdep-flags)
+ 
+ $(objpfx)cross-rpcgen: $(addprefix $(objpfx)cross-,$(rpcgen-objs))
+--- a/libc/timezone/Makefile
++++ b/libc/timezone/Makefile
+@@ -182,7 +182,7 @@ $(objpfx)zic: $(addprefix $(objpfx), $(z
+ 
+ $(addprefix $(objpfx)cross-,$(zic-objs)): $(objpfx)cross-%.o: %.c
+ 	gcc $< -c $(OUTPUT_OPTION) $(CFLAGS-$*.c) $(CPPFLAGS-$*) \
+-		-DCROSS_ZIC $(compile-mkdep-flags)
++		-DCROSS_ZIC $(HOST_CFLAGS) $(compile-mkdep-flags)
+ 
+ $(objpfx)cross-zic: $(addprefix $(objpfx)cross-,$(zic-objs))
+ 	gcc $(addprefix $(objpfx)cross-,$(zic-objs)) -o $@
diff --git a/toolchain/patches/2.15/200-add-dl-search-paths.patch b/toolchain/patches/2.15/200-add-dl-search-paths.patch
new file mode 100644
index 0000000000000000000000000000000000000000..70e7e604de6f67a3dfb1c3b9a0c73655b982e11f
--- /dev/null
+++ b/toolchain/patches/2.15/200-add-dl-search-paths.patch
@@ -0,0 +1,14 @@
+add /usr/lib to default search path for the dynamic linker
+
+--- a/libc/Makeconfig
++++ b/libc/Makeconfig
+@@ -539,6 +539,9 @@
+ default-rpath = $(libdir)
+ endif
+ 
++# Add /usr/lib to default search path for the dynamic linker
++user-defined-trusted-dirs := /usr/lib
++
+ ifndef link-extra-libs
+ link-extra-libs = $(LDLIBS-$(@F))
+ link-extra-libs-static = $(link-extra-libs)
diff --git a/toolchain/patches/2.19/100-fix_cross_rpcgen.patch b/toolchain/patches/2.19/100-fix_cross_rpcgen.patch
new file mode 100644
index 0000000000000000000000000000000000000000..5c0d45b53052bb0759de56c9147faf401118c97d
--- /dev/null
+++ b/toolchain/patches/2.19/100-fix_cross_rpcgen.patch
@@ -0,0 +1,52 @@
+--- a/libc/sunrpc/rpc/types.h
++++ b/libc/sunrpc/rpc/types.h
+@@ -75,18 +75,23 @@ typedef unsigned long rpcport_t;
+ #endif
+ 
+ #ifndef __u_char_defined
+-typedef __u_char u_char;
+-typedef __u_short u_short;
+-typedef __u_int u_int;
+-typedef __u_long u_long;
+-typedef __quad_t quad_t;
+-typedef __u_quad_t u_quad_t;
+-typedef __fsid_t fsid_t;
++typedef unsigned char u_char;
++typedef unsigned short u_short;
++typedef unsigned int u_int;
++typedef unsigned long u_long;
++#if __WORDSIZE == 64
++typedef long int quad_t;
++typedef unsigned long int u_quad_t;
++#elif defined __GLIBC_HAVE_LONG_LONG
++typedef long long int quad_t;
++typedef unsigned long long int u_quad_t;
++#endif
++typedef u_quad_t fsid_t;
+ # define __u_char_defined
+ #endif
+-#ifndef __daddr_t_defined
+-typedef __daddr_t daddr_t;
+-typedef __caddr_t caddr_t;
++#if !defined(__daddr_t_defined) && defined(linux)
++typedef long int daddr_t;
++typedef char *caddr_t;
+ # define __daddr_t_defined
+ #endif
+ 
+--- a/libc/sunrpc/rpc_main.c
++++ b/libc/sunrpc/rpc_main.c
+@@ -958,9 +958,10 @@ mkfile_output (struct commandline *cmd)
+ 	abort ();
+       temp = rindex (cmd->infile, '.');
+       cp = stpcpy (mkfilename, "Makefile.");
+-      if (temp != NULL)
+-	*((char *) stpncpy (cp, cmd->infile, temp - cmd->infile)) = '\0';
+-      else
++      if (temp != NULL) {
++        strncpy(cp, cmd->infile, temp - cmd->infile);
++        cp[temp - cmd->infile - 1] = 0;
++      } else
+ 	stpcpy (cp, cmd->infile);
+ 
+     }
diff --git a/toolchain/patches/2.19/200-add-dl-search-paths.patch b/toolchain/patches/2.19/200-add-dl-search-paths.patch
new file mode 100644
index 0000000000000000000000000000000000000000..fa192ca1cd148252496e10c9d91a53e814e098e8
--- /dev/null
+++ b/toolchain/patches/2.19/200-add-dl-search-paths.patch
@@ -0,0 +1,14 @@
+add /usr/lib to default search path for the dynamic linker
+
+--- a/libc/Makeconfig
++++ b/libc/Makeconfig
+@@ -501,6 +501,9 @@ else
+ default-rpath = $(libdir)
+ endif
+ 
++# Add /usr/lib to default search path for the dynamic linker
++user-defined-trusted-dirs := /usr/lib
++
+ ifndef link-extra-libs
+ link-extra-libs = $(LDLIBS-$(@F))
+ link-extra-libs-static = $(link-extra-libs)
diff --git a/toolchain/patches/2.19/300-require-autoconf-2.69.patch b/toolchain/patches/2.19/300-require-autoconf-2.69.patch
new file mode 100644
index 0000000000000000000000000000000000000000..623885ca8fa0bf279772b22fb543d497cae9522c
--- /dev/null
+++ b/toolchain/patches/2.19/300-require-autoconf-2.69.patch
@@ -0,0 +1,13 @@
+Index: eglibc-2.19-r25243/libc/aclocal.m4
+===================================================================
+--- eglibc-2.19-r25243.orig/libc/aclocal.m4	2013-11-06 15:03:08.000000000 -0800
++++ eglibc-2.19-r25243/libc/aclocal.m4	2014-11-22 15:43:05.343256863 -0800
+@@ -1,7 +1,7 @@
+ dnl We require that everyone use exactly the same Autoconf version so that
+ dnl the internal functions defined and used by the main configure script
+ dnl match those expected by the fragments.
+-m4_define([GLIBC_AUTOCONF_VERSION], [2.68])
++m4_define([GLIBC_AUTOCONF_VERSION], [2.69])
+ m4_if(m4_defn([AC_AUTOCONF_VERSION]), GLIBC_AUTOCONF_VERSION, [],
+       [m4_fatal(m4_flatten(
+ Exactly version GLIBC_AUTOCONF_VERSION of Autoconf is required but you have