aboutsummaryrefslogtreecommitdiffstats
path: root/toolchain/uClibc
diff options
context:
space:
mode:
authorJames <>2015-09-26 12:29:31 +0100
committerJames <>2015-09-26 12:29:31 +0100
commit626d9efa74685720020e816f3a917b7591d3cf7a (patch)
treed22eef73ae82287b30a1140decb4fc806d39d621 /toolchain/uClibc
downloadtrunk-47048-626d9efa74685720020e816f3a917b7591d3cf7a.tar.gz
trunk-47048-626d9efa74685720020e816f3a917b7591d3cf7a.tar.bz2
trunk-47048-626d9efa74685720020e816f3a917b7591d3cf7a.zip
trunk-47048
Diffstat (limited to 'toolchain/uClibc')
-rw-r--r--toolchain/uClibc/Config.in21
-rw-r--r--toolchain/uClibc/Config.version9
-rw-r--r--toolchain/uClibc/Makefile41
-rw-r--r--toolchain/uClibc/common.mk96
-rw-r--r--toolchain/uClibc/config-0.9.33.2/arm7
-rw-r--r--toolchain/uClibc/config-0.9.33.2/armeb7
-rw-r--r--toolchain/uClibc/config-0.9.33.2/common214
-rw-r--r--toolchain/uClibc/config-0.9.33.2/debug6
-rw-r--r--toolchain/uClibc/config-0.9.33.2/i38621
-rw-r--r--toolchain/uClibc/config-0.9.33.2/i68621
-rw-r--r--toolchain/uClibc/config-0.9.33.2/m68k6
-rw-r--r--toolchain/uClibc/config-0.9.33.2/mips17
-rw-r--r--toolchain/uClibc/config-0.9.33.2/mips6417
-rw-r--r--toolchain/uClibc/config-0.9.33.2/mips64.3218
-rw-r--r--toolchain/uClibc/config-0.9.33.2/mips64.6418
-rw-r--r--toolchain/uClibc/config-0.9.33.2/mips64.n3218
-rw-r--r--toolchain/uClibc/config-0.9.33.2/mips64el17
-rw-r--r--toolchain/uClibc/config-0.9.33.2/mips64el.3218
-rw-r--r--toolchain/uClibc/config-0.9.33.2/mips64el.6418
-rw-r--r--toolchain/uClibc/config-0.9.33.2/mips64el.n3218
-rw-r--r--toolchain/uClibc/config-0.9.33.2/mipsel17
-rw-r--r--toolchain/uClibc/config-0.9.33.2/mipsel.cobalt17
-rw-r--r--toolchain/uClibc/config-0.9.33.2/powerpc6
-rw-r--r--toolchain/uClibc/config-0.9.33.2/powerpc.e5006
-rw-r--r--toolchain/uClibc/config-0.9.33.2/sparc8
-rw-r--r--toolchain/uClibc/config-0.9.33.2/sparc.leon8
-rw-r--r--toolchain/uClibc/config-0.9.33.2/x86_646
-rw-r--r--toolchain/uClibc/headers/Makefile26
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/009_backport_mount.h-update.patch91
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/010-backport_sscanf_alloc.patch184
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/011-dlsym_rtld_next_fix.patch25
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/012-elf-Add-STT_GNU_IFUNC-from-glibc.patch37
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/020-endian.h-add-some-handy-macros-to-be-used-in-syscall.patch28
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/021-add-posix_madvise.c.patch48
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/022-libc-add-posix_fallocate.patch301
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/023-libc-add-fallocate-and-fallocate64.patch447
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/024-i386-bits-syscalls.h-allow-immediate-values-as-6th-s.patch25
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/025-libc-sync_file_range.patch57
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/100-fix_unifdef.patch11
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/110-compat_macros.patch51
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/120-adjtimex.patch14
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/131-inet-fix-__read_etc_hosts_r-segfault.patch10
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/132-inet_fix_res_init.patch15
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/133-inet6-scoped-getnameinfo.patch26
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/135-inet_fix_threaded_use_of_res_functions.patch126
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/136-inet_make_res_init_thread_safe.patch53
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/137-inet_fix_threaded_res_init.patch10
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/150-vasprintf_size_reduce.patch37
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/170-math_finite.patch23
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/180-pthread_cleanup_fix.patch45
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/190-nptl_use_arch_default_stack_limit.patch13
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/200-no_forced_unwind.patch10
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/210-mips_use_pic_crt1.patch11
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/350-use-fputs_unlocked.patch19
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/410-llvm_workaround.patch11
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/450-powerpc_copysignl.patch103
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/460-powerpc_ptrace_h.patch96
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/470-powerpc_syscall6.patch10
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/480-powerpc_rel24_support.patch26
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/500-eventfd.patch53
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/600-mips64_abi_selection.patch48
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/610-mips64_syscall_fix.patch285
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/611-mips_syscall_error_argument.patch99
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/612-mips64_relocation_fix.patch29
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/613-mips64_more_relocation_fixes.patch20
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/614-mips64_fix_setjmp_longjmp.patch99
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/615-mips_fix_sigev_pad_size.patch58
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/616-mips_fix_stat_time.patch123
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/617-mips_fix_setjmp_ptrsize.patch58
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/618-mips64_fix_syscall_error.patch36
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/619-mips64_fix_sysdep_cancel.patch195
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/960-remove_eabi_oabi_selection.patch32
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/970-add___kernel_long_and___kernel_ulong.patch320
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/981-fix_setting_arch_native_bit.patch28
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/990-no-stack-cache.patch11
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/991-gen_wctype.patch183
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/995-add-sigsys-to-siginfo_t-union.patch145
-rw-r--r--toolchain/uClibc/patches-0.9.33.2/999-eventfd_use_bits_scheme.patch248
-rw-r--r--toolchain/uClibc/utils/Makefile24
79 files changed, 4759 insertions, 0 deletions
diff --git a/toolchain/uClibc/Config.in b/toolchain/uClibc/Config.in
new file mode 100644
index 0000000..08ea00a
--- /dev/null
+++ b/toolchain/uClibc/Config.in
@@ -0,0 +1,21 @@
+# Choose uclibc version.
+
+choice
+ prompt "uClibc Version"
+ depends on TOOLCHAINOPTS && USE_UCLIBC
+ default UCLIBC_USE_VERSION_0_9_33
+ help
+ Select the version of uClibc you wish to use.
+
+ config UCLIBC_USE_VERSION_0_9_33
+ select UCLIBC_VERSION_0_9_33
+ bool "uClibc 0.9.33.2"
+
+endchoice
+
+# Debug version.
+
+config UCLIBC_ENABLE_DEBUG
+ bool "Build with debug information"
+ depends on TOOLCHAINOPTS && USE_UCLIBC
+ default n
diff --git a/toolchain/uClibc/Config.version b/toolchain/uClibc/Config.version
new file mode 100644
index 0000000..dd302f2
--- /dev/null
+++ b/toolchain/uClibc/Config.version
@@ -0,0 +1,9 @@
+config UCLIBC_VERSION
+ string
+ depends on USE_UCLIBC
+ default "0.9.33.2" if UCLIBC_VERSION_0_9_33
+ default "0.9.33.2"
+
+config UCLIBC_VERSION_0_9_33
+ default y if !TOOLCHAINOPTS && USE_UCLIBC
+ bool
diff --git a/toolchain/uClibc/Makefile b/toolchain/uClibc/Makefile
new file mode 100644
index 0000000..a5fb54b
--- /dev/null
+++ b/toolchain/uClibc/Makefile
@@ -0,0 +1,41 @@
+PATH_PREFIX=.
+
+include ./common.mk
+
+HOST_STAMP_BUILT:=$(HOST_BUILD_DIR)/.built
+HOST_STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.uclibc_installed
+
+HOST_BUILD_PARALLEL:=1
+
+define Host/SetToolchainInfo
+ $(SED) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR)/info.mk
+ $(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.uclibc.org/,' $(TOOLCHAIN_DIR)/info.mk
+ $(SED) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
+ $(SED) 's,^\(LIBC_SO_VERSION\)=.*,\1=$(LIBC_SO_VERSION),' $(TOOLCHAIN_DIR)/info.mk
+endef
+
+define Host/Compile
+ $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(HOST_BUILD_DIR)/Rules.mak
+ $(UCLIBC_MAKE) PREFIX= all
+endef
+
+define Host/Install
+ $(call Host/SetToolchainInfo)
+ $(UCLIBC_MAKE) PREFIX="$(TOOLCHAIN_DIR)/" install_runtime install_dev
+ $(CP) $(HOST_BUILD_DIR)/libc/libc_so.a $(TOOLCHAIN_DIR)/lib/
+ $(CP) $(HOST_BUILD_DIR)/libpthread/*/libpthread_so.a $(TOOLCHAIN_DIR)/lib/
+ ( cd $(TOOLCHAIN_DIR) ; \
+ for d in lib usr/lib ; do \
+ for f in libc.so libpthread.so libgcc_s.so ; do \
+ if [ -f $$$$d/$$$$f -a ! -L $$$$d/$$$$f ] ; then \
+ $(SED) 's,/usr/lib/,,g;s,/lib/,,g' $$$$d/$$$$f ; \
+ fi \
+ done \
+ done \
+ )
+ rm -f \
+ $(TOOLCHAIN_DIR)/lib/libresolv*.so* \
+ $(TOOLCHAIN_DIR)/lib/libnsl*.so*
+endef
+
+$(eval $(call HostBuild))
diff --git a/toolchain/uClibc/common.mk b/toolchain/uClibc/common.mk
new file mode 100644
index 0000000..53a8443
--- /dev/null
+++ b/toolchain/uClibc/common.mk
@@ -0,0 +1,96 @@
+#
+# Copyright (C) 2006-2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/target.mk
+
+PKG_NAME:=uClibc
+PKG_VERSION:=$(call qstrip,$(CONFIG_UCLIBC_VERSION))
+PKG_SOURCE_URL:=http://www.uclibc.org/downloads
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+LIBC_SO_VERSION:=$(PKG_VERSION)
+PATCH_DIR:=$(PATH_PREFIX)/patches-$(PKG_VERSION)
+CONFIG_DIR:=$(PATH_PREFIX)/config-$(PKG_VERSION)
+
+PKG_MD5SUM_0.9.33.2 = a338aaffc56f0f5040e6d9fa8a12eda1
+PKG_MD5SUM=$(PKG_MD5SUM_$(PKG_VERSION))
+
+HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/toolchain-build.mk
+
+UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
+ -e 's/i.86/i386/' \
+ -e 's/sparc.*/sparc/' \
+ -e 's/arm.*/arm/g' \
+ -e 's/m68k.*/m68k/' \
+ -e 's/ppc/powerpc/g' \
+ -e 's/v850.*/v850/g' \
+ -e 's/sh64/sh/' \
+ -e 's/sh[234].*/sh/' \
+ -e 's/mips.*/mips/' \
+ -e 's/mipsel.*/mips/' \
+)
+
+GEN_CONFIG=$(SCRIPT_DIR)/kconfig.pl -n \
+ $(if $(wildcard $(CONFIG_DIR)/common),'+' $(CONFIG_DIR)/common) \
+ $(if $(CONFIG_UCLIBC_ENABLE_DEBUG),$(if $(wildcard $(CONFIG_DIR)/debug),'+' $(CONFIG_DIR)/debug)) \
+ $(CONFIG_DIR)/$(ARCH)$(strip \
+ $(if $(wildcard $(CONFIG_DIR)/$(ARCH).$(BOARD)),.$(BOARD), \
+ $(if $(CONFIG_MIPS64_ABI),.$(subst ",,$(CONFIG_MIPS64_ABI)), \
+ $(if $(CONFIG_HAS_SPE_FPU),$(if $(wildcard $(CONFIG_DIR)/$(ARCH).e500),.e500)))))
+
+CPU_CFLAGS = \
+ -funsigned-char -fno-builtin -fno-asm \
+ --std=gnu99 -ffunction-sections -fdata-sections \
+ -Wno-unused-but-set-variable \
+ $(TARGET_CFLAGS) -ggdb
+
+UCLIBC_MAKE = PATH='$(TOOLCHAIN_DIR)/initial/bin:$(TARGET_PATH)' $(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) \
+ $(TARGET_CONFIGURE_OPTS) \
+ DEVEL_PREFIX=/ \
+ RUNTIME_PREFIX=/ \
+ HOSTCC="$(HOSTCC)" \
+ CPU_CFLAGS="$(CPU_CFLAGS)" \
+ ARCH="$(CONFIG_ARCH)" \
+ LIBGCC="$(subst libgcc.a,libgcc_initial.a,$(shell $(TARGET_CC) -print-libgcc-file-name))" \
+ DOSTRIP=""
+
+define Host/Prepare
+ $(call Host/Prepare/Default)
+ $(if $(strip $(QUILT)), \
+ cd $(HOST_BUILD_DIR); \
+ if $(QUILT_CMD) next >/dev/null 2>&1; then \
+ $(QUILT_CMD) push -a; \
+ fi
+ )
+ ln -snf $(PKG_NAME)-$(PKG_VERSION) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
+endef
+
+define Host/Configure
+ $(GEN_CONFIG) > $(HOST_BUILD_DIR)/.config.new
+ $(SED) 's,^KERNEL_HEADERS=.*,KERNEL_HEADERS=\"$(BUILD_DIR_TOOLCHAIN)/linux-dev/include\",g' \
+ -e 's,^.*UCLIBC_HAS_FPU.*,UCLIBC_HAS_FPU=$(if $(CONFIG_SOFT_FLOAT),n,y),g' \
+ -e 's,^.*UCLIBC_HAS_SOFT_FLOAT.*,UCLIBC_HAS_SOFT_FLOAT=$(if $(CONFIG_SOFT_FLOAT),y,n),g' \
+ -e 's,^.*UCLIBC_HAS_SHADOW.*,UCLIBC_HAS_SHADOW=$(if $(CONFIG_SHADOW_PASSWORDS),y,n),g' \
+ -e 's,^.*UCLIBC_HAS_LOCALE.*,UCLIBC_HAS_LOCALE=$(if $(CONFIG_BUILD_NLS),y,n),g' \
+ -e 's,^.*UCLIBC_BUILD_ALL_LOCALE.*,UCLIBC_BUILD_ALL_LOCALE=$(if $(CONFIG_BUILD_NLS),y,n),g' \
+ -e 's,^.*UCLIBC_HAS_SSP[^_].*,UCLIBC_HAS_SSP=$(if $(or $(CONFIG_PKG_CC_STACKPROTECTOR_REGULAR),$(CONFIG_PKG_CC_STACKPROTECTOR_STRONG)),y,n),g' \
+ $(HOST_BUILD_DIR)/.config.new
+ cmp -s $(HOST_BUILD_DIR)/.config.new $(HOST_BUILD_DIR)/.config.last || { \
+ cp $(HOST_BUILD_DIR)/.config.new $(HOST_BUILD_DIR)/.config && \
+ $(MAKE) -C $(HOST_BUILD_DIR) oldconfig KBUILD_HAVE_NLS= HOSTCFLAGS="-DKBUILD_NO_NLS" && \
+ $(MAKE) -C $(HOST_BUILD_DIR)/extra/config conf KBUILD_HAVE_NLS= HOSTCFLAGS="-DKBUILD_NO_NLS" && \
+ cp $(HOST_BUILD_DIR)/.config.new $(HOST_BUILD_DIR)/.config.last; \
+ }
+endef
+
+define Host/Clean
+ rm -rf \
+ $(HOST_BUILD_DIR) \
+ $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME) \
+ $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev
+endef
diff --git a/toolchain/uClibc/config-0.9.33.2/arm b/toolchain/uClibc/config-0.9.33.2/arm
new file mode 100644
index 0000000..b68617b
--- /dev/null
+++ b/toolchain/uClibc/config-0.9.33.2/arm
@@ -0,0 +1,7 @@
+ARCH_ANY_ENDIAN=y
+ARCH_LITTLE_ENDIAN=y
+ARCH_WANTS_LITTLE_ENDIAN=y
+# COMPILE_IN_THUMB_MODE is not set
+TARGET_ARCH="arm"
+TARGET_arm=y
+# USE_BX is not set
diff --git a/toolchain/uClibc/config-0.9.33.2/armeb b/toolchain/uClibc/config-0.9.33.2/armeb
new file mode 100644
index 0000000..d4932e8
--- /dev/null
+++ b/toolchain/uClibc/config-0.9.33.2/armeb
@@ -0,0 +1,7 @@
+ARCH_ANY_ENDIAN=y
+ARCH_BIG_ENDIAN=y
+ARCH_WANTS_BIG_ENDIAN=y
+# COMPILE_IN_THUMB_MODE is not set
+TARGET_ARCH="arm"
+TARGET_arm=y
+# USE_BX is not set
diff --git a/toolchain/uClibc/config-0.9.33.2/common b/toolchain/uClibc/config-0.9.33.2/common
new file mode 100644
index 0000000..b948d4b
--- /dev/null
+++ b/toolchain/uClibc/config-0.9.33.2/common
@@ -0,0 +1,214 @@
+# ARCH_ANY_ENDIAN is not set
+ARCH_HAS_MMU=y
+# ARCH_HAS_NO_LDSO is not set
+# ARCH_HAS_NO_SHARED is not set
+# ARCH_LITTLE_ENDIAN is not set
+ARCH_USE_MMU=y
+# ARCH_WANTS_BIG_ENDIAN is not set
+# ARCH_WANTS_LITTLE_ENDIAN is not set
+ASSUME_DEVPTS=y
+# COMPAT_ATEXIT is not set
+CROSS_COMPILER_PREFIX=""
+DEVEL_PREFIX="/usr/"
+# DOASSERTS is not set
+# DODEBUG is not set
+# DODEBUG_PT is not set
+# DOMULTI is not set
+DOPIC=y
+DOSTRIP=y
+DO_C99_MATH=y
+# DO_XSI_MATH is not set
+# EXTRA_WARNINGS is not set
+FORCE_OPTIONS_FOR_ARCH=y
+# FORCE_SHAREABLE_TEXT_SEGMENTS is not set
+# HARDWIRED_ABSPATH is not set
+# HAS_NO_THREADS is not set
+HAVE_DOT_CONFIG=y
+# HAVE_NO_PIC is not set
+# HAVE_NO_SSP is not set
+HAVE_SHARED=y
+KERNEL_HEADERS="."
+LDSO_BASE_FILENAME="ld.so"
+LDSO_CACHE_SUPPORT=y
+# LDSO_GNU_HASH_SUPPORT is not set
+LDSO_LD_LIBRARY_PATH=y
+LDSO_LDD_SUPPORT=y
+# LDSO_NO_CLEANUP is not set
+# LDSO_PRELINK_SUPPORT is not set
+# LDSO_PRELOAD_FILE_SUPPORT is not set
+LDSO_PRELOAD_ENV_SUPPORT=y
+LDSO_RUNPATH=y
+# LDSO_SEARCH_INTERP_PATH is not set
+# LDSO_STANDALONE_SUPPORT is not set
+# LINUXTHREADS_NEW is not set
+# LINUXTHREADS_OLD is not set
+# UCLIBC_HAS_BACKTRACE is not set
+UCLIBC_HAS_THREADS_NATIVE=y
+# MALLOC is not set
+MALLOC_GLIBC_COMPAT=y
+# MALLOC_SIMPLE is not set
+MALLOC_STANDARD=y
+MULTILIB_DIR="lib"
+PTHREADS_DEBUG_SUPPORT=y
+RUNTIME_PREFIX="/"
+# SUPPORT_LD_DEBUG is not set
+# SUPPORT_LD_DEBUG_EARLY is not set
+TARGET_SUBARCH=""
+# TARGET_alpha is not set
+# TARGET_arm is not set
+# TARGET_avr32 is not set
+# TARGET_bfin is not set
+# TARGET_c6x is not set
+# TARGET_cris is not set
+# TARGET_e1 is not set
+# TARGET_frv is not set
+# TARGET_h8300 is not set
+# TARGET_hppa is not set
+# TARGET_i386 is not set
+# TARGET_i960 is not set
+# TARGET_ia64 is not set
+# TARGET_m68k is not set
+# TARGET_microblaze is not set
+# TARGET_mips is not set
+# TARGET_nios is not set
+# TARGET_nios2 is not set
+# TARGET_powerpc is not set
+# TARGET_sh is not set
+# TARGET_sh64 is not set
+# TARGET_sparc is not set
+# TARGET_v850 is not set
+# TARGET_vax is not set
+# TARGET_x86_64 is not set
+# TARGET_xtensa is not set
+UCLIBC_BSD_SPECIFIC=y
+UCLIBC_BUILD_NOEXECSTACK=y
+# UCLIBC_BUILD_NOW is not set
+# UCLIBC_BUILD_PIE is not set
+UCLIBC_BUILD_RELRO=y
+UCLIBC_CTOR_DTOR=y
+UCLIBC_DYNAMIC_ATEXIT=y
+UCLIBC_EXTRA_CFLAGS=""
+UCLIBC_GRP_BUFFER_SIZE=256
+UCLIBC_HAS_ADVANCED_REALTIME=y
+# UCLIBC_HAS_ARC4RANDOM is not set
+UCLIBC_HAS_BSD_ERR=y
+UCLIBC_HAS_BSD_RES_CLOSE=y
+# UCLIBC_HAS_COMPAT_RES_STATE is not set
+UCLIBC_HAS_CRYPT=y
+UCLIBC_HAS_CRYPT_IMPL=y
+UCLIBC_HAS_CTYPE_CHECKED=y
+# UCLIBC_HAS_CTYPE_ENFORCED is not set
+UCLIBC_HAS_CTYPE_SIGNED=y
+UCLIBC_HAS_CTYPE_TABLES=y
+# UCLIBC_HAS_CTYPE_UNSAFE is not set
+UCLIBC_HAS_EPOLL=y
+UCLIBC_HAS_ERRNO_MESSAGES=y
+# UCLIBC_HAS_EXTRA_COMPAT_RES_STATE is not set
+# UCLIBC_HAS_FENV is not set
+UCLIBC_HAS_FLOATS=y
+UCLIBC_HAS_FNMATCH=y
+UCLIBC_HAS_FNMATCH_OLD=y
+# UCLIBC_HAS_FOPEN_CLOSEEXEC_MODE is not set
+UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y
+# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set
+# UCLIBC_HAS_FPU is not set
+UCLIBC_HAS_FTS=y
+UCLIBC_HAS_FTW=y
+# UCLIBC_HAS_FULL_RPC is not set
+UCLIBC_HAS_GETPT=y
+UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y
+UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
+# UCLIBC_HAS_GLIBC_DIGIT_GROUPING is not set
+UCLIBC_HAS_GLOB=y
+UCLIBC_HAS_GNU_ERROR=y
+UCLIBC_HAS_GNU_GETOPT=y
+UCLIBC_HAS_GNU_GETSUBOPT=y
+UCLIBC_HAS_GNU_GLOB=y
+UCLIBC_HAS_HEXADECIMAL_FLOATS=y
+UCLIBC_HAS_IPV4=y
+UCLIBC_HAS_IPV6=y
+UCLIBC_HAS_LFS=y
+UCLIBC_HAS_LIBNSL_STUB=y
+UCLIBC_HAS_LIBRESOLV_STUB=y
+UCLIBC_HAS_LIBUTIL=y
+# UCLIBC_HAS_LOCALE is not set
+# UCLIBC_BUILD_ALL_LOCALE is not set
+# UCLIBC_BUILD_MINIMAL_LOCALE is not set
+# UCLIBC_PREGENERATED_LOCALE_DATA is not set
+UCLIBC_HAS_LONG_DOUBLE_MATH=y
+UCLIBC_HAS_NETWORK_SUPPORT=y
+UCLIBC_HAS_NFTW=y
+# UCLIBC_HAS_OBSOLETE_BSD_SIGNAL is not set
+# UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL is not set
+UCLIBC_HAS_PRINTF_M_SPEC=y
+# UCLIBC_HAS_PROFILING is not set
+UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
+UCLIBC_HAS_PTY=y
+UCLIBC_HAS_REALTIME=y
+# UCLIBC_HAS_REENTRANT_RPC is not set
+UCLIBC_HAS_REGEX=y
+UCLIBC_HAS_REGEX_OLD=y
+UCLIBC_HAS_RESOLVER_SUPPORT=y
+# UCLIBC_HAS_RPC is not set
+UCLIBC_HAS_SCANF_GLIBC_A_FLAG=y
+# UCLIBC_HAS_SHA256_CRYPT_IMPL is not set
+# UCLIBC_HAS_SHA512_CRYPT_IMPL is not set
+UCLIBC_HAS_SHADOW=y
+UCLIBC_HAS_SIGNUM_MESSAGES=y
+UCLIBC_HAS_SOCKET=y
+UCLIBC_HAS_SOFT_FLOAT=y
+# UCLIBC_HAS_SSP is not set
+# UCLIBC_HAS_SSP_COMPAT is not set
+UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y
+# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set
+# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set
+# UCLIBC_HAS_STDIO_BUFSIZ_256 is not set
+UCLIBC_HAS_STDIO_BUFSIZ_4096=y
+# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set
+# UCLIBC_HAS_STDIO_BUFSIZ_8192 is not set
+# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set
+# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set
+# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set
+UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y
+UCLIBC_HAS_STDIO_GETC_MACRO=y
+UCLIBC_HAS_STDIO_PUTC_MACRO=y
+# UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT is not set
+UCLIBC_HAS_STRING_ARCH_OPT=y
+UCLIBC_HAS_STRING_GENERIC_OPT=y
+# UCLIBC_HAS_STUBS is not set
+UCLIBC_HAS_SYSLOG=y
+# UCLIBC_HAS_SYS_ERRLIST is not set
+# UCLIBC_HAS_SYS_SIGLIST is not set
+UCLIBC_HAS_THREADS=y
+UCLIBC_HAS_TM_EXTENSIONS=y
+UCLIBC_HAS_TZ_CACHING=y
+UCLIBC_HAS_TZ_FILE=y
+UCLIBC_HAS_TZ_FILE_READ_MANY=y
+# UCLIBC_HAS_UTMPX is not set
+UCLIBC_HAS_WCHAR=y
+UCLIBC_HAS_WORDEXP=y
+# UCLIBC_HAS_XATTR is not set
+# UCLIBC_HAS_XLOCALE is not set
+UCLIBC_HAS___PROGNAME=y
+# UCLIBC_LINUX_MODULE_24 is not set
+UCLIBC_LINUX_MODULE_26=y
+UCLIBC_LINUX_SPECIFIC=y
+# UCLIBC_MALLOC_DEBUGGING is not set
+# UCLIBC_MJN3_ONLY is not set
+# UCLIBC_NTP_LEGACY is not set
+# USE_OLD_VFPRINTF is not set
+UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
+UCLIBC_PWD_BUFFER_SIZE=256
+# UCLIBC_STATIC_LDCONFIG is not set
+# UCLIBC_STRICT_HEADERS is not set
+UCLIBC_SUPPORT_AI_ADDRCONFIG=y
+UCLIBC_SUSV3_LEGACY=y
+UCLIBC_SUSV3_LEGACY_MACROS=y
+UCLIBC_SUSV4_LEGACY=y
+# UCLIBC_SV4_DEPRECATED is not set
+UCLIBC_TZ_FILE_PATH="/etc/TZ"
+# UCLIBC_FALLBACK_TO_ETC_LOCALTIME is not set
+UCLIBC_USE_NETLINK=y
+# UNIX98PTY_ONLY is not set
+USE_BX=y
+WARNINGS="-Wall"
diff --git a/toolchain/uClibc/config-0.9.33.2/debug b/toolchain/uClibc/config-0.9.33.2/debug
new file mode 100644
index 0000000..b366e66
--- /dev/null
+++ b/toolchain/uClibc/config-0.9.33.2/debug
@@ -0,0 +1,6 @@
+DODEBUG=y
+DODEBUG_PT=y
+PTHREADS_DEBUG_SUPPORT=y
+SUPPORT_LD_DEBUG=y
+SUPPORT_LD_DEBUG_EARLY=y
+UCLIBC_MALLOC_DEBUGGING=y
diff --git a/toolchain/uClibc/config-0.9.33.2/i386 b/toolchain/uClibc/config-0.9.33.2/i386
new file mode 100644
index 0000000..5ef264c
--- /dev/null
+++ b/toolchain/uClibc/config-0.9.33.2/i386
@@ -0,0 +1,21 @@
+ARCH_LITTLE_ENDIAN=y
+# CONFIG_386 is not set
+CONFIG_486=y
+# CONFIG_586 is not set
+# CONFIG_586MMX is not set
+# CONFIG_686 is not set
+# CONFIG_CRUSOE is not set
+# CONFIG_CYRIXIII is not set
+# CONFIG_ELAN is not set
+# CONFIG_GENERIC_386 is not set
+# CONFIG_K6 is not set
+# CONFIG_K7 is not set
+# CONFIG_NEHEMIAH is not set
+# CONFIG_PENTIUM4 is not set
+# CONFIG_PENTIUMII is not set
+# CONFIG_PENTIUMIII is not set
+# CONFIG_WINCHIP2 is not set
+# CONFIG_WINCHIPC6 is not set
+TARGET_ARCH="i386"
+TARGET_i386=y
+UCLIBC_HAS_FPU=y
diff --git a/toolchain/uClibc/config-0.9.33.2/i686 b/toolchain/uClibc/config-0.9.33.2/i686
new file mode 100644
index 0000000..ba615f6
--- /dev/null
+++ b/toolchain/uClibc/config-0.9.33.2/i686
@@ -0,0 +1,21 @@
+ARCH_LITTLE_ENDIAN=y
+# CONFIG_386 is not set
+# CONFIG_486 is not set
+# CONFIG_586 is not set
+# CONFIG_586MMX is not set
+CONFIG_686=y
+# CONFIG_CRUSOE is not set
+# CONFIG_CYRIXIII is not set
+# CONFIG_ELAN is not set
+# CONFIG_GENERIC_386 is not set
+# CONFIG_K6 is not set
+# CONFIG_K7 is not set
+# CONFIG_NEHEMIAH is not set
+# CONFIG_PENTIUM4 is not set
+# CONFIG_PENTIUMII is not set
+# CONFIG_PENTIUMIII is not set
+# CONFIG_WINCHIP2 is not set
+# CONFIG_WINCHIPC6 is not set
+TARGET_ARCH="i386"
+TARGET_i386=y
+UCLIBC_HAS_FPU=y
diff --git a/toolchain/uClibc/config-0.9.33.2/m68k b/toolchain/uClibc/config-0.9.33.2/m68k
new file mode 100644
index 0000000..14ce5ae
--- /dev/null
+++ b/toolchain/uClibc/config-0.9.33.2/m68k
@@ -0,0 +1,6 @@
+ARCH_BIG_ENDIAN=y
+LINUXTHREADS_OLD=y
+TARGET_ARCH="m68k"
+TARGET_SUBARCH=""
+TARGET_m68k=y
+# UCLIBC_HAS_THREADS_NATIVE is not set
diff --git a/toolchain/uClibc/config-0.9.33.2/mips b/toolchain/uClibc/config-0.9.33.2/mips
new file mode 100644
index 0000000..7398c66
--- /dev/null
+++ b/toolchain/uClibc/config-0.9.33.2/mips
@@ -0,0 +1,17 @@
+ARCH_ANY_ENDIAN=y
+ARCH_BIG_ENDIAN=y
+ARCH_CFLAGS="-mno-split-addresses"
+ARCH_WANTS_BIG_ENDIAN=y
+# CONFIG_MIPS_ISA_1 is not set
+# CONFIG_MIPS_ISA_2 is not set
+# CONFIG_MIPS_ISA_3 is not set
+# CONFIG_MIPS_ISA_4 is not set
+CONFIG_MIPS_ISA_MIPS32=y
+# CONFIG_MIPS_ISA_MIPS32R2 is not set
+# CONFIG_MIPS_ISA_MIPS64 is not set
+# CONFIG_MIPS_N32_ABI is not set
+# CONFIG_MIPS_N64_ABI is not set
+CONFIG_MIPS_O32_ABI=y
+TARGET_ARCH="mips"
+TARGET_mips=y
+UCLIBC_HAS_FPU=y
diff --git a/toolchain/uClibc/config-0.9.33.2/mips64 b/toolchain/uClibc/config-0.9.33.2/mips64
new file mode 100644
index 0000000..fa5bee3
--- /dev/null
+++ b/toolchain/uClibc/config-0.9.33.2/mips64
@@ -0,0 +1,17 @@
+ARCH_ANY_ENDIAN=y
+ARCH_BIG_ENDIAN=y
+ARCH_CFLAGS="-mno-split-addresses"
+ARCH_WANTS_BIG_ENDIAN=y
+# CONFIG_MIPS_ISA_1 is not set
+# CONFIG_MIPS_ISA_2 is not set
+# CONFIG_MIPS_ISA_3 is not set
+# CONFIG_MIPS_ISA_4 is not set
+# CONFIG_MIPS_ISA_MIPS32 is not set
+# CONFIG_MIPS_ISA_MIPS32R2 is not set
+CONFIG_MIPS_ISA_MIPS64=y
+# CONFIG_MIPS_N32_ABI is not set
+CONFIG_MIPS_N64_ABI=y
+# CONFIG_MIPS_O32_ABI is not set
+TARGET_ARCH="mips"
+TARGET_mips=y
+UCLIBC_HAS_FPU=y
diff --git a/toolchain/uClibc/config-0.9.33.2/mips64.32 b/toolchain/uClibc/config-0.9.33.2/mips64.32
new file mode 100644
index 0000000..03f7fba
--- /dev/null
+++ b/toolchain/uClibc/config-0.9.33.2/mips64.32
@@ -0,0 +1,18 @@
+ARCH_ANY_ENDIAN=y
+ARCH_BIG_ENDIAN=y
+ARCH_CFLAGS="-mno-split-addresses"
+ARCH_WANTS_BIG_ENDIAN=y
+# CONFIG_MIPS_ISA_1 is not set
+# CONFIG_MIPS_ISA_2 is not set
+# CONFIG_MIPS_ISA_3 is not set
+# CONFIG_MIPS_ISA_4 is not set
+# CONFIG_MIPS_ISA_MIPS32 is not set
+# CONFIG_MIPS_ISA_MIPS32R2 is not set
+CONFIG_MIPS_ISA_MIPS64=y
+# CONFIG_MIPS_N32_ABI is not set
+# CONFIG_MIPS_N64_ABI is not set
+CONFIG_MIPS_O32_ABI=y
+TARGET_ARCH="mips"
+TARGET_mips=y
+TARGET_SUBARCH="mips64"
+UCLIBC_HAS_FPU=y
diff --git a/toolchain/uClibc/config-0.9.33.2/mips64.64 b/toolchain/uClibc/config-0.9.33.2/mips64.64
new file mode 100644
index 0000000..7b66c2f
--- /dev/null
+++ b/toolchain/uClibc/config-0.9.33.2/mips64.64
@@ -0,0 +1,18 @@
+ARCH_ANY_ENDIAN=y
+ARCH_BIG_ENDIAN=y
+ARCH_CFLAGS="-mno-split-addresses"
+ARCH_WANTS_BIG_ENDIAN=y
+# CONFIG_MIPS_ISA_1 is not set
+# CONFIG_MIPS_ISA_2 is not set
+# CONFIG_MIPS_ISA_3 is not set
+# CONFIG_MIPS_ISA_4 is not set
+# CONFIG_MIPS_ISA_MIPS32 is not set
+# CONFIG_MIPS_ISA_MIPS32R2 is not set
+CONFIG_MIPS_ISA_MIPS64=y
+# CONFIG_MIPS_N32_ABI is not set
+CONFIG_MIPS_N64_ABI=y
+# CONFIG_MIPS_O32_ABI is not set
+TARGET_ARCH="mips"
+TARGET_mips=y
+TARGET_SUBARCH="mips64"
+UCLIBC_HAS_FPU=y
diff --git a/toolchain/uClibc/config-0.9.33.2/mips64.n32 b/toolchain/uClibc/config-0.9.33.2/mips64.n32
new file mode 100644
index 0000000..84a5de6
--- /dev/null
+++ b/toolchain/uClibc/config-0.9.33.2/mips64.n32
@@ -0,0 +1,18 @@
+ARCH_ANY_ENDIAN=y
+ARCH_BIG_ENDIAN=y
+ARCH_CFLAGS="-mno-split-addresses"
+ARCH_WANTS_BIG_ENDIAN=y
+# CONFIG_MIPS_ISA_1 is not set
+# CONFIG_MIPS_ISA_2 is not set
+# CONFIG_MIPS_ISA_3 is not set
+# CONFIG_MIPS_ISA_4 is not set
+# CONFIG_MIPS_ISA_MIPS32 is not set
+# CONFIG_MIPS_ISA_MIPS32R2 is not set
+CONFIG_MIPS_ISA_MIPS64=y
+CONFIG_MIPS_N32_ABI=y
+# CONFIG_MIPS_N64_ABI is not set
+# CONFIG_MIPS_O32_ABI is not set
+TARGET_ARCH="mips"
+TARGET_mips=y
+TARGET_SUBARCH="mips64"
+UCLIBC_HAS_FPU=y
diff --git a/toolchain/uClibc/config-0.9.33.2/mips64el b/toolchain/uClibc/config-0.9.33.2/mips64el
new file mode 100644
index 0000000..1ca764f
--- /dev/null
+++ b/toolchain/uClibc/config-0.9.33.2/mips64el
@@ -0,0 +1,17 @@
+ARCH_ANY_ENDIAN=y
+ARCH_CFLAGS="-mno-split-addresses"
+ARCH_LITTLE_ENDIAN=y
+ARCH_WANTS_LITTLE_ENDIAN=y
+# CONFIG_MIPS_ISA_1 is not set
+# CONFIG_MIPS_ISA_2 is not set
+# CONFIG_MIPS_ISA_3 is not set
+# CONFIG_MIPS_ISA_4 is not set
+# CONFIG_MIPS_ISA_MIPS32 is not set
+# CONFIG_MIPS_ISA_MIPS32R2 is not set
+CONFIG_MIPS_ISA_MIPS64=y
+# CONFIG_MIPS_N32_ABI is not set
+CONFIG_MIPS_N64_ABI=y
+# CONFIG_MIPS_O32_ABI is not set
+TARGET_ARCH="mips"
+TARGET_mips=y
+UCLIBC_HAS_FPU=y
diff --git a/toolchain/uClibc/config-0.9.33.2/mips64el.32 b/toolchain/uClibc/config-0.9.33.2/mips64el.32
new file mode 100644
index 0000000..73b1f9f
--- /dev/null
+++ b/toolchain/uClibc/config-0.9.33.2/mips64el.32
@@ -0,0 +1,18 @@
+ARCH_ANY_ENDIAN=y
+ARCH_CFLAGS="-mno-split-addresses"
+ARCH_LITTLE_ENDIAN=y
+ARCH_WANTS_LITTLE_ENDIAN=y
+# CONFIG_MIPS_ISA_1 is not set
+# CONFIG_MIPS_ISA_2 is not set
+# CONFIG_MIPS_ISA_3 is not set
+# CONFIG_MIPS_ISA_4 is not set
+# CONFIG_MIPS_ISA_MIPS32 is not set
+# CONFIG_MIPS_ISA_MIPS32R2 is not set
+CONFIG_MIPS_ISA_MIPS64=y
+# CONFIG_MIPS_N32_ABI is not set
+# CONFIG_MIPS_N64_ABI is not set
+CONFIG_MIPS_O32_ABI=y
+TARGET_ARCH="mips"
+TARGET_mips=y
+TARGET_SUBARCH="mips64"
+UCLIBC_HAS_FPU=y
diff --git a/toolchain/uClibc/config-0.9.33.2/mips64el.64 b/toolchain/uClibc/config-0.9.33.2/mips64el.64
new file mode 100644
index 0000000..790f210
--- /dev/null
+++ b/toolchain/uClibc/config-0.9.33.2/mips64el.64
@@ -0,0 +1,18 @@
+ARCH_ANY_ENDIAN=y
+ARCH_CFLAGS="-mno-split-addresses"
+ARCH_LITTLE_ENDIAN=y
+ARCH_WANTS_LITTLE_ENDIAN=y
+# CONFIG_MIPS_ISA_1 is not set
+# CONFIG_MIPS_ISA_2 is not set
+# CONFIG_MIPS_ISA_3 is not set
+# CONFIG_MIPS_ISA_4 is not set
+# CONFIG_MIPS_ISA_MIPS32 is not set
+# CONFIG_MIPS_ISA_MIPS32R2 is not set
+CONFIG_MIPS_ISA_MIPS64=y
+# CONFIG_MIPS_N32_ABI is not set
+CONFIG_MIPS_N64_ABI=y
+# CONFIG_MIPS_O32_ABI is not set
+TARGET_ARCH="mips"
+TARGET_mips=y
+TARGET_SUBARCH="mips64"
+UCLIBC_HAS_FPU=y
diff --git a/toolchain/uClibc/config-0.9.33.2/mips64el.n32 b/toolchain/uClibc/config-0.9.33.2/mips64el.n32
new file mode 100644
index 0000000..c2929bf
--- /dev/null
+++ b/toolchain/uClibc/config-0.9.33.2/mips64el.n32
@@ -0,0 +1,18 @@
+ARCH_ANY_ENDIAN=y
+ARCH_CFLAGS="-mno-split-addresses"
+ARCH_LITTLE_ENDIAN=y
+ARCH_WANTS_LITTLE_ENDIAN=y
+# CONFIG_MIPS_ISA_1 is not set
+# CONFIG_MIPS_ISA_2 is not set
+# CONFIG_MIPS_ISA_3 is not set
+# CONFIG_MIPS_ISA_4 is not set
+# CONFIG_MIPS_ISA_MIPS32 is not set
+# CONFIG_MIPS_ISA_MIPS32R2 is not set
+CONFIG_MIPS_ISA_MIPS64=y
+CONFIG_MIPS_N32_ABI=y
+# CONFIG_MIPS_N64_ABI is not set
+# CONFIG_MIPS_O32_ABI is not set
+TARGET_ARCH="mips"
+TARGET_mips=y
+TARGET_SUBARCH="mips64"
+UCLIBC_HAS_FPU=y
diff --git a/toolchain/uClibc/config-0.9.33.2/mipsel b/toolchain/uClibc/config-0.9.33.2/mipsel
new file mode 100644
index 0000000..7648f39
--- /dev/null
+++ b/toolchain/uClibc/config-0.9.33.2/mipsel
@@ -0,0 +1,17 @@
+ARCH_ANY_ENDIAN=y
+ARCH_CFLAGS="-mno-split-addresses"
+ARCH_LITTLE_ENDIAN=y
+ARCH_WANTS_LITTLE_ENDIAN=y
+# CONFIG_MIPS_ISA_1 is not set
+# CONFIG_MIPS_ISA_2 is not set
+# CONFIG_MIPS_ISA_3 is not set
+# CONFIG_MIPS_ISA_4 is not set
+CONFIG_MIPS_ISA_MIPS32=y
+# CONFIG_MIPS_ISA_MIPS32R2 is not set
+# CONFIG_MIPS_ISA_MIPS64 is not set
+# CONFIG_MIPS_N32_ABI is not set
+# CONFIG_MIPS_N64_ABI is not set
+CONFIG_MIPS_O32_ABI=y
+TARGET_ARCH="mips"
+TARGET_mips=y
+UCLIBC_HAS_FPU=y
diff --git a/toolchain/uClibc/config-0.9.33.2/mipsel.cobalt b/toolchain/uClibc/config-0.9.33.2/mipsel.cobalt
new file mode 100644
index 0000000..323b0aa
--- /dev/null
+++ b/toolchain/uClibc/config-0.9.33.2/mipsel.cobalt
@@ -0,0 +1,17 @@
+ARCH_ANY_ENDIAN=y
+ARCH_CFLAGS="-mno-split-addresses"
+ARCH_LITTLE_ENDIAN=y
+ARCH_WANTS_LITTLE_ENDIAN=y
+# CONFIG_MIPS_ISA_1 is not set
+# CONFIG_MIPS_ISA_2 is not set
+CONFIG_MIPS_ISA_3=y
+# CONFIG_MIPS_ISA_4 is not set
+# CONFIG_MIPS_ISA_MIPS32 is not set
+# CONFIG_MIPS_ISA_MIPS32R2 is not set
+# CONFIG_MIPS_ISA_MIPS64 is not set
+# CONFIG_MIPS_N32_ABI is not set
+# CONFIG_MIPS_N64_ABI is not set
+CONFIG_MIPS_O32_ABI=y
+TARGET_ARCH="mips"
+TARGET_mips=y
+UCLIBC_HAS_FPU=y
diff --git a/toolchain/uClibc/config-0.9.33.2/powerpc b/toolchain/uClibc/config-0.9.33.2/powerpc
new file mode 100644
index 0000000..5b1292d
--- /dev/null
+++ b/toolchain/uClibc/config-0.9.33.2/powerpc
@@ -0,0 +1,6 @@
+ARCH_BIG_ENDIAN=y
+CONFIG_CLASSIC=y
+# CONFIG_E500 is not set
+TARGET_ARCH="powerpc"
+TARGET_SUBARCH="classic"
+TARGET_powerpc=y
diff --git a/toolchain/uClibc/config-0.9.33.2/powerpc.e500 b/toolchain/uClibc/config-0.9.33.2/powerpc.e500
new file mode 100644
index 0000000..a835c3d
--- /dev/null
+++ b/toolchain/uClibc/config-0.9.33.2/powerpc.e500
@@ -0,0 +1,6 @@
+ARCH_BIG_ENDIAN=y
+# CONFIG_CLASSIC is not set
+CONFIG_E500=y
+TARGET_ARCH="powerpc"
+TARGET_SUBARCH="classic"
+TARGET_powerpc=y
diff --git a/toolchain/uClibc/config-0.9.33.2/sparc b/toolchain/uClibc/config-0.9.33.2/sparc
new file mode 100644
index 0000000..e1596c4
--- /dev/null
+++ b/toolchain/uClibc/config-0.9.33.2/sparc
@@ -0,0 +1,8 @@
+ARCH_BIG_ENDIAN=y
+# CONFIG_SPARC_V7 is not set
+# CONFIG_SPARC_V8 is not set
+CONFIG_SPARC_V9=y
+# CONFIG_SPARC_V9B is not set
+TARGET_ARCH="sparc"
+TARGET_sparc=y
+UCLIBC_HAS_LONG_DOUBLE_MATH=y
diff --git a/toolchain/uClibc/config-0.9.33.2/sparc.leon b/toolchain/uClibc/config-0.9.33.2/sparc.leon
new file mode 100644
index 0000000..eb725ac
--- /dev/null
+++ b/toolchain/uClibc/config-0.9.33.2/sparc.leon
@@ -0,0 +1,8 @@
+ARCH_BIG_ENDIAN=y
+# CONFIG_SPARC_V7 is not set
+CONFIG_SPARC_V8=y
+# CONFIG_SPARC_V9 is not set
+# CONFIG_SPARC_V9B is not set
+TARGET_ARCH="sparc"
+TARGET_sparc=y
+UCLIBC_HAS_LONG_DOUBLE_MATH=y
diff --git a/toolchain/uClibc/config-0.9.33.2/x86_64 b/toolchain/uClibc/config-0.9.33.2/x86_64
new file mode 100644
index 0000000..92f0e65
--- /dev/null
+++ b/toolchain/uClibc/config-0.9.33.2/x86_64
@@ -0,0 +1,6 @@
+ARCH_LITTLE_ENDIAN=y
+# LINUXTHREADS_NEW is not set
+TARGET_ARCH="x86_64"
+TARGET_x86_64=y
+UCLIBC_BSD_SPECIFIC=y
+UCLIBC_HAS_FPU=y
diff --git a/toolchain/uClibc/headers/Makefile b/toolchain/uClibc/headers/Makefile
new file mode 100644
index 0000000..67a2d95
--- /dev/null
+++ b/toolchain/uClibc/headers/Makefile
@@ -0,0 +1,26 @@
+PATH_PREFIX:=..
+
+include ../common.mk
+
+HOST_STAMP_BUILT:=$(HOST_BUILD_DIR)/.headers_built
+HOST_STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.uclibc_headers_installed
+
+define Host/Compile
+
+endef
+
+define Host/Install
+ PATH='$(TARGET_PATH)' $(MAKE) -C $(HOST_BUILD_DIR) \
+ PREFIX="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/" \
+ DEVEL_PREFIX=/ \
+ RUNTIME_PREFIX="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/" \
+ HOSTCC="$(HOSTCC)" \
+ CC="$(TARGET_CC)" \
+ CPU_CFLAGS="$(TARGET_CFLAGS)" \
+ ARCH="$(CONFIG_ARCH)" \
+ pregen \
+ install_headers
+endef
+
+$(eval $(call HostBuild))
+
diff --git a/toolchain/uClibc/patches-0.9.33.2/009_backport_mount.h-update.patch b/toolchain/uClibc/patches-0.9.33.2/009_backport_mount.h-update.patch
new file mode 100644
index 0000000..47fb624
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/009_backport_mount.h-update.patch
@@ -0,0 +1,91 @@
+From 76ff037059f6d387bde9d540f7e27a2b376d7cd7 Mon Sep 17 00:00:00 2001
+From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+Date: Fri, 18 Jan 2013 11:12:49 +0100
+Subject: [PATCH] mount.h: update
+
+Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+---
+ include/sys/mount.h | 45 +++++++++++++++++++++++++++++++++++----------
+ 1 file changed, 35 insertions(+), 10 deletions(-)
+
+diff --git a/include/sys/mount.h b/include/sys/mount.h
+index fbd61fd..c0e7b84 100644
+--- a/include/sys/mount.h
++++ b/include/sys/mount.h
+@@ -1,5 +1,5 @@
+ /* Header file for mounting/unmount Linux filesystems.
+- Copyright (C) 1996,1997,1998,1999,2000,2004 Free Software Foundation, Inc.
++ Copyright (C) 1996-2000, 2004, 2010, 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+@@ -46,23 +46,46 @@ enum
+ #define MS_REMOUNT MS_REMOUNT
+ MS_MANDLOCK = 64, /* Allow mandatory locks on an FS. */
+ #define MS_MANDLOCK MS_MANDLOCK
+- S_WRITE = 128, /* Write on file/directory/symlink. */
+-#define S_WRITE S_WRITE
+- S_APPEND = 256, /* Append-only file. */
+-#define S_APPEND S_APPEND
+- S_IMMUTABLE = 512, /* Immutable file. */
+-#define S_IMMUTABLE S_IMMUTABLE
++ MS_DIRSYNC = 128, /* Directory modifications are synchronous. */
++#define MS_DIRSYNC MS_DIRSYNC
+ MS_NOATIME = 1024, /* Do not update access times. */
+ #define MS_NOATIME MS_NOATIME
+ MS_NODIRATIME = 2048, /* Do not update directory access times. */
+ #define MS_NODIRATIME MS_NODIRATIME
+ MS_BIND = 4096, /* Bind directory at different place. */
+ #define MS_BIND MS_BIND
++ MS_MOVE = 8192,
++#define MS_MOVE MS_MOVE
++ MS_REC = 16384,
++#define MS_REC MS_REC
++ MS_SILENT = 32768,
++#define MS_SILENT MS_SILENT
++ MS_POSIXACL = 1 << 16, /* VFS does not apply the umask. */
++#define MS_POSIXACL MS_POSIXACL
++ MS_UNBINDABLE = 1 << 17, /* Change to unbindable. */
++#define MS_UNBINDABLE MS_UNBINDABLE
++ MS_PRIVATE = 1 << 18, /* Change to private. */
++#define MS_PRIVATE MS_PRIVATE
++ MS_SLAVE = 1 << 19, /* Change to slave. */
++#define MS_SLAVE MS_SLAVE
++ MS_SHARED = 1 << 20, /* Change to shared. */
++#define MS_SHARED MS_SHARED
++ MS_RELATIME = 1 << 21, /* Update atime relative to mtime/ctime. */
++#define MS_RELATIME MS_RELATIME
++ MS_KERNMOUNT = 1 << 22, /* This is a kern_mount call. */
++#define MS_KERNMOUNT MS_KERNMOUNT
++ MS_I_VERSION = 1 << 23, /* Update inode I_version field. */
++#define MS_I_VERSION MS_I_VERSION
++ MS_STRICTATIME = 1 << 24, /* Always perform atime updates. */
++#define MS_STRICTATIME MS_STRICTATIME
++ MS_ACTIVE = 1 << 30,
++#define MS_ACTIVE MS_ACTIVE
++ MS_NOUSER = 1 << 31
++#define MS_NOUSER MS_NOUSER
+ };
+
+ /* Flags that can be altered by MS_REMOUNT */
+-#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_NOATIME \
+- |MS_NODIRATIME)
++#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION)
+
+
+ /* Magic mount flag number. Has to be or-ed to the flag values. */
+@@ -99,8 +122,10 @@ enum
+ #define MNT_FORCE MNT_FORCE
+ MNT_DETACH = 2, /* Just detach from the tree. */
+ #define MNT_DETACH MNT_DETACH
+- MNT_EXPIRE = 4 /* Mark for expiry. */
++ MNT_EXPIRE = 4, /* Mark for expiry. */
+ #define MNT_EXPIRE MNT_EXPIRE
++ UMOUNT_NOFOLLOW = 8 /* Don't follow symlink on umount. */
++#define UMOUNT_NOFOLLOW UMOUNT_NOFOLLOW
+ };
+
+
+--
+1.9.1
+
diff --git a/toolchain/uClibc/patches-0.9.33.2/010-backport_sscanf_alloc.patch b/toolchain/uClibc/patches-0.9.33.2/010-backport_sscanf_alloc.patch
new file mode 100644
index 0000000..b5ce091
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/010-backport_sscanf_alloc.patch
@@ -0,0 +1,184 @@
+From 8cfb43de636faa401634340d1a18404844f9ba5a Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sun, 6 May 2012 03:50:44 -0400
+Subject: [PATCH] stdio: implement assignment-allocation "m" character
+
+The latest POSIX spec introduces a "m" character to allocate buffers for
+the user when using scanf type functions. This is like the old glibc "a"
+flag, but now standardized. With packages starting to use these, we need
+to implement it.
+
+for example:
+ char *s;
+ sscanf("foo", "%ms", &s);
+ printf("%s\n", s);
+ free(s);
+This will automatically allocate storage for "s", read in "foo" to it,
+and then display it.
+
+I'm not terribly familiar with the stdio layer, so this could be wrong.
+But it seems to work for me.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+---
+ extra/Configs/Config.in | 13 ----------
+ libc/stdio/_scanf.c | 68 ++++++++++++++++++++++++++++---------------------
+ 2 files changed, 39 insertions(+), 42 deletions(-)
+
+--- a/extra/Configs/Config.in
++++ b/extra/Configs/Config.in
+@@ -1590,19 +1590,6 @@ config UCLIBC_PRINTF_SCANF_POSITIONAL_AR
+
+ Most people will answer 9.
+
+-
+-config UCLIBC_HAS_SCANF_GLIBC_A_FLAG
+- bool "Support glibc's 'a' flag for scanf string conversions (not implemented)"
+- help
+- NOTE!!! Currently Not Implemented!!! Just A Place Holder!! NOTE!!!
+- NOTE!!! Conflicts with an ANSI/ISO C99 scanf flag!! NOTE!!!
+-
+- Answer Y to enable support for glibc's 'a' flag for the scanf string
+- conversions '%s', '%[', '%ls', '%l[', and '%S'. This is used to
+- auto-allocate sufficient memory to hold the data retrieved.
+-
+- Most people will answer N.
+-
+ choice
+ prompt "Stdio buffer size"
+ default UCLIBC_HAS_STDIO_BUFSIZ_4096
+--- a/libc/stdio/_scanf.c
++++ b/libc/stdio/_scanf.c
+@@ -77,14 +77,6 @@
+ #include <bits/uClibc_fpmax.h>
+ #endif /* __UCLIBC_HAS_FLOATS__ */
+
+-#ifdef __UCLIBC_HAS_SCANF_GLIBC_A_FLAG__
+-#ifdef L_vfscanf
+-/* only emit this once */
+-#warning Forcing undef of __UCLIBC_HAS_SCANF_GLIBC_A_FLAG__ until implemented!
+-#endif
+-#undef __UCLIBC_HAS_SCANF_GLIBC_A_FLAG__
+-#endif
+-
+ #undef __STDIO_HAS_VSSCANF
+ #if defined(__STDIO_BUFFERS) || !defined(__UCLIBC_HAS_WCHAR__) || defined(__UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__)
+ #define __STDIO_HAS_VSSCANF 1
+@@ -433,8 +425,9 @@ libc_hidden_def(vswscanf)
+
+
+ /* float layout 0123456789012345678901 repeat n for "l[" */
+-#define SPEC_CHARS "npxXoudifFeEgGaACSncs["
+-/* npxXoudif eEgG CS cs[ */
++#define SPEC_CHARS "npxXoudifFeEgGaACSnmcs["
++/* npxXoudif eEgG CS cs[ */
++/* NOTE: the 'm' flag must come before any convs that support it */
+
+ /* NOTE: Ordering is important! In particular, CONV_LEFTBRACKET
+ * must immediately precede CONV_c. */
+@@ -444,7 +437,7 @@ enum {
+ CONV_p,
+ CONV_x, CONV_X, CONV_o, CONV_u, CONV_d, CONV_i,
+ CONV_f, CONV_F, CONV_e, CONV_E, CONV_g, CONV_G, CONV_a, CONV_A,
+- CONV_C, CONV_S, CONV_LEFTBRACKET, CONV_c, CONV_s, CONV_leftbracket,
++ CONV_C, CONV_S, CONV_LEFTBRACKET, CONV_m, CONV_c, CONV_s, CONV_leftbracket,
+ CONV_percent, CONV_whitespace /* not in SPEC_* and no flags */
+ };
+
+@@ -474,7 +467,7 @@ enum {
+ FLAG_SURPRESS = 0x10, /* MUST BE 1ST!! See DO_FLAGS. */
+ FLAG_THOUSANDS = 0x20,
+ FLAG_I18N = 0x40, /* only works for d, i, u */
+- FLAG_MALLOC = 0x80, /* only works for s, S, and [ (and l[)*/
++ FLAG_MALLOC = 0x80, /* only works for c, s, S, and [ (and l[)*/
+ };
+
+
+@@ -491,7 +484,7 @@ enum {
+ /* fFeEgGaA */ (0x0c|FLAG_SURPRESS|FLAG_THOUSANDS|FLAG_I18N), \
+ /* C */ ( 0|FLAG_SURPRESS), \
+ /* S and l[ */ ( 0|FLAG_SURPRESS|FLAG_MALLOC), \
+- /* c */ (0x04|FLAG_SURPRESS), \
++ /* c */ (0x04|FLAG_SURPRESS|FLAG_MALLOC), \
+ /* s and [ */ (0x04|FLAG_SURPRESS|FLAG_MALLOC), \
+ }
+
+@@ -904,17 +897,17 @@ int attribute_hidden __psfs_parse_spec(r
+ if (*psfs->fmt == *p) {
+ int p_m_spec_chars = p - spec_chars;
+
+-#ifdef __UCLIBC_HAS_SCANF_GLIBC_A_FLAG__
+-#error implement gnu a flag
+- if ((*p == 'a')
+- && ((psfs->fmt[1] == '[') || ((psfs->fmt[1]|0x20) == 's'))
+- ) { /* Assumes ascii for 's' and 'S' test. */
+- psfs->flags |= FLAG_MALLOC;
++ if (*p == 'm' &&
++ (psfs->fmt[1] == '[' || psfs->fmt[1] == 'c' ||
++ /* Assumes ascii for 's' and 'S' test. */
++ (psfs->fmt[1] | 0x20) == 's'))
++ {
++ if (psfs->store)
++ psfs->flags |= FLAG_MALLOC;
+ ++psfs->fmt;
+ ++p;
+- continue; /* The related conversions follow 'a'. */
++ continue; /* The related conversions follow 'm'. */
+ }
+-#endif /* __UCLIBC_HAS_SCANF_GLIBC_A_FLAG__ */
+
+ for (p = spec_ranges; p_m_spec_chars > *p ; ++p) {}
+ if (((psfs->dataargtype >> 8) | psfs->flags)
+@@ -1265,12 +1258,6 @@ int VFSCANF (FILE *__restrict fp, const
+ while (*wf && __isascii(*wf) && (b < buf + sizeof(buf) - 1)) {
+ *b++ = *wf++;
+ }
+-#ifdef __UCLIBC_HAS_SCANF_GLIBC_A_FLAG__
+-#error this is wrong... we need to ched in __psfs_parse_spec instead since this checks last char in buffer and conversion my have stopped before it.
+- if ((*b == 'a') && ((*wf == '[') || ((*wf|0x20) == 's'))) {
+- goto DONE; /* Spec was excessively long. */
+- }
+-#endif /* __UCLIBC_HAS_SCANF_GLIBC_A_FLAG__ */
+ *b = 0;
+ if (b == buf) { /* Bad conversion specifier! */
+ goto DONE;
+@@ -1390,13 +1377,36 @@ int VFSCANF (FILE *__restrict fp, const
+ }
+
+ if (psfs.conv_num == CONV_s) {
++ /* We might have to handle the allocation ourselves */
++ int len;
++ /* With 'm', we actually got a pointer to a pointer */
++ unsigned char **ptr = (void *)b;
++
++ i = 0;
++ if (psfs.flags & FLAG_MALLOC) {
++ len = 0;
++ b = NULL;
++ } else
++ len = -1;
++
+ /* Yes, believe it or not, a %s conversion can store nuls. */
+ while ((__scan_getc(&sc) >= 0) && !isspace(sc.cc)) {
+ zero_conversions = 0;
+- *b = sc.cc;
+- b += psfs.store;
++ if (i == len) {
++ /* Pick a size that won't trigger a lot of
++ * mallocs early on ... */
++ len += 256;
++ b = realloc(b, len + 1);
++ }
++ b[i] = sc.cc;
++ i += psfs.store;
+ fail = 0;
+ }
++
++ if (psfs.flags & FLAG_MALLOC)
++ *ptr = b;
++ /* The code below takes care of terminating NUL */
++ b += i;
+ } else {
+ #ifdef __UCLIBC_HAS_WCHAR__
+ assert((psfs.conv_num == CONV_LEFTBRACKET) || \
diff --git a/toolchain/uClibc/patches-0.9.33.2/011-dlsym_rtld_next_fix.patch b/toolchain/uClibc/patches-0.9.33.2/011-dlsym_rtld_next_fix.patch
new file mode 100644
index 0000000..f1a8ff5
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/011-dlsym_rtld_next_fix.patch
@@ -0,0 +1,25 @@
+--- a/ldso/libdl/libdl.c
++++ b/ldso/libdl/libdl.c
+@@ -671,7 +671,7 @@ static void *do_dlsym(void *vhandle, con
+ {
+ struct elf_resolve *tpnt, *tfrom;
+ struct dyn_elf *handle;
+- ElfW(Addr) from;
++ ElfW(Addr) from = 0;
+ struct dyn_elf *rpnt;
+ void *ret;
+ struct symbol_ref sym_ref = { NULL, NULL };
+@@ -729,7 +729,12 @@ static void *do_dlsym(void *vhandle, con
+ tpnt = NULL;
+ if (handle == _dl_symbol_tables)
+ tpnt = handle->dyn; /* Only search RTLD_GLOBAL objs if global object */
+- ret = _dl_find_hash(name2, &handle->dyn->symbol_scope, tpnt, ELF_RTYPE_CLASS_DLSYM, &sym_ref);
++ do {
++ ret = _dl_find_hash(name2, &handle->dyn->symbol_scope, tpnt, ELF_RTYPE_CLASS_DLSYM, &sym_ref);
++ if (ret != NULL)
++ break;
++ handle = handle->next;
++ } while (from && handle);
+
+ #if defined(USE_TLS) && USE_TLS && defined SHARED
+ if (sym_ref.sym && (ELF_ST_TYPE(sym_ref.sym->st_info) == STT_TLS) && (sym_ref.tpnt)) {
diff --git a/toolchain/uClibc/patches-0.9.33.2/012-elf-Add-STT_GNU_IFUNC-from-glibc.patch b/toolchain/uClibc/patches-0.9.33.2/012-elf-Add-STT_GNU_IFUNC-from-glibc.patch
new file mode 100644
index 0000000..6cecfaa
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/012-elf-Add-STT_GNU_IFUNC-from-glibc.patch
@@ -0,0 +1,37 @@
+From be58779614b2fe9aa57a9315be9dc004dfd77b3b Mon Sep 17 00:00:00 2001
+From: Vineet Gupta <vgupta@synopsys.com>
+Date: Fri, 20 Feb 2015 15:27:08 +0530
+Subject: [PATCH] elf: Add STT_GNU_IFUNC from glibc
+
+perf in upstream Linux kernel 3.17 onwards expects STT_GNU_IFUNC
+replicate it from glibc
+
+Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
+Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+---
+ include/elf.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/include/elf.h b/include/elf.h
+index facf09c..917930b 100644
+--- a/include/elf.h
++++ b/include/elf.h
+@@ -566,6 +566,7 @@ typedef struct
+ #define STB_WEAK 2 /* Weak symbol */
+ #define STB_NUM 3 /* Number of defined types. */
+ #define STB_LOOS 10 /* Start of OS-specific */
++#define STB_GNU_UNIQUE 10 /* Unique symbol. */
+ #define STB_HIOS 12 /* End of OS-specific */
+ #define STB_LOPROC 13 /* Start of processor-specific */
+ #define STB_HIPROC 15 /* End of processor-specific */
+@@ -581,6 +582,7 @@ typedef struct
+ #define STT_TLS 6 /* Symbol is thread-local data object*/
+ #define STT_NUM 7 /* Number of defined types. */
+ #define STT_LOOS 10 /* Start of OS-specific */
++#define STT_GNU_IFUNC 10 /* Symbol is indirect code object */
+ #define STT_HIOS 12 /* End of OS-specific */
+ #define STT_LOPROC 13 /* Start of processor-specific */
+ #define STT_HIPROC 15 /* End of processor-specific */
+--
+2.1.4
+
diff --git a/toolchain/uClibc/patches-0.9.33.2/020-endian.h-add-some-handy-macros-to-be-used-in-syscall.patch b/toolchain/uClibc/patches-0.9.33.2/020-endian.h-add-some-handy-macros-to-be-used-in-syscall.patch
new file mode 100644
index 0000000..7201041
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/020-endian.h-add-some-handy-macros-to-be-used-in-syscall.patch
@@ -0,0 +1,28 @@
+From: "Peter S. Mazinger" <ps.m@gmx.net>
+Date: Thu, 21 Apr 2011 21:20:55 +0200
+Subject: [PATCH] endian.h: add some handy macros to be used in syscalls
+
+Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
+Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+---
+
+--- a/include/endian.h
++++ b/include/endian.h
+@@ -55,6 +55,17 @@
+ # define __LONG_LONG_PAIR(HI, LO) HI, LO
+ #endif
+
++#ifdef _LIBC
++# ifndef __ASSEMBLER__
++# include <stdint.h>
++# define OFF_HI(offset) (offset >> 31)
++# define OFF_LO(offset) (offset)
++# define OFF64_HI(offset) (uint32_t)(offset >> 32)
++# define OFF64_LO(offset) (uint32_t)(offset & 0xffffffff)
++# define OFF_HI_LO(offset) __LONG_LONG_PAIR(OFF_HI(offset), OFF_LO(offset))
++# define OFF64_HI_LO(offset) __LONG_LONG_PAIR(OFF64_HI(offset), OFF64_LO(offset))
++# endif
++#endif
+
+ #ifdef __USE_BSD
+ /* Conversion interfaces. */
diff --git a/toolchain/uClibc/patches-0.9.33.2/021-add-posix_madvise.c.patch b/toolchain/uClibc/patches-0.9.33.2/021-add-posix_madvise.c.patch
new file mode 100644
index 0000000..2b18c25
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/021-add-posix_madvise.c.patch
@@ -0,0 +1,48 @@
+From: "Peter S. Mazinger" <ps.m@gmx.net>
+Date: Tue, 26 Apr 2011 23:03:44 +0200
+Subject: [PATCH] add posix_madvise.c
+
+Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
+Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+---
+ create mode 100644 libc/sysdeps/linux/common/posix_madvise.c
+
+--- a/libc/sysdeps/linux/common/Makefile.in
++++ b/libc/sysdeps/linux/common/Makefile.in
+@@ -81,7 +81,7 @@ CSRC-$(UCLIBC_HAS_REALTIME) += clock_get
+ sched_get_priority_max.c sched_get_priority_min.c sched_getscheduler.c \
+ sched_rr_get_interval.c sched_setparam.c sched_setscheduler.c sigqueue.c
+ # clock_getcpuclockid|clock_nanosleep|mq_timedreceive|mq_timedsend|posix_fadvise|posix_fallocate|posix_madvise|posix_memalign|posix_mem_offset|posix_spawnattr_destroy|posix_spawnattr_init|posix_spawnattr_getflags|posix_spawnattr_setflags|posix_spawnattr_getpgroup|posix_spawnattr_setpgroup|posix_spawnattr_getschedparam|posix_spawnattr_setschedparam|posix_spawnattr_getschedpolicy|posix_spawnattr_setschedpolicy|posix_spawnattr_getsigdefault|posix_spawnattr_setsigdefault|posix_spawnattr_getsigmask|posix_spawnattr_setsigmask|posix_spawnattr_init|posix_spawnattr_setflags|posix_spawnattr_setpgroup|posix_spawnattr_setschedparam|posix_spawnattr_setschedpolicy|posix_spawnattr_setsigdefault|posix_spawnattr_setsigmask|posix_spawn_file_actions_addclose|posix_spawn_file_actions_addopen|posix_spawn_file_actions_adddup2|posix_spawn_file_actions_addopen|posix_spawn_file_actions_destroy|posix_spawn_file_actions_init|posix_spawn_file_actions_init|posix_spawn|posix_spawnp|posix_spawnp|posix_typed_mem_get_info|pthread_mutex_timedlock|sem_timedwait
+-CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c
++CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c posix_madvise.c
+ CSRC-$(UCLIBC_SUSV4_LEGACY) += utime.c
+ CSRC-$(UCLIBC_HAS_EPOLL) += epoll.c
+ CSRC-$(UCLIBC_HAS_XATTR) += xattr.c
+--- /dev/null
++++ b/libc/sysdeps/linux/common/posix_madvise.c
+@@ -0,0 +1,25 @@
++/* vi: set sw=4 ts=4: */
++/* Licensed under the LGPL v2.1, see the file LICENSE in this tarball. */
++
++#include <sys/mman.h>
++#include <sys/syscall.h>
++
++#if defined __NR_madvise && defined __USE_XOPEN2K && defined __UCLIBC_HAS_ADVANCED_REALTIME__
++int posix_madvise(void *addr, size_t len, int advice)
++{
++ int result;
++ /* We have one problem: the kernel's MADV_DONTNEED does not
++ * correspond to POSIX's POSIX_MADV_DONTNEED. The former simply
++ * discards changes made to the memory without writing it back to
++ * disk, if this would be necessary. The POSIX behaviour does not
++ * allow this. There is no functionality mapping for the POSIX
++ * behaviour so far so we ignore that advice for now. */
++ if (advice == POSIX_MADV_DONTNEED)
++ return 0;
++
++ /* this part might use madvise function */
++ INTERNAL_SYSCALL_DECL (err);
++ result = INTERNAL_SYSCALL (madvise, err, 3, addr, len, advice);
++ return INTERNAL_SYSCALL_ERRNO (result, err);
++}
++#endif
diff --git a/toolchain/uClibc/patches-0.9.33.2/022-libc-add-posix_fallocate.patch b/toolchain/uClibc/patches-0.9.33.2/022-libc-add-posix_fallocate.patch
new file mode 100644
index 0000000..504405a
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/022-libc-add-posix_fallocate.patch
@@ -0,0 +1,301 @@
+From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+Date: Tue, 17 Apr 2012 09:30:15 +0200
+Subject: [PATCH] libc: add posix_fallocate()
+
+Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+---
+ create mode 100644 libc/sysdeps/linux/common/posix_fallocate.c
+ create mode 100644 libc/sysdeps/linux/common/posix_fallocate64.c
+ create mode 100644 test/unistd/tst-posix_fallocate.c
+ create mode 100644 test/unistd/tst-posix_fallocate64.c
+
+--- a/include/fcntl.h
++++ b/include/fcntl.h
+@@ -210,9 +210,7 @@ extern int posix_fadvise64 (int __fd, __
+
+ #endif
+
+-#if 0 /* && defined __UCLIBC_HAS_ADVANCED_REALTIME__ */
+-
+-/* FIXME -- uClibc should probably implement these... */
++#if defined __UCLIBC_HAS_ADVANCED_REALTIME__
+
+ /* Reserve storage for the data of the file associated with FD.
+
+--- a/libc/sysdeps/linux/common/Makefile.in
++++ b/libc/sysdeps/linux/common/Makefile.in
+@@ -81,7 +81,8 @@ CSRC-$(UCLIBC_HAS_REALTIME) += clock_get
+ sched_get_priority_max.c sched_get_priority_min.c sched_getscheduler.c \
+ sched_rr_get_interval.c sched_setparam.c sched_setscheduler.c sigqueue.c
+ # clock_getcpuclockid|clock_nanosleep|mq_timedreceive|mq_timedsend|posix_fadvise|posix_fallocate|posix_madvise|posix_memalign|posix_mem_offset|posix_spawnattr_destroy|posix_spawnattr_init|posix_spawnattr_getflags|posix_spawnattr_setflags|posix_spawnattr_getpgroup|posix_spawnattr_setpgroup|posix_spawnattr_getschedparam|posix_spawnattr_setschedparam|posix_spawnattr_getschedpolicy|posix_spawnattr_setschedpolicy|posix_spawnattr_getsigdefault|posix_spawnattr_setsigdefault|posix_spawnattr_getsigmask|posix_spawnattr_setsigmask|posix_spawnattr_init|posix_spawnattr_setflags|posix_spawnattr_setpgroup|posix_spawnattr_setschedparam|posix_spawnattr_setschedpolicy|posix_spawnattr_setsigdefault|posix_spawnattr_setsigmask|posix_spawn_file_actions_addclose|posix_spawn_file_actions_addopen|posix_spawn_file_actions_adddup2|posix_spawn_file_actions_addopen|posix_spawn_file_actions_destroy|posix_spawn_file_actions_init|posix_spawn_file_actions_init|posix_spawn|posix_spawnp|posix_spawnp|posix_typed_mem_get_info|pthread_mutex_timedlock|sem_timedwait
+-CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c posix_madvise.c
++CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c posix_madvise.c \
++ posix_fallocate.c posix_fallocate64.c
+ CSRC-$(UCLIBC_SUSV4_LEGACY) += utime.c
+ CSRC-$(UCLIBC_HAS_EPOLL) += epoll.c
+ CSRC-$(UCLIBC_HAS_XATTR) += xattr.c
+--- a/libc/sysdeps/linux/common/bits/kernel-features.h
++++ b/libc/sysdeps/linux/common/bits/kernel-features.h
+@@ -494,6 +494,14 @@
+ # define __ASSUME_PRIVATE_FUTEX 1
+ #endif
+
++/* Support for fallocate was added in 2.6.23,
++ on s390 only after 2.6.23-rc1, on alpha only after 2.6.33-rc1. */
++#if __LINUX_KERNEL_VERSION >= 0x020617 \
++ && (!defined __s390__ || __LINUX_KERNEL_VERSION >= 0x020618) \
++ && (!defined __alpha__ || __LINUX_KERNEL_VERSION >= 0x020621)
++# define __ASSUME_FALLOCATE 1
++#endif
++
+ /* getcpu is a syscall for x86-64 since 3.1. */
+ #if defined __x86_64__ && __LINUX_KERNEL_VERSION >= 0x030100
+ # define __ASSUME_GETCPU_SYSCALL 1
+--- /dev/null
++++ b/libc/sysdeps/linux/common/posix_fallocate.c
+@@ -0,0 +1,43 @@
++/* vi: set sw=4 ts=4: */
++/*
++ * posix_fallocate() for uClibc
++ * http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
++ *
++ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
++ *
++ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
++ */
++
++#include <sys/syscall.h>
++#include <fcntl.h>
++#include <bits/kernel-features.h>
++#include <stdint.h>
++
++#if defined __NR_fallocate
++int posix_fallocate(int fd, __off_t offset, __off_t len)
++{
++ int ret;
++
++# if __WORDSIZE == 32
++ uint32_t off_low = offset;
++ uint32_t len_low = len;
++ /* may assert that these >>31 are 0 */
++ uint32_t zero = 0;
++ INTERNAL_SYSCALL_DECL(err);
++ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0,
++ __LONG_LONG_PAIR (zero, off_low),
++ __LONG_LONG_PAIR (zero, len_low)));
++# elif __WORDSIZE == 64
++ INTERNAL_SYSCALL_DECL(err);
++ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 4, fd, 0, offset, len));
++# else
++# error your machine is neither 32 bit or 64 bit ... it must be magical
++#endif
++ if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
++ return INTERNAL_SYSCALL_ERRNO (ret, err);
++ return 0;
++}
++# if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64
++strong_alias(posix_fallocate,posix_fallocate64)
++# endif
++#endif
+--- /dev/null
++++ b/libc/sysdeps/linux/common/posix_fallocate64.c
+@@ -0,0 +1,39 @@
++/* vi: set sw=4 ts=4: */
++/*
++ * posix_fallocate() for uClibc
++ * http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
++ *
++ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
++ *
++ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
++ */
++
++#include <sys/syscall.h>
++#include <fcntl.h>
++#include <bits/kernel-features.h>
++#include <stdint.h>
++
++#if defined __NR_fallocate
++
++# if __WORDSIZE == 64
++/* Can use normal posix_fallocate() */
++# elif __WORDSIZE == 32
++int posix_fallocate64(int fd, __off64_t offset, __off64_t len)
++{
++ int ret;
++ uint32_t off_low = offset & 0xffffffff;
++ uint32_t off_high = offset >> 32;
++ uint32_t len_low = len & 0xffffffff;
++ uint32_t len_high = len >> 32;
++ INTERNAL_SYSCALL_DECL(err);
++ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0,
++ __LONG_LONG_PAIR (off_high, off_low),
++ __LONG_LONG_PAIR (len_high, len_low)));
++ if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
++ return INTERNAL_SYSCALL_ERRNO (ret, err);
++ return 0;
++}
++# else
++# error your machine is neither 32 bit or 64 bit ... it must be magical
++# endif
++#endif
+--- a/test/.gitignore
++++ b/test/.gitignore
+@@ -302,6 +302,8 @@ unistd/getcwd
+ unistd/getopt
+ unistd/getopt_long
+ unistd/tstgetopt
++unistd/tst-posix_fallocate
++unistd/tst-posix_fallocate64
+ unistd/tst-preadwrite
+ unistd/tst-preadwrite64
+ unistd/vfork
+--- a/test/unistd/Makefile.in
++++ b/test/unistd/Makefile.in
+@@ -2,7 +2,10 @@
+ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+ ifeq ($(UCLIBC_HAS_LFS),)
+-TESTS_DISABLED := tst-preadwrite64
++TESTS_DISABLED := tst-preadwrite64 tst-posix_fallocate64
++endif
++ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),)
++TESTS_DISABLED := tst-posix_fallocate
+ endif
+ OPTS_getopt := -abcXXX -9
+ OPTS_getopt_long := --add XXX --delete YYY --verbose
+--- /dev/null
++++ b/test/unistd/tst-posix_fallocate.c
+@@ -0,0 +1,127 @@
++#include <fcntl.h>
++#include <sys/stat.h>
++
++#ifndef TST_POSIX_FALLOCATE64
++# define stat64 stat
++# define fstat64 fstat
++# else
++# ifndef O_LARGEFILE
++# error no O_LARGEFILE but you want to test with LFS enabled
++# endif
++#endif
++
++static void do_prepare (void);
++#define PREPARE(argc, argv) do_prepare ()
++static int do_test (void);
++#define TEST_FUNCTION do_test ()
++#include <test-skeleton.c>
++
++static int fd;
++static void
++do_prepare (void)
++{
++ fd = create_temp_file ("tst-posix_fallocate.", NULL);
++ if (fd == -1)
++ {
++ printf ("cannot create temporary file: %m\n");
++ exit (1);
++ }
++}
++
++
++static int
++do_test (void)
++{
++ struct stat64 st;
++
++ if (fstat64 (fd, &st) != 0)
++ {
++ puts ("1st fstat failed");
++ return 1;
++ }
++
++ if (st.st_size != 0)
++ {
++ puts ("file not created with size 0");
++ return 1;
++ }
++
++ if (posix_fallocate (fd, 512, 768) != 0)
++ {
++ puts ("1st posix_fallocate call failed");
++ return 1;
++ }
++
++ if (fstat64 (fd, &st) != 0)
++ {
++ puts ("2nd fstat failed");
++ return 1;
++ }
++
++ if (st.st_size != 512 + 768)
++ {
++ printf ("file size after 1st posix_fallocate call is %llu, expected %u\n",
++ (unsigned long long int) st.st_size, 512u + 768u);
++ return 1;
++ }
++
++ if (posix_fallocate (fd, 0, 1024) != 0)
++ {
++ puts ("2nd posix_fallocate call failed");
++ return 1;
++ }
++
++ if (fstat64 (fd, &st) != 0)
++ {
++ puts ("3rd fstat failed");
++ return 1;
++ }
++
++ if (st.st_size != 512 + 768)
++ {
++ puts ("file size changed in 2nd posix_fallocate");
++ return 1;
++ }
++
++ if (posix_fallocate (fd, 2048, 64) != 0)
++ {
++ puts ("3rd posix_fallocate call failed");
++ return 1;
++ }
++
++ if (fstat64 (fd, &st) != 0)
++ {
++ puts ("4th fstat failed");
++ return 1;
++ }
++
++ if (st.st_size != 2048 + 64)
++ {
++ printf ("file size after 3rd posix_fallocate call is %llu, expected %u\n",
++ (unsigned long long int) st.st_size, 2048u + 64u);
++ return 1;
++ }
++#ifdef TST_POSIX_FALLOCATE64
++ if (posix_fallocate64 (fd, 4097ULL, 4294967295ULL + 2ULL) != 0)
++ {
++ puts ("4th posix_fallocate call failed");
++ return 1;
++ }
++
++ if (fstat64 (fd, &st) != 0)
++ {
++ puts ("5th fstat failed");
++ return 1;
++ }
++
++ if (st.st_size != 4097ULL + 4294967295ULL + 2ULL)
++ {
++ printf ("file size after 4th posix_fallocate call is %llu, expected %llu\n",
++ (unsigned long long int) st.st_size, 4097ULL + 4294967295ULL + 2ULL);
++ return 1;
++ }
++#endif
++ close (fd);
++
++ return 0;
++}
+--- /dev/null
++++ b/test/unistd/tst-posix_fallocate64.c
+@@ -0,0 +1,2 @@
++#define TST_POSIX_FALLOCATE64
++#include "tst-posix_fallocate.c"
diff --git a/toolchain/uClibc/patches-0.9.33.2/023-libc-add-fallocate-and-fallocate64.patch b/toolchain/uClibc/patches-0.9.33.2/023-libc-add-fallocate-and-fallocate64.patch
new file mode 100644
index 0000000..282b64f
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/023-libc-add-fallocate-and-fallocate64.patch
@@ -0,0 +1,447 @@
+From: "Anthony G. Basile" <blueness@gentoo.org>
+Date: Sun, 7 Sep 2014 15:33:46 -0400
+Subject: [PATCH] libc: add fallocate() and fallocate64()
+
+We add the Linux-specific function fallocate() which allows the user to
+directly manipulate allocate space for a file. fallocate() can operate
+in different modes, but the default mode is equivalent to posix_fallocate()
+which is specified in POSIX.1.
+
+Recent releases of e2fsprogs 1.42.11 and above expect fallocate64() to be
+available.
+
+Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
+Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+---
+ create mode 100644 libc/sysdeps/linux/common/fallocate.c
+ create mode 100644 libc/sysdeps/linux/common/fallocate64.c
+ create mode 100644 test/unistd/tst-fallocate.c
+ create mode 100644 test/unistd/tst-fallocate64.c
+
+--- a/extra/Configs/Config.in
++++ b/extra/Configs/Config.in
+@@ -952,8 +952,8 @@ config UCLIBC_LINUX_SPECIFIC
+ default y
+ help
+ accept4(), bdflush(),
+- capget(), capset(), eventfd(), fstatfs(),
+- inotify_*(), ioperm(), iopl(),
++ capget(), capset(), eventfd(), fallocate(),
++ fstatfs(), inotify_*(), ioperm(), iopl(),
+ madvise(), modify_ldt(), pipe2(), personality(),
+ prctl()/arch_prctl(), pivot_root(), modify_ldt(),
+ ppoll(), readahead(), reboot(), remap_file_pages(),
+--- a/include/fcntl.h
++++ b/include/fcntl.h
+@@ -237,6 +237,38 @@ extern int __fcntl_nocancel (int fd, int
+ libc_hidden_proto(__fcntl_nocancel)
+ #endif
+
++#if (defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU) || defined _LIBC
++/* Reserve storage for the data of a file associated with FD. This function
++ is Linux-specific. For the portable version, use posix_fallocate().
++ Unlike the latter, fallocate can operate in different modes. The default
++ mode = 0 is equivalent to posix_fallocate().
++
++ Note: These declarations are used in posix_fallocate.c and
++ posix_fallocate64.c, so we expose them internally.
++ */
++
++/* Flags for fallocate's mode. */
++# define FALLOC_FL_KEEP_SIZE 1 /* Don't extend size of file
++ even if offset + len is
++ greater than file size. */
++# define FALLOC_FL_PUNCH_HOLE 2 /* Create a hole in the file. */
++
++# ifndef __USE_FILE_OFFSET64
++extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len);
++# else
++# ifdef __REDIRECT
++extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset,
++ __off64_t __len),
++ fallocate64);
++# else
++# define fallocate fallocate64
++# endif
++# endif
++# ifdef __USE_LARGEFILE64
++extern int fallocate64 (int __fd, int __mode, __off64_t __offset, __off64_t __len);
++# endif
++#endif
++
+ __END_DECLS
+
+ #endif /* fcntl.h */
+--- a/libc/sysdeps/linux/common/Makefile.in
++++ b/libc/sysdeps/linux/common/Makefile.in
+@@ -61,6 +61,10 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += \
+ vmsplice.c
+ CSRC-$(if $(findstring yy,$(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_LFS)),y) += \
+ sendfile64.c
++# posix_fallocate() needs __libc_fallocate() from fallocate.c
++# posix_fallocate64() needs __libc_fallocate64() from fallocate64.c
++CSRC-$(if $(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_ADVANCED_REALTIME),y,) += \
++ fallocate.c $(filter fallocate64.c,$(CSRC-y))
+ # NPTL needs these internally: madvise.c
+ CSRC-$(findstring y,$(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_THREADS_NATIVE)) += madvise.c
+ ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
+--- /dev/null
++++ b/libc/sysdeps/linux/common/fallocate.c
+@@ -0,0 +1,48 @@
++/* vi: set sw=4 ts=4: */
++/*
++ * fallocate() for uClibc - Based off of posix_fallocate() by Erik Andersen
++ * http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
++ *
++ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
++ *
++ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
++ */
++
++#include <sys/syscall.h>
++#include <fcntl.h>
++#include <bits/kernel-features.h>
++#include <stdint.h>
++
++#if defined __NR_fallocate
++extern __typeof(fallocate) __libc_fallocate attribute_hidden;
++int attribute_hidden __libc_fallocate(int fd, int mode, __off_t offset, __off_t len)
++{
++ int ret;
++
++# if __WORDSIZE == 32
++ uint32_t off_low = offset;
++ uint32_t len_low = len;
++ /* may assert that these >>31 are 0 */
++ uint32_t zero = 0;
++ INTERNAL_SYSCALL_DECL(err);
++ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, mode,
++ __LONG_LONG_PAIR (zero, off_low),
++ __LONG_LONG_PAIR (zero, len_low)));
++# elif __WORDSIZE == 64
++ INTERNAL_SYSCALL_DECL(err);
++ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 4, fd, mode, offset, len));
++# else
++# error your machine is neither 32 bit or 64 bit ... it must be magical
++# endif
++ if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
++ return INTERNAL_SYSCALL_ERRNO (ret, err);
++ return 0;
++}
++
++# if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
++strong_alias(__libc_fallocate,fallocate)
++# if __WORDSIZE == 64
++strong_alias(__libc_fallocate,fallocate64)
++# endif
++# endif
++#endif
+--- /dev/null
++++ b/libc/sysdeps/linux/common/fallocate64.c
+@@ -0,0 +1,42 @@
++/* vi: set sw=4 ts=4: */
++/*
++ * fallocate() for uClibc - based off posix_fallocate() by Erik Andersen
++ * http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
++ *
++ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
++ *
++ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
++ */
++
++#include <sys/syscall.h>
++
++#include <fcntl.h>
++#include <bits/kernel-features.h>
++#include <stdint.h>
++
++#if defined __NR_fallocate
++
++# if __WORDSIZE == 64
++/* Can use normal fallocate() */
++# elif __WORDSIZE == 32
++extern __typeof(fallocate64) __libc_fallocate64 attribute_hidden;
++int attribute_hidden __libc_fallocate64(int fd, int mode, __off64_t offset,
++ __off64_t len)
++{
++ int ret;
++ INTERNAL_SYSCALL_DECL(err);
++ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, mode,
++ OFF64_HI_LO (offset), OFF64_HI_LO (len)));
++ if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
++ return INTERNAL_SYSCALL_ERRNO (ret, err);
++ return 0;
++}
++
++# if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
++strong_alias(__libc_fallocate64,fallocate64)
++# endif
++
++# else
++# error your machine is neither 32 bit or 64 bit ... it must be magical
++# endif
++#endif
+--- a/libc/sysdeps/linux/common/posix_fallocate.c
++++ b/libc/sysdeps/linux/common/posix_fallocate.c
+@@ -14,28 +14,10 @@
+ #include <stdint.h>
+
+ #if defined __NR_fallocate
++extern __typeof(fallocate) __libc_fallocate attribute_hidden;
+ int posix_fallocate(int fd, __off_t offset, __off_t len)
+ {
+- int ret;
+-
+-# if __WORDSIZE == 32
+- uint32_t off_low = offset;
+- uint32_t len_low = len;
+- /* may assert that these >>31 are 0 */
+- uint32_t zero = 0;
+- INTERNAL_SYSCALL_DECL(err);
+- ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0,
+- __LONG_LONG_PAIR (zero, off_low),
+- __LONG_LONG_PAIR (zero, len_low)));
+-# elif __WORDSIZE == 64
+- INTERNAL_SYSCALL_DECL(err);
+- ret = (int) (INTERNAL_SYSCALL(fallocate, err, 4, fd, 0, offset, len));
+-# else
+-# error your machine is neither 32 bit or 64 bit ... it must be magical
+-#endif
+- if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
+- return INTERNAL_SYSCALL_ERRNO (ret, err);
+- return 0;
++ return __libc_fallocate(fd, 0, offset, len);
+ }
+ # if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64
+ strong_alias(posix_fallocate,posix_fallocate64)
+--- a/libc/sysdeps/linux/common/posix_fallocate64.c
++++ b/libc/sysdeps/linux/common/posix_fallocate64.c
+@@ -18,22 +18,12 @@
+ # if __WORDSIZE == 64
+ /* Can use normal posix_fallocate() */
+ # elif __WORDSIZE == 32
++extern __typeof(fallocate64) __libc_fallocate64 attribute_hidden;
+ int posix_fallocate64(int fd, __off64_t offset, __off64_t len)
+ {
+- int ret;
+- uint32_t off_low = offset & 0xffffffff;
+- uint32_t off_high = offset >> 32;
+- uint32_t len_low = len & 0xffffffff;
+- uint32_t len_high = len >> 32;
+- INTERNAL_SYSCALL_DECL(err);
+- ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0,
+- __LONG_LONG_PAIR (off_high, off_low),
+- __LONG_LONG_PAIR (len_high, len_low)));
+- if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
+- return INTERNAL_SYSCALL_ERRNO (ret, err);
+- return 0;
++ return __libc_fallocate64(fd, 0, offset, len);
+ }
+ # else
+-# error your machine is neither 32 bit or 64 bit ... it must be magical
++# error your machine is neither 32 bit or 64 bit ... it must be magical
+ # endif
+ #endif
+--- a/test/.gitignore
++++ b/test/.gitignore
+@@ -302,6 +302,8 @@ unistd/getcwd
+ unistd/getopt
+ unistd/getopt_long
+ unistd/tstgetopt
++unistd/tst-fallocate
++unistd/tst-fallocate64
+ unistd/tst-posix_fallocate
+ unistd/tst-posix_fallocate64
+ unistd/tst-preadwrite
+--- /dev/null
++++ b/test/unistd/tst-fallocate.c
+@@ -0,0 +1,166 @@
++#include <fcntl.h>
++#include <sys/stat.h>
++
++#ifndef TST_FALLOCATE64
++# define stat64 stat
++# define fstat64 fstat
++# else
++# ifndef O_LARGEFILE
++# error no O_LARGEFILE but you want to test with LFS enabled
++# endif
++#endif
++
++static void do_prepare(void);
++static int do_test(void);
++#define PREPARE(argc, argv) do_prepare ()
++#define TEST_FUNCTION do_test ()
++#include <test-skeleton.c>
++
++static int fd;
++static void
++do_prepare (void)
++{
++ fd = create_temp_file ("tst-fallocate.", NULL);
++ if (fd == -1)
++ {
++ printf ("cannot create temporary file: %m\n");
++ exit (1);
++ }
++}
++
++
++static int
++do_test (void)
++{
++ struct stat64 st;
++ int c;
++ char garbage[4096];
++ blkcnt_t blksb4;
++
++ if (fstat64 (fd, &st) != 0)
++ {
++ puts ("1st fstat failed");
++ return 1;
++ }
++
++ if (st.st_size != 0)
++ {
++ puts ("file not created with size 0");
++ return 1;
++ }
++
++ /* This is the default mode which is identical to posix_fallocate().
++ Note: we need a few extra blocks for FALLOC_FL_PUNCH_HOLE below.
++ While block sizes vary, we'll assume eight 4K blocks for good measure. */
++ if (fallocate (fd, 0, 8 * 4096, 128) != 0)
++ {
++ puts ("1st fallocate call failed");
++ return 1;
++ }
++
++ if (fstat64 (fd, &st) != 0)
++ {
++ puts ("2nd fstat failed");
++ return 1;
++ }
++
++ if (st.st_size != 8 * 4096 + 128)
++ {
++ printf ("file size after 1st fallocate call is %llu, expected %u\n",
++ (unsigned long long int) st.st_size, 8u * 4096u + 128u);
++ return 1;
++ }
++
++ /* Without FALLOC_FL_KEEP_SIZE, this would increaste the size of the file. */
++ if (fallocate (fd, FALLOC_FL_KEEP_SIZE, 0, 16 * 4096) != 0)
++ {
++ puts ("2nd fallocate call failed");
++ return 1;
++ }
++
++ if (fstat64 (fd, &st) != 0)
++ {
++ puts ("3rd fstat failed");
++ return 1;
++ }
++
++ if (st.st_size != 8 * 4096 + 128)
++ {
++ printf ("file size changed in 2nd fallocate call to %llu, expected %u\n",
++ (unsigned long long int) st.st_size, 8u * 4096u + 128u);
++ return 1;
++ }
++
++ /* Let's fill up the first eight 4k blocks with 'x' to force some allocations. */
++
++ memset(garbage, 'x', 4096);
++ for(c=0; c < 8; c++)
++ if(write(fd, garbage, 4096) == -1)
++ {
++ puts ("write failed");
++ return 1;
++ }
++
++ if (fstat64 (fd, &st) != 0)
++ {
++ puts ("4th fstat failed");
++ return 1;
++ }
++
++ blksb4 = st.st_blocks;
++
++ /* Let's punch a hole in the entire file, turning it effectively into a sparse file. */
++ if (fallocate (fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 8 * 4096 + 128) != 0)
++ {
++ puts ("3rd fallocate call failed");
++ return 1;
++ }
++
++ if (fstat64 (fd, &st) != 0)
++ {
++ puts ("5th fstat failed");
++ return 1;
++ }
++
++ if (st.st_size != 8 * 4096 + 128)
++ {
++ printf ("file size after 3rd fallocate call is %llu, expected %u\n",
++ (unsigned long long int) st.st_size, 8u * 4096u + 128u);
++ return 1;
++ }
++
++ /* The number of allocated blocks should decrease. I hope this works on
++ all filesystems! */
++ if (st.st_blocks >= blksb4)
++ {
++ printf ("number of blocks after 3rd fallocate call is %lu, expected less than %lu\n",
++ (unsigned long int) st.st_blocks, blksb4);
++ return 1;
++ }
++
++#ifdef TST_FALLOCATE64
++ /* We'll just do a mode = 0 test for fallocate64() */
++ if (fallocate64 (fd, 0, 4097ULL, 4294967295ULL + 2ULL) != 0)
++ {
++ puts ("1st fallocate64 call failed");
++ return 1;
++ }
++
++ if (fstat64 (fd, &st) != 0)
++ {
++ puts ("6th fstat failed");
++ return 1;
++ }
++
++ if (st.st_size != 4097ULL + 4294967295ULL + 2ULL)
++ {
++ printf ("file size after 1st fallocate64 call is %llu, expected %llu\n",
++ (unsigned long long int) st.st_size, 4097ULL + 4294967295ULL + 2ULL);
++ return 1;
++ }
++#endif
++ close (fd);
++
++ return 0;
++}
++
+--- /dev/null
++++ b/test/unistd/tst-fallocate64.c
+@@ -0,0 +1,2 @@
++#define TST_FALLOCATE64
++#include "tst-fallocate.c"
+--- a/test/unistd/Makefile.in
++++ b/test/unistd/Makefile.in
+@@ -2,10 +2,13 @@
+ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+ ifeq ($(UCLIBC_HAS_LFS),)
+-TESTS_DISABLED := tst-preadwrite64 tst-posix_fallocate64
++TESTS_DISABLED := tst-preadwrite64 tst-posix_fallocate64 tst-fallocate64
+ endif
+ ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),)
+-TESTS_DISABLED := tst-posix_fallocate
++TESTS_DISABLED := tst-posix_fallocate tst-fallocate64
++endif
++ifeq ($(UCLIBC_LINUX_SPECIFIC),)
++TESTS_DISABLED += tst-fallocate
+ endif
+ OPTS_getopt := -abcXXX -9
+ OPTS_getopt_long := --add XXX --delete YYY --verbose
diff --git a/toolchain/uClibc/patches-0.9.33.2/024-i386-bits-syscalls.h-allow-immediate-values-as-6th-s.patch b/toolchain/uClibc/patches-0.9.33.2/024-i386-bits-syscalls.h-allow-immediate-values-as-6th-s.patch
new file mode 100644
index 0000000..2f75fbe
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/024-i386-bits-syscalls.h-allow-immediate-values-as-6th-s.patch
@@ -0,0 +1,25 @@
+From: Natanael Copa <natanael.copa@gmail.com>
+Date: Thu, 5 Jul 2012 11:55:19 +0000
+Subject: [PATCH] i386/bits/syscalls.h: allow immediate values as 6th syscall
+ arg
+
+Allow use of immedate values as the 6th syscall argument. Otherwise we must
+store the arg on memory. This gives gcc more options to optimize better.
+
+This also works around an issue with posix_fallocate.
+
+Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
+Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+---
+
+--- a/libc/sysdeps/linux/i386/bits/syscalls.h
++++ b/libc/sysdeps/linux/i386/bits/syscalls.h
+@@ -136,7 +136,7 @@ __asm__ (
+ #define ASMFMT_5(arg1, arg2, arg3, arg4, arg5) \
+ , "a" (arg1), "c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5)
+ #define ASMFMT_6(arg1, arg2, arg3, arg4, arg5, arg6) \
+- , "a" (arg1), "c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5), "m" (arg6)
++ , "a" (arg1), "c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5), "g" (arg6)
+
+ #else /* !PIC */
+
diff --git a/toolchain/uClibc/patches-0.9.33.2/025-libc-sync_file_range.patch b/toolchain/uClibc/patches-0.9.33.2/025-libc-sync_file_range.patch
new file mode 100644
index 0000000..e7efb93
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/025-libc-sync_file_range.patch
@@ -0,0 +1,57 @@
+Index: uClibc-0.9.33.2/libc/sysdeps/linux/common/sync_file_range.c
+===================================================================
+--- uClibc-0.9.33.2.orig/libc/sysdeps/linux/common/sync_file_range.c 2012-05-15 09:20:09.000000000 +0200
++++ uClibc-0.9.33.2/libc/sysdeps/linux/common/sync_file_range.c 2015-04-03 00:27:47.701221722 +0200
+@@ -4,24 +4,39 @@
+ *
+ * Copyright (C) 2008 Bernhard Reutner-Fischer <uclibc@uclibc.org>
+ *
+- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
++ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
+ */
+
+ #include <sys/syscall.h>
+-#if defined __USE_GNU
+-#include <fcntl.h>
++#if defined __UCLIBC_HAS_LFS__ && defined __USE_GNU
++# include <bits/wordsize.h>
++# include <endian.h>
++# include <fcntl.h>
+
+-#if defined __NR_sync_file_range && defined __UCLIBC_HAS_LFS__
+-#define __NR___syscall_sync_file_range __NR_sync_file_range
+-static __inline__ _syscall6(int, __syscall_sync_file_range, int, fd,
+- off_t, offset_hi, off_t, offset_lo,
+- off_t, nbytes_hi, off_t, nbytes_lo, unsigned int, flags)
++# ifdef __NR_sync_file_range2
++# undef __NR_sync_file_range
++# define __NR_sync_file_range __NR_sync_file_range2
++# endif
++
++# ifdef __NR_sync_file_range
+ int sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags)
+ {
+- return __syscall_sync_file_range(fd,
+- __LONG_LONG_PAIR((long)(offset >> 32), (long)(offset & 0xffffffff)),
+- __LONG_LONG_PAIR((long)(nbytes >> 32), (long)(nbytes & 0xffffffff)),
+- flags);
++# if defined __powerpc__ && __WORDSIZE == 64
++ return INLINE_SYSCALL(sync_file_range, 4, fd, flags, offset, nbytes);
++# elif (defined __mips__ && _MIPS_SIM == _ABIO32) || \
++ (defined(__UCLIBC_SYSCALL_ALIGN_64BIT__) && !(defined(__powerpc__) || defined(__xtensa__)))
++ /* arch with 64-bit data in even reg alignment #2: [arcv2/others-in-future]
++ * stock syscall handler in kernel (reg hole punched)
++ * see libc/sysdeps/linux/common/posix_fadvise.c for more details */
++ return INLINE_SYSCALL(sync_file_range, 7, fd, 0,
++ OFF64_HI_LO(offset), OFF64_HI_LO(nbytes), flags);
++# elif defined __NR_sync_file_range2
++ return INLINE_SYSCALL(sync_file_range, 6, fd, flags,
++ OFF64_HI_LO(offset), OFF64_HI_LO(nbytes));
++# else
++ return INLINE_SYSCALL(sync_file_range, 6, fd,
++ OFF64_HI_LO(offset), OFF64_HI_LO(nbytes), flags);
++# endif
+ }
+-#endif
++# endif
+ #endif
diff --git a/toolchain/uClibc/patches-0.9.33.2/100-fix_unifdef.patch b/toolchain/uClibc/patches-0.9.33.2/100-fix_unifdef.patch
new file mode 100644
index 0000000..3d75b6e
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/100-fix_unifdef.patch
@@ -0,0 +1,11 @@
+--- a/extra/scripts/unifdef.c
++++ b/extra/scripts/unifdef.c
+@@ -78,8 +78,6 @@ __FBSDID("$FreeBSD: /repoman/r/ncvs/src/
+ #define errx(exit_code, fmt, args...) ({ warnx(fmt, ## args); exit(exit_code); })
+ #define err(exit_code, fmt, args...) errx(exit_code, fmt ": %s", ## args, strerror(errno))
+
+-size_t strlcpy(char *dst, const char *src, size_t siz);
+-
+ /* types of input lines: */
+ typedef enum {
+ LT_TRUEI, /* a true #if with ignore flag */
diff --git a/toolchain/uClibc/patches-0.9.33.2/110-compat_macros.patch b/toolchain/uClibc/patches-0.9.33.2/110-compat_macros.patch
new file mode 100644
index 0000000..a7538b1
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/110-compat_macros.patch
@@ -0,0 +1,51 @@
+--- a/include/string.h
++++ b/include/string.h
+@@ -355,18 +355,40 @@ extern char *index (__const char *__s, i
+ /* Find the last occurrence of C in S (same as strrchr). */
+ extern char *rindex (__const char *__s, int __c)
+ __THROW __attribute_pure__ __nonnull ((1));
+-# else
+-# ifdef __UCLIBC_SUSV3_LEGACY_MACROS__
++# elif defined(__UCLIBC_SUSV3_LEGACY_MACROS__) && !defined(_STRINGS_H)
+ /* bcopy/bzero/bcmp/index/rindex are marked LEGACY in SuSv3.
+ * They are replaced as proposed by SuSv3. Don't sync this part
+ * with glibc and keep it in sync with strings.h. */
+
+-# define bcopy(src,dest,n) (memmove((dest), (src), (n)), (void) 0)
+-# define bzero(s,n) (memset((s), '\0', (n)), (void) 0)
+-# define bcmp(s1,s2,n) memcmp((s1), (s2), (size_t)(n))
+-# define index(s,c) strchr((s), (c))
+-# define rindex(s,c) strrchr((s), (c))
+-# endif
++/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
++static __inline__ void bcopy (__const void *__src, void *__dest, size_t __n)
++{
++ memmove(__dest, __src, __n);
++}
++
++/* Set N bytes of S to 0. */
++static __inline__ void bzero (void *__s, size_t __n)
++{
++ memset(__s, 0, __n);
++}
++
++/* Compare N bytes of S1 and S2 (same as memcmp). */
++static __inline__ int bcmp (__const void *__s1, __const void *__s2, size_t __n)
++{
++ return memcmp(__s1, __s2, __n);
++}
++
++/* Find the first occurrence of C in S (same as strchr). */
++static __inline__ char *index (__const char *__s, int __c)
++{
++ return strchr(__s, __c);
++}
++
++/* Find the last occurrence of C in S (same as strrchr). */
++static __inline__ char *rindex (__const char *__s, int __c)
++{
++ return strrchr(__s, __c);
++}
+ # endif
+
+ /* Return the position of the first bit set in I, or 0 if none are set.
diff --git a/toolchain/uClibc/patches-0.9.33.2/120-adjtimex.patch b/toolchain/uClibc/patches-0.9.33.2/120-adjtimex.patch
new file mode 100644
index 0000000..dcf9c9b
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/120-adjtimex.patch
@@ -0,0 +1,14 @@
+--- a/include/sys/timex.h
++++ b/include/sys/timex.h
+@@ -116,9 +116,8 @@ struct timex
+
+ __BEGIN_DECLS
+
+-#if 0
+-extern int __adjtimex (struct timex *__ntx) __THROW;
+-#endif
++#undef __adjtimex
++#define __adjtimex adjtimex
+ extern int adjtimex (struct timex *__ntx) __THROW;
+ libc_hidden_proto(adjtimex)
+
diff --git a/toolchain/uClibc/patches-0.9.33.2/131-inet-fix-__read_etc_hosts_r-segfault.patch b/toolchain/uClibc/patches-0.9.33.2/131-inet-fix-__read_etc_hosts_r-segfault.patch
new file mode 100644
index 0000000..bd9ed38
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/131-inet-fix-__read_etc_hosts_r-segfault.patch
@@ -0,0 +1,10 @@
+--- a/libc/inet/resolv.c
++++ b/libc/inet/resolv.c
+@@ -1631,6 +1631,7 @@ int attribute_hidden __read_etc_hosts_r(
+ * struct in[6]_addr
+ * char line_buffer[BUFSZ+];
+ */
++ memset(buf, 0, buflen);
+ parser->data = buf;
+ parser->data_len = aliaslen;
+ parser->line_len = buflen - aliaslen;
diff --git a/toolchain/uClibc/patches-0.9.33.2/132-inet_fix_res_init.patch b/toolchain/uClibc/patches-0.9.33.2/132-inet_fix_res_init.patch
new file mode 100644
index 0000000..c935821
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/132-inet_fix_res_init.patch
@@ -0,0 +1,15 @@
+--- a/libc/inet/resolv.c
++++ b/libc/inet/resolv.c
+@@ -3654,11 +3654,11 @@ res_init(void)
+ */
+ if (!_res.id)
+ _res.id = res_randomid();
+- __res_sync = res_sync_func;
+
+ __UCLIBC_MUTEX_UNLOCK(__resolv_lock);
+
+ __res_vinit(&_res, 1);
++ __res_sync = res_sync_func;
+
+ return 0;
+ }
diff --git a/toolchain/uClibc/patches-0.9.33.2/133-inet6-scoped-getnameinfo.patch b/toolchain/uClibc/patches-0.9.33.2/133-inet6-scoped-getnameinfo.patch
new file mode 100644
index 0000000..390e06d
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/133-inet6-scoped-getnameinfo.patch
@@ -0,0 +1,26 @@
+--- a/libc/inet/resolv.c
++++ b/libc/inet/resolv.c
+@@ -317,6 +317,7 @@ Domain name in a message can be represen
+ #include <sys/utsname.h>
+ #include <sys/un.h>
+ #include <sys/stat.h>
++#include <net/if.h>
+ #include <bits/uClibc_mutex.h>
+ #include "internal/parse_config.h"
+
+@@ -1861,7 +1862,6 @@ int getnameinfo(const struct sockaddr *s
+ c = inet_ntop(AF_INET6,
+ (const void *) &sin6p->sin6_addr,
+ host, hostlen);
+-#if 0
+ /* Does scope id need to be supported? */
+ uint32_t scopeid;
+ scopeid = sin6p->sin6_scope_id;
+@@ -1898,7 +1898,6 @@ int getnameinfo(const struct sockaddr *s
+ return EAI_SYSTEM;
+ memcpy(host + real_hostlen, scopebuf, scopelen + 1);
+ }
+-#endif
+ }
+ #endif /* __UCLIBC_HAS_IPV6__ */
+ #if defined __UCLIBC_HAS_IPV4__
diff --git a/toolchain/uClibc/patches-0.9.33.2/135-inet_fix_threaded_use_of_res_functions.patch b/toolchain/uClibc/patches-0.9.33.2/135-inet_fix_threaded_use_of_res_functions.patch
new file mode 100644
index 0000000..6732d54
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/135-inet_fix_threaded_use_of_res_functions.patch
@@ -0,0 +1,126 @@
+--- a/libc/inet/resolv.c
++++ b/libc/inet/resolv.c
+@@ -3536,6 +3536,61 @@ __res_vinit(res_state rp, int preinit)
+ return 0;
+ }
+
++static unsigned int
++res_randomid(void)
++{
++ return 0xffff & getpid();
++}
++
++/* Our res_init never fails (always returns 0) */
++int
++res_init(void)
++{
++ /*
++ * These three fields used to be statically initialized. This made
++ * it hard to use this code in a shared library. It is necessary,
++ * now that we're doing dynamic initialization here, that we preserve
++ * the old semantics: if an application modifies one of these three
++ * fields of _res before res_init() is called, res_init() will not
++ * alter them. Of course, if an application is setting them to
++ * _zero_ before calling res_init(), hoping to override what used
++ * to be the static default, we can't detect it and unexpected results
++ * will follow. Zero for any of these fields would make no sense,
++ * so one can safely assume that the applications were already getting
++ * unexpected results.
++ *
++ * _res.options is tricky since some apps were known to diddle the bits
++ * before res_init() was first called. We can't replicate that semantic
++ * with dynamic initialization (they may have turned bits off that are
++ * set in RES_DEFAULT). Our solution is to declare such applications
++ * "broken". They could fool us by setting RES_INIT but none do (yet).
++ */
++
++ __UCLIBC_MUTEX_LOCK(__resolv_lock);
++
++ if (!_res.retrans)
++ _res.retrans = RES_TIMEOUT;
++ if (!_res.retry)
++ _res.retry = 4;
++ if (!(_res.options & RES_INIT))
++ _res.options = RES_DEFAULT;
++
++ /*
++ * This one used to initialize implicitly to zero, so unless the app
++ * has set it to something in particular, we can randomize it now.
++ */
++ if (!_res.id)
++ _res.id = res_randomid();
++
++ __UCLIBC_MUTEX_UNLOCK(__resolv_lock);
++
++ __res_vinit(&_res, 1);
++ __res_sync = res_sync_func;
++
++ return 0;
++}
++libc_hidden_def(res_init)
++
+ static void
+ __res_iclose(void)
+ {
+@@ -3608,61 +3663,6 @@ struct __res_state *__resp = &_res;
+ # endif
+ #endif /* !__UCLIBC_HAS_THREADS__ */
+
+-static unsigned int
+-res_randomid(void)
+-{
+- return 0xffff & getpid();
+-}
+-
+-/* Our res_init never fails (always returns 0) */
+-int
+-res_init(void)
+-{
+- /*
+- * These three fields used to be statically initialized. This made
+- * it hard to use this code in a shared library. It is necessary,
+- * now that we're doing dynamic initialization here, that we preserve
+- * the old semantics: if an application modifies one of these three
+- * fields of _res before res_init() is called, res_init() will not
+- * alter them. Of course, if an application is setting them to
+- * _zero_ before calling res_init(), hoping to override what used
+- * to be the static default, we can't detect it and unexpected results
+- * will follow. Zero for any of these fields would make no sense,
+- * so one can safely assume that the applications were already getting
+- * unexpected results.
+- *
+- * _res.options is tricky since some apps were known to diddle the bits
+- * before res_init() was first called. We can't replicate that semantic
+- * with dynamic initialization (they may have turned bits off that are
+- * set in RES_DEFAULT). Our solution is to declare such applications
+- * "broken". They could fool us by setting RES_INIT but none do (yet).
+- */
+-
+- __UCLIBC_MUTEX_LOCK(__resolv_lock);
+-
+- if (!_res.retrans)
+- _res.retrans = RES_TIMEOUT;
+- if (!_res.retry)
+- _res.retry = 4;
+- if (!(_res.options & RES_INIT))
+- _res.options = RES_DEFAULT;
+-
+- /*
+- * This one used to initialize implicitly to zero, so unless the app
+- * has set it to something in particular, we can randomize it now.
+- */
+- if (!_res.id)
+- _res.id = res_randomid();
+-
+- __UCLIBC_MUTEX_UNLOCK(__resolv_lock);
+-
+- __res_vinit(&_res, 1);
+- __res_sync = res_sync_func;
+-
+- return 0;
+-}
+-libc_hidden_def(res_init)
+-
+ /*
+ * Set up default settings. If the configuration file exist, the values
+ * there will have precedence. Otherwise, the server address is set to
diff --git a/toolchain/uClibc/patches-0.9.33.2/136-inet_make_res_init_thread_safe.patch b/toolchain/uClibc/patches-0.9.33.2/136-inet_make_res_init_thread_safe.patch
new file mode 100644
index 0000000..0627889
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/136-inet_make_res_init_thread_safe.patch
@@ -0,0 +1,53 @@
+--- a/libc/inet/resolv.c
++++ b/libc/inet/resolv.c
+@@ -3432,6 +3432,7 @@ static void res_sync_func(void)
+ */
+ }
+
++/* has to be called under __resolv_lock */
+ static int
+ __res_vinit(res_state rp, int preinit)
+ {
+@@ -3440,7 +3441,6 @@ __res_vinit(res_state rp, int preinit)
+ int m = 0;
+ #endif
+
+- __UCLIBC_MUTEX_LOCK(__resolv_lock);
+ __close_nameservers();
+ __open_nameservers();
+
+@@ -3532,7 +3532,6 @@ __res_vinit(res_state rp, int preinit)
+
+ rp->options |= RES_INIT;
+
+- __UCLIBC_MUTEX_UNLOCK(__resolv_lock);
+ return 0;
+ }
+
+@@ -3582,11 +3581,11 @@ res_init(void)
+ if (!_res.id)
+ _res.id = res_randomid();
+
+- __UCLIBC_MUTEX_UNLOCK(__resolv_lock);
+-
+ __res_vinit(&_res, 1);
+ __res_sync = res_sync_func;
+
++ __UCLIBC_MUTEX_UNLOCK(__resolv_lock);
++
+ return 0;
+ }
+ libc_hidden_def(res_init)
+@@ -3687,7 +3686,11 @@ struct __res_state *__resp = &_res;
+ int
+ res_ninit(res_state statp)
+ {
+- return __res_vinit(statp, 0);
++ int ret;
++ __UCLIBC_MUTEX_LOCK(__resolv_lock);
++ ret = __res_vinit(statp, 0);
++ __UCLIBC_MUTEX_UNLOCK(__resolv_lock);
++ return ret;
+ }
+
+ #endif /* L_res_init */
diff --git a/toolchain/uClibc/patches-0.9.33.2/137-inet_fix_threaded_res_init.patch b/toolchain/uClibc/patches-0.9.33.2/137-inet_fix_threaded_res_init.patch
new file mode 100644
index 0000000..ce8448a
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/137-inet_fix_threaded_res_init.patch
@@ -0,0 +1,10 @@
+--- a/libc/inet/resolv.c
++++ b/libc/inet/resolv.c
+@@ -3581,6 +3581,7 @@ res_init(void)
+ if (!_res.id)
+ _res.id = res_randomid();
+
++ __res_sync = NULL;
+ __res_vinit(&_res, 1);
+ __res_sync = res_sync_func;
+
diff --git a/toolchain/uClibc/patches-0.9.33.2/150-vasprintf_size_reduce.patch b/toolchain/uClibc/patches-0.9.33.2/150-vasprintf_size_reduce.patch
new file mode 100644
index 0000000..7853c1a
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/150-vasprintf_size_reduce.patch
@@ -0,0 +1,37 @@
+Reduce the initial buffer size for open_memstream (used by vasprintf),
+as most strings are usually smaller than that.
+Realloc the buffer after finishing the string to further reduce size.
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+
+--- a/libc/stdio/vasprintf.c
++++ b/libc/stdio/vasprintf.c
+@@ -39,6 +39,8 @@ int vasprintf(char **__restrict buf, con
+ if (rv < 0) {
+ free(*buf);
+ *buf = NULL;
++ } else {
++ *buf = realloc(*buf, rv + 1);
+ }
+ }
+
+--- a/libc/stdio/open_memstream.c
++++ b/libc/stdio/open_memstream.c
+@@ -17,6 +17,8 @@
+
+ #define COOKIE ((__oms_cookie *) cookie)
+
++#define MEMSTREAM_BUFSIZ 256
++
+ typedef struct {
+ char *buf;
+ size_t len;
+@@ -134,7 +136,7 @@ FILE *open_memstream(char **__restrict b
+ register FILE *fp;
+
+ if ((cookie = malloc(sizeof(__oms_cookie))) != NULL) {
+- if ((cookie->buf = malloc(cookie->len = BUFSIZ)) == NULL) {
++ if ((cookie->buf = malloc(cookie->len = MEMSTREAM_BUFSIZ)) == NULL) {
+ goto EXIT_cookie;
+ }
+ *cookie->buf = 0; /* Set nul terminator for buffer. */
diff --git a/toolchain/uClibc/patches-0.9.33.2/170-math_finite.patch b/toolchain/uClibc/patches-0.9.33.2/170-math_finite.patch
new file mode 100644
index 0000000..b0ae333
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/170-math_finite.patch
@@ -0,0 +1,23 @@
+--- a/include/math.h
++++ b/include/math.h
+@@ -195,7 +195,7 @@ extern int signgam;
+
+
+ /* ISO C99 defines some generic macros which work on any data type. */
+-#ifdef __USE_ISOC99
++#if defined(__USE_ISOC99) || defined(__USE_BSD)
+
+ /* Get the architecture specific values describing the floating-point
+ evaluation. The following symbols will get defined:
+@@ -315,6 +315,11 @@ enum
+
+ #endif /* Use ISO C99. */
+
++/* BSD compat */
++#define finite(x) __finite(x)
++#define finitef(x) __finitef(x)
++#define finitel(x) __finitel(x)
++
+ #ifdef __USE_MISC
+ /* Support for various different standard error handling behaviors. */
+ typedef enum
diff --git a/toolchain/uClibc/patches-0.9.33.2/180-pthread_cleanup_fix.patch b/toolchain/uClibc/patches-0.9.33.2/180-pthread_cleanup_fix.patch
new file mode 100644
index 0000000..ae36018
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/180-pthread_cleanup_fix.patch
@@ -0,0 +1,45 @@
+--- a/libpthread/nptl/cleanup_defer_compat.c
++++ b/libpthread/nptl/cleanup_defer_compat.c
+@@ -22,7 +22,7 @@
+
+ void
+ attribute_protected
+-_pthread_cleanup_push_defer (
++__pthread_cleanup_push_defer (
+ struct _pthread_cleanup_buffer *buffer,
+ void (*routine) (void *),
+ void *arg)
+@@ -57,12 +57,12 @@ _pthread_cleanup_push_defer (
+
+ THREAD_SETMEM (self, cleanup, buffer);
+ }
+-strong_alias (_pthread_cleanup_push_defer, __pthread_cleanup_push_defer)
++strong_alias (__pthread_cleanup_push_defer, _pthread_cleanup_push_defer)
+
+
+ void
+ attribute_protected
+-_pthread_cleanup_pop_restore (
++__pthread_cleanup_pop_restore (
+ struct _pthread_cleanup_buffer *buffer,
+ int execute)
+ {
+@@ -97,4 +97,4 @@ _pthread_cleanup_pop_restore (
+ if (execute)
+ buffer->__routine (buffer->__arg);
+ }
+-strong_alias (_pthread_cleanup_pop_restore, __pthread_cleanup_pop_restore)
++strong_alias (__pthread_cleanup_pop_restore, _pthread_cleanup_pop_restore)
+--- a/libpthread/nptl/init.c
++++ b/libpthread/nptl/init.c
+@@ -112,8 +112,8 @@ static const struct pthread_functions pt
+ .ptr___pthread_key_create = __pthread_key_create_internal,
+ .ptr___pthread_getspecific = __pthread_getspecific_internal,
+ .ptr___pthread_setspecific = __pthread_setspecific_internal,
+- .ptr__pthread_cleanup_push_defer = _pthread_cleanup_push_defer,
+- .ptr__pthread_cleanup_pop_restore = _pthread_cleanup_pop_restore,
++ .ptr__pthread_cleanup_push_defer = __pthread_cleanup_push_defer,
++ .ptr__pthread_cleanup_pop_restore = __pthread_cleanup_pop_restore,
+ .ptr_nthreads = &__nptl_nthreads,
+ .ptr___pthread_unwind = &__pthread_unwind,
+ .ptr__nptl_deallocate_tsd = __nptl_deallocate_tsd,
diff --git a/toolchain/uClibc/patches-0.9.33.2/190-nptl_use_arch_default_stack_limit.patch b/toolchain/uClibc/patches-0.9.33.2/190-nptl_use_arch_default_stack_limit.patch
new file mode 100644
index 0000000..b7f5c82
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/190-nptl_use_arch_default_stack_limit.patch
@@ -0,0 +1,13 @@
+--- a/libpthread/nptl/init.c
++++ b/libpthread/nptl/init.c
+@@ -402,6 +402,10 @@ __pthread_initialize_minimal_internal (v
+ Use the minimal size acceptable. */
+ limit.rlim_cur = PTHREAD_STACK_MIN;
+
++ /* Do not exceed architecture specific default */
++ if (limit.rlim_cur > ARCH_STACK_DEFAULT_SIZE)
++ limit.rlim_cur = ARCH_STACK_DEFAULT_SIZE;
++
+ /* Make sure it meets the minimum size that allocate_stack
+ (allocatestack.c) will demand, which depends on the page size. */
+ const uintptr_t pagesz = sysconf (_SC_PAGESIZE);
diff --git a/toolchain/uClibc/patches-0.9.33.2/200-no_forced_unwind.patch b/toolchain/uClibc/patches-0.9.33.2/200-no_forced_unwind.patch
new file mode 100644
index 0000000..d6869e2
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/200-no_forced_unwind.patch
@@ -0,0 +1,10 @@
+--- a/Rules.mak
++++ b/Rules.mak
+@@ -707,7 +707,6 @@ endif
+ ifeq ($(UCLIBC_HAS_THREADS),y)
+ ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
+ PTNAME := nptl
+- CFLAGS += -DHAVE_FORCED_UNWIND
+ else
+ ifeq ($(LINUXTHREADS_OLD),y)
+ PTNAME := linuxthreads.old
diff --git a/toolchain/uClibc/patches-0.9.33.2/210-mips_use_pic_crt1.patch b/toolchain/uClibc/patches-0.9.33.2/210-mips_use_pic_crt1.patch
new file mode 100644
index 0000000..2ca10d4
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/210-mips_use_pic_crt1.patch
@@ -0,0 +1,11 @@
+--- a/libc/sysdeps/linux/mips/Makefile.arch
++++ b/libc/sysdeps/linux/mips/Makefile.arch
+@@ -20,6 +20,8 @@ ifneq ($(UCLIBC_HAS_THREADS_NATIVE),y)
+ SSRC += vfork.S clone.S
+ endif
+
++CFLAGS-crt1.S += $(PICFLAG)
++
+ ASFLAGS-syscall_error.S += -D_LIBC_REENTRANT
+
+ ARCH_HEADERS := sgidefs.h
diff --git a/toolchain/uClibc/patches-0.9.33.2/350-use-fputs_unlocked.patch b/toolchain/uClibc/patches-0.9.33.2/350-use-fputs_unlocked.patch
new file mode 100644
index 0000000..58b03ec
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/350-use-fputs_unlocked.patch
@@ -0,0 +1,19 @@
+commit 3e3ae40f053b22fbb9bef50067d6edad4c358c4c
+Author: Mirko Vogt <dev@nanl.de>
+Date: Tue May 24 14:36:42 2011 +0200
+
+ use 'fputws_unlocked(S,F)' instead of 'fputws(S,F)'
+
+ this eliminates a source of reproduceable freezes
+
+--- a/libc/stdio/_vfprintf.c
++++ b/libc/stdio/_vfprintf.c
+@@ -1229,7 +1229,7 @@ static size_t _fp_out_narrow(FILE *fp, i
+ #define STRLEN wcslen
+ #define _PPFS_init _ppwfs_init
+ /* Pulls in fseek: */
+-#define OUTPUT(F,S) fputws(S,F)
++#define OUTPUT(F,S) fputws_unlocked(S,F)
+ /* TODO: #define OUTPUT(F,S) _wstdio_fwrite((S),wcslen(S),(F)) */
+ #define _outnwcs(stream, wstring, len) _wstdio_fwrite((const wchar_t *)(wstring), len, stream)
+ #define FP_OUT _fp_out_wide
diff --git a/toolchain/uClibc/patches-0.9.33.2/410-llvm_workaround.patch b/toolchain/uClibc/patches-0.9.33.2/410-llvm_workaround.patch
new file mode 100644
index 0000000..7ae3943
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/410-llvm_workaround.patch
@@ -0,0 +1,11 @@
+--- a/libc/stdio/_stdio.c
++++ b/libc/stdio/_stdio.c
+@@ -124,7 +124,7 @@ static FILE _stdio_streams[] = {
+ __FLAG_NBF|__FLAG_WRITEONLY, \
+ 2, \
+ NULL, \
+- NULL, \
++ 0, \
+ 0 )
+ };
+
diff --git a/toolchain/uClibc/patches-0.9.33.2/450-powerpc_copysignl.patch b/toolchain/uClibc/patches-0.9.33.2/450-powerpc_copysignl.patch
new file mode 100644
index 0000000..ad8d682
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/450-powerpc_copysignl.patch
@@ -0,0 +1,103 @@
+--- a/libc/sysdeps/linux/powerpc/Makefile.arch
++++ b/libc/sysdeps/linux/powerpc/Makefile.arch
+@@ -5,7 +5,7 @@
+ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ #
+
+-CSRC := __syscall_error.c pread_write.c ioctl.c
++CSRC := __syscall_error.c pread_write.c ioctl.c copysignl.c
+
+ ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y)
+ CSRC += posix_fadvise.c posix_fadvise64.c
+--- /dev/null
++++ b/libc/sysdeps/linux/powerpc/copysignl.c
+@@ -0,0 +1,89 @@
++/* s_copysignl.c -- long double version of s_copysign.c.
++ * Conversion to long double by Ulrich Drepper,
++ * Cygnus Support, drepper@cygnus.com.
++ */
++
++/*
++ * ====================================================
++ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
++ *
++ * Developed at SunPro, a Sun Microsystems, Inc. business.
++ * Permission to use, copy, modify, and distribute this
++ * software is freely granted, provided that this notice
++ * is preserved.
++ * ====================================================
++ */
++
++/*
++ * copysignl(long double x, long double y)
++ * copysignl(x,y) returns a value with the magnitude of x and
++ * with the sign bit of y.
++ */
++
++#include <endian.h>
++#include <stdint.h>
++
++#if __FLOAT_WORD_ORDER == BIG_ENDIAN
++
++typedef union
++{
++ long double value;
++ struct
++ {
++ int sign_exponent:16;
++ unsigned int empty:16;
++ uint32_t msw;
++ uint32_t lsw;
++ } parts;
++} ieee_long_double_shape_type;
++
++#endif
++
++#if __FLOAT_WORD_ORDER == LITTLE_ENDIAN
++
++typedef union
++{
++ long double value;
++ struct
++ {
++ uint32_t lsw;
++ uint32_t msw;
++ int sign_exponent:16;
++ unsigned int empty:16;
++ } parts;
++} ieee_long_double_shape_type;
++
++#endif
++
++/* Get int from the exponent of a long double. */
++
++#define GET_LDOUBLE_EXP(exp,d) \
++do { \
++ ieee_long_double_shape_type ge_u; \
++ ge_u.value = (d); \
++ (exp) = ge_u.parts.sign_exponent; \
++} while (0)
++
++/* Set exponent of a long double from an int. */
++
++#define SET_LDOUBLE_EXP(d,exp) \
++do { \
++ ieee_long_double_shape_type se_u; \
++ se_u.value = (d); \
++ se_u.parts.sign_exponent = (exp); \
++ (d) = se_u.value; \
++} while (0)
++
++long double copysignl(long double x, long double y);
++libc_hidden_proto(copysignl);
++
++long double copysignl(long double x, long double y)
++{
++ uint32_t es1,es2;
++ GET_LDOUBLE_EXP(es1,x);
++ GET_LDOUBLE_EXP(es2,y);
++ SET_LDOUBLE_EXP(x,(es1&0x7fff)|(es2&0x8000));
++ return x;
++}
++
++libc_hidden_def(copysignl);
diff --git a/toolchain/uClibc/patches-0.9.33.2/460-powerpc_ptrace_h.patch b/toolchain/uClibc/patches-0.9.33.2/460-powerpc_ptrace_h.patch
new file mode 100644
index 0000000..c48b682
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/460-powerpc_ptrace_h.patch
@@ -0,0 +1,96 @@
+--- a/libc/sysdeps/linux/powerpc/sys/ptrace.h
++++ b/libc/sysdeps/linux/powerpc/sys/ptrace.h
+@@ -1,5 +1,5 @@
+ /* `ptrace' debugger support interface. Linux version.
+- Copyright (C) 2001 Free Software Foundation, Inc.
++ Copyright (C) 2001, 2006, 2007, 2011 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+@@ -13,9 +13,8 @@
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+- License along with the GNU C Library; if not, write to the Free
+- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+- 02111-1307 USA. */
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
+
+ #ifndef _SYS_PTRACE_H
+ #define _SYS_PTRACE_H 1
+@@ -79,8 +78,73 @@ enum __ptrace_request
+ #define PT_DETACH PTRACE_DETACH
+
+ /* Continue and stop at the next (return from) syscall. */
+- PTRACE_SYSCALL = 24
++ PTRACE_SYSCALL = 24,
+ #define PT_SYSCALL PTRACE_SYSCALL
++
++ /* Set ptrace filter options. */
++ PTRACE_SETOPTIONS = 0x4200,
++#define PT_SETOPTIONS PTRACE_SETOPTIONS
++
++ /* Get last ptrace message. */
++ PTRACE_GETEVENTMSG = 0x4201,
++#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
++
++ /* Get siginfo for process. */
++ PTRACE_GETSIGINFO = 0x4202,
++#define PT_GETSIGINFO PTRACE_GETSIGINFO
++
++ /* Set new siginfo for process. */
++ PTRACE_SETSIGINFO = 0x4203,
++#define PT_SETSIGINFO PTRACE_SETSIGINFO
++
++ /* Get register content. */
++ PTRACE_GETREGSET = 0x4204,
++#define PTRACE_GETREGSET PTRACE_GETREGSET
++
++ /* Set register content. */
++ PTRACE_SETREGSET = 0x4205,
++#define PTRACE_SETREGSET PTRACE_SETREGSET
++
++ /* Like PTRACE_ATTACH, but do not force tracee to trap and do not affect
++ signal or group stop state. */
++ PTRACE_SEIZE = 0x4206,
++#define PTRACE_SEIZE PTRACE_SEIZE
++
++ /* Trap seized tracee. */
++ PTRACE_INTERRUPT = 0x4207,
++#define PTRACE_INTERRUPT PTRACE_INTERRUPT
++
++ /* Wait for next group event. */
++ PTRACE_LISTEN = 0x4208
++};
++
++
++/* Flag for PTRACE_LISTEN. */
++enum __ptrace_flags
++{
++ PTRACE_SEIZE_DEVEL = 0x80000000
++};
++
++/* Options set using PTRACE_SETOPTIONS. */
++enum __ptrace_setoptions {
++ PTRACE_O_TRACESYSGOOD = 0x00000001,
++ PTRACE_O_TRACEFORK = 0x00000002,
++ PTRACE_O_TRACEVFORK = 0x00000004,
++ PTRACE_O_TRACECLONE = 0x00000008,
++ PTRACE_O_TRACEEXEC = 0x00000010,
++ PTRACE_O_TRACEVFORKDONE = 0x00000020,
++ PTRACE_O_TRACEEXIT = 0x00000040,
++ PTRACE_O_MASK = 0x0000007f
++};
++
++/* Wait extended result codes for the above trace options. */
++enum __ptrace_eventcodes {
++ PTRACE_EVENT_FORK = 1,
++ PTRACE_EVENT_VFORK = 2,
++ PTRACE_EVENT_CLONE = 3,
++ PTRACE_EVENT_EXEC = 4,
++ PTRACE_EVENT_VFORK_DONE = 5,
++ PTRACE_EVENT_EXIT = 6
+ };
+
+ /* Perform process tracing functions. REQUEST is one of the values
diff --git a/toolchain/uClibc/patches-0.9.33.2/470-powerpc_syscall6.patch b/toolchain/uClibc/patches-0.9.33.2/470-powerpc_syscall6.patch
new file mode 100644
index 0000000..9511dcc
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/470-powerpc_syscall6.patch
@@ -0,0 +1,10 @@
+--- a/libc/sysdeps/linux/powerpc/syscall.S
++++ b/libc/sysdeps/linux/powerpc/syscall.S
+@@ -30,6 +30,7 @@ syscall:
+ mr 5,6
+ mr 6,7
+ mr 7,8
++ mr 8,9
+ sc
+ bnslr;
+
diff --git a/toolchain/uClibc/patches-0.9.33.2/480-powerpc_rel24_support.patch b/toolchain/uClibc/patches-0.9.33.2/480-powerpc_rel24_support.patch
new file mode 100644
index 0000000..19c2b2c
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/480-powerpc_rel24_support.patch
@@ -0,0 +1,26 @@
+--- a/ldso/ldso/powerpc/elfinterp.c
++++ b/ldso/ldso/powerpc/elfinterp.c
+@@ -297,22 +297,17 @@ _dl_do_reloc (struct elf_resolve *tpnt,s
+ break;
+ #endif
+ case R_PPC_REL24:
+-#if 0
+ {
+ Elf32_Sword delta = finaladdr - (Elf32_Word)reloc_addr;
+ if (unlikely(delta<<6>>6 != delta)) {
+ _dl_dprintf(2, "%s: symbol '%s' R_PPC_REL24 is out of range.\n\t"
+ "Compile shared libraries with -fPIC!\n",
+ _dl_progname, symname);
+- _dl_exit(1);
++ return -1;
+ }
+ *reloc_addr = (*reloc_addr & 0xfc000003) | (delta & 0x3fffffc);
+ break;
+ }
+-#else
+- _dl_dprintf(2,"R_PPC_REL24: Compile shared libraries with -fPIC!\n");
+- return -1;
+-#endif
+ case R_PPC_NONE:
+ goto out_nocode; /* No code code modified */
+ default:
diff --git a/toolchain/uClibc/patches-0.9.33.2/500-eventfd.patch b/toolchain/uClibc/patches-0.9.33.2/500-eventfd.patch
new file mode 100644
index 0000000..374052c
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/500-eventfd.patch
@@ -0,0 +1,53 @@
+From 7810e4f8027b5c4c8ceec6fefec4eb779362ebb5 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 10 Jun 2012 16:36:23 +0000
+Subject: eventfd: Implement eventfd2 and fix eventfd
+
+eventfd: evntfd assumes to take two arguments instead it
+should be one evntfd expects two therefore implement both syscalls with
+correct parameters
+
+Thanks Eugene Rudoy for reporting it and also providing the patch
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+--- a/libc/sysdeps/linux/common/eventfd.c
++++ b/libc/sysdeps/linux/common/eventfd.c
+@@ -7,12 +7,24 @@
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
++#include <errno.h>
+ #include <sys/syscall.h>
+ #include <sys/eventfd.h>
+
+ /*
+ * eventfd()
+ */
+-#ifdef __NR_eventfd
+-_syscall2(int, eventfd, int, count, int, flags)
++#if defined __NR_eventfd || defined __NR_eventfd2
++int eventfd (int count, int flags)
++{
++#if defined __NR_eventfd2
++ return INLINE_SYSCALL (eventfd2, 2, count, flags);
++#elif defined __NR_eventfd
++ if (flags != 0) {
++ __set_errno (EINVAL);
++ return -1;
++ }
++ return INLINE_SYSCALL (eventfd, 1, count);
++#endif
++}
+ #endif
+--- a/libc/sysdeps/linux/common/stubs.c
++++ b/libc/sysdeps/linux/common/stubs.c
+@@ -93,7 +93,7 @@ make_stub(epoll_ctl)
+ make_stub(epoll_wait)
+ #endif
+
+-#if !defined __NR_eventfd && defined __UCLIBC_LINUX_SPECIFIC__
++#if !defined __NR_eventfd && !defined __NR_eventfd2 && defined __UCLIBC_LINUX_SPECIFIC__
+ make_stub(eventfd)
+ #endif
+
diff --git a/toolchain/uClibc/patches-0.9.33.2/600-mips64_abi_selection.patch b/toolchain/uClibc/patches-0.9.33.2/600-mips64_abi_selection.patch
new file mode 100644
index 0000000..beca17c
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/600-mips64_abi_selection.patch
@@ -0,0 +1,48 @@
+From 603af30d6992e94ac30a66b953264076f4f2fd71 Mon Sep 17 00:00:00 2001
+From: Markos Chandras <markos.chandras@imgtec.com>
+Date: Thu, 11 Jul 2013 16:59:16 +0000
+Subject: Rules.mak: MIPS64: Select correct interpreter
+
+gcc (eg 4.7.3) hardcodes the MIPS64 interpreters like this:
+(see gcc/config/linux.h and gcc/config/mips/linux64.h)
+
+o32: UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
+n32: UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
+n64: UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
+
+The existing check for MIPS64 in uClibc is wrong because it does
+not respect the selected ABI
+
+We fix this by explicitely checking the selected ABI instead of the
+selected MIPS variant.
+
+Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
+Cc: Anthony G. Basile <blueness@gentoo.org>
+Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+---
+
+--- a/Rules.mak
++++ b/Rules.mak
+@@ -118,13 +118,19 @@ export MAJOR_VERSION MINOR_VERSION SUBLE
+ LIBC := libc
+ SHARED_LIBNAME := $(LIBC).so.$(ABI_VERSION)
+ UBACKTRACE_DSO := libubacktrace.so.$(ABI_VERSION)
+-ifneq ($(findstring $(TARGET_ARCH) , hppa64 ia64 mips64 powerpc64 s390x sparc64 x86_64 ),)
++
++UCLIBC_LDSO_NAME := ld-uClibc
++ARCH_NATIVE_BIT := 32
++ifneq ($(findstring $(TARGET_ARCH),hppa64 ia64 powerpc64 s390x sparc64 x86_64),)
+ UCLIBC_LDSO_NAME := ld64-uClibc
+ ARCH_NATIVE_BIT := 64
+ else
+-UCLIBC_LDSO_NAME := ld-uClibc
+-ARCH_NATIVE_BIT := 32
++ifeq ($(CONFIG_MIPS_N64_ABI),y)
++UCLIBC_LDSO_NAME := ld64-uClibc
++ARCH_NATIVE_BIT := 64
+ endif
++endif
++
+ UCLIBC_LDSO := $(UCLIBC_LDSO_NAME).so.$(ABI_VERSION)
+ NONSHARED_LIBNAME := uclibc_nonshared.a
+ libc := $(top_builddir)lib/$(SHARED_LIBNAME)
diff --git a/toolchain/uClibc/patches-0.9.33.2/610-mips64_syscall_fix.patch b/toolchain/uClibc/patches-0.9.33.2/610-mips64_syscall_fix.patch
new file mode 100644
index 0000000..46d1f5c
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/610-mips64_syscall_fix.patch
@@ -0,0 +1,285 @@
+commit e5cde2eb0ed7df9416fdd6070af07c8448c72a30
+Author: Steve Ellcey <sellcey@mips.com>
+Date: Wed Feb 12 11:01:35 2014 -0800
+
+ mips: Remove duplicate macro definitions
+
+ The INLINE_SYSCALL, INTERNAL_SYSCALL*, and internal_syscall* macros
+ are defined for MIPS in both libc/sysdeps/linux/mips/sysdep.h and
+ libc/sysdeps/linux/mips/bits/syscalls.h. The macros are the same
+ in both cases except that syscalls.h defines internal_syscalls[567]
+ the same for N32 and N64 ABIs and has a different definition for O32.
+ I believe that is correct. The sysdep.h header uses the O32 versions
+ for N32 and has different definitions for N64. I think that is wrong
+ and that N32 and N64 should share the same definition (modulo the
+ type 'long' vs. 'long long' for the arguments. This setup (from
+ sysdep.h) now agrees with what glibc has.
+
+ I am not positive about which header (sysdep.h vs syscalls.h) is
+ really the right one to have these definitions in but using sysdep.h
+ seems to work for all my builds.
+
+ Signed-off-by: Steve Ellcey <sellcey@mips.com>
+ Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+
+--- a/libc/sysdeps/linux/mips/sysdep.h
++++ b/libc/sysdeps/linux/mips/sysdep.h
+@@ -133,258 +133,6 @@ L(syse1):
+
+ #else /* ! __ASSEMBLER__ */
+
+-/* Define a macro which expands into the inline wrapper code for a system
+- call. */
+-#undef INLINE_SYSCALL
+-#define INLINE_SYSCALL(name, nr, args...) \
+- ({ INTERNAL_SYSCALL_DECL(err); \
+- long result_var = INTERNAL_SYSCALL (name, err, nr, args); \
+- if ( INTERNAL_SYSCALL_ERROR_P (result_var, err) ) \
+- { \
+- __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, err)); \
+- result_var = -1L; \
+- } \
+- result_var; })
+-
+-#undef INTERNAL_SYSCALL_DECL
+-#define INTERNAL_SYSCALL_DECL(err) long err
+-
+-#undef INTERNAL_SYSCALL_ERROR_P
+-#define INTERNAL_SYSCALL_ERROR_P(val, err) ((long) (err))
+-
+-#undef INTERNAL_SYSCALL_ERRNO
+-#define INTERNAL_SYSCALL_ERRNO(val, err) (val)
+-
+-#undef INTERNAL_SYSCALL
+-#define INTERNAL_SYSCALL(name, err, nr, args...) \
+- internal_syscall##nr (, "li\t$2, %2\t\t\t# " #name "\n\t", \
+- "i" (SYS_ify (name)), err, args)
+-
+-#undef INTERNAL_SYSCALL_NCS
+-#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \
+- internal_syscall##nr (= number, , "r" (__v0), err, args)
+-#undef internal_syscall0
+-#define internal_syscall0(ncs_init, cs_init, input, err, dummy...) \
+-({ \
+- long _sys_result; \
+- \
+- { \
+- register long __v0 __asm__("$2") ncs_init; \
+- register long __a3 __asm__("$7"); \
+- __asm__ __volatile__ ( \
+- ".set\tnoreorder\n\t" \
+- cs_init \
+- "syscall\n\t" \
+- ".set reorder" \
+- : "=r" (__v0), "=r" (__a3) \
+- : input \
+- : __SYSCALL_CLOBBERS); \
+- err = __a3; \
+- _sys_result = __v0; \
+- } \
+- _sys_result; \
+-})
+-
+-#undef internal_syscall1
+-#define internal_syscall1(ncs_init, cs_init, input, err, arg1) \
+-({ \
+- long _sys_result; \
+- \
+- { \
+- register long __v0 __asm__("$2") ncs_init; \
+- register long __a0 __asm__("$4") = (long) arg1; \
+- register long __a3 __asm__("$7"); \
+- __asm__ __volatile__ ( \
+- ".set\tnoreorder\n\t" \
+- cs_init \
+- "syscall\n\t" \
+- ".set reorder" \
+- : "=r" (__v0), "=r" (__a3) \
+- : input, "r" (__a0) \
+- : __SYSCALL_CLOBBERS); \
+- err = __a3; \
+- _sys_result = __v0; \
+- } \
+- _sys_result; \
+-})
+-
+-#undef internal_syscall2
+-#define internal_syscall2(ncs_init, cs_init, input, err, arg1, arg2) \
+-({ \
+- long _sys_result; \
+- \
+- { \
+- register long __v0 __asm__("$2") ncs_init; \
+- register long __a0 __asm__("$4") = (long) arg1; \
+- register long __a1 __asm__("$5") = (long) arg2; \
+- register long __a3 __asm__("$7"); \
+- __asm__ __volatile__ ( \
+- ".set\tnoreorder\n\t" \
+- cs_init \
+- "syscall\n\t" \
+- ".set\treorder" \
+- : "=r" (__v0), "=r" (__a3) \
+- : input, "r" (__a0), "r" (__a1) \
+- : __SYSCALL_CLOBBERS); \
+- err = __a3; \
+- _sys_result = __v0; \
+- } \
+- _sys_result; \
+-})
+-
+-#undef internal_syscall3
+-#define internal_syscall3(ncs_init, cs_init, input, err, arg1, arg2, arg3)\
+-({ \
+- long _sys_result; \
+- \
+- { \
+- register long __v0 __asm__("$2") ncs_init; \
+- register long __a0 __asm__("$4") = (long) arg1; \
+- register long __a1 __asm__("$5") = (long) arg2; \
+- register long __a2 __asm__("$6") = (long) arg3; \
+- register long __a3 __asm__("$7"); \
+- __asm__ __volatile__ ( \
+- ".set\tnoreorder\n\t" \
+- cs_init \
+- "syscall\n\t" \
+- ".set\treorder" \
+- : "=r" (__v0), "=r" (__a3) \
+- : input, "r" (__a0), "r" (__a1), "r" (__a2) \
+- : __SYSCALL_CLOBBERS); \
+- err = __a3; \
+- _sys_result = __v0; \
+- } \
+- _sys_result; \
+-})
+-
+-#undef internal_syscall4
+-#define internal_syscall4(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4)\
+-({ \
+- long _sys_result; \
+- \
+- { \
+- register long __v0 __asm__("$2") ncs_init; \
+- register long __a0 __asm__("$4") = (long) arg1; \
+- register long __a1 __asm__("$5") = (long) arg2; \
+- register long __a2 __asm__("$6") = (long) arg3; \
+- register long __a3 __asm__("$7") = (long) arg4; \
+- __asm__ __volatile__ ( \
+- ".set\tnoreorder\n\t" \
+- cs_init \
+- "syscall\n\t" \
+- ".set\treorder" \
+- : "=r" (__v0), "+r" (__a3) \
+- : input, "r" (__a0), "r" (__a1), "r" (__a2) \
+- : __SYSCALL_CLOBBERS); \
+- err = __a3; \
+- _sys_result = __v0; \
+- } \
+- _sys_result; \
+-})
+-
+-/* We need to use a frame pointer for the functions in which we
+- adjust $sp around the syscall, or debug information and unwind
+- information will be $sp relative and thus wrong during the syscall. As
+- of GCC 3.4.3, this is sufficient. */
+-#define FORCE_FRAME_POINTER alloca (4)
+-
+-#undef internal_syscall5
+-#define internal_syscall5(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5)\
+-({ \
+- long _sys_result; \
+- \
+- FORCE_FRAME_POINTER; \
+- { \
+- register long __v0 __asm__("$2") ncs_init; \
+- register long __a0 __asm__("$4") = (long) arg1; \
+- register long __a1 __asm__("$5") = (long) arg2; \
+- register long __a2 __asm__("$6") = (long) arg3; \
+- register long __a3 __asm__("$7") = (long) arg4; \
+- __asm__ __volatile__ ( \
+- ".set\tnoreorder\n\t" \
+- "subu\t$29, 32\n\t" \
+- "sw\t%6, 16($29)\n\t" \
+- cs_init \
+- "syscall\n\t" \
+- "addiu\t$29, 32\n\t" \
+- ".set\treorder" \
+- : "=r" (__v0), "+r" (__a3) \
+- : input, "r" (__a0), "r" (__a1), "r" (__a2), \
+- "r" ((long)arg5) \
+- : __SYSCALL_CLOBBERS); \
+- err = __a3; \
+- _sys_result = __v0; \
+- } \
+- _sys_result; \
+-})
+-
+-#undef internal_syscall6
+-#define internal_syscall6(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5, arg6)\
+-({ \
+- long _sys_result; \
+- \
+- FORCE_FRAME_POINTER; \
+- { \
+- register long __v0 __asm__("$2") ncs_init; \
+- register long __a0 __asm__("$4") = (long) arg1; \
+- register long __a1 __asm__("$5") = (long) arg2; \
+- register long __a2 __asm__("$6") = (long) arg3; \
+- register long __a3 __asm__("$7") = (long) arg4; \
+- __asm__ __volatile__ ( \
+- ".set\tnoreorder\n\t" \
+- "subu\t$29, 32\n\t" \
+- "sw\t%6, 16($29)\n\t" \
+- "sw\t%7, 20($29)\n\t" \
+- cs_init \
+- "syscall\n\t" \
+- "addiu\t$29, 32\n\t" \
+- ".set\treorder" \
+- : "=r" (__v0), "+r" (__a3) \
+- : input, "r" (__a0), "r" (__a1), "r" (__a2), \
+- "r" ((long)arg5), "r" ((long)arg6) \
+- : __SYSCALL_CLOBBERS); \
+- err = __a3; \
+- _sys_result = __v0; \
+- } \
+- _sys_result; \
+-})
+-
+-#undef internal_syscall7
+-#define internal_syscall7(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5, arg6, arg7)\
+-({ \
+- long _sys_result; \
+- \
+- FORCE_FRAME_POINTER; \
+- { \
+- register long __v0 __asm__("$2") ncs_init; \
+- register long __a0 __asm__("$4") = (long) arg1; \
+- register long __a1 __asm__("$5") = (long) arg2; \
+- register long __a2 __asm__("$6") = (long) arg3; \
+- register long __a3 __asm__("$7") = (long) arg4; \
+- __asm__ __volatile__ ( \
+- ".set\tnoreorder\n\t" \
+- "subu\t$29, 32\n\t" \
+- "sw\t%6, 16($29)\n\t" \
+- "sw\t%7, 20($29)\n\t" \
+- "sw\t%8, 24($29)\n\t" \
+- cs_init \
+- "syscall\n\t" \
+- "addiu\t$29, 32\n\t" \
+- ".set\treorder" \
+- : "=r" (__v0), "+r" (__a3) \
+- : input, "r" (__a0), "r" (__a1), "r" (__a2), \
+- "r" ((long)arg5), "r" ((long)arg6), "r" ((long)arg7) \
+- : __SYSCALL_CLOBBERS); \
+- err = __a3; \
+- _sys_result = __v0; \
+- } \
+- _sys_result; \
+-})
+-
+-#undef __SYSCALL_CLOBBERS
+-#define __SYSCALL_CLOBBERS "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \
+- "$14", "$15", "$24", "$25", "memory"
+-
+ /* Pointer mangling is not yet supported for MIPS. */
+ #define PTR_MANGLE(var) (void) (var)
+ #define PTR_DEMANGLE(var) (void) (var)
diff --git a/toolchain/uClibc/patches-0.9.33.2/611-mips_syscall_error_argument.patch b/toolchain/uClibc/patches-0.9.33.2/611-mips_syscall_error_argument.patch
new file mode 100644
index 0000000..87ef8ba
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/611-mips_syscall_error_argument.patch
@@ -0,0 +1,99 @@
+commit 2952c70804b48bb5c87eea21df5e401969dc4ec1
+Author: Kevin Cernekee <cernekee@gmail.com>
+Date: Tue Jun 5 15:05:20 2012 -0700
+
+ MIPS: Use $a0 instead of $v0 for __syscall_error() argument
+
+ $a0 is saved across _dl_runtime_resolve(); $v0 is not. Unfortunately,
+ __syscall_error() uses $v0 for its argument, not $a0 as is the MIPS ABI
+ standard. This means that if lazy binding was used for __syscall_error(),
+ the errno value in $v0 could get corrupted.
+
+ The problem can be easily seen in testcases where syscalls in librt fail;
+ when librt tries to call __syscall_error() in libc, the argument gets
+ lost and errno gets set to a bogus value:
+
+ # ./tst-mqueue1 ; echo $?
+ mq_receive on O_WRONLY mqd_t did not fail with EBADF: Unknown error 2004684208
+ 1
+ # ./tst-mqueue2 ; echo $?
+ mq_timedreceive with too small msg_len did not fail with EMSGSIZE: Unknown error 1997360560
+ 1
+ # ./tst-mqueue4 ; echo $?
+ mq_timedsend did not fail with ETIMEDOUT: Unknown error 2008747440
+ 1
+
+ When _dl_runtime_resolve() was taken out of the equation, the same test
+ cases passed:
+
+ # LD_BIND_NOW=y ./tst-mqueue1 ; echo $?
+ 0
+ # LD_BIND_NOW=y ./tst-mqueue2 ; echo $?
+ 0
+ # LD_BIND_NOW=y ./tst-mqueue4 ; echo $?
+ 0
+
+ Changing __syscall_error() to look at $a0 instead of $v0 fixed the
+ problem.
+
+ (Note that there is also a "__syscall_error.c" file which presumably
+ uses the standard C calling conventions, but I do not think it is used
+ on MIPS.)
+
+ Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
+ Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+
+commit 3c58d95d918c7e2fda374c37a52f81b34b81e4ca
+Author: Kevin Cernekee <cernekee@gmail.com>
+Date: Tue Jun 5 15:05:19 2012 -0700
+
+ MIPS: Convert __syscall_error() callers to use $a0 for argument
+
+ Some callers passed the first argument in $v0, while others used $a0.
+ Change the callers to use $a0 consistently.
+
+ Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
+ Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+
+--- a/libc/sysdeps/linux/mips/vfork.S
++++ b/libc/sysdeps/linux/mips/vfork.S
+@@ -84,6 +84,7 @@ NESTED(__vfork,FRAMESZ,sp)
+
+ /* Something bad happened -- no child created. */
+ L(error):
++ move a0, v0
+ #ifdef __PIC__
+ PTR_LA t9, __syscall_error
+ RESTORE_GP64
+--- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/mips/mips64/sysdep-cancel.h
++++ b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/mips/mips64/sysdep-cancel.h
+@@ -31,7 +31,7 @@
+ # undef PSEUDO
+ # define PSEUDO(name, syscall_name, args) \
+ .align 2; \
+- 99: \
++ 99: move a0, v0; \
+ PTR_LA t9,__syscall_error; \
+ /* manual cpreturn. */ \
+ REG_L gp, STKOFF_GP(sp); \
+--- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/mips/vfork.S
++++ b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/mips/vfork.S
+@@ -80,6 +80,7 @@ NESTED(__vfork,FRAMESZ,sp)
+
+ /* Something bad happened -- no child created. */
+ L(error):
++ move a0, v0
+ #ifdef __PIC__
+ PTR_LA t9, __syscall_error
+ RESTORE_GP64
+--- a/libc/sysdeps/linux/mips/syscall_error.S
++++ b/libc/sysdeps/linux/mips/syscall_error.S
+@@ -43,7 +43,7 @@ ENTRY(__syscall_error)
+ #ifdef __PIC__
+ SAVE_GP(GPOFF)
+ #endif
+- REG_S v0, V0OFF(sp)
++ REG_S a0, V0OFF(sp)
+ REG_S ra, RAOFF(sp)
+
+ /* Find our per-thread errno address */
diff --git a/toolchain/uClibc/patches-0.9.33.2/612-mips64_relocation_fix.patch b/toolchain/uClibc/patches-0.9.33.2/612-mips64_relocation_fix.patch
new file mode 100644
index 0000000..7edeee1
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/612-mips64_relocation_fix.patch
@@ -0,0 +1,29 @@
+commit 052bcf13afb067cafac5e7f4fc21fbad2b34b11f
+Author: Waldemar Brodkorb <wbx@openadk.org>
+Date: Wed Nov 27 09:55:51 2013 +0100
+
+ Fix for SIGBUS error on MIPS64 with N64 ABI
+
+ When accessing errno, a per thread variable, from _stdio_init
+ a SIGBUS error happens. This change fixes the wrong relocation
+ and debug output.
+
+ Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+ Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+
+--- a/ldso/ldso/mips/elfinterp.c
++++ b/ldso/ldso/mips/elfinterp.c
+@@ -259,11 +259,11 @@ int _dl_parse_relocation_information(str
+ case R_MIPS_TLS_TPREL32:
+ case R_MIPS_TLS_TPREL64:
+ CHECK_STATIC_TLS((struct link_map *)tls_tpnt);
+- *(ElfW(Word) *)reloc_addr +=
++ *(ElfW(Addr) *)reloc_addr +=
+ TLS_TPREL_VALUE (tls_tpnt, symbol_addr);
+ #ifdef __SUPPORT_LD_DEBUG__
+ _dl_dprintf(2, "TLS_TPREL : %s, %x, %x\n",
+- symname, old_val, *((unsigned int *)reloc_addr));
++ symname, old_val, *((unsigned long *)reloc_addr));
+ #endif
+ break;
+ }
diff --git a/toolchain/uClibc/patches-0.9.33.2/613-mips64_more_relocation_fixes.patch b/toolchain/uClibc/patches-0.9.33.2/613-mips64_more_relocation_fixes.patch
new file mode 100644
index 0000000..e2efa23
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/613-mips64_more_relocation_fixes.patch
@@ -0,0 +1,20 @@
+--- a/ldso/ldso/mips/elfinterp.c
++++ b/ldso/ldso/mips/elfinterp.c
+@@ -239,7 +239,7 @@ int _dl_parse_relocation_information(str
+ case R_MIPS_TLS_DTPMOD64:
+ case R_MIPS_TLS_DTPMOD32:
+ if (tls_tpnt)
+- *(ElfW(Word) *)reloc_addr = tls_tpnt->l_tls_modid;
++ *(ElfW(Addr) *)reloc_addr = tls_tpnt->l_tls_modid;
+ #ifdef __SUPPORT_LD_DEBUG__
+ _dl_dprintf(2, "TLS_DTPMOD : %s, %d, %d\n",
+ symname, old_val, *((unsigned int *)reloc_addr));
+@@ -248,7 +248,7 @@ int _dl_parse_relocation_information(str
+
+ case R_MIPS_TLS_DTPREL64:
+ case R_MIPS_TLS_DTPREL32:
+- *(ElfW(Word) *)reloc_addr +=
++ *(ElfW(Addr) *)reloc_addr +=
+ TLS_DTPREL_VALUE (symbol_addr);
+ #ifdef __SUPPORT_LD_DEBUG__
+ _dl_dprintf(2, "TLS_DTPREL : %s, %x, %x\n",
diff --git a/toolchain/uClibc/patches-0.9.33.2/614-mips64_fix_setjmp_longjmp.patch b/toolchain/uClibc/patches-0.9.33.2/614-mips64_fix_setjmp_longjmp.patch
new file mode 100644
index 0000000..1706130
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/614-mips64_fix_setjmp_longjmp.patch
@@ -0,0 +1,99 @@
+commit 70a04a287a2875c82e6822c36e071afba5b63a62
+Author: Waldemar Brodkorb <wbx@openadk.org>
+Date: Wed Jan 29 18:58:56 2014 +0100
+
+ libc: mips: Fix setjmp/longjmp for MIPS64 N64 ABI
+
+ When booting a Linux system with qemu-system-mips64 the execution
+ of $(pwd) in the ash shell triggers a segmentation fault. Ash uses
+ setjmp/longjmp for exception handling.
+
+ After looking at the glibc implementation,
+ I found some differences, with this patch tries to resolve.
+ Now the system boots up fine and no segmentation faults occur.
+
+ The global pointer should be restored and the types for the
+ register values should be wide enough.
+
+ See:
+ http://www.cygwin.com/ml/libc-alpha/2003-03/msg00363.html
+
+ Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+ Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+
+--- a/libc/sysdeps/linux/mips/bits/setjmp.h
++++ b/libc/sysdeps/linux/mips/bits/setjmp.h
+@@ -26,13 +26,19 @@
+
+ #include <sgidefs.h>
+
++#if _MIPS_SIM == _MIPS_SIM_ABI32
++#define ptrsize void *
++#else
++#define ptrsize long long
++#endif
++
+ typedef struct
+ {
+ /* Program counter. */
+- void * __pc;
++ ptrsize __pc;
+
+ /* Stack pointer. */
+- void * __sp;
++ ptrsize __sp;
+
+ /* Callee-saved registers s0 through s7. */
+ #if _MIPS_SIM == _MIPS_SIM_ABI32
+@@ -42,10 +48,10 @@ typedef struct
+ #endif
+
+ /* The frame pointer. */
+- void * __fp;
++ ptrsize __fp;
+
+ /* The global pointer. */
+- void * __gp;
++ ptrsize __gp;
+
+ /* Floating point status register. */
+ int __fpc_csr;
+--- a/libc/sysdeps/linux/mips/setjmp.S
++++ b/libc/sysdeps/linux/mips/setjmp.S
+@@ -53,6 +53,7 @@ __sigsetjmp:
+ PTR_LA t9, __sigsetjmp_aux
+ #if _MIPS_SIM != _MIPS_SIM_ABI32
+ .cpreturn
++ move a4, gp
+ #endif
+ jr t9
+ #else
+--- a/libc/sysdeps/linux/mips/setjmp_aux.c
++++ b/libc/sysdeps/linux/mips/setjmp_aux.c
+@@ -31,7 +31,7 @@ extern int __sigjmp_save (sigjmp_buf, in
+
+ int
+ #if _MIPS_SIM == _MIPS_SIM_ABI64
+-__sigsetjmp_aux (jmp_buf env, int savemask, long sp, long fp)
++__sigsetjmp_aux (jmp_buf env, int savemask, long long sp, long long fp, long long gp)
+ #else /* O32 || N32 */
+ __sigsetjmp_aux (jmp_buf env, int savemask, int sp, int fp)
+ #endif /* O32 || N32 */
+@@ -65,14 +65,14 @@ __sigsetjmp_aux (jmp_buf env, int savema
+ #endif
+
+ /* .. and the stack pointer; */
+- env[0].__jmpbuf[0].__sp = (void *) sp;
++ env[0].__jmpbuf[0].__sp = (ptrsize) sp;
+
+ /* .. and the FP; it'll be in s8. */
+- env[0].__jmpbuf[0].__fp = (void *) fp;
++ env[0].__jmpbuf[0].__fp = (ptrsize) fp;
+
+ /* .. and the GP; */
+ #if _MIPS_SIM == _MIPS_SIM_ABI64
+- __asm__ __volatile__ ("sd $gp, %0" : : "m" (env[0].__jmpbuf[0].__gp));
++ env[0].__jmpbuf[0].__gp = (ptrsize) gp;
+ #else
+ __asm__ __volatile__ ("sw $gp, %0" : : "m" (env[0].__jmpbuf[0].__gp));
+ #endif
diff --git a/toolchain/uClibc/patches-0.9.33.2/615-mips_fix_sigev_pad_size.patch b/toolchain/uClibc/patches-0.9.33.2/615-mips_fix_sigev_pad_size.patch
new file mode 100644
index 0000000..f75092f
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/615-mips_fix_sigev_pad_size.patch
@@ -0,0 +1,58 @@
+commit b97b4b698b023f75b54f987859c856ab4861ea00
+Author: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
+Date: Thu Jan 2 15:02:12 2014 +0000
+
+ siginfo.h: __SIGEV_PAD_SIZE takes __WORDSIZE into account
+
+ Make __SIGEV_PAD_SIZE to take __WORDSIZE into account for alpha, mips
+ and ia64 arches.
+
+ Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
+ Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+
+--- a/libc/sysdeps/linux/alpha/bits/siginfo.h
++++ b/libc/sysdeps/linux/alpha/bits/siginfo.h
+@@ -258,7 +258,11 @@ enum
+
+ /* Structure to transport application-defined values with signals. */
+ # define __SIGEV_MAX_SIZE 64
+-# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 4)
++# if __WORDSIZE == 64
++# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 4)
++# else
++# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 3)
++# endif
+
+ typedef struct sigevent
+ {
+--- a/libc/sysdeps/linux/ia64/bits/siginfo.h
++++ b/libc/sysdeps/linux/ia64/bits/siginfo.h
+@@ -298,7 +298,11 @@ enum
+
+ /* Structure to transport application-defined values with signals. */
+ # define __SIGEV_MAX_SIZE 64
+-# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 4)
++# if __WORDSIZE == 64
++# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 4)
++# else
++# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 3)
++# endif
+
+ typedef struct sigevent
+ {
+--- a/libc/sysdeps/linux/mips/bits/siginfo.h
++++ b/libc/sysdeps/linux/mips/bits/siginfo.h
+@@ -265,8 +265,11 @@ enum
+
+ /* Structure to transport application-defined values with signals. */
+ # define __SIGEV_MAX_SIZE 64
+-# define __SIGEV_HEAD_SIZE (sizeof(long) + 2*sizeof(int))
+-# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE - __SIGEV_HEAD_SIZE) / sizeof (int))
++# if __WORDSIZE == 64
++# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 4)
++# else
++# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 3)
++# endif
+
+ /* Forward declaration of the `pthread_attr_t' type. */
+ struct __pthread_attr_s;
diff --git a/toolchain/uClibc/patches-0.9.33.2/616-mips_fix_stat_time.patch b/toolchain/uClibc/patches-0.9.33.2/616-mips_fix_stat_time.patch
new file mode 100644
index 0000000..1559857
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/616-mips_fix_stat_time.patch
@@ -0,0 +1,123 @@
+--- a/libc/sysdeps/linux/common/xstatconv.c
++++ b/libc/sysdeps/linux/common/xstatconv.c
+@@ -39,9 +39,12 @@ void __xstat_conv(struct kernel_stat *kb
+ buf->st_size = kbuf->st_size;
+ buf->st_blksize = kbuf->st_blksize;
+ buf->st_blocks = kbuf->st_blocks;
+- buf->st_atim = kbuf->st_atim;
+- buf->st_mtim = kbuf->st_mtim;
+- buf->st_ctim = kbuf->st_ctim;
++ buf->st_atim.tv_sec = kbuf->st_atim.tv_sec;
++ buf->st_atim.tv_nsec = kbuf->st_atim.tv_nsec;
++ buf->st_mtim.tv_sec = kbuf->st_mtim.tv_sec;
++ buf->st_mtim.tv_nsec = kbuf->st_mtim.tv_nsec;
++ buf->st_ctim.tv_sec = kbuf->st_ctim.tv_sec;
++ buf->st_ctim.tv_nsec = kbuf->st_ctim.tv_nsec;
+ }
+
+ void __xstat32_conv(struct kernel_stat64 *kbuf, struct stat *buf)
+@@ -58,9 +61,12 @@ void __xstat32_conv(struct kernel_stat64
+ buf->st_size = kbuf->st_size;
+ buf->st_blksize = kbuf->st_blksize;
+ buf->st_blocks = kbuf->st_blocks;
+- buf->st_atim = kbuf->st_atim;
+- buf->st_mtim = kbuf->st_mtim;
+- buf->st_ctim = kbuf->st_ctim;
++ buf->st_atim.tv_sec = kbuf->st_atim.tv_sec;
++ buf->st_atim.tv_nsec = kbuf->st_atim.tv_nsec;
++ buf->st_mtim.tv_sec = kbuf->st_mtim.tv_sec;
++ buf->st_mtim.tv_nsec = kbuf->st_mtim.tv_nsec;
++ buf->st_ctim.tv_sec = kbuf->st_ctim.tv_sec;
++ buf->st_ctim.tv_nsec = kbuf->st_ctim.tv_nsec;
+ }
+
+ #ifdef __UCLIBC_HAS_LFS__
+@@ -82,9 +88,12 @@ void __xstat64_conv(struct kernel_stat64
+ buf->st_size = kbuf->st_size;
+ buf->st_blksize = kbuf->st_blksize;
+ buf->st_blocks = kbuf->st_blocks;
+- buf->st_atim = kbuf->st_atim;
+- buf->st_mtim = kbuf->st_mtim;
+- buf->st_ctim = kbuf->st_ctim;
++ buf->st_atim.tv_sec = kbuf->st_atim.tv_sec;
++ buf->st_atim.tv_nsec = kbuf->st_atim.tv_nsec;
++ buf->st_mtim.tv_sec = kbuf->st_mtim.tv_sec;
++ buf->st_mtim.tv_nsec = kbuf->st_mtim.tv_nsec;
++ buf->st_ctim.tv_sec = kbuf->st_ctim.tv_sec;
++ buf->st_ctim.tv_nsec = kbuf->st_ctim.tv_nsec;
+ }
+
+ #endif /* __UCLIBC_HAS_LFS__ */
+--- a/libc/sysdeps/linux/mips/bits/kernel_stat.h
++++ b/libc/sysdeps/linux/mips/bits/kernel_stat.h
+@@ -8,6 +8,18 @@
+ #include <sgidefs.h>
+
+ #if _MIPS_SIM == _MIPS_SIM_ABI64
++typedef struct {
++ unsigned int tv_sec;
++ unsigned int tv_nsec;
++} __ktimespec_t;
++#else
++typedef struct {
++ time_t tv_sec;
++ unsigned long tv_nsec;
++} __ktimespec_t;
++#endif
++
++#if _MIPS_SIM == _MIPS_SIM_ABI64
+ /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */
+ struct kernel_stat {
+ __kernel_dev_t st_dev;
+@@ -20,9 +32,9 @@ struct kernel_stat {
+ __kernel_dev_t st_rdev;
+ unsigned int st_pad2[3];
+ __kernel_off_t st_size;
+- struct timespec st_atim;
+- struct timespec st_mtim;
+- struct timespec st_ctim;
++ __ktimespec_t st_atim;
++ __ktimespec_t st_mtim;
++ __ktimespec_t st_ctim;
+ unsigned int st_blksize;
+ unsigned int reserved3;
+ unsigned long st_blocks;
+@@ -41,9 +53,9 @@ struct kernel_stat {
+ unsigned int st_rdev;
+ unsigned int st_pad2[3];
+ unsigned long long st_size;
+- struct timespec st_atim;
+- struct timespec st_mtim;
+- struct timespec st_ctim;
++ __ktimespec_t st_atim;
++ __ktimespec_t st_mtim;
++ __ktimespec_t st_ctim;
+ unsigned int st_blksize;
+ unsigned int reserved3;
+ unsigned long long st_blocks;
+@@ -62,9 +74,9 @@ struct kernel_stat {
+ long st_pad2[2];
+ __kernel_off_t st_size;
+ long st_pad3;
+- struct timespec st_atim;
+- struct timespec st_mtim;
+- struct timespec st_ctim;
++ __ktimespec_t st_atim;
++ __ktimespec_t st_mtim;
++ __ktimespec_t st_ctim;
+ long st_blksize;
+ long st_blocks;
+ long st_pad4[14];
+@@ -81,9 +93,9 @@ struct kernel_stat64 {
+ unsigned long st_rdev;
+ unsigned long st_pad1[3]; /* Reserved for st_rdev expansion */
+ long long st_size;
+- struct timespec st_atim;
+- struct timespec st_mtim;
+- struct timespec st_ctim;
++ __ktimespec_t st_atim;
++ __ktimespec_t st_mtim;
++ __ktimespec_t st_ctim;
+ unsigned long st_blksize;
+ unsigned long st_pad2;
+ long long st_blocks;
diff --git a/toolchain/uClibc/patches-0.9.33.2/617-mips_fix_setjmp_ptrsize.patch b/toolchain/uClibc/patches-0.9.33.2/617-mips_fix_setjmp_ptrsize.patch
new file mode 100644
index 0000000..628d4b0
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/617-mips_fix_setjmp_ptrsize.patch
@@ -0,0 +1,58 @@
+--- a/libc/sysdeps/linux/mips/bits/setjmp.h
++++ b/libc/sysdeps/linux/mips/bits/setjmp.h
+@@ -27,18 +27,18 @@
+ #include <sgidefs.h>
+
+ #if _MIPS_SIM == _MIPS_SIM_ABI32
+-#define ptrsize void *
++#define __setjmp_ptr void *
+ #else
+-#define ptrsize long long
++#define __setjmp_ptr long long
+ #endif
+
+ typedef struct
+ {
+ /* Program counter. */
+- ptrsize __pc;
++ __setjmp_ptr __pc;
+
+ /* Stack pointer. */
+- ptrsize __sp;
++ __setjmp_ptr __sp;
+
+ /* Callee-saved registers s0 through s7. */
+ #if _MIPS_SIM == _MIPS_SIM_ABI32
+@@ -48,10 +48,10 @@ typedef struct
+ #endif
+
+ /* The frame pointer. */
+- ptrsize __fp;
++ __setjmp_ptr __fp;
+
+ /* The global pointer. */
+- ptrsize __gp;
++ __setjmp_ptr __gp;
+
+ /* Floating point status register. */
+ int __fpc_csr;
+--- a/libc/sysdeps/linux/mips/setjmp_aux.c
++++ b/libc/sysdeps/linux/mips/setjmp_aux.c
+@@ -65,14 +65,14 @@ __sigsetjmp_aux (jmp_buf env, int savema
+ #endif
+
+ /* .. and the stack pointer; */
+- env[0].__jmpbuf[0].__sp = (ptrsize) sp;
++ env[0].__jmpbuf[0].__sp = (__setjmp_ptr) sp;
+
+ /* .. and the FP; it'll be in s8. */
+- env[0].__jmpbuf[0].__fp = (ptrsize) fp;
++ env[0].__jmpbuf[0].__fp = (__setjmp_ptr) fp;
+
+ /* .. and the GP; */
+ #if _MIPS_SIM == _MIPS_SIM_ABI64
+- env[0].__jmpbuf[0].__gp = (ptrsize) gp;
++ env[0].__jmpbuf[0].__gp = (__setjmp_ptr) gp;
+ #else
+ __asm__ __volatile__ ("sw $gp, %0" : : "m" (env[0].__jmpbuf[0].__gp));
+ #endif
diff --git a/toolchain/uClibc/patches-0.9.33.2/618-mips64_fix_syscall_error.patch b/toolchain/uClibc/patches-0.9.33.2/618-mips64_fix_syscall_error.patch
new file mode 100644
index 0000000..67611fd
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/618-mips64_fix_syscall_error.patch
@@ -0,0 +1,36 @@
+--- a/libc/sysdeps/linux/mips/sysdep.h
++++ b/libc/sysdeps/linux/mips/sysdep.h
+@@ -96,7 +96,8 @@
+ backwards into the previous fn. */
+
+ #ifdef __PIC__
+-#define PSEUDO(name, syscall_name, args) \
++# if _MIPS_SIM == _ABIO32
++# define PSEUDO(name, syscall_name, args) \
+ .align 2; \
+ 99: move a0, v0; \
+ la t9,__syscall_error; \
+@@ -109,6 +110,23 @@
+ .set reorder; \
+ bne a3, zero, 99b; \
+ L(syse1):
++# else
++# define PSEUDO(name, syscall_name, args) \
++ .align 2; \
++ 99: \
++ .set noat; \
++ .cpsetup t9, $1, name; \
++ .set at; \
++ move a0, v0; \
++ dla t9,__syscall_error; \
++ .cpreturn; \
++ jr t9; \
++ ENTRY(name) \
++ li v0, SYS_ify(syscall_name); \
++ syscall; \
++ bne a3, zero, 99b; \
++L(syse1):
++# endif
+ #else
+ #define PSEUDO(name, syscall_name, args) \
+ .set noreorder; \
diff --git a/toolchain/uClibc/patches-0.9.33.2/619-mips64_fix_sysdep_cancel.patch b/toolchain/uClibc/patches-0.9.33.2/619-mips64_fix_sysdep_cancel.patch
new file mode 100644
index 0000000..d590359
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/619-mips64_fix_sysdep_cancel.patch
@@ -0,0 +1,195 @@
+--- a/extra/Configs/Config.in
++++ b/extra/Configs/Config.in
+@@ -235,6 +235,7 @@ config TARGET_SUBARCH
+ default "i486" if CONFIG_486
+ default "i586" if CONFIG_586 || CONFIG_586MMX
+ default "i686" if TARGET_ARCH = "i386"
++ default "mips64" if CONFIG_MIPS_N64_ABI
+ default ""
+
+ source "extra/Configs/Config.in.arch"
+--- /dev/null
++++ b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/mips64/sysdep-cancel.h
+@@ -0,0 +1,182 @@
++/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C 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
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library. If not, see
++ <http://www.gnu.org/licenses/>. */
++
++#include <sysdep.h>
++#include <tls.h>
++#ifndef __ASSEMBLER__
++# include <pthreadP.h>
++#endif
++#include <sys/asm.h>
++
++/* Gas will put the initial save of $gp into the CIE, because it appears to
++ happen before any instructions. So we use cfi_same_value instead of
++ cfi_restore. */
++
++#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
++
++#ifdef __PIC__
++# undef PSEUDO
++# define PSEUDO(name, syscall_name, args) \
++ .align 2; \
++ L(pseudo_start): \
++ cfi_startproc; \
++ cfi_adjust_cfa_offset (STKSPACE); \
++ cfi_rel_offset (gp, STKOFF_GP); \
++ 99: move a0, v0; \
++ PTR_LA t9,__syscall_error; \
++ /* manual cpreturn */ \
++ REG_L gp, STKOFF_GP(sp); \
++ cfi_same_value (gp); \
++ RESTORESTK; \
++ jr t9; \
++ .type __##syscall_name##_nocancel, @function; \
++ .globl __##syscall_name##_nocancel; \
++ __##syscall_name##_nocancel: \
++ SAVESTK; \
++ .cpsetup t9, STKOFF_GP, name; \
++ cfi_rel_offset (gp, STKOFF_GP); \
++ li v0, SYS_ify(syscall_name); \
++ syscall; \
++ bne a3, zero, SYSCALL_ERROR_LABEL; \
++ /* manual cpreturn */ \
++ REG_L gp, STKOFF_GP(sp); \
++ cfi_same_value (gp); \
++ RESTORESTK; \
++ ret; \
++ .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
++ ENTRY (name) \
++ SAVESTK; \
++ .cpsetup t9, STKOFF_GP, name; \
++ cfi_rel_offset (gp, STKOFF_GP); \
++ SINGLE_THREAD_P(v1); \
++ bne zero, v1, L(pseudo_cancel); \
++ .set noreorder; \
++ li v0, SYS_ify(syscall_name); \
++ syscall; \
++ .set reorder; \
++ bne a3, zero, SYSCALL_ERROR_LABEL; \
++ /* manual cpreturn */ \
++ REG_L gp, STKOFF_GP(sp); \
++ cfi_same_value (gp); \
++ RESTORESTK; \
++ ret; \
++ L(pseudo_cancel): \
++ cfi_adjust_cfa_offset (STKSPACE); \
++ cfi_rel_offset (gp, STKOFF_GP); \
++ REG_S ra, STKOFF_RA(sp); \
++ cfi_rel_offset (ra, STKOFF_RA); \
++ PUSHARGS_##args; /* save syscall args */ \
++ CENABLE; \
++ REG_S v0, STKOFF_SVMSK(sp); /* save mask */ \
++ POPARGS_##args; /* restore syscall args */ \
++ .set noreorder; \
++ li v0, SYS_ify (syscall_name); \
++ syscall; \
++ .set reorder; \
++ REG_S v0, STKOFF_SC_V0(sp); /* save syscall result */ \
++ REG_S a3, STKOFF_SC_ERR(sp); /* save syscall error flag */ \
++ REG_L a0, STKOFF_SVMSK(sp); /* pass mask as arg1 */ \
++ CDISABLE; \
++ REG_L a3, STKOFF_SC_ERR(sp); /* restore syscall error flag */ \
++ REG_L ra, STKOFF_RA(sp); /* restore return address */ \
++ REG_L v0, STKOFF_SC_V0(sp); /* restore syscall result */ \
++ bne a3, zero, SYSCALL_ERROR_LABEL; \
++ /* manual cpreturn */ \
++ REG_L gp, STKOFF_GP(sp); \
++ cfi_same_value (gp); \
++ RESTORESTK; \
++ L(pseudo_end):
++
++
++# undef PSEUDO_END
++# define PSEUDO_END(sym) cfi_endproc; .end sym; .size sym,.-sym
++
++#endif
++
++# define PUSHARGS_0 /* nothing to do */
++# define PUSHARGS_1 PUSHARGS_0 REG_S a0, STKOFF_A0(sp); cfi_rel_offset (a0, STKOFF_A0);
++# define PUSHARGS_2 PUSHARGS_1 REG_S a1, STKOFF_A1(sp); cfi_rel_offset (a1, STKOFF_A1);
++# define PUSHARGS_3 PUSHARGS_2 REG_S a2, STKOFF_A2(sp); cfi_rel_offset (a2, STKOFF_A2);
++# define PUSHARGS_4 PUSHARGS_3 REG_S a3, STKOFF_A3(sp); cfi_rel_offset (a3, STKOFF_A3);
++# define PUSHARGS_5 PUSHARGS_4 REG_S a4, STKOFF_A4(sp); cfi_rel_offset (a3, STKOFF_A4);
++# define PUSHARGS_6 PUSHARGS_5 REG_S a5, STKOFF_A5(sp); cfi_rel_offset (a3, STKOFF_A5);
++
++# define POPARGS_0 /* nothing to do */
++# define POPARGS_1 POPARGS_0 REG_L a0, STKOFF_A0(sp);
++# define POPARGS_2 POPARGS_1 REG_L a1, STKOFF_A1(sp);
++# define POPARGS_3 POPARGS_2 REG_L a2, STKOFF_A2(sp);
++# define POPARGS_4 POPARGS_3 REG_L a3, STKOFF_A3(sp);
++# define POPARGS_5 POPARGS_4 REG_L a4, STKOFF_A4(sp);
++# define POPARGS_6 POPARGS_5 REG_L a5, STKOFF_A5(sp);
++
++/* Save an even number of slots. Should be 0 if an even number of slots
++ are used below, or SZREG if an odd number are used. */
++# define STK_PAD SZREG
++
++/* Place values that we are more likely to use later in this sequence, i.e.
++ closer to the SP at function entry. If you do that, the are more
++ likely to already be in your d-cache. */
++# define STKOFF_A5 (STK_PAD)
++# define STKOFF_A4 (STKOFF_A5 + SZREG)
++# define STKOFF_A3 (STKOFF_A4 + SZREG)
++# define STKOFF_A2 (STKOFF_A3 + SZREG) /* MT and more args. */
++# define STKOFF_A1 (STKOFF_A2 + SZREG) /* MT and 2 args. */
++# define STKOFF_A0 (STKOFF_A1 + SZREG) /* MT and 1 arg. */
++# define STKOFF_RA (STKOFF_A0 + SZREG) /* Used if MT. */
++# define STKOFF_SC_V0 (STKOFF_RA + SZREG) /* Used if MT. */
++# define STKOFF_SC_ERR (STKOFF_SC_V0 + SZREG) /* Used if MT. */
++# define STKOFF_SVMSK (STKOFF_SC_ERR + SZREG) /* Used if MT. */
++# define STKOFF_GP (STKOFF_SVMSK + SZREG) /* Always used. */
++
++# define STKSPACE (STKOFF_GP + SZREG)
++# define SAVESTK PTR_SUBU sp, STKSPACE; cfi_adjust_cfa_offset(STKSPACE)
++# define RESTORESTK PTR_ADDU sp, STKSPACE; cfi_adjust_cfa_offset(-STKSPACE)
++
++# ifdef IS_IN_libpthread
++# define CENABLE PTR_LA t9, __pthread_enable_asynccancel; jalr t9
++# define CDISABLE PTR_LA t9, __pthread_disable_asynccancel; jalr t9
++# elif defined IS_IN_librt
++# define CENABLE PTR_LA t9, __librt_enable_asynccancel; jalr t9
++# define CDISABLE PTR_LA t9, __librt_disable_asynccancel; jalr t9
++# else
++# define CENABLE PTR_LA t9, __libc_enable_asynccancel; jalr t9
++# define CDISABLE PTR_LA t9, __libc_disable_asynccancel; jalr t9
++# endif
++
++# ifndef __ASSEMBLER__
++# define SINGLE_THREAD_P \
++ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
++ header.multiple_threads) \
++ == 0, 1)
++# else
++# define SINGLE_THREAD_P(reg) \
++ READ_THREAD_POINTER(reg); \
++ lw reg, MULTIPLE_THREADS_OFFSET(reg)
++#endif
++
++#elif !defined __ASSEMBLER__
++
++# define SINGLE_THREAD_P 1
++# define NO_CANCELLATION 1
++
++#endif
++
++#ifndef __ASSEMBLER__
++# define RTLD_SINGLE_THREAD_P \
++ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
++ header.multiple_threads) == 0, 1)
++#endif
diff --git a/toolchain/uClibc/patches-0.9.33.2/960-remove_eabi_oabi_selection.patch b/toolchain/uClibc/patches-0.9.33.2/960-remove_eabi_oabi_selection.patch
new file mode 100644
index 0000000..19ac246
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/960-remove_eabi_oabi_selection.patch
@@ -0,0 +1,32 @@
+Rely on the compiler to be properly setup for the default ABI.
+
+When installing-headers, there are two cases:
+- NPTL: no issue, a cross-compiler is already expected
+- LinuxThreads: no issue, EABI/OABI has no impact on installed headers.
+
+Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
+Cc: Khem Raj <raj.khem@gmail.com>
+Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+Cc: Carmelo AMOROSO <carmelo.amoroso@st.com>
+---
+
+--- a/extra/Configs/Config.arm
++++ b/extra/Configs/Config.arm
+@@ -12,17 +12,6 @@ config FORCE_OPTIONS_FOR_ARCH
+ default y
+ select ARCH_ANY_ENDIAN
+
+-config CONFIG_ARM_EABI
+- bool "Build for EABI"
+- help
+- If you say 'y' here, functions and constants required by the
+- ARM EABI will be built into the library. You should say 'y'
+- if your compiler uses the ARM EABI, in which case you will also
+- need a kernel supporting the EABI system call interface.
+-
+- If you say 'n' here, then the library will be built for the
+- old Linux ABI.
+-
+ config COMPILE_IN_THUMB_MODE
+ bool "Build using Thumb mode"
+ select USE_BX
diff --git a/toolchain/uClibc/patches-0.9.33.2/970-add___kernel_long_and___kernel_ulong.patch b/toolchain/uClibc/patches-0.9.33.2/970-add___kernel_long_and___kernel_ulong.patch
new file mode 100644
index 0000000..d790664
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/970-add___kernel_long_and___kernel_ulong.patch
@@ -0,0 +1,320 @@
+From 6a76edddaa62ff06f178143b582167734cb55c18 Mon Sep 17 00:00:00 2001
+From: Chris Packham <chris.packham@alliedtelesis.co.nz>
+Date: Mon, 01 Oct 2012 05:12:54 +0000
+Subject: libc/sysdeps: add __kernel_long and __kernel_ulong
+
+Linux 3.4 added __kernel_long_t and __kernel_ulong_t and various
+exported header files were updated to use these new types. Add the
+definitions for __kernel_long_t and __kernel_ulong_t to the relevant
+kernel_types.h headers.
+
+This change was automated with the following scriptlet
+
+ git grep --name-only 'typedef.*__kernel_old_dev_t' \
+ | xargs sed -i '/typedef.*__kernel_old_dev_t/ a\
+ typedef long\t\t__kernel_long_t;\
+ typedef unsigned long\t__kernel_ulong_t;'
+
+Whitespace in arm, avr32, hppa, sparc was then manually fixed up.
+
+Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
+--
+Here's a cleaned up patch which should get the whitespace right. I'm a
+bit iffy about the sparc changes they make sense to me but it's not a
+platform I have access to.
+
+I can break this up per arch or per maintainer if requested.
+
+ libc/sysdeps/linux/alpha/bits/kernel_types.h | 2 ++
+ libc/sysdeps/linux/arm/bits/kernel_types.h | 2 ++
+ libc/sysdeps/linux/avr32/bits/kernel_types.h | 2 ++
+ libc/sysdeps/linux/bfin/bits/kernel_types.h | 2 ++
+ libc/sysdeps/linux/c6x/bits/kernel_types.h | 2 ++
+ libc/sysdeps/linux/cris/bits/kernel_types.h | 2 ++
+ libc/sysdeps/linux/e1/bits/kernel_types.h | 2 ++
+ libc/sysdeps/linux/h8300/bits/kernel_types.h | 2 ++
+ libc/sysdeps/linux/hppa/bits/kernel_types.h | 2 ++
+ libc/sysdeps/linux/i386/bits/kernel_types.h | 2 ++
+ libc/sysdeps/linux/ia64/bits/kernel_types.h | 2 ++
+ libc/sysdeps/linux/m68k/bits/kernel_types.h | 2 ++
+ libc/sysdeps/linux/microblaze/bits/kernel_types.h | 2 ++
+ libc/sysdeps/linux/mips/bits/kernel_types.h | 4 ++++
+ libc/sysdeps/linux/nios2/bits/kernel_types.h | 2 ++
+ libc/sysdeps/linux/powerpc/bits/kernel_types.h | 4 ++++
+ libc/sysdeps/linux/sh/bits/kernel_types.h | 2 ++
+ libc/sysdeps/linux/sh64/bits/kernel_types.h | 2 ++
+ libc/sysdeps/linux/sparc/bits/kernel_types.h | 4 ++++
+ libc/sysdeps/linux/v850/bits/kernel_types.h | 2 ++
+ libc/sysdeps/linux/x86_64/bits/kernel_types.h | 2 ++
+ libc/sysdeps/linux/xtensa/bits/kernel_types.h | 2 ++
+ 22 files changed, 50 insertions(+)
+Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+---
+--- a/libc/sysdeps/linux/alpha/bits/kernel_types.h
++++ b/libc/sysdeps/linux/alpha/bits/kernel_types.h
+@@ -33,6 +33,8 @@ typedef __kernel_gid_t __kernel_old_gid_
+ typedef __kernel_uid_t __kernel_uid32_t;
+ typedef __kernel_gid_t __kernel_gid32_t;
+ typedef __kernel_dev_t __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+
+ typedef struct {
+ int val[2];
+--- a/libc/sysdeps/linux/arm/bits/kernel_types.h
++++ b/libc/sysdeps/linux/arm/bits/kernel_types.h
+@@ -32,6 +32,8 @@ typedef unsigned short __kernel_old_uid
+ typedef unsigned short __kernel_old_gid_t;
+ typedef long long __kernel_loff_t;
+ typedef __kernel_dev_t __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+
+ typedef struct {
+ #ifdef __USE_ALL
+--- a/libc/sysdeps/linux/avr32/bits/kernel_types.h
++++ b/libc/sysdeps/linux/avr32/bits/kernel_types.h
+@@ -39,6 +39,8 @@ typedef unsigned int __kernel_gid32_t;
+ typedef unsigned short __kernel_old_uid_t;
+ typedef unsigned short __kernel_old_gid_t;
+ typedef unsigned short __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+
+ #ifdef __GNUC__
+ typedef long long __kernel_loff_t;
+--- a/libc/sysdeps/linux/bfin/bits/kernel_types.h
++++ b/libc/sysdeps/linux/bfin/bits/kernel_types.h
+@@ -32,6 +32,8 @@ typedef unsigned short __kernel_old_uid_
+ typedef unsigned short __kernel_old_gid_t;
+ typedef long long __kernel_loff_t;
+ typedef __kernel_dev_t __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+
+ typedef struct {
+ #ifdef __USE_ALL
+--- a/libc/sysdeps/linux/c6x/bits/kernel_types.h
++++ b/libc/sysdeps/linux/c6x/bits/kernel_types.h
+@@ -22,6 +22,8 @@ typedef unsigned int __kernel_gid32_t;
+ typedef unsigned int __kernel_old_uid_t;
+ typedef unsigned int __kernel_old_gid_t;
+ typedef unsigned int __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+ typedef unsigned int __kernel_size_t;
+ typedef int __kernel_ssize_t;
+ typedef int __kernel_ptrdiff_t;
+--- a/libc/sysdeps/linux/cris/bits/kernel_types.h
++++ b/libc/sysdeps/linux/cris/bits/kernel_types.h
+@@ -28,6 +28,8 @@ typedef unsigned int __kernel_gid32_t
+ typedef unsigned short __kernel_old_uid_t;
+ typedef unsigned short __kernel_old_gid_t;
+ typedef __kernel_dev_t __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+
+ #ifdef __GNUC__
+ typedef long long __kernel_loff_t;
+--- a/libc/sysdeps/linux/e1/bits/kernel_types.h
++++ b/libc/sysdeps/linux/e1/bits/kernel_types.h
+@@ -31,6 +31,8 @@ typedef unsigned int __kernel_gid32_t;
+ typedef unsigned short __kernel_old_uid_t;
+ typedef unsigned short __kernel_old_gid_t;
+ typedef __kernel_dev_t __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+ typedef long long __kernel_loff_t;
+
+ /*
+--- a/libc/sysdeps/linux/h8300/bits/kernel_types.h
++++ b/libc/sysdeps/linux/h8300/bits/kernel_types.h
+@@ -32,6 +32,8 @@ typedef unsigned short __kernel_old_uid_
+ typedef unsigned short __kernel_old_gid_t;
+ typedef long long __kernel_loff_t;
+ typedef __kernel_dev_t __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+
+ typedef struct {
+ #ifdef __USE_ALL
+--- a/libc/sysdeps/linux/hppa/bits/kernel_types.h
++++ b/libc/sysdeps/linux/hppa/bits/kernel_types.h
+@@ -45,6 +45,8 @@ typedef long long __kernel_off64_t;
+ typedef unsigned long long __kernel_ino64_t;
+
+ typedef unsigned int __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+
+ typedef struct {
+ #ifdef __USE_ALL
+--- a/libc/sysdeps/linux/i386/bits/kernel_types.h
++++ b/libc/sysdeps/linux/i386/bits/kernel_types.h
+@@ -40,6 +40,8 @@ typedef unsigned int __kernel_gid32_t;
+ typedef unsigned short __kernel_old_uid_t;
+ typedef unsigned short __kernel_old_gid_t;
+ typedef __kernel_dev_t __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+ typedef long long __kernel_loff_t;
+
+ typedef struct {
+--- a/libc/sysdeps/linux/ia64/bits/kernel_types.h
++++ b/libc/sysdeps/linux/ia64/bits/kernel_types.h
+@@ -52,5 +52,7 @@ typedef __kernel_gid_t __kernel_gid32_t;
+
+ typedef unsigned int __kernel_dev_t;
+ typedef unsigned int __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+
+ #endif /* _ASM_IA64_POSIX_TYPES_H */
+--- a/libc/sysdeps/linux/m68k/bits/kernel_types.h
++++ b/libc/sysdeps/linux/m68k/bits/kernel_types.h
+@@ -32,6 +32,8 @@ typedef unsigned short __kernel_old_uid_
+ typedef unsigned short __kernel_old_gid_t;
+ typedef long long __kernel_loff_t;
+ typedef __kernel_dev_t __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+
+ typedef struct {
+ #ifdef __USE_ALL
+--- a/libc/sysdeps/linux/microblaze/bits/kernel_types.h
++++ b/libc/sysdeps/linux/microblaze/bits/kernel_types.h
+@@ -44,6 +44,8 @@ typedef unsigned int __kernel_gid32_t;
+ typedef unsigned int __kernel_old_uid_t;
+ typedef unsigned int __kernel_old_gid_t;
+ typedef unsigned int __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+
+ #ifdef __GNUC__
+ typedef long long __kernel_loff_t;
+--- a/libc/sysdeps/linux/mips/bits/kernel_types.h
++++ b/libc/sysdeps/linux/mips/bits/kernel_types.h
+@@ -32,6 +32,8 @@ typedef int __kernel_gid32_t;
+ typedef __kernel_uid_t __kernel_old_uid_t;
+ typedef __kernel_gid_t __kernel_old_gid_t;
+ typedef __kernel_dev_t __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+ typedef long long __kernel_loff_t;
+ #else
+ typedef unsigned int __kernel_dev_t;
+@@ -68,6 +70,8 @@ typedef int __kernel_gid32_t;
+ typedef __kernel_uid_t __kernel_old_uid_t;
+ typedef __kernel_gid_t __kernel_old_gid_t;
+ typedef __kernel_dev_t __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+ typedef long long __kernel_loff_t;
+ #endif
+
+--- a/libc/sysdeps/linux/nios2/bits/kernel_types.h
++++ b/libc/sysdeps/linux/nios2/bits/kernel_types.h
+@@ -31,6 +31,8 @@ typedef unsigned int __kernel_gid32_t;
+ typedef unsigned short __kernel_old_uid_t;
+ typedef unsigned short __kernel_old_gid_t;
+ typedef unsigned short __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+ typedef long long __kernel_loff_t;
+
+ typedef struct {
+--- a/libc/sysdeps/linux/powerpc/bits/kernel_types.h
++++ b/libc/sysdeps/linux/powerpc/bits/kernel_types.h
+@@ -36,6 +36,8 @@ typedef unsigned int __kernel_gid32_t;
+ typedef unsigned int __kernel_old_uid_t;
+ typedef unsigned int __kernel_old_gid_t;
+ typedef __kernel_dev_t __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+ #else
+ typedef unsigned int __kernel_dev_t;
+ typedef unsigned int __kernel_ino_t;
+@@ -61,6 +63,8 @@ typedef unsigned int __kernel_gid32_t;
+ typedef unsigned int __kernel_old_uid_t;
+ typedef unsigned int __kernel_old_gid_t;
+ typedef __kernel_dev_t __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+ typedef long long __kernel_loff_t;
+ #endif
+
+--- a/libc/sysdeps/linux/sh/bits/kernel_types.h
++++ b/libc/sysdeps/linux/sh/bits/kernel_types.h
+@@ -32,6 +32,8 @@ typedef unsigned int __kernel_gid32_t;
+ typedef unsigned short __kernel_old_uid_t;
+ typedef unsigned short __kernel_old_gid_t;
+ typedef __kernel_dev_t __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+ typedef long long __kernel_loff_t;
+
+ typedef struct {
+--- a/libc/sysdeps/linux/sh64/bits/kernel_types.h
++++ b/libc/sysdeps/linux/sh64/bits/kernel_types.h
+@@ -43,6 +43,8 @@ typedef unsigned int __kernel_gid32_t
+ typedef unsigned short __kernel_old_uid_t;
+ typedef unsigned short __kernel_old_gid_t;
+ typedef __kernel_dev_t __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+ typedef long long __kernel_loff_t;
+
+ typedef struct {
+--- a/libc/sysdeps/linux/sparc/bits/kernel_types.h
++++ b/libc/sysdeps/linux/sparc/bits/kernel_types.h
+@@ -32,6 +32,8 @@ typedef unsigned short __kernel_g
+ typedef __kernel_uid_t __kernel_old_uid_t;
+ typedef __kernel_gid_t __kernel_old_gid_t;
+ typedef __kernel_dev_t __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+ typedef __kernel_uid_t __kernel_uid32_t;
+ typedef __kernel_gid_t __kernel_gid32_t;
+ typedef int __kernel_suseconds_t;
+@@ -62,6 +64,8 @@ typedef unsigned int __kernel_gid
+ typedef unsigned short __kernel_old_uid_t;
+ typedef unsigned short __kernel_old_gid_t;
+ typedef __kernel_dev_t __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+ typedef long long __kernel_loff_t;
+ #endif
+
+--- a/libc/sysdeps/linux/v850/bits/kernel_types.h
++++ b/libc/sysdeps/linux/v850/bits/kernel_types.h
+@@ -41,6 +41,8 @@ typedef unsigned int __kernel_gid32_t;
+ typedef unsigned short __kernel_old_uid_t;
+ typedef unsigned short __kernel_old_gid_t;
+ typedef __kernel_dev_t __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+
+ typedef struct {
+ #ifdef __USE_ALL
+--- a/libc/sysdeps/linux/x86_64/bits/kernel_types.h
++++ b/libc/sysdeps/linux/x86_64/bits/kernel_types.h
+@@ -40,6 +40,8 @@ typedef unsigned int __kernel_gid32_t;
+ typedef unsigned short __kernel_old_uid_t;
+ typedef unsigned short __kernel_old_gid_t;
+ typedef __kernel_dev_t __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+ typedef long long __kernel_loff_t;
+
+ typedef struct {
+--- a/libc/sysdeps/linux/xtensa/bits/kernel_types.h
++++ b/libc/sysdeps/linux/xtensa/bits/kernel_types.h
+@@ -33,6 +33,8 @@ typedef unsigned int __kernel_gid32_t;
+ typedef unsigned short __kernel_old_uid_t;
+ typedef unsigned short __kernel_old_gid_t;
+ typedef unsigned short __kernel_old_dev_t;
++typedef long __kernel_long_t;
++typedef unsigned long __kernel_ulong_t;
+ typedef long long __kernel_loff_t;
+
+ /* Beginning in 2.6 kernels, which is the first version that includes the
diff --git a/toolchain/uClibc/patches-0.9.33.2/981-fix_setting_arch_native_bit.patch b/toolchain/uClibc/patches-0.9.33.2/981-fix_setting_arch_native_bit.patch
new file mode 100644
index 0000000..4c7dd46
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/981-fix_setting_arch_native_bit.patch
@@ -0,0 +1,28 @@
+From 7e509aae23665b9a79f6c9b4c24d1d8a55bd3582 Mon Sep 17 00:00:00 2001
+From: Gustavo Zacarias <gustavo@zacarias.com.ar>
+Date: Wed, 24 Jul 2013 15:30:35 +0000
+Subject: Rules.mak: Fix setting arch native bit
+
+fix breakage from 603af30d
+
+Removing the whitespace from findstring for 64 bit architectures has
+bad consequences since powerpc would be a match in powerpc64 and sparc
+would also be a match in sparc64.
+That doesn't make them 64 bits in reality causing general breakage.
+
+Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
+Reviewed-by: Markos Chandras <markos.chandras@imgtec.com>
+Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+---
+
+--- a/Rules.mak
++++ b/Rules.mak
+@@ -121,7 +121,7 @@ UBACKTRACE_DSO := libubacktrace.so.$(ABI
+
+ UCLIBC_LDSO_NAME := ld-uClibc
+ ARCH_NATIVE_BIT := 32
+-ifneq ($(findstring $(TARGET_ARCH),hppa64 ia64 powerpc64 s390x sparc64 x86_64),)
++ifneq ($(findstring $(TARGET_ARCH) , hppa64 ia64 powerpc64 s390x sparc64 x86_64 ),)
+ UCLIBC_LDSO_NAME := ld64-uClibc
+ ARCH_NATIVE_BIT := 64
+ else
diff --git a/toolchain/uClibc/patches-0.9.33.2/990-no-stack-cache.patch b/toolchain/uClibc/patches-0.9.33.2/990-no-stack-cache.patch
new file mode 100644
index 0000000..8f0b511
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/990-no-stack-cache.patch
@@ -0,0 +1,11 @@
+--- a/libpthread/nptl/allocatestack.c
++++ b/libpthread/nptl/allocatestack.c
+@@ -100,7 +100,7 @@
+ /* Cache handling for not-yet free stacks. */
+
+ /* Maximum size in kB of cache. */
+-static size_t stack_cache_maxsize = 40 * 1024 * 1024; /* 40MiBi by default. */
++static size_t stack_cache_maxsize = 0; /* embedded systems don't have enough ram for dirty stack caches */
+ static size_t stack_cache_actsize;
+
+ /* Mutex protecting this variable. */
diff --git a/toolchain/uClibc/patches-0.9.33.2/991-gen_wctype.patch b/toolchain/uClibc/patches-0.9.33.2/991-gen_wctype.patch
new file mode 100644
index 0000000..e85d6d4
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/991-gen_wctype.patch
@@ -0,0 +1,183 @@
+--- a/extra/locale/gen_wctype.c
++++ b/extra/locale/gen_wctype.c
+@@ -227,11 +227,12 @@ int main(int argc, char **argv)
+ ++verbose;
+ continue;
+ }
+- if (!setlocale(LC_CTYPE, *argv)) {
++ /* setlocale might be just a stub */
++ /* if (!setlocale(LC_CTYPE, *argv)) {
+ verbose_msg("setlocale(LC_CTYPE,%s) failed! Skipping this locale...\n", *argv);
+ continue;
+ }
+-
++ */
+ if (!(totitle = wctrans("totitle"))) {
+ verbose_msg("no totitle transformation.\n");
+ }
+@@ -306,43 +307,43 @@ int main(int argc, char **argv)
+ #endif
+ #if 0
+ if (c < 256) {
+- unsigned int glibc;
++ unsigned int curr_stdclib;
+
+- glibc = 0;
+- if (isalnum(c)) ++glibc; glibc <<= 1;
+- if (isalpha(c)) ++glibc; glibc <<= 1;
+- if (isblank(c)) ++glibc; glibc <<= 1;
+- if (iscntrl(c)) ++glibc; glibc <<= 1;
+- if (isdigit(c)) ++glibc; glibc <<= 1;
+- if (isgraph(c)) ++glibc; glibc <<= 1;
+- if (islower(c)) ++glibc; glibc <<= 1;
+- if (isprint(c)) ++glibc; glibc <<= 1;
+- if (ispunct(c)) ++glibc; glibc <<= 1;
+- if (isspace(c)) ++glibc; glibc <<= 1;
+- if (isupper(c)) ++glibc; glibc <<= 1;
+- if (isxdigit(c)) ++glibc;
+- verbose_msg("%#8x : ctype %#4x\n", c, glibc);
++ curr_stdclib = 0;
++ if (isalnum(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (isalpha(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (isblank(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (iscntrl(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (isdigit(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (isgraph(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (islower(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (isprint(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (ispunct(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (isspace(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (isupper(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (isxdigit(c)) ++curr_stdclib;
++ verbose_msg("%#8x : ctype %#4x\n", c, curr_stdclib);
+ }
+ #endif
+ #if 1
+ /* Paranoid checking... */
+ {
+- unsigned int glibc;
++ unsigned int curr_stdclib;
+ unsigned int mine;
+
+- glibc = 0;
+- if (iswalnum(c)) ++glibc; glibc <<= 1;
+- if (iswalpha(c)) ++glibc; glibc <<= 1;
+- if (iswblank(c)) ++glibc; glibc <<= 1;
+- if (iswcntrl(c)) ++glibc; glibc <<= 1;
+- if (iswdigit(c)) ++glibc; glibc <<= 1;
+- if (iswgraph(c)) ++glibc; glibc <<= 1;
+- if (iswlower(c)) ++glibc; glibc <<= 1;
+- if (iswprint(c)) ++glibc; glibc <<= 1;
+- if (iswpunct(c)) ++glibc; glibc <<= 1;
+- if (iswspace(c)) ++glibc; glibc <<= 1;
+- if (iswupper(c)) ++glibc; glibc <<= 1;
+- if (iswxdigit(c)) ++glibc;
++ curr_stdclib = 0;
++ if (iswalnum(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (iswalpha(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (iswblank(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (iswcntrl(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (iswdigit(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (iswgraph(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (iswlower(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (iswprint(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (iswpunct(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (iswspace(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (iswupper(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (iswxdigit(c)) ++curr_stdclib;
+
+ mine = 0;
+ if (mywalnum(d,c)) ++mine; mine <<= 1;
+@@ -358,15 +359,15 @@ int main(int argc, char **argv)
+ if (mywupper(d,c)) ++mine; mine <<= 1;
+ if (mywxdigit(d,c)) ++mine;
+
+- if (glibc != mine) {
+- verbose_msg("%#8x : glibc %#4x != %#4x mine %u\n", c, glibc, mine, d);
++ if (curr_stdclib != mine) {
++ verbose_msg("%#8x : curr_stdclib %#4x != %#4x mine %u\n", c, curr_stdclib, mine, d);
+ return EXIT_FAILURE;
+ }
+ #if 0
+ if (iswctype(c,is_comb) || iswctype(c,is_comb3)) {
+ /* if (!iswpunct(c)) { */
+ verbose_msg("%#8x : %d %d %#4x\n",
+- c, iswctype(c,is_comb),iswctype(c,is_comb3), glibc);
++ c, iswctype(c,is_comb),iswctype(c,is_comb3), curr_stdclib);
+ /* } */
+ }
+ #endif
+@@ -553,7 +554,7 @@ int main(int argc, char **argv)
+ for (c = 0; c <= 0x10ffffUL; c++)
+ #endif
+ {
+- unsigned int glibc;
++ unsigned int curr_stdclib;
+ unsigned int mine;
+ unsigned int upper, lower;
+
+@@ -568,19 +569,19 @@ int main(int argc, char **argv)
+ }
+ #endif
+ #endif
+- glibc = 0;
+- if (iswalnum(c)) ++glibc; glibc <<= 1;
+- if (iswalpha(c)) ++glibc; glibc <<= 1;
+- if (iswblank(c)) ++glibc; glibc <<= 1;
+- if (iswcntrl(c)) ++glibc; glibc <<= 1;
+- if (iswdigit(c)) ++glibc; glibc <<= 1;
+- if (iswgraph(c)) ++glibc; glibc <<= 1;
+- if (iswlower(c)) ++glibc; glibc <<= 1;
+- if (iswprint(c)) ++glibc; glibc <<= 1;
+- if (iswpunct(c)) ++glibc; glibc <<= 1;
+- if (iswspace(c)) ++glibc; glibc <<= 1;
+- if (iswupper(c)) ++glibc; glibc <<= 1;
+- if (iswxdigit(c)) ++glibc;
++ curr_stdclib = 0;
++ if (iswalnum(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (iswalpha(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (iswblank(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (iswcntrl(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (iswdigit(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (iswgraph(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (iswlower(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (iswprint(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (iswpunct(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (iswspace(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (iswupper(c)) ++curr_stdclib; curr_stdclib <<= 1;
++ if (iswxdigit(c)) ++curr_stdclib;
+
+ {
+ unsigned int u;
+@@ -630,8 +631,8 @@ int main(int argc, char **argv)
+ if (mywupper(d,c)) ++mine; mine <<= 1;
+ if (mywxdigit(d,c)) ++mine;
+
+- if (glibc != mine) {
+- verbose_msg("%#8x : glibc %#4x != %#4x mine %d\n", c, glibc, mine, d);
++ if (curr_stdclib != mine) {
++ verbose_msg("%#8x : curr_stdclib %#4x != %#4x mine %d\n", c, curr_stdclib, mine, d);
+ if (c < 0x30000UL) {
+ verbose_msg("sc=%#x u=%#x n=%#x i0=%#x i1=%#x\n", sc, u, n, i0, i1);
+ }
+@@ -655,17 +656,17 @@ int main(int argc, char **argv)
+ }
+
+ if (towupper(c) != upper) {
+- verbose_msg("%#8x : towupper glibc %#4x != %#4x mine\n",
++ verbose_msg("%#8x : towupper curr_stdclib %#4x != %#4x mine\n",
+ c, towupper(c), upper);
+ }
+
+ if (towlower(c) != lower) {
+- verbose_msg("%#8x : towlower glibc %#4x != %#4x mine i0 = %d\n",
++ verbose_msg("%#8x : towlower curr_stdclib %#4x != %#4x mine i0 = %d\n",
+ c, towlower(c), lower, i0);
+ }
+
+ if (totitle && ((tt = towctrans(c, totitle)) != upper)) {
+- verbose_msg("%#8x : totitle glibc %#4lx != %#4x mine i0 = %d\n",
++ verbose_msg("%#8x : totitle curr_stdclib %#4lx != %#4x mine i0 = %d\n",
+ c, tt, upper, i0);
+ }
+ }
diff --git a/toolchain/uClibc/patches-0.9.33.2/995-add-sigsys-to-siginfo_t-union.patch b/toolchain/uClibc/patches-0.9.33.2/995-add-sigsys-to-siginfo_t-union.patch
new file mode 100644
index 0000000..4894a56
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/995-add-sigsys-to-siginfo_t-union.patch
@@ -0,0 +1,145 @@
+Index: uClibc/libc/sysdeps/linux/common/bits/siginfo.h
+===================================================================
+--- uClibc.orig/libc/sysdeps/linux/common/bits/siginfo.h
++++ uClibc/libc/sysdeps/linux/common/bits/siginfo.h
+@@ -104,6 +104,14 @@ typedef struct siginfo
+ long int si_band; /* Band event for SIGPOLL. */
+ int si_fd;
+ } _sigpoll;
++
++ /* SIGSYS. */
++ struct
++ {
++ void *_call_addr; /* Calling user insn. */
++ int _syscall; /* Triggering system call number. */
++ unsigned int _arch; /* AUDIT_ARCH_* of syscall. */
++ } _sigsys;
+ } _sifields;
+ } siginfo_t;
+
+@@ -122,6 +130,9 @@ typedef struct siginfo
+ # define si_addr _sifields._sigfault.si_addr
+ # define si_band _sifields._sigpoll.si_band
+ # define si_fd _sifields._sigpoll.si_fd
++# define si_call_addr _sifields._sigsys._call_addr
++# define si_syscall _sifields._sigsys._syscall
++# define si_arch _sifields._sigsys._arch
+
+
+ /* Values for `si_code'. Positive values are reserved for kernel-generated
+Index: uClibc/libc/sysdeps/linux/alpha/bits/siginfo.h
+===================================================================
+--- uClibc.orig/libc/sysdeps/linux/alpha/bits/siginfo.h
++++ uClibc/libc/sysdeps/linux/alpha/bits/siginfo.h
+@@ -98,6 +98,14 @@ typedef struct siginfo
+ int si_band; /* Band event for SIGPOLL. */
+ int si_fd;
+ } _sigpoll;
++
++ /* SIGSYS. */
++ struct
++ {
++ void *_call_addr; /* Calling user insn. */
++ int _syscall; /* Triggering system call number. */
++ unsigned int _arch; /* AUDIT_ARCH_* of syscall. */
++ } _sigsys;
+ } _sifields;
+ } siginfo_t;
+
+@@ -116,6 +124,9 @@ typedef struct siginfo
+ # define si_addr _sifields._sigfault.si_addr
+ # define si_band _sifields._sigpoll.si_band
+ # define si_fd _sifields._sigpoll.si_fd
++# define si_call_addr _sifields._sigsys._call_addr
++# define si_syscall _sifields._sigsys._syscall
++# define si_arch _sifields._sigsys._arch
+
+
+ /* Values for `si_code'. Positive values are reserved for kernel-generated
+Index: uClibc/libc/sysdeps/linux/ia64/bits/siginfo.h
+===================================================================
+--- uClibc.orig/libc/sysdeps/linux/ia64/bits/siginfo.h
++++ uClibc/libc/sysdeps/linux/ia64/bits/siginfo.h
+@@ -103,6 +103,14 @@ typedef struct siginfo
+ long int si_band; /* Band event for SIGPOLL. */
+ int si_fd;
+ } _sigpoll;
++
++ /* SIGSYS. */
++ struct
++ {
++ void *_call_addr; /* Calling user insn. */
++ int _syscall; /* Triggering system call number. */
++ unsigned int _arch; /* AUDIT_ARCH_* of syscall. */
++ } _sigsys;
+ } _sifields;
+ } siginfo_t;
+
+@@ -121,6 +129,9 @@ typedef struct siginfo
+ # define si_addr _sifields._sigfault.si_addr
+ # define si_band _sifields._sigpoll.si_band
+ # define si_fd _sifields._sigpoll.si_fd
++# define si_call_addr _sifields._sigsys._call_addr
++# define si_syscall _sifields._sigsys._syscall
++# define si_arch _sifields._sigsys._arch
+
+ # ifdef __USE_GNU
+ # define si_imm _sifields._sigfault._si_imm
+Index: uClibc/libc/sysdeps/linux/mips/bits/siginfo.h
+===================================================================
+--- uClibc.orig/libc/sysdeps/linux/mips/bits/siginfo.h
++++ uClibc/libc/sysdeps/linux/mips/bits/siginfo.h
+@@ -107,6 +107,14 @@ typedef struct siginfo
+ __uid_t si_uid; /* Real user ID of sending process. */
+ sigval_t si_sigval; /* Signal value. */
+ } _rt;
++
++ /* SIGSYS. */
++ struct
++ {
++ void *_call_addr; /* Calling user insn. */
++ int _syscall; /* Triggering system call number. */
++ unsigned int _arch; /* AUDIT_ARCH_* of syscall. */
++ } _sigsys;
+ } _sifields;
+ } siginfo_t;
+
+@@ -123,6 +131,9 @@ typedef struct siginfo
+ # define si_addr _sifields._sigfault.si_addr
+ # define si_band _sifields._sigpoll.si_band
+ # define si_fd _sifields._sigpoll.si_fd
++# define si_call_addr _sifields._sigsys._call_addr
++# define si_syscall _sifields._sigsys._syscall
++# define si_arch _sifields._sigsys._arch
+
+
+ /* Values for `si_code'. Positive values are reserved for kernel-generated
+Index: uClibc/libc/sysdeps/linux/sparc/bits/siginfo.h
+===================================================================
+--- uClibc.orig/libc/sysdeps/linux/sparc/bits/siginfo.h
++++ uClibc/libc/sysdeps/linux/sparc/bits/siginfo.h
+@@ -105,6 +105,14 @@ typedef struct siginfo
+ int si_band; /* Band event for SIGPOLL. */
+ int si_fd;
+ } _sigpoll;
++
++ /* SIGSYS. */
++ struct
++ {
++ void *_call_addr; /* Calling user insn. */
++ int _syscall; /* Triggering system call number. */
++ unsigned int _arch; /* AUDIT_ARCH_* of syscall. */
++ } _sigsys;
+ } _sifields;
+ } siginfo_t;
+
+@@ -124,6 +132,9 @@ typedef struct siginfo
+ # define si_trapno _sifields._sigfault.si_trapno
+ # define si_band _sifields._sigpoll.si_band
+ # define si_fd _sifields._sigpoll.si_fd
++# define si_call_addr _sifields._sigsys._call_addr
++# define si_syscall _sifields._sigsys._syscall
++# define si_arch _sifields._sigsys._arch
+
+
+ /* Values for `si_code'. Positive values are reserved for kernel-generated
diff --git a/toolchain/uClibc/patches-0.9.33.2/999-eventfd_use_bits_scheme.patch b/toolchain/uClibc/patches-0.9.33.2/999-eventfd_use_bits_scheme.patch
new file mode 100644
index 0000000..0551290
--- /dev/null
+++ b/toolchain/uClibc/patches-0.9.33.2/999-eventfd_use_bits_scheme.patch
@@ -0,0 +1,248 @@
+From fd355bc1dbcb794ae1abf0fad1459e28d8567ba0 Mon Sep 17 00:00:00 2001
+From: Hiroaki KAWAI <kawai@stratosphere.co.jp>
+Date: Fri, 19 Apr 2013 01:09:35 +0000
+Subject: eventfd.h: Use new "bits/" scheme for arch-specific flags
+
+As in timerfd.h, eventfd.h needs arch-specific definition files.
+alpha, mips and sparc needs separate file, all the other arch
+will use common definition.
+
+This problem is already fixed in glibc.
+
+Also sanitize and provide bits for hppa.
+Make sure not to install the new bits/eventfd unless eventfd support is
+enabled.
+
+Signed-off-by: Hiroaki KAWAI <kawai@stratosphere.co.jp>
+Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
+---
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -272,6 +272,7 @@ HEADERS_RM-$(UCLIBC_HAS_XATTR)
+ HEADERS_RM-$(UCLIBC_HAS_XLOCALE) += xlocale.h
+ HEADERS_RM-$(UCLIBC_LINUX_SPECIFIC) += sys/eventfd.h sys/fsuid.h \
+ bits/inotify.h \
++ bits/eventfd.h \
+ sys/inotify.h \
+ sys/kdaemon.h \
+ sys/perm.h \
+--- /dev/null
++++ b/libc/sysdeps/linux/alpha/bits/eventfd.h
+@@ -0,0 +1,31 @@
++/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C 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
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _SYS_EVENTFD_H
++# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
++#endif
++
++/* Flags for eventfd. */
++enum
++ {
++ EFD_SEMAPHORE = 000000001,
++#define EFD_SEMAPHORE EFD_SEMAPHORE
++ EFD_CLOEXEC = 010000000,
++#define EFD_CLOEXEC EFD_CLOEXEC
++ EFD_NONBLOCK = 000000004
++#define EFD_NONBLOCK EFD_NONBLOCK
++ };
+--- /dev/null
++++ b/libc/sysdeps/linux/common/bits/eventfd.h
+@@ -0,0 +1,31 @@
++/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C 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
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _SYS_EVENTFD_H
++# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
++#endif
++
++/* Flags for eventfd. */
++enum
++ {
++ EFD_SEMAPHORE = 00000001,
++#define EFD_SEMAPHORE EFD_SEMAPHORE
++ EFD_CLOEXEC = 02000000,
++#define EFD_CLOEXEC EFD_CLOEXEC
++ EFD_NONBLOCK = 00004000
++#define EFD_NONBLOCK EFD_NONBLOCK
++ };
+--- a/libc/sysdeps/linux/common/sys/eventfd.h
++++ b/libc/sysdeps/linux/common/sys/eventfd.h
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
++/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+@@ -21,21 +21,12 @@
+
+ #include <stdint.h>
+
++/* Get the platform-dependent flags. */
++#include <bits/eventfd.h>
+
+ /* Type for event counter. */
+ typedef uint64_t eventfd_t;
+
+-/* Flags for signalfd. */
+-enum
+- {
+- EFD_SEMAPHORE = 1,
+-#define EFD_SEMAPHORE EFD_SEMAPHORE
+- EFD_CLOEXEC = 02000000,
+-#define EFD_CLOEXEC EFD_CLOEXEC
+- EFD_NONBLOCK = 04000
+-#define EFD_NONBLOCK EFD_NONBLOCK
+- };
+-
+
+ __BEGIN_DECLS
+
+@@ -43,6 +34,16 @@ __BEGIN_DECLS
+ value to COUNT. */
+ extern int eventfd (int __count, int __flags) __THROW;
+
++#if 0 /* not (yet) implemented in uClibc */
++
++/* Read event counter and possibly wait for events. */
++extern int eventfd_read (int __fd, eventfd_t *__value);
++
++/* Increment event counter. */
++extern int eventfd_write (int __fd, eventfd_t __value);
++
++#endif
++
+ __END_DECLS
+
+ #endif /* sys/eventfd.h */
+--- /dev/null
++++ b/libc/sysdeps/linux/hppa/bits/eventfd.h
+@@ -0,0 +1,32 @@
++/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C 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
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library. If not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _SYS_EVENTFD_H
++# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
++#endif
++
++/* Flags for signalfd. */
++enum
++ {
++ EFD_SEMAPHORE = 000000001,
++#define EFD_SEMAPHORE EFD_SEMAPHORE
++ EFD_CLOEXEC = 010000000,
++#define EFD_CLOEXEC EFD_CLOEXEC
++/* the below value looks suspicious, should be 000200004 for consistency */
++ EFD_NONBLOCK = 00200004 /* HPUX has separate NDELAY & NONBLOCK */
++#define EFD_NONBLOCK EFD_NONBLOCK
++ };
+--- /dev/null
++++ b/libc/sysdeps/linux/mips/bits/eventfd.h
+@@ -0,0 +1,31 @@
++/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C 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
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _SYS_EVENTFD_H
++# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
++#endif
++
++/* Flags for eventfd. */
++enum
++ {
++ EFD_SEMAPHORE = 00000001,
++#define EFD_SEMAPHORE EFD_SEMAPHORE
++ EFD_CLOEXEC = 02000000,
++#define EFD_CLOEXEC EFD_CLOEXEC
++ EFD_NONBLOCK = 00000200
++#define EFD_NONBLOCK EFD_NONBLOCK
++ };
+--- /dev/null
++++ b/libc/sysdeps/linux/sparc/bits/eventfd.h
+@@ -0,0 +1,31 @@
++/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C 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
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _SYS_EVENTFD_H
++# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
++#endif
++
++/* Flags for eventfd. */
++enum
++ {
++ EFD_SEMAPHORE = 1,
++#define EFD_SEMAPHORE EFD_SEMAPHORE
++ EFD_CLOEXEC = 0x400000,
++#define EFD_CLOEXEC EFD_CLOEXEC
++ EFD_NONBLOCK = 0x004000
++#define EFD_NONBLOCK EFD_NONBLOCK
++ };
diff --git a/toolchain/uClibc/utils/Makefile b/toolchain/uClibc/utils/Makefile
new file mode 100644
index 0000000..83100d7
--- /dev/null
+++ b/toolchain/uClibc/utils/Makefile
@@ -0,0 +1,24 @@
+PATH_PREFIX=..
+
+include ../common.mk
+
+HOST_STAMP_BUILT:=$(HOST_BUILD_DIR)/.utils_built
+HOST_STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.uclibc_utils_installed
+
+define Host/Compile
+ $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(HOST_BUILD_DIR)/Rules.mak
+ $(UCLIBC_MAKE) PREFIX= utils
+endef
+
+define Host/Install
+ $(INSTALL_DIR) $(TOOLCHAIN_DIR)/bin
+ $(INSTALL_BIN) \
+ $(HOST_BUILD_DIR)/utils/ldd \
+ $(TOOLCHAIN_DIR)/bin/
+ $(INSTALL_DIR) $(TOOLCHAIN_DIR)/sbin
+ $(INSTALL_BIN) \
+ $(HOST_BUILD_DIR)/utils/ldconfig \
+ $(TOOLCHAIN_DIR)/sbin/
+endef
+
+$(eval $(call HostBuild))