aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-02-15 01:29:13 +0000
committerFelix Fietkau <nbd@openwrt.org>2011-02-15 01:29:13 +0000
commitb71c26a5b1f52a0767f9faad96e3aedfa63465b6 (patch)
treea67967d0b335cdce261bdbe0fe3a58a120af8b8c
parent65da314b7dca25d2f270c61d6bd80210b27a9355 (diff)
downloadupstream-b71c26a5b1f52a0767f9faad96e3aedfa63465b6.tar.gz
upstream-b71c26a5b1f52a0767f9faad96e3aedfa63465b6.tar.bz2
upstream-b71c26a5b1f52a0767f9faad96e3aedfa63465b6.zip
uClibc: remove 0.9.30, 0.9.31
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@25542 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--toolchain/uClibc/Config.in6
-rw-r--r--toolchain/uClibc/Config.version2
-rw-r--r--toolchain/uClibc/Makefile2
-rw-r--r--toolchain/uClibc/config-0.9.30.1/arm25
-rw-r--r--toolchain/uClibc/config-0.9.30.1/arm.cns21xx26
-rw-r--r--toolchain/uClibc/config-0.9.30.1/arm.cns3xxx25
-rw-r--r--toolchain/uClibc/config-0.9.30.1/arm.gemini26
-rw-r--r--toolchain/uClibc/config-0.9.30.1/armeb25
-rw-r--r--toolchain/uClibc/config-0.9.30.1/avr3210
-rw-r--r--toolchain/uClibc/config-0.9.30.1/common179
-rw-r--r--toolchain/uClibc/config-0.9.30.1/cris6
-rw-r--r--toolchain/uClibc/config-0.9.30.1/debug6
-rw-r--r--toolchain/uClibc/config-0.9.30.1/i38622
-rw-r--r--toolchain/uClibc/config-0.9.30.1/i68622
-rw-r--r--toolchain/uClibc/config-0.9.30.1/m68k5
-rw-r--r--toolchain/uClibc/config-0.9.30.1/mips17
-rw-r--r--toolchain/uClibc/config-0.9.30.1/mips6417
-rw-r--r--toolchain/uClibc/config-0.9.30.1/mips64el17
-rw-r--r--toolchain/uClibc/config-0.9.30.1/mipsel17
-rw-r--r--toolchain/uClibc/config-0.9.30.1/mipsel.brcm-2.418
-rw-r--r--toolchain/uClibc/config-0.9.30.1/mipsel.cobalt17
-rw-r--r--toolchain/uClibc/config-0.9.30.1/powerpc7
-rw-r--r--toolchain/uClibc/config-0.9.30.1/sparc8
-rw-r--r--toolchain/uClibc/config-0.9.30.1/sparc.leon8
-rw-r--r--toolchain/uClibc/config-0.9.30.1/ubicom3235
-rw-r--r--toolchain/uClibc/config-0.9.30.1/x86_647
-rw-r--r--toolchain/uClibc/config-0.9.31/arm25
-rw-r--r--toolchain/uClibc/config-0.9.31/arm.cns21xx26
-rw-r--r--toolchain/uClibc/config-0.9.31/arm.cns3xxx25
-rw-r--r--toolchain/uClibc/config-0.9.31/arm.gemini26
-rw-r--r--toolchain/uClibc/config-0.9.31/armeb25
-rw-r--r--toolchain/uClibc/config-0.9.31/avr3210
-rw-r--r--toolchain/uClibc/config-0.9.31/common190
-rw-r--r--toolchain/uClibc/config-0.9.31/cris6
-rw-r--r--toolchain/uClibc/config-0.9.31/debug6
-rw-r--r--toolchain/uClibc/config-0.9.31/i38622
-rw-r--r--toolchain/uClibc/config-0.9.31/i68622
-rw-r--r--toolchain/uClibc/config-0.9.31/m68k5
-rw-r--r--toolchain/uClibc/config-0.9.31/mips17
-rw-r--r--toolchain/uClibc/config-0.9.31/mips6417
-rw-r--r--toolchain/uClibc/config-0.9.31/mips64el17
-rw-r--r--toolchain/uClibc/config-0.9.31/mipsel17
-rw-r--r--toolchain/uClibc/config-0.9.31/mipsel.brcm-2.418
-rw-r--r--toolchain/uClibc/config-0.9.31/mipsel.cobalt17
-rw-r--r--toolchain/uClibc/config-0.9.31/powerpc7
-rw-r--r--toolchain/uClibc/config-0.9.31/powerpc.mpc85xx7
-rw-r--r--toolchain/uClibc/config-0.9.31/sparc8
-rw-r--r--toolchain/uClibc/config-0.9.31/sparc.leon8
-rw-r--r--toolchain/uClibc/config-0.9.31/ubicom3235
-rw-r--r--toolchain/uClibc/config-0.9.31/x86_647
-rw-r--r--toolchain/uClibc/patches-0.9.30.1/110-compat_macros.patch51
-rw-r--r--toolchain/uClibc/patches-0.9.30.1/120-adjtimex.patch14
-rw-r--r--toolchain/uClibc/patches-0.9.30.1/130-pthread_weak_binding.patch10
-rw-r--r--toolchain/uClibc/patches-0.9.30.1/140-math_decl.patch11
-rw-r--r--toolchain/uClibc/patches-0.9.30.1/150-c99_ldbl_math.patch474
-rw-r--r--toolchain/uClibc/patches-0.9.30.1/160-unifdef_fix.patch43
-rw-r--r--toolchain/uClibc/patches-0.9.30.1/170-math_finite.patch23
-rw-r--r--toolchain/uClibc/patches-0.9.30.1/180-dl_sysdep_inline.patch371
-rw-r--r--toolchain/uClibc/patches-0.9.30.1/300-fix-ppoll.diff38
-rw-r--r--toolchain/uClibc/patches-0.9.30.1/400-gcc4.4-fixes.patch916
-rw-r--r--toolchain/uClibc/patches-0.9.30.1/410-llvm_workaround.patch11
-rw-r--r--toolchain/uClibc/patches-0.9.30.1/420-i386_strrchr_fix.patch11
-rw-r--r--toolchain/uClibc/patches-0.9.30.1/430-i386_copysign.patch96
-rw-r--r--toolchain/uClibc/patches-0.9.30.1/440-backport_mips_nonpic.patch289
-rw-r--r--toolchain/uClibc/patches-0.9.30.1/450-powerpc_copysignl.patch103
-rw-r--r--toolchain/uClibc/patches-0.9.30.1/500-avr32_add_varargs_handling_of_prctl_syscall.patch68
-rw-r--r--toolchain/uClibc/patches-0.9.30.1/600-ubicom32-uClibc.patch4407
-rw-r--r--toolchain/uClibc/patches-0.9.30.1/900-backport_fix_possible_null_ptr_dereference_in_getaddrinfo.patch11
-rw-r--r--toolchain/uClibc/patches-0.9.30.1/901-hi_lo_system_calls.patch30
-rw-r--r--toolchain/uClibc/patches-0.9.30.1/902-Fix-use-after-free-bug-in-__dns_lookup.patch45
-rw-r--r--toolchain/uClibc/patches-0.9.31/000-upstream-attribute_optimize_fix.patch25
-rw-r--r--toolchain/uClibc/patches-0.9.31/000-upstream-calloc_return_zeroed_memory.patch33
-rw-r--r--toolchain/uClibc/patches-0.9.31/000-upstream-ctime_fix.patch86
-rw-r--r--toolchain/uClibc/patches-0.9.31/000-upstream-enum_fix.patch20
-rw-r--r--toolchain/uClibc/patches-0.9.31/000-upstream-fix_usage_of_uninitialized_DNS_parameters.patch40
-rw-r--r--toolchain/uClibc/patches-0.9.31/000-upstream_initialize_stdio_locking.patch33
-rw-r--r--toolchain/uClibc/patches-0.9.31/110-compat_macros.patch51
-rw-r--r--toolchain/uClibc/patches-0.9.31/120-adjtimex.patch14
-rw-r--r--toolchain/uClibc/patches-0.9.31/130-ldso-fix-__dl_parse_dynamic_info-segfault.patch43
-rw-r--r--toolchain/uClibc/patches-0.9.31/140-math_decl.patch12
-rw-r--r--toolchain/uClibc/patches-0.9.31/170-math_finite.patch23
-rw-r--r--toolchain/uClibc/patches-0.9.31/410-llvm_workaround.patch11
-rw-r--r--toolchain/uClibc/patches-0.9.31/450-powerpc_copysignl.patch103
-rw-r--r--toolchain/uClibc/patches-0.9.31/600-ubicom32-uClibc.patch4340
-rw-r--r--toolchain/uClibc/patches-0.9.31/901-MIPS-restore-INLINE_SYSCALL-macro.patch110
-rw-r--r--toolchain/uClibc/patches-0.9.31/903-fcntl64_fix.patch26
-rw-r--r--toolchain/uClibc/patches-0.9.31/904-pthread_errno_fix.patch18
87 files changed, 0 insertions, 13128 deletions
diff --git a/toolchain/uClibc/Config.in b/toolchain/uClibc/Config.in
index 03d2176a13..36bb8804ea 100644
--- a/toolchain/uClibc/Config.in
+++ b/toolchain/uClibc/Config.in
@@ -7,12 +7,6 @@ choice
help
Select the version of uClibc you wish to use.
- config UCLIBC_VERSION_0_9_30_1
- bool "uClibc 0.9.30.1"
-
- config UCLIBC_VERSION_0_9_31
- bool "uClibc 0.9.31"
-
config UCLIBC_VERSION_0_9_32
bool "uClibc 0.9.32-git"
diff --git a/toolchain/uClibc/Config.version b/toolchain/uClibc/Config.version
index 29d4c7d636..843a499bda 100644
--- a/toolchain/uClibc/Config.version
+++ b/toolchain/uClibc/Config.version
@@ -1,7 +1,5 @@
config UCLIBC_VERSION
string
depends on USE_UCLIBC
- default "0.9.30.1" if UCLIBC_VERSION_0_9_30_1
- default "0.9.31" if UCLIBC_VERSION_0_9_31
default "0.9.32" if UCLIBC_VERSION_0_9_32
default "0.9.32"
diff --git a/toolchain/uClibc/Makefile b/toolchain/uClibc/Makefile
index 8b445b604f..32747a53a2 100644
--- a/toolchain/uClibc/Makefile
+++ b/toolchain/uClibc/Makefile
@@ -24,8 +24,6 @@ endif
PATCH_DIR:=./patches-$(PKG_VERSION)
CONFIG_DIR:=./config-$(PKG_VERSION)
-PKG_MD5SUM_0.9.30.1 = 1a4b84e5536ad8170563ffa88c34679c
-PKG_MD5SUM_0.9.31 = 52fb8a494758630c8d3ddd7f1e0daafd
PKG_MD5SUM=$(PKG_MD5SUM_$(PKG_VERSION))
HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)-$(PKG_VERSION)
diff --git a/toolchain/uClibc/config-0.9.30.1/arm b/toolchain/uClibc/config-0.9.30.1/arm
deleted file mode 100644
index d26b075b45..0000000000
--- a/toolchain/uClibc/config-0.9.30.1/arm
+++ /dev/null
@@ -1,25 +0,0 @@
-ARCH_ANY_ENDIAN=y
-ARCH_LITTLE_ENDIAN=y
-ARCH_WANTS_LITTLE_ENDIAN=y
-# CONFIG_ARM10T is not set
-# CONFIG_ARM1136JF_S is not set
-# CONFIG_ARM1176JZF_S is not set
-# CONFIG_ARM1176JZ_S is not set
-# CONFIG_ARM610 is not set
-# CONFIG_ARM710 is not set
-# CONFIG_ARM720T is not set
-# CONFIG_ARM7TDMI is not set
-# CONFIG_ARM920T is not set
-# CONFIG_ARM922T is not set
-# CONFIG_ARM926T is not set
-# CONFIG_ARM_CORTEX_M1 is not set
-# CONFIG_ARM_CORTEX_M3 is not set
-# CONFIG_ARM_EABI is not set
-# CONFIG_ARM_IWMMXT is not set
-CONFIG_ARM_OABI=y
-# CONFIG_ARM_SA110 is not set
-# CONFIG_ARM_SA1100 is not set
-CONFIG_ARM_XSCALE=y
-# CONFIG_GENERIC_ARM is not set
-TARGET_ARCH="arm"
-TARGET_arm=y
diff --git a/toolchain/uClibc/config-0.9.30.1/arm.cns21xx b/toolchain/uClibc/config-0.9.30.1/arm.cns21xx
deleted file mode 100644
index 8043cf61b7..0000000000
--- a/toolchain/uClibc/config-0.9.30.1/arm.cns21xx
+++ /dev/null
@@ -1,26 +0,0 @@
-ARCH_ANY_ENDIAN=y
-ARCH_LITTLE_ENDIAN=y
-ARCH_WANTS_LITTLE_ENDIAN=y
-# CONFIG_ARM10T is not set
-# CONFIG_ARM1136JF_S is not set
-# CONFIG_ARM1176JZF_S is not set
-# CONFIG_ARM1176JZ_S is not set
-# CONFIG_ARM610 is not set
-# CONFIG_ARM710 is not set
-# CONFIG_ARM720T is not set
-# CONFIG_ARM7TDMI is not set
-CONFIG_ARM920T=y
-# CONFIG_ARM922T is not set
-# CONFIG_ARM926T is not set
-# CONFIG_ARM_CORTEX_M1 is not set
-# CONFIG_ARM_CORTEX_M3 is not set
-# CONFIG_ARM_EABI is not set
-# CONFIG_ARM_IWMMXT is not set
-CONFIG_ARM_OABI=y
-# CONFIG_ARM_SA110 is not set
-# CONFIG_ARM_SA1100 is not set
-# CONFIG_ARM_XSCALE is not set
-# CONFIG_GENERIC_ARM is not set
-TARGET_ARCH="arm"
-TARGET_arm=y
-# USE_BX is not set
diff --git a/toolchain/uClibc/config-0.9.30.1/arm.cns3xxx b/toolchain/uClibc/config-0.9.30.1/arm.cns3xxx
deleted file mode 100644
index 84ad02bb3e..0000000000
--- a/toolchain/uClibc/config-0.9.30.1/arm.cns3xxx
+++ /dev/null
@@ -1,25 +0,0 @@
-ARCH_ANY_ENDIAN=y
-ARCH_LITTLE_ENDIAN=y
-ARCH_WANTS_LITTLE_ENDIAN=y
-# CONFIG_ARM10T is not set
-# CONFIG_ARM1136JF_S is not set
-CONFIG_ARM1176JZF_S=y
-# CONFIG_ARM1176JZ_S is not set
-# CONFIG_ARM610 is not set
-# CONFIG_ARM710 is not set
-# CONFIG_ARM720T is not set
-# CONFIG_ARM7TDMI is not set
-# CONFIG_ARM920T is not set
-# CONFIG_ARM922T is not set
-# CONFIG_ARM926T is not set
-# CONFIG_ARM_CORTEX_M1 is not set
-# CONFIG_ARM_CORTEX_M3 is not set
-# CONFIG_ARM_EABI is not set
-# CONFIG_ARM_IWMMXT is not set
-CONFIG_ARM_OABI=y
-# CONFIG_ARM_SA110 is not set
-# CONFIG_ARM_SA1100 is not set
-# CONFIG_ARM_XSCALE is not set
-# CONFIG_GENERIC_ARM is not set
-TARGET_ARCH="arm"
-TARGET_arm=y
diff --git a/toolchain/uClibc/config-0.9.30.1/arm.gemini b/toolchain/uClibc/config-0.9.30.1/arm.gemini
deleted file mode 100644
index 8043cf61b7..0000000000
--- a/toolchain/uClibc/config-0.9.30.1/arm.gemini
+++ /dev/null
@@ -1,26 +0,0 @@
-ARCH_ANY_ENDIAN=y
-ARCH_LITTLE_ENDIAN=y
-ARCH_WANTS_LITTLE_ENDIAN=y
-# CONFIG_ARM10T is not set
-# CONFIG_ARM1136JF_S is not set
-# CONFIG_ARM1176JZF_S is not set
-# CONFIG_ARM1176JZ_S is not set
-# CONFIG_ARM610 is not set
-# CONFIG_ARM710 is not set
-# CONFIG_ARM720T is not set
-# CONFIG_ARM7TDMI is not set
-CONFIG_ARM920T=y
-# CONFIG_ARM922T is not set
-# CONFIG_ARM926T is not set
-# CONFIG_ARM_CORTEX_M1 is not set
-# CONFIG_ARM_CORTEX_M3 is not set
-# CONFIG_ARM_EABI is not set
-# CONFIG_ARM_IWMMXT is not set
-CONFIG_ARM_OABI=y
-# CONFIG_ARM_SA110 is not set
-# CONFIG_ARM_SA1100 is not set
-# CONFIG_ARM_XSCALE is not set
-# CONFIG_GENERIC_ARM is not set
-TARGET_ARCH="arm"
-TARGET_arm=y
-# USE_BX is not set
diff --git a/toolchain/uClibc/config-0.9.30.1/armeb b/toolchain/uClibc/config-0.9.30.1/armeb
deleted file mode 100644
index ba3ea5c845..0000000000
--- a/toolchain/uClibc/config-0.9.30.1/armeb
+++ /dev/null
@@ -1,25 +0,0 @@
-ARCH_ANY_ENDIAN=y
-ARCH_BIG_ENDIAN=y
-ARCH_WANTS_BIG_ENDIAN=y
-# CONFIG_ARM10T is not set
-# CONFIG_ARM1136JF_S is not set
-# CONFIG_ARM1176JZF_S is not set
-# CONFIG_ARM1176JZ_S is not set
-# CONFIG_ARM610 is not set
-# CONFIG_ARM710 is not set
-# CONFIG_ARM720T is not set
-# CONFIG_ARM7TDMI is not set
-# CONFIG_ARM920T is not set
-# CONFIG_ARM922T is not set
-# CONFIG_ARM926T is not set
-# CONFIG_ARM_CORTEX_M1 is not set
-# CONFIG_ARM_CORTEX_M3 is not set
-# CONFIG_ARM_EABI is not set
-# CONFIG_ARM_IWMMXT is not set
-CONFIG_ARM_OABI=y
-# CONFIG_ARM_SA110 is not set
-# CONFIG_ARM_SA1100 is not set
-CONFIG_ARM_XSCALE=y
-# CONFIG_GENERIC_ARM is not set
-TARGET_ARCH="arm"
-TARGET_arm=y
diff --git a/toolchain/uClibc/config-0.9.30.1/avr32 b/toolchain/uClibc/config-0.9.30.1/avr32
deleted file mode 100644
index bf7907aed9..0000000000
--- a/toolchain/uClibc/config-0.9.30.1/avr32
+++ /dev/null
@@ -1,10 +0,0 @@
-ARCH_BIG_ENDIAN=y
-CONFIG_AVR32_AP7=y
-FORCE_SHAREABLE_TEXT_SEGMENTS=y
-LINKRELAX=y
-TARGET_ARCH="avr32"
-TARGET_avr32=y
-UCLIBC_HAS_FPU=y
-# UCLIBC_HAS_SCANF_GLIBC_A_FLAG is not set
-# UCLIBC_HAS_STRING_ARCH_OPT is not set
-UNIX98PTY_ONLY=y
diff --git a/toolchain/uClibc/config-0.9.30.1/common b/toolchain/uClibc/config-0.9.30.1/common
deleted file mode 100644
index 76632ab721..0000000000
--- a/toolchain/uClibc/config-0.9.30.1/common
+++ /dev/null
@@ -1,179 +0,0 @@
-# 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
-# EXTRA_WARNINGS is not set
-FORCE_OPTIONS_FOR_ARCH=y
-# FORCE_SHAREABLE_TEXT_SEGMENTS 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_LDD_SUPPORT=y
-# LDSO_PRELOAD_FILE_SUPPORT is not set
-LDSO_RUNPATH=y
-LINUXTHREADS_OLD=y
-# MALLOC is not set
-MALLOC_GLIBC_COMPAT=y
-# MALLOC_SIMPLE is not set
-MALLOC_STANDARD=y
-# PTHREADS_DEBUG_SUPPORT is not set
-RUNTIME_PREFIX="/"
-SHARED_LIB_LOADER_PREFIX="/lib"
-# 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_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_ubicom32 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 is not set
-# UCLIBC_HAS_ARC4RANDOM is not set
-UCLIBC_HAS_BSD_ERR=y
-UCLIBC_HAS_BSD_RES_CLOSE=y
-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_FENV is not set
-UCLIBC_HAS_FLOATS=y
-UCLIBC_HAS_FNMATCH=y
-UCLIBC_HAS_FNMATCH_OLD=y
-UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y
-# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set
-# UCLIBC_HAS_FPU is not set
-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_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_LOCALE is not set
-UCLIBC_HAS_NETWORK_SUPPORT=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_RPC is not set
-UCLIBC_HAS_SCANF_GLIBC_A_FLAG=y
-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_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_WCHAR=y
-UCLIBC_HAS_WORDEXP=y
-# UCLIBC_HAS_XATTR is not set
-UCLIBC_HAS___PROGNAME=y
-# UCLIBC_LINUX_MODULE_24 is not set
-UCLIBC_LINUX_SPECIFIC=y
-# UCLIBC_MALLOC_DEBUGGING is not set
-# UCLIBC_MJN3_ONLY is not set
-# UCLIBC_NTP_LEGACY is not set
-UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
-UCLIBC_PWD_BUFFER_SIZE=256
-# UCLIBC_STATIC_LDCONFIG is not set
-UCLIBC_SUPPORT_AI_ADDRCONFIG=y
-UCLIBC_SUSV3_LEGACY=y
-UCLIBC_SUSV3_LEGACY_MACROS=y
-# UCLIBC_SV4_DEPRECATED is not set
-UCLIBC_TZ_FILE_PATH="/etc/TZ"
-UCLIBC_USE_NETLINK=y
-# UNIX98PTY_ONLY is not set
-USE_BX=y
-WARNINGS="-Wall"
diff --git a/toolchain/uClibc/config-0.9.30.1/cris b/toolchain/uClibc/config-0.9.30.1/cris
deleted file mode 100644
index b9ea676fcd..0000000000
--- a/toolchain/uClibc/config-0.9.30.1/cris
+++ /dev/null
@@ -1,6 +0,0 @@
-ARCH_LITTLE_ENDIAN=y
-CONFIG_CRIS=y
-# CONFIG_CRISV32 is not set
-TARGET_ARCH="cris"
-TARGET_cris=y
-UCLIBC_HAS_FPU=y
diff --git a/toolchain/uClibc/config-0.9.30.1/debug b/toolchain/uClibc/config-0.9.30.1/debug
deleted file mode 100644
index b366e66e39..0000000000
--- a/toolchain/uClibc/config-0.9.30.1/debug
+++ /dev/null
@@ -1,6 +0,0 @@
-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.30.1/i386 b/toolchain/uClibc/config-0.9.30.1/i386
deleted file mode 100644
index 719a53d70a..0000000000
--- a/toolchain/uClibc/config-0.9.30.1/i386
+++ /dev/null
@@ -1,22 +0,0 @@
-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
-UCLIBC_HAS_LONG_DOUBLE_MATH=y
diff --git a/toolchain/uClibc/config-0.9.30.1/i686 b/toolchain/uClibc/config-0.9.30.1/i686
deleted file mode 100644
index c0034a0fbf..0000000000
--- a/toolchain/uClibc/config-0.9.30.1/i686
+++ /dev/null
@@ -1,22 +0,0 @@
-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
-UCLIBC_HAS_LONG_DOUBLE_MATH=y
diff --git a/toolchain/uClibc/config-0.9.30.1/m68k b/toolchain/uClibc/config-0.9.30.1/m68k
deleted file mode 100644
index ae984916df..0000000000
--- a/toolchain/uClibc/config-0.9.30.1/m68k
+++ /dev/null
@@ -1,5 +0,0 @@
-ARCH_BIG_ENDIAN=y
-TARGET_ARCH="m68k"
-TARGET_SUBARCH=""
-TARGET_m68k=y
-UCLIBC_HAS_LONG_DOUBLE_MATH=y
diff --git a/toolchain/uClibc/config-0.9.30.1/mips b/toolchain/uClibc/config-0.9.30.1/mips
deleted file mode 100644
index 7398c66929..0000000000
--- a/toolchain/uClibc/config-0.9.30.1/mips
+++ /dev/null
@@ -1,17 +0,0 @@
-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.30.1/mips64 b/toolchain/uClibc/config-0.9.30.1/mips64
deleted file mode 100644
index fa5bee3aa5..0000000000
--- a/toolchain/uClibc/config-0.9.30.1/mips64
+++ /dev/null
@@ -1,17 +0,0 @@
-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.30.1/mips64el b/toolchain/uClibc/config-0.9.30.1/mips64el
deleted file mode 100644
index 1ca764f6e2..0000000000
--- a/toolchain/uClibc/config-0.9.30.1/mips64el
+++ /dev/null
@@ -1,17 +0,0 @@
-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.30.1/mipsel b/toolchain/uClibc/config-0.9.30.1/mipsel
deleted file mode 100644
index 7648f396ba..0000000000
--- a/toolchain/uClibc/config-0.9.30.1/mipsel
+++ /dev/null
@@ -1,17 +0,0 @@
-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.30.1/mipsel.brcm-2.4 b/toolchain/uClibc/config-0.9.30.1/mipsel.brcm-2.4
deleted file mode 100644
index 7857868465..0000000000
--- a/toolchain/uClibc/config-0.9.30.1/mipsel.brcm-2.4
+++ /dev/null
@@ -1,18 +0,0 @@
-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
-UCLIBC_LINUX_MODULE_24=y
diff --git a/toolchain/uClibc/config-0.9.30.1/mipsel.cobalt b/toolchain/uClibc/config-0.9.30.1/mipsel.cobalt
deleted file mode 100644
index 323b0aa52e..0000000000
--- a/toolchain/uClibc/config-0.9.30.1/mipsel.cobalt
+++ /dev/null
@@ -1,17 +0,0 @@
-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.30.1/powerpc b/toolchain/uClibc/config-0.9.30.1/powerpc
deleted file mode 100644
index 4e5cd43ba4..0000000000
--- a/toolchain/uClibc/config-0.9.30.1/powerpc
+++ /dev/null
@@ -1,7 +0,0 @@
-ARCH_BIG_ENDIAN=y
-CONFIG_CLASSIC=y
-# CONFIG_E500 is not set
-TARGET_ARCH="powerpc"
-TARGET_SUBARCH="classic"
-TARGET_powerpc=y
-UCLIBC_HAS_LONG_DOUBLE_MATH=y
diff --git a/toolchain/uClibc/config-0.9.30.1/sparc b/toolchain/uClibc/config-0.9.30.1/sparc
deleted file mode 100644
index e1596c4100..0000000000
--- a/toolchain/uClibc/config-0.9.30.1/sparc
+++ /dev/null
@@ -1,8 +0,0 @@
-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.30.1/sparc.leon b/toolchain/uClibc/config-0.9.30.1/sparc.leon
deleted file mode 100644
index eb725ac05d..0000000000
--- a/toolchain/uClibc/config-0.9.30.1/sparc.leon
+++ /dev/null
@@ -1,8 +0,0 @@
-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.30.1/ubicom32 b/toolchain/uClibc/config-0.9.30.1/ubicom32
deleted file mode 100644
index ef00e79355..0000000000
--- a/toolchain/uClibc/config-0.9.30.1/ubicom32
+++ /dev/null
@@ -1,35 +0,0 @@
-ARCH_BIG_ENDIAN=y
-ARCH_HAS_NO_MMU=y
-COMPAT_ATEXIT=y
-# CONFIG_UC_UBICOM32_V3 is not set
-CONFIG_UC_UBICOM32_V4=y
-# DOSTRIP is not set
-EXCLUDE_BRK=y
-FORCE_SHAREABLE_TEXT_SEGMENTS=y
-LDSO_PRELOAD_FILE_SUPPORT=y
-MALLOC=y
-# MALLOC_STANDARD is not set
-PTHREADS_DEBUG_SUPPORT=y
-SUPPORT_LD_DEBUG=y
-TARGET_ARCH="ubicom32"
-TARGET_ubicom32=y
-# UCLIBC_FORMAT_ELF is not set
-UCLIBC_FORMAT_FDPIC_ELF=y
-# UCLIBC_FORMAT_FLAT is not set
-# UCLIBC_FORMAT_FLAT_SEP_DATA is not set
-# UCLIBC_FORMAT_SHARED_FLAT is not set
-UCLIBC_HAS_ADVANCED_REALTIME=y
-UCLIBC_HAS_FOPEN_LARGEFILE_MODE=y
-UCLIBC_HAS_FPU=y
-# UCLIBC_HAS_GETPT is not set
-UCLIBC_HAS_OBSOLETE_BSD_SIGNAL=y
-UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL=y
-UCLIBC_HAS_PROFILING=y
-UCLIBC_HAS_REENTRANT_RPC=y
-UCLIBC_HAS_STUBS=y
-UCLIBC_HAS_XATTR=y
-UCLIBC_NTP_LEGACY=y
-UCLIBC_STATIC_LDCONFIG=y
-UCLIBC_SV4_DEPRECATED=y
-UCLIBC_UCLINUX_BROKEN_MUNMAP=y
-UNIX98PTY_ONLY=y
diff --git a/toolchain/uClibc/config-0.9.30.1/x86_64 b/toolchain/uClibc/config-0.9.30.1/x86_64
deleted file mode 100644
index 20a18f1a07..0000000000
--- a/toolchain/uClibc/config-0.9.30.1/x86_64
+++ /dev/null
@@ -1,7 +0,0 @@
-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
-UCLIBC_HAS_LONG_DOUBLE_MATH=y
diff --git a/toolchain/uClibc/config-0.9.31/arm b/toolchain/uClibc/config-0.9.31/arm
deleted file mode 100644
index d26b075b45..0000000000
--- a/toolchain/uClibc/config-0.9.31/arm
+++ /dev/null
@@ -1,25 +0,0 @@
-ARCH_ANY_ENDIAN=y
-ARCH_LITTLE_ENDIAN=y
-ARCH_WANTS_LITTLE_ENDIAN=y
-# CONFIG_ARM10T is not set
-# CONFIG_ARM1136JF_S is not set
-# CONFIG_ARM1176JZF_S is not set
-# CONFIG_ARM1176JZ_S is not set
-# CONFIG_ARM610 is not set
-# CONFIG_ARM710 is not set
-# CONFIG_ARM720T is not set
-# CONFIG_ARM7TDMI is not set
-# CONFIG_ARM920T is not set
-# CONFIG_ARM922T is not set
-# CONFIG_ARM926T is not set
-# CONFIG_ARM_CORTEX_M1 is not set
-# CONFIG_ARM_CORTEX_M3 is not set
-# CONFIG_ARM_EABI is not set
-# CONFIG_ARM_IWMMXT is not set
-CONFIG_ARM_OABI=y
-# CONFIG_ARM_SA110 is not set
-# CONFIG_ARM_SA1100 is not set
-CONFIG_ARM_XSCALE=y
-# CONFIG_GENERIC_ARM is not set
-TARGET_ARCH="arm"
-TARGET_arm=y
diff --git a/toolchain/uClibc/config-0.9.31/arm.cns21xx b/toolchain/uClibc/config-0.9.31/arm.cns21xx
deleted file mode 100644
index 8043cf61b7..0000000000
--- a/toolchain/uClibc/config-0.9.31/arm.cns21xx
+++ /dev/null
@@ -1,26 +0,0 @@
-ARCH_ANY_ENDIAN=y
-ARCH_LITTLE_ENDIAN=y
-ARCH_WANTS_LITTLE_ENDIAN=y
-# CONFIG_ARM10T is not set
-# CONFIG_ARM1136JF_S is not set
-# CONFIG_ARM1176JZF_S is not set
-# CONFIG_ARM1176JZ_S is not set
-# CONFIG_ARM610 is not set
-# CONFIG_ARM710 is not set
-# CONFIG_ARM720T is not set
-# CONFIG_ARM7TDMI is not set
-CONFIG_ARM920T=y
-# CONFIG_ARM922T is not set
-# CONFIG_ARM926T is not set
-# CONFIG_ARM_CORTEX_M1 is not set
-# CONFIG_ARM_CORTEX_M3 is not set
-# CONFIG_ARM_EABI is not set
-# CONFIG_ARM_IWMMXT is not set
-CONFIG_ARM_OABI=y
-# CONFIG_ARM_SA110 is not set
-# CONFIG_ARM_SA1100 is not set
-# CONFIG_ARM_XSCALE is not set
-# CONFIG_GENERIC_ARM is not set
-TARGET_ARCH="arm"
-TARGET_arm=y
-# USE_BX is not set
diff --git a/toolchain/uClibc/config-0.9.31/arm.cns3xxx b/toolchain/uClibc/config-0.9.31/arm.cns3xxx
deleted file mode 100644
index 84ad02bb3e..0000000000
--- a/toolchain/uClibc/config-0.9.31/arm.cns3xxx
+++ /dev/null
@@ -1,25 +0,0 @@
-ARCH_ANY_ENDIAN=y
-ARCH_LITTLE_ENDIAN=y
-ARCH_WANTS_LITTLE_ENDIAN=y
-# CONFIG_ARM10T is not set
-# CONFIG_ARM1136JF_S is not set
-CONFIG_ARM1176JZF_S=y
-# CONFIG_ARM1176JZ_S is not set
-# CONFIG_ARM610 is not set
-# CONFIG_ARM710 is not set
-# CONFIG_ARM720T is not set
-# CONFIG_ARM7TDMI is not set
-# CONFIG_ARM920T is not set
-# CONFIG_ARM922T is not set
-# CONFIG_ARM926T is not set
-# CONFIG_ARM_CORTEX_M1 is not set
-# CONFIG_ARM_CORTEX_M3 is not set
-# CONFIG_ARM_EABI is not set
-# CONFIG_ARM_IWMMXT is not set
-CONFIG_ARM_OABI=y
-# CONFIG_ARM_SA110 is not set
-# CONFIG_ARM_SA1100 is not set
-# CONFIG_ARM_XSCALE is not set
-# CONFIG_GENERIC_ARM is not set
-TARGET_ARCH="arm"
-TARGET_arm=y
diff --git a/toolchain/uClibc/config-0.9.31/arm.gemini b/toolchain/uClibc/config-0.9.31/arm.gemini
deleted file mode 100644
index 8043cf61b7..0000000000
--- a/toolchain/uClibc/config-0.9.31/arm.gemini
+++ /dev/null
@@ -1,26 +0,0 @@
-ARCH_ANY_ENDIAN=y
-ARCH_LITTLE_ENDIAN=y
-ARCH_WANTS_LITTLE_ENDIAN=y
-# CONFIG_ARM10T is not set
-# CONFIG_ARM1136JF_S is not set
-# CONFIG_ARM1176JZF_S is not set
-# CONFIG_ARM1176JZ_S is not set
-# CONFIG_ARM610 is not set
-# CONFIG_ARM710 is not set
-# CONFIG_ARM720T is not set
-# CONFIG_ARM7TDMI is not set
-CONFIG_ARM920T=y
-# CONFIG_ARM922T is not set
-# CONFIG_ARM926T is not set
-# CONFIG_ARM_CORTEX_M1 is not set
-# CONFIG_ARM_CORTEX_M3 is not set
-# CONFIG_ARM_EABI is not set
-# CONFIG_ARM_IWMMXT is not set
-CONFIG_ARM_OABI=y
-# CONFIG_ARM_SA110 is not set
-# CONFIG_ARM_SA1100 is not set
-# CONFIG_ARM_XSCALE is not set
-# CONFIG_GENERIC_ARM is not set
-TARGET_ARCH="arm"
-TARGET_arm=y
-# USE_BX is not set
diff --git a/toolchain/uClibc/config-0.9.31/armeb b/toolchain/uClibc/config-0.9.31/armeb
deleted file mode 100644
index ba3ea5c845..0000000000
--- a/toolchain/uClibc/config-0.9.31/armeb
+++ /dev/null
@@ -1,25 +0,0 @@
-ARCH_ANY_ENDIAN=y
-ARCH_BIG_ENDIAN=y
-ARCH_WANTS_BIG_ENDIAN=y
-# CONFIG_ARM10T is not set
-# CONFIG_ARM1136JF_S is not set
-# CONFIG_ARM1176JZF_S is not set
-# CONFIG_ARM1176JZ_S is not set
-# CONFIG_ARM610 is not set
-# CONFIG_ARM710 is not set
-# CONFIG_ARM720T is not set
-# CONFIG_ARM7TDMI is not set
-# CONFIG_ARM920T is not set
-# CONFIG_ARM922T is not set
-# CONFIG_ARM926T is not set
-# CONFIG_ARM_CORTEX_M1 is not set
-# CONFIG_ARM_CORTEX_M3 is not set
-# CONFIG_ARM_EABI is not set
-# CONFIG_ARM_IWMMXT is not set
-CONFIG_ARM_OABI=y
-# CONFIG_ARM_SA110 is not set
-# CONFIG_ARM_SA1100 is not set
-CONFIG_ARM_XSCALE=y
-# CONFIG_GENERIC_ARM is not set
-TARGET_ARCH="arm"
-TARGET_arm=y
diff --git a/toolchain/uClibc/config-0.9.31/avr32 b/toolchain/uClibc/config-0.9.31/avr32
deleted file mode 100644
index bf7907aed9..0000000000
--- a/toolchain/uClibc/config-0.9.31/avr32
+++ /dev/null
@@ -1,10 +0,0 @@
-ARCH_BIG_ENDIAN=y
-CONFIG_AVR32_AP7=y
-FORCE_SHAREABLE_TEXT_SEGMENTS=y
-LINKRELAX=y
-TARGET_ARCH="avr32"
-TARGET_avr32=y
-UCLIBC_HAS_FPU=y
-# UCLIBC_HAS_SCANF_GLIBC_A_FLAG is not set
-# UCLIBC_HAS_STRING_ARCH_OPT is not set
-UNIX98PTY_ONLY=y
diff --git a/toolchain/uClibc/config-0.9.31/common b/toolchain/uClibc/config-0.9.31/common
deleted file mode 100644
index 0e9ae6aa76..0000000000
--- a/toolchain/uClibc/config-0.9.31/common
+++ /dev/null
@@ -1,190 +0,0 @@
-# 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_LDD_SUPPORT=y
-# LDSO_PRELOAD_FILE_SUPPORT is not set
-LDSO_RUNPATH=y
-# LDSO_SEARCH_INTERP_PATH is not set
-# LINUXTHREADS_NEW is not set
-LINUXTHREADS_OLD=y
-# MALLOC is not set
-MALLOC_GLIBC_COMPAT=y
-# MALLOC_SIMPLE is not set
-MALLOC_STANDARD=y
-MULTILIB_DIR="lib"
-# PTHREADS_DEBUG_SUPPORT is not set
-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_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_ubicom32 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 is not set
-# 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_EXCLUSIVE_MODE=y
-# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set
-# UCLIBC_HAS_FPU is not set
-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_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_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_RPC is not set
-UCLIBC_HAS_SCANF_GLIBC_A_FLAG=y
-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_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_WCHAR=y
-UCLIBC_HAS_WORDEXP=y
-# UCLIBC_HAS_XATTR is not set
-UCLIBC_HAS___PROGNAME=y
-# UCLIBC_LINUX_MODULE_24 is not set
-UCLIBC_LINUX_SPECIFIC=y
-# UCLIBC_MALLOC_DEBUGGING is not set
-# UCLIBC_MJN3_ONLY is not set
-# UCLIBC_NTP_LEGACY is not set
-UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
-UCLIBC_PWD_BUFFER_SIZE=256
-# UCLIBC_STATIC_LDCONFIG 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_USE_NETLINK=y
-# UNIX98PTY_ONLY is not set
-USE_BX=y
-WARNINGS="-Wall"
diff --git a/toolchain/uClibc/config-0.9.31/cris b/toolchain/uClibc/config-0.9.31/cris
deleted file mode 100644
index b9ea676fcd..0000000000
--- a/toolchain/uClibc/config-0.9.31/cris
+++ /dev/null
@@ -1,6 +0,0 @@
-ARCH_LITTLE_ENDIAN=y
-CONFIG_CRIS=y
-# CONFIG_CRISV32 is not set
-TARGET_ARCH="cris"
-TARGET_cris=y
-UCLIBC_HAS_FPU=y
diff --git a/toolchain/uClibc/config-0.9.31/debug b/toolchain/uClibc/config-0.9.31/debug
deleted file mode 100644
index b366e66e39..0000000000
--- a/toolchain/uClibc/config-0.9.31/debug
+++ /dev/null
@@ -1,6 +0,0 @@
-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.31/i386 b/toolchain/uClibc/config-0.9.31/i386
deleted file mode 100644
index 719a53d70a..0000000000
--- a/toolchain/uClibc/config-0.9.31/i386
+++ /dev/null
@@ -1,22 +0,0 @@
-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
-UCLIBC_HAS_LONG_DOUBLE_MATH=y
diff --git a/toolchain/uClibc/config-0.9.31/i686 b/toolchain/uClibc/config-0.9.31/i686
deleted file mode 100644
index c0034a0fbf..0000000000
--- a/toolchain/uClibc/config-0.9.31/i686
+++ /dev/null
@@ -1,22 +0,0 @@
-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
-UCLIBC_HAS_LONG_DOUBLE_MATH=y
diff --git a/toolchain/uClibc/config-0.9.31/m68k b/toolchain/uClibc/config-0.9.31/m68k
deleted file mode 100644
index ae984916df..0000000000
--- a/toolchain/uClibc/config-0.9.31/m68k
+++ /dev/null
@@ -1,5 +0,0 @@
-ARCH_BIG_ENDIAN=y
-TARGET_ARCH="m68k"
-TARGET_SUBARCH=""
-TARGET_m68k=y
-UCLIBC_HAS_LONG_DOUBLE_MATH=y
diff --git a/toolchain/uClibc/config-0.9.31/mips b/toolchain/uClibc/config-0.9.31/mips
deleted file mode 100644
index 7398c66929..0000000000
--- a/toolchain/uClibc/config-0.9.31/mips
+++ /dev/null
@@ -1,17 +0,0 @@
-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.31/mips64 b/toolchain/uClibc/config-0.9.31/mips64
deleted file mode 100644
index fa5bee3aa5..0000000000
--- a/toolchain/uClibc/config-0.9.31/mips64
+++ /dev/null
@@ -1,17 +0,0 @@
-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.31/mips64el b/toolchain/uClibc/config-0.9.31/mips64el
deleted file mode 100644
index 1ca764f6e2..0000000000
--- a/toolchain/uClibc/config-0.9.31/mips64el
+++ /dev/null
@@ -1,17 +0,0 @@
-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.31/mipsel b/toolchain/uClibc/config-0.9.31/mipsel
deleted file mode 100644
index 7648f396ba..0000000000
--- a/toolchain/uClibc/config-0.9.31/mipsel
+++ /dev/null
@@ -1,17 +0,0 @@
-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.31/mipsel.brcm-2.4 b/toolchain/uClibc/config-0.9.31/mipsel.brcm-2.4
deleted file mode 100644
index 7857868465..0000000000
--- a/toolchain/uClibc/config-0.9.31/mipsel.brcm-2.4
+++ /dev/null
@@ -1,18 +0,0 @@
-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
-UCLIBC_LINUX_MODULE_24=y
diff --git a/toolchain/uClibc/config-0.9.31/mipsel.cobalt b/toolchain/uClibc/config-0.9.31/mipsel.cobalt
deleted file mode 100644
index 323b0aa52e..0000000000
--- a/toolchain/uClibc/config-0.9.31/mipsel.cobalt
+++ /dev/null
@@ -1,17 +0,0 @@
-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.31/powerpc b/toolchain/uClibc/config-0.9.31/powerpc
deleted file mode 100644
index 4e5cd43ba4..0000000000
--- a/toolchain/uClibc/config-0.9.31/powerpc
+++ /dev/null
@@ -1,7 +0,0 @@
-ARCH_BIG_ENDIAN=y
-CONFIG_CLASSIC=y
-# CONFIG_E500 is not set
-TARGET_ARCH="powerpc"
-TARGET_SUBARCH="classic"
-TARGET_powerpc=y
-UCLIBC_HAS_LONG_DOUBLE_MATH=y
diff --git a/toolchain/uClibc/config-0.9.31/powerpc.mpc85xx b/toolchain/uClibc/config-0.9.31/powerpc.mpc85xx
deleted file mode 100644
index 97e7d1725f..0000000000
--- a/toolchain/uClibc/config-0.9.31/powerpc.mpc85xx
+++ /dev/null
@@ -1,7 +0,0 @@
-ARCH_BIG_ENDIAN=y
-# CONFIG_CLASSIC is not set
-CONFIG_E500=y
-TARGET_ARCH="powerpc"
-TARGET_SUBARCH="classic"
-TARGET_powerpc=y
-UCLIBC_HAS_LONG_DOUBLE_MATH=y
diff --git a/toolchain/uClibc/config-0.9.31/sparc b/toolchain/uClibc/config-0.9.31/sparc
deleted file mode 100644
index e1596c4100..0000000000
--- a/toolchain/uClibc/config-0.9.31/sparc
+++ /dev/null
@@ -1,8 +0,0 @@
-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.31/sparc.leon b/toolchain/uClibc/config-0.9.31/sparc.leon
deleted file mode 100644
index eb725ac05d..0000000000
--- a/toolchain/uClibc/config-0.9.31/sparc.leon
+++ /dev/null
@@ -1,8 +0,0 @@
-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.31/ubicom32 b/toolchain/uClibc/config-0.9.31/ubicom32
deleted file mode 100644
index ef00e79355..0000000000
--- a/toolchain/uClibc/config-0.9.31/ubicom32
+++ /dev/null
@@ -1,35 +0,0 @@
-ARCH_BIG_ENDIAN=y
-ARCH_HAS_NO_MMU=y
-COMPAT_ATEXIT=y
-# CONFIG_UC_UBICOM32_V3 is not set
-CONFIG_UC_UBICOM32_V4=y
-# DOSTRIP is not set
-EXCLUDE_BRK=y
-FORCE_SHAREABLE_TEXT_SEGMENTS=y
-LDSO_PRELOAD_FILE_SUPPORT=y
-MALLOC=y
-# MALLOC_STANDARD is not set
-PTHREADS_DEBUG_SUPPORT=y
-SUPPORT_LD_DEBUG=y
-TARGET_ARCH="ubicom32"
-TARGET_ubicom32=y
-# UCLIBC_FORMAT_ELF is not set
-UCLIBC_FORMAT_FDPIC_ELF=y
-# UCLIBC_FORMAT_FLAT is not set
-# UCLIBC_FORMAT_FLAT_SEP_DATA is not set
-# UCLIBC_FORMAT_SHARED_FLAT is not set
-UCLIBC_HAS_ADVANCED_REALTIME=y
-UCLIBC_HAS_FOPEN_LARGEFILE_MODE=y
-UCLIBC_HAS_FPU=y
-# UCLIBC_HAS_GETPT is not set
-UCLIBC_HAS_OBSOLETE_BSD_SIGNAL=y
-UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL=y
-UCLIBC_HAS_PROFILING=y
-UCLIBC_HAS_REENTRANT_RPC=y
-UCLIBC_HAS_STUBS=y
-UCLIBC_HAS_XATTR=y
-UCLIBC_NTP_LEGACY=y
-UCLIBC_STATIC_LDCONFIG=y
-UCLIBC_SV4_DEPRECATED=y
-UCLIBC_UCLINUX_BROKEN_MUNMAP=y
-UNIX98PTY_ONLY=y
diff --git a/toolchain/uClibc/config-0.9.31/x86_64 b/toolchain/uClibc/config-0.9.31/x86_64
deleted file mode 100644
index 20a18f1a07..0000000000
--- a/toolchain/uClibc/config-0.9.31/x86_64
+++ /dev/null
@@ -1,7 +0,0 @@
-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
-UCLIBC_HAS_LONG_DOUBLE_MATH=y
diff --git a/toolchain/uClibc/patches-0.9.30.1/110-compat_macros.patch b/toolchain/uClibc/patches-0.9.30.1/110-compat_macros.patch
deleted file mode 100644
index 7659e465cc..0000000000
--- a/toolchain/uClibc/patches-0.9.30.1/110-compat_macros.patch
+++ /dev/null
@@ -1,51 +0,0 @@
---- ./include/string.h.orig 2008-06-08 22:38:53.000000000 +0200
-+++ ./include/string.h 2009-01-02 16:09:03.000000000 +0100
-@@ -355,18 +355,40 @@
- /* 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.30.1/120-adjtimex.patch b/toolchain/uClibc/patches-0.9.30.1/120-adjtimex.patch
deleted file mode 100644
index 5127701dfc..0000000000
--- a/toolchain/uClibc/patches-0.9.30.1/120-adjtimex.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-Index: uClibc-0.9.29/include/sys/timex.h
-===================================================================
---- uClibc-0.9.29.orig/include/sys/timex.h 2007-12-30 17:34:21.983513096 +0100
-+++ uClibc-0.9.29/include/sys/timex.h 2007-12-30 17:34:32.180094169 +0100
-@@ -116,7 +116,8 @@
-
- __BEGIN_DECLS
-
--extern int __adjtimex (struct timex *__ntx) __THROW;
-+#undef __adjtimex
-+#define __adjtimex adjtimex
- extern int adjtimex (struct timex *__ntx) __THROW;
-
- extern int ntp_gettime (struct ntptimeval *__ntv) __THROW;
diff --git a/toolchain/uClibc/patches-0.9.30.1/130-pthread_weak_binding.patch b/toolchain/uClibc/patches-0.9.30.1/130-pthread_weak_binding.patch
deleted file mode 100644
index 92227cf418..0000000000
--- a/toolchain/uClibc/patches-0.9.30.1/130-pthread_weak_binding.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/libc/unistd/daemon.c
-+++ b/libc/unistd/daemon.c
-@@ -54,7 +54,6 @@
- libc_hidden_proto(dup2)
- libc_hidden_proto(setsid)
- libc_hidden_proto(chdir)
--libc_hidden_proto(fork)
-
- int daemon( int nochdir, int noclose )
- {
diff --git a/toolchain/uClibc/patches-0.9.30.1/140-math_decl.patch b/toolchain/uClibc/patches-0.9.30.1/140-math_decl.patch
deleted file mode 100644
index 3b9a6a99c2..0000000000
--- a/toolchain/uClibc/patches-0.9.30.1/140-math_decl.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/libc/sysdeps/linux/common/bits/mathcalls.h
-+++ b/libc/sysdeps/linux/common/bits/mathcalls.h
-@@ -229,7 +229,7 @@
-
-
- /* Return nonzero if VALUE is not a number. */
--__MATHDECL_PRIV (int,__isnan,, (_Mdouble_ __value), (__const__));
-+__MATHDECL_PRIV (int,isnan,, (_Mdouble_ __value), (__const__));
-
- #if defined __USE_MISC || defined __USE_XOPEN
- /* Return nonzero if VALUE is not a number. */
diff --git a/toolchain/uClibc/patches-0.9.30.1/150-c99_ldbl_math.patch b/toolchain/uClibc/patches-0.9.30.1/150-c99_ldbl_math.patch
deleted file mode 100644
index f3718431ea..0000000000
--- a/toolchain/uClibc/patches-0.9.30.1/150-c99_ldbl_math.patch
+++ /dev/null
@@ -1,474 +0,0 @@
-Index: uClibc-0.9.30.1/libm/ldouble_wrappers.c
-===================================================================
---- uClibc-0.9.30.1/libm/ldouble_wrappers.c (revision 25552)
-+++ uClibc-0.9.30.1/libm/ldouble_wrappers.c (working copy)
-@@ -13,6 +13,16 @@
- #include "math.h"
- #include <complex.h>
-
-+#if defined __NO_LONG_DOUBLE_MATH
-+# define int_WRAPPER_C99(func) /* not needed */
-+# else
-+# define int_WRAPPER_C99(func) \
-+int func##l(long double x) \
-+{ \
-+ return func((double) x); \
-+} \
-+libm_hidden_def(func##l)
-+#endif
-
- /* Implement the following, as defined by SuSv3 */
- #if 0
-@@ -543,46 +553,28 @@ long double truncl (long double x)
- #endif
-
-
--#ifdef __DO_C99_MATH__
-+#if defined __DO_C99_MATH__
-
- #ifdef L_fpclassifyl
--int __fpclassifyl (long double x)
--{
-- return __fpclassify ( (double) x );
--}
--libm_hidden_def(__fpclassifyl)
-+int_WRAPPER_C99(__fpclassify)
- #endif
-
- #ifdef L_finitel
--int __finitel (long double x)
--{
-- return __finite ( (double)x );
--}
--libm_hidden_def(__finitel)
-+int_WRAPPER_C99(__finite)
- #endif
-
- #ifdef L_signbitl
--int __signbitl (long double x)
--{
-- return __signbitl ( (double)x );
--}
--libm_hidden_def(__signbitl)
-+int_WRAPPER_C99(__signbit)
- #endif
-
- #ifdef L_isnanl
--int __isnanl (long double x)
--{
-- return __isnan ( (double)x );
--}
--libm_hidden_def(__isnanl)
-+int_WRAPPER_C99(__isnan)
- #endif
-
- #ifdef L_isinfl
--int __isinfl (long double x)
--{
-- return __isinf ( (double)x );
--}
--libm_hidden_def(__isinfl)
-+int_WRAPPER_C99(__isinf)
- #endif
-
--#endif
-+#endif /* DO_C99_MATH */
-+
-+#undef int_WRAPPER_C99
-Index: uClibc-0.9.30.1/libm/nan.c
-===================================================================
---- uClibc-0.9.30.1/libm/nan.c (revision 25552)
-+++ uClibc-0.9.30.1/libm/nan.c (working copy)
-@@ -45,7 +45,7 @@ float nanf (const char *tagp)
- }
- libm_hidden_def(nanf)
-
--#if defined __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+#if defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ && !defined __NO_LONG_DOUBLE_MATH
- libm_hidden_proto(nanl)
- long double nanl (const char *tagp)
- {
-Index: uClibc-0.9.30.1/include/math.h
-===================================================================
---- uClibc-0.9.30.1/include/math.h (revision 25552)
-+++ uClibc-0.9.30.1/include/math.h (working copy)
-@@ -118,7 +118,7 @@ __BEGIN_DECLS
- # undef __MATH_PRECNAME
-
- # if (__STDC__ - 0 || __GNUC__ - 0) \
-- && (defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ || defined __LDBL_COMPAT)
-+ && (!defined __NO_LONG_DOUBLE_MATH || defined __LDBL_COMPAT)
- # ifdef __LDBL_COMPAT
-
- # ifdef __USE_ISOC99
-@@ -230,7 +230,7 @@ enum
- };
-
- /* Return number of classification appropriate for X. */
--# ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+# ifdef __NO_LONG_DOUBLE_MATH
- # define fpclassify(x) \
- (sizeof (x) == sizeof (float) ? __fpclassifyf (x) : __fpclassify (x))
- # else
-@@ -242,7 +242,7 @@ enum
- # endif
-
- /* Return nonzero value if sign of X is negative. */
--# ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+# ifdef __NO_LONG_DOUBLE_MATH
- # define signbit(x) \
- (sizeof (x) == sizeof (float) ? __signbitf (x) : __signbit (x))
- # else
-@@ -254,7 +254,7 @@ enum
- # endif
-
- /* Return nonzero value if X is not +-Inf or NaN. */
--# ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+# ifdef __NO_LONG_DOUBLE_MATH
- # define isfinite(x) \
- (sizeof (x) == sizeof (float) ? __finitef (x) : __finite (x))
- # else
-@@ -270,7 +270,7 @@ enum
-
- /* Return nonzero value if X is a NaN. We could use `fpclassify' but
- we already have this functions `__isnan' and it is faster. */
--# ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+# ifdef __NO_LONG_DOUBLE_MATH
- # define isnan(x) \
- (sizeof (x) == sizeof (float) ? __isnanf (x) : __isnan (x))
- # else
-@@ -282,7 +282,7 @@ enum
- # endif
-
- /* Return nonzero value is X is positive or negative infinity. */
--# ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+# ifdef __NO_LONG_DOUBLE_MATH
- # define isinf(x) \
- (sizeof (x) == sizeof (float) ? __isinff (x) : __isinf (x))
- # else
-Index: uClibc-0.9.30.1/include/tgmath.h
-===================================================================
---- uClibc-0.9.30.1/include/tgmath.h (revision 25552)
-+++ uClibc-0.9.30.1/include/tgmath.h (working copy)
-@@ -36,7 +36,7 @@
-
- #if __GNUC_PREREQ (2, 7)
-
--# ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+# ifdef __NO_LONG_DOUBLE_MATH
- # define __tgml(fct) fct
- # else
- # define __tgml(fct) fct ## l
-Index: uClibc-0.9.30.1/libc/sysdeps/linux/powerpc/bits/wordsize.h
-===================================================================
---- uClibc-0.9.30.1/libc/sysdeps/linux/powerpc/bits/wordsize.h (revision 25552)
-+++ uClibc-0.9.30.1/libc/sysdeps/linux/powerpc/bits/wordsize.h (working copy)
-@@ -7,13 +7,13 @@
- # define __WORDSIZE 32
- #endif
-
--#if defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ && !defined __LONG_DOUBLE_MATH_OPTIONAL
-+#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
-
- /* Signal the glibc ABI didn't used to have a `long double'.
- The changes all the `long double' function variants to be redirects
- to the double functions. */
- # define __LONG_DOUBLE_MATH_OPTIONAL 1
- # ifndef __LONG_DOUBLE_128__
--# undef __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+# define __NO_LONG_DOUBLE_MATH 1
- # endif
- #endif
-Index: uClibc-0.9.30.1/libc/sysdeps/linux/powerpc/bits/mathdef.h
-===================================================================
---- uClibc-0.9.30.1/libc/sysdeps/linux/powerpc/bits/mathdef.h (revision 25552)
-+++ uClibc-0.9.30.1/libc/sysdeps/linux/powerpc/bits/mathdef.h (working copy)
-@@ -65,11 +65,13 @@ typedef double double_t;
-
- #endif /* ISO C99 */
-
--#ifdef __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+#ifndef __NO_LONG_DOUBLE_MATH
- #include <bits/wordsize.h>
- /* Signal that we do not really have a `long double'. The disables the
- declaration of all the `long double' function variants. */
- # if __WORDSIZE == 32
--# undef __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+# define __NO_LONG_DOUBLE_MATH 1
-+# elif !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+# define __NO_LONG_DOUBLE_MATH 1
- # endif /* __WORDSIZE == 32 */
--#endif /* __UCLIBC_HAS_LONG_DOUBLE_MATH__ */
-+#endif /* __NO_LONG_DOUBLE_MATH */
-Index: uClibc-0.9.30.1/libc/sysdeps/linux/arm/bits/mathdef.h
-===================================================================
---- uClibc-0.9.30.1/libc/sysdeps/linux/arm/bits/mathdef.h (revision 25552)
-+++ uClibc-0.9.30.1/libc/sysdeps/linux/arm/bits/mathdef.h (working copy)
-@@ -34,3 +34,11 @@ typedef double double_t; /* `double' exp
- # define FP_ILOGBNAN (2147483647)
-
- #endif /* ISO C99 */
-+
-+#ifndef __NO_LONG_DOUBLE_MATH
-+/* Signal that we do not really have a `long double'. This disables the
-+ declaration of all the `long double' function variants. */
-+/* XXX The FPA does support this but the patterns in GCC are currently
-+ turned off. */
-+# define __NO_LONG_DOUBLE_MATH 1
-+#endif
-Index: uClibc-0.9.30.1/libc/sysdeps/linux/m68k/bits/mathdef.h
-===================================================================
---- uClibc-0.9.30.1/libc/sysdeps/linux/m68k/bits/mathdef.h (revision 25552)
-+++ uClibc-0.9.30.1/libc/sysdeps/linux/m68k/bits/mathdef.h (working copy)
-@@ -36,3 +36,7 @@ typedef long double double_t; /* `double
- # define FP_ILOGBNAN (2147483647)
-
- #endif /* ISO C99 */
-+
-+#if !defined __NO_LONG_DOUBLE_MATH && !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+# define __NO_LONG_DOUBLE_MATH 1
-+#endif
-Index: uClibc-0.9.30.1/libc/sysdeps/linux/alpha/bits/wordsize.h
-===================================================================
---- uClibc-0.9.30.1/libc/sysdeps/linux/alpha/bits/wordsize.h (revision 25552)
-+++ uClibc-0.9.30.1/libc/sysdeps/linux/alpha/bits/wordsize.h (working copy)
-@@ -18,13 +18,13 @@
-
- #define __WORDSIZE 64
-
--#if defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ && !defined __LONG_DOUBLE_MATH_OPTIONAL
-+#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
-
- /* Signal that we didn't used to have a `long double'. The changes all
- the `long double' function variants to be redirects to the double
- functions. */
- # define __LONG_DOUBLE_MATH_OPTIONAL 1
- # ifndef __LONG_DOUBLE_128__
--# undef __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+# define __NO_LONG_DOUBLE_MATH 1
- # endif
- #endif
-Index: uClibc-0.9.30.1/libc/sysdeps/linux/alpha/bits/mathdef.h
-===================================================================
---- uClibc-0.9.30.1/libc/sysdeps/linux/alpha/bits/mathdef.h (revision 25552)
-+++ uClibc-0.9.30.1/libc/sysdeps/linux/alpha/bits/mathdef.h (working copy)
-@@ -78,3 +78,7 @@ typedef double double_t;
-
- # endif /* GNUC before 3.4 */
- #endif /* COMPLEX_H */
-+
-+#if !defined __NO_LONG_DOUBLE_MATH && !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+# define __NO_LONG_DOUBLE_MATH 1
-+#endif
-Index: uClibc-0.9.30.1/libc/sysdeps/linux/common/bits/mathdef.h
-===================================================================
---- uClibc-0.9.30.1/libc/sysdeps/linux/common/bits/mathdef.h (revision 25552)
-+++ uClibc-0.9.30.1/libc/sysdeps/linux/common/bits/mathdef.h (working copy)
-@@ -35,3 +35,9 @@ typedef double double_t; /* `double' exp
- # define FP_ILOGBNAN 2147483647
-
- #endif /* ISO C99 */
-+
-+#ifndef __NO_LONG_DOUBLE_MATH
-+/* Signal that we do not really have a `long double'. The disables the
-+ declaration of all the `long double' function variants. */
-+# define __NO_LONG_DOUBLE_MATH 1
-+#endif
-Index: uClibc-0.9.30.1/libc/sysdeps/linux/i386/bits/mathdef.h
-===================================================================
---- uClibc-0.9.30.1/libc/sysdeps/linux/i386/bits/mathdef.h (revision 25552)
-+++ uClibc-0.9.30.1/libc/sysdeps/linux/i386/bits/mathdef.h (working copy)
-@@ -44,3 +44,7 @@ typedef long double double_t; /* `double
- # define FP_ILOGBNAN (-2147483647 - 1)
-
- #endif /* ISO C99 */
-+
-+#if !defined __NO_LONG_DOUBLE_MATH && !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+# define __NO_LONG_DOUBLE_MATH 1
-+#endif
-Index: uClibc-0.9.30.1/libc/sysdeps/linux/nios2/bits/mathdef.h
-===================================================================
---- uClibc-0.9.30.1/libc/sysdeps/linux/nios2/bits/mathdef.h (revision 25552)
-+++ uClibc-0.9.30.1/libc/sysdeps/linux/nios2/bits/mathdef.h (working copy)
-@@ -34,3 +34,11 @@ typedef double double_t; /* `double' exp
- # define FP_ILOGBNAN (2147483647)
-
- #endif /* ISO C99 */
-+
-+#ifndef __NO_LONG_DOUBLE_MATH
-+/* Signal that we do not really have a `long double'. This disables the
-+ declaration of all the `long double' function variants. */
-+/* XXX The FPA does support this but the patterns in GCC are currently
-+ turned off. */
-+# define __NO_LONG_DOUBLE_MATH 1
-+#endif
-Index: uClibc-0.9.30.1/libc/sysdeps/linux/x86_64/bits/mathdef.h
-===================================================================
---- uClibc-0.9.30.1/libc/sysdeps/linux/x86_64/bits/mathdef.h (revision 25552)
-+++ uClibc-0.9.30.1/libc/sysdeps/linux/x86_64/bits/mathdef.h (working copy)
-@@ -46,3 +46,7 @@ typedef long double double_t; /* `double
- # define FP_ILOGBNAN (-2147483647 - 1)
-
- #endif /* ISO C99 */
-+
-+#if !defined __NO_LONG_DOUBLE_MATH && !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+# define __NO_LONG_DOUBLE_MATH 1
-+#endif
-Index: uClibc-0.9.30.1/libc/sysdeps/linux/xtensa/bits/mathdef.h
-===================================================================
---- uClibc-0.9.30.1/libc/sysdeps/linux/xtensa/bits/mathdef.h (revision 25552)
-+++ uClibc-0.9.30.1/libc/sysdeps/linux/xtensa/bits/mathdef.h (working copy)
-@@ -36,8 +36,8 @@ typedef double double_t; /* `double' exp
-
- #endif /* ISO C99 */
-
--#if defined __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+#ifndef __NO_LONG_DOUBLE_MATH
- /* Signal that we do not really have a `long double'. The disables the
- declaration of all the `long double' function variants. */
--# undef __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+# define __NO_LONG_DOUBLE_MATH 1
- #endif
-Index: uClibc-0.9.30.1/libc/sysdeps/linux/ia64/bits/mathdef.h
-===================================================================
---- uClibc-0.9.30.1/libc/sysdeps/linux/ia64/bits/mathdef.h (revision 25552)
-+++ uClibc-0.9.30.1/libc/sysdeps/linux/ia64/bits/mathdef.h (working copy)
-@@ -35,3 +35,7 @@ typedef double double_t; /* `double' exp
- # define FP_ILOGBNAN 2147483647
-
- #endif /* ISO C99 */
-+
-+#if !defined __NO_LONG_DOUBLE_MATH && !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+# define __NO_LONG_DOUBLE_MATH 1
-+#endif
-Index: uClibc-0.9.30.1/libc/sysdeps/linux/mips/bits/mathdef.h
-===================================================================
---- uClibc-0.9.30.1/libc/sysdeps/linux/mips/bits/mathdef.h (revision 25552)
-+++ uClibc-0.9.30.1/libc/sysdeps/linux/mips/bits/mathdef.h (working copy)
-@@ -39,8 +39,10 @@ typedef double double_t; /* `double' exp
-
- #endif /* ISO C99 */
-
--#if defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ && _MIPS_SIM == _ABIO32
-+#if ! defined __NO_LONG_DOUBLE_MATH && _MIPS_SIM == _ABIO32
- /* Signal that we do not really have a `long double'. This disables the
- declaration of all the `long double' function variants. */
--# error defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ and _MIPS_SIM == _ABIO32
-+# define __NO_LONG_DOUBLE_MATH 1
-+#elif !defined __NO_LONG_DOUBLE_MATH && !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+# define __NO_LONG_DOUBLE_MATH 1
- #endif
-Index: uClibc-0.9.30.1/libc/sysdeps/linux/nios/bits/mathdef.h
-===================================================================
---- uClibc-0.9.30.1/libc/sysdeps/linux/nios/bits/mathdef.h (revision 25552)
-+++ uClibc-0.9.30.1/libc/sysdeps/linux/nios/bits/mathdef.h (working copy)
-@@ -34,3 +34,11 @@ typedef double double_t; /* `double' exp
- # define FP_ILOGBNAN (2147483647)
-
- #endif /* ISO C99 */
-+
-+#ifndef __NO_LONG_DOUBLE_MATH
-+/* Signal that we do not really have a `long double'. This disables the
-+ declaration of all the `long double' function variants. */
-+/* XXX The FPA does support this but the patterns in GCC are currently
-+ turned off. */
-+# define __NO_LONG_DOUBLE_MATH 1
-+#endif
-Index: uClibc-0.9.30.1/libc/sysdeps/linux/sparc/bits/wordsize.h
-===================================================================
---- uClibc-0.9.30.1/libc/sysdeps/linux/sparc/bits/wordsize.h (revision 25552)
-+++ uClibc-0.9.30.1/libc/sysdeps/linux/sparc/bits/wordsize.h (working copy)
-@@ -6,7 +6,7 @@
- # define __WORDSIZE 32
- #endif
-
--#if 0 /* uClibc: done in mathdefs.h: defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ && !defined __LONG_DOUBLE_MATH_OPTIONAL*/
-+#if 0 /* uClibc: done in mathdefs.h: !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL*/
-
- # if __WORDSIZE == 32
- /* Signal that in 32bit ABI we didn't used to have a `long double'.
-@@ -14,7 +14,7 @@
- to the double functions. */
- # define __LONG_DOUBLE_MATH_OPTIONAL 1
- # ifndef __LONG_DOUBLE_128__
--# undef __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+# define __NO_LONG_DOUBLE_MATH 1
- # endif
- # endif
- #endif
-Index: uClibc-0.9.30.1/libc/sysdeps/linux/sparc/bits/mathdef.h
-===================================================================
---- uClibc-0.9.30.1/libc/sysdeps/linux/sparc/bits/mathdef.h (revision 25552)
-+++ uClibc-0.9.30.1/libc/sysdeps/linux/sparc/bits/mathdef.h (working copy)
-@@ -57,13 +57,15 @@ typedef double double_t;
-
- #endif /* ISO C99 */
-
--#ifdef __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+#ifndef __NO_LONG_DOUBLE_MATH
-
- # if __WORDSIZE == 32
- /* Signal that in 32bit ABI we do not really have a `long double'.
- The disables the declaration of all the `long double' function
- variants. */
--# undef __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+# define __NO_LONG_DOUBLE_MATH 1
-+# elif !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+# define __NO_LONG_DOUBLE_MATH 1
- # endif
-
- #endif
-Index: uClibc-0.9.30.1/libc/sysdeps/linux/sparc/bits/mathinline.h
-===================================================================
---- uClibc-0.9.30.1/libc/sysdeps/linux/sparc/bits/mathinline.h (revision 25552)
-+++ uClibc-0.9.30.1/libc/sysdeps/linux/sparc/bits/mathinline.h (working copy)
-@@ -37,7 +37,7 @@
-
- # if __WORDSIZE == 32
-
--# ifdef __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+# ifndef __NO_LONG_DOUBLE_MATH
-
- # define __unordered_cmp(x, y) \
- (__extension__ \
-@@ -157,7 +157,7 @@ __NTH (__signbit (double __x))
- return __u.__i[0] < 0;
- }
-
--# ifdef __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+# ifndef __NO_LONG_DOUBLE_MATH
- __MATH_INLINE int
- __NTH (__signbitl (long double __x))
- {
-@@ -219,7 +219,7 @@ __NTH (sqrtl (long double __x))
- _Qp_sqrt (&__r, &__x);
- return __r;
- }
--# elif defined __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+# elif !defined __NO_LONG_DOUBLE_MATH
- __MATH_INLINE long double
- sqrtl (long double __x) __THROW
- {
-@@ -257,7 +257,7 @@ __ieee754_sqrtl (long double __x)
- _Qp_sqrt(&__r, &__x);
- return __r;
- }
--# elif defined __UCLIBC_HAS_LONG_DOUBLE_MATH__
-+# elif !defined __NO_LONG_DOUBLE_MATH
- __MATH_INLINE long double
- __ieee754_sqrtl (long double __x)
- {
-Index: uClibc-0.9.30.1/libc/sysdeps/linux/sh/bits/mathdef.h
-===================================================================
---- uClibc-0.9.30.1/libc/sysdeps/linux/sh/bits/mathdef.h (revision 25552)
-+++ uClibc-0.9.30.1/libc/sysdeps/linux/sh/bits/mathdef.h (working copy)
-@@ -61,3 +61,9 @@ typedef double double_t;
- # define FP_ILOGBNAN 0x7fffffff
-
- #endif /* ISO C99 */
-+
-+#ifndef __NO_LONG_DOUBLE_MATH
-+/* Signal that we do not really have a `long double'. The disables the
-+ declaration of all the `long double' function variants. */
-+# define __NO_LONG_DOUBLE_MATH 1
-+#endif
diff --git a/toolchain/uClibc/patches-0.9.30.1/160-unifdef_fix.patch b/toolchain/uClibc/patches-0.9.30.1/160-unifdef_fix.patch
deleted file mode 100644
index 6c7b221c36..0000000000
--- a/toolchain/uClibc/patches-0.9.30.1/160-unifdef_fix.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-Index: uClibc-0.9.30.1/extra/scripts/unifdef.c
-===================================================================
---- uClibc-0.9.30.1.orig/extra/scripts/unifdef.c 2008-04-28 01:10:00.000000000 +0200
-+++ uClibc-0.9.30.1/extra/scripts/unifdef.c 2009-08-25 15:20:08.000000000 +0200
-@@ -206,7 +206,11 @@
- static void error(const char *);
- static int findsym(const char *);
- static void flushline(bool);
--static Linetype getline(void);
-+#ifndef __CYGWIN__
-+static Linetype __getline(void);
-+#else
-+static Linetype get_line(void);
-+#endif
- static Linetype ifeval(const char **);
- static void ignoreoff(void);
- static void ignoreon(void);
-@@ -512,7 +516,11 @@
-
- for (;;) {
- linenum++;
-- lineval = getline();
-+#ifndef __CYGWIN__
-+ lineval = __getline();
-+#else
-+ lineval = get_line();
-+#endif
- trans_table[ifstate[depth]][lineval]();
- debug("process %s -> %s depth %d",
- linetype_name[lineval],
-@@ -526,7 +534,11 @@
- * help from skipcomment().
- */
- static Linetype
--getline(void)
-+#ifndef __CYGWIN__
-+__getline(void)
-+#else
-+get_line(void)
-+#endif
- {
- const char *cp;
- int cursym;
diff --git a/toolchain/uClibc/patches-0.9.30.1/170-math_finite.patch b/toolchain/uClibc/patches-0.9.30.1/170-math_finite.patch
deleted file mode 100644
index 973177235b..0000000000
--- a/toolchain/uClibc/patches-0.9.30.1/170-math_finite.patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- a/include/math.h
-+++ b/include/math.h
-@@ -179,7 +179,7 @@
-
-
- /* 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:
-@@ -299,6 +299,11 @@
-
- #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.30.1/180-dl_sysdep_inline.patch b/toolchain/uClibc/patches-0.9.30.1/180-dl_sysdep_inline.patch
deleted file mode 100644
index cf72c888d6..0000000000
--- a/toolchain/uClibc/patches-0.9.30.1/180-dl_sysdep_inline.patch
+++ /dev/null
@@ -1,371 +0,0 @@
-Index: uClibc-0.9.30.1/ldso/ldso/arm/dl-sysdep.h
-===================================================================
---- uClibc-0.9.30.1/ldso/ldso/arm/dl-sysdep.h (revision 25503)
-+++ uClibc-0.9.30.1/ldso/ldso/arm/dl-sysdep.h (working copy)
-@@ -15,7 +15,7 @@
- GOT_BASE[1] = (unsigned long) MODULE; \
- }
-
--static __inline__ unsigned long arm_modulus(unsigned long m, unsigned long p)
-+static __always_inline unsigned long arm_modulus(unsigned long m, unsigned long p)
- {
- unsigned long i,t,inc;
- i=p; t=0;
-@@ -72,7 +72,7 @@ unsigned long _dl_linux_resolver(struct
- first element of the GOT. We used to use the PIC register to do this
- without a constant pool reference, but GCC 4.2 will use a pseudo-register
- for the PIC base, so it may not be in r10. */
--static __inline__ Elf32_Addr __attribute__ ((unused))
-+static __always_inline Elf32_Addr __attribute__ ((unused))
- elf_machine_dynamic (void)
- {
- Elf32_Addr dynamic;
-@@ -104,7 +104,7 @@ elf_machine_dynamic (void)
- }
-
- /* Return the run-time load address of the shared object. */
--static __inline__ Elf32_Addr __attribute__ ((unused))
-+static __always_inline Elf32_Addr __attribute__ ((unused))
- elf_machine_load_address (void)
- {
- extern void __dl_start __asm__ ("_dl_start");
-@@ -128,7 +128,7 @@ elf_machine_load_address (void)
- return pcrel_addr - got_addr;
- }
-
--static __inline__ void
-+static __always_inline void
- elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
- Elf32_Word relative_count)
- {
-Index: uClibc-0.9.30.1/ldso/ldso/powerpc/dl-sysdep.h
-===================================================================
---- uClibc-0.9.30.1/ldso/ldso/powerpc/dl-sysdep.h (revision 25503)
-+++ uClibc-0.9.30.1/ldso/ldso/powerpc/dl-sysdep.h (working copy)
-@@ -90,7 +90,7 @@ void _dl_init_got(unsigned long *lpnt,st
- #define ELF_MACHINE_PLTREL_OVERLAP 1
-
- /* Return the value of the GOT pointer. */
--static __inline__ Elf32_Addr * __attribute__ ((const))
-+static __always_inline Elf32_Addr * __attribute__ ((const))
- ppc_got (void)
- {
- Elf32_Addr *got;
-@@ -109,14 +109,14 @@ ppc_got (void)
-
- /* Return the link-time address of _DYNAMIC, stored as
- the first value in the GOT. */
--static __inline__ Elf32_Addr __attribute__ ((const))
-+static __always_inline Elf32_Addr __attribute__ ((const))
- elf_machine_dynamic (void)
- {
- return *ppc_got();
- }
-
- /* Return the run-time load address of the shared object. */
--static __inline__ Elf32_Addr __attribute__ ((const))
-+static __always_inline Elf32_Addr __attribute__ ((const))
- elf_machine_load_address (void)
- {
- Elf32_Addr *branchaddr;
-@@ -164,7 +164,7 @@ elf_machine_load_address (void)
- return runtime_dynamic - elf_machine_dynamic ();
- }
-
--static __inline__ void
-+static __always_inline void
- elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
- Elf32_Word relative_count)
- {
-Index: uClibc-0.9.30.1/ldso/ldso/sh64/dl-sysdep.h
-===================================================================
---- uClibc-0.9.30.1/ldso/ldso/sh64/dl-sysdep.h (revision 25503)
-+++ uClibc-0.9.30.1/ldso/ldso/sh64/dl-sysdep.h (working copy)
-@@ -42,7 +42,7 @@ extern unsigned long _dl_linux_resolver(
- /* Return the link-time address of _DYNAMIC. Conveniently, this is the
- first element of the GOT. This must be inlined in a function which
- uses global data. */
--static __inline__ Elf32_Addr elf_machine_dynamic(void)
-+static __always_inline Elf32_Addr elf_machine_dynamic(void)
- {
- register Elf32_Addr *got;
-
-@@ -70,7 +70,7 @@ static __inline__ Elf32_Addr elf_machine
- }
-
- /* Return the run-time load address of the shared object. */
--static __inline__ Elf32_Addr elf_machine_load_address(void)
-+static __always_inline Elf32_Addr elf_machine_load_address(void)
- {
- Elf32_Addr addr;
-
-@@ -123,7 +123,7 @@ static __inline__ Elf32_Addr elf_machine
- } \
- }
-
--static __inline__ void
-+static __always_inline void
- elf_machine_relative(Elf32_Addr load_off, const Elf32_Addr rel_addr,
- Elf32_Word relative_count)
- {
-Index: uClibc-0.9.30.1/ldso/ldso/m68k/dl-sysdep.h
-===================================================================
---- uClibc-0.9.30.1/ldso/ldso/m68k/dl-sysdep.h (revision 25503)
-+++ uClibc-0.9.30.1/ldso/ldso/m68k/dl-sysdep.h (working copy)
-@@ -41,7 +41,7 @@ extern unsigned long _dl_linux_resolver
- /* Return the link-time address of _DYNAMIC. Conveniently, this is the
- first element of the GOT. This must be inlined in a function which
- uses global data. */
--static __inline__ Elf32_Addr
-+static __always_inline Elf32_Addr
- elf_machine_dynamic (void)
- {
- register Elf32_Addr *got __asm__ ("%a5");
-@@ -50,7 +50,7 @@ elf_machine_dynamic (void)
-
-
- /* Return the run-time load address of the shared object. */
--static __inline__ Elf32_Addr
-+static __always_inline Elf32_Addr
- elf_machine_load_address (void)
- {
- Elf32_Addr addr;
-@@ -60,7 +60,7 @@ elf_machine_load_address (void)
- return addr;
- }
-
--static __inline__ void
-+static __always_inline void
- elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
- Elf32_Word relative_count)
- {
-Index: uClibc-0.9.30.1/ldso/ldso/i386/dl-sysdep.h
-===================================================================
---- uClibc-0.9.30.1/ldso/ldso/i386/dl-sysdep.h (revision 25503)
-+++ uClibc-0.9.30.1/ldso/ldso/i386/dl-sysdep.h (working copy)
-@@ -42,8 +42,8 @@ extern unsigned long _dl_linux_resolver(
- /* Return the link-time address of _DYNAMIC. Conveniently, this is the
- first element of the GOT. This must be inlined in a function which
- uses global data. */
--static __inline__ Elf32_Addr elf_machine_dynamic (void) attribute_unused;
--static __inline__ Elf32_Addr
-+static __always_inline Elf32_Addr elf_machine_dynamic (void) attribute_unused;
-+static __always_inline Elf32_Addr
- elf_machine_dynamic (void)
- {
- register Elf32_Addr *got __asm__ ("%ebx");
-@@ -52,8 +52,8 @@ elf_machine_dynamic (void)
-
-
- /* Return the run-time load address of the shared object. */
--static __inline__ Elf32_Addr elf_machine_load_address (void) attribute_unused;
--static __inline__ Elf32_Addr
-+static __always_inline Elf32_Addr elf_machine_load_address (void) attribute_unused;
-+static __always_inline Elf32_Addr
- elf_machine_load_address (void)
- {
- /* It doesn't matter what variable this is, the reference never makes
-@@ -66,7 +66,7 @@ elf_machine_load_address (void)
- return addr;
- }
-
--static __inline__ void
-+static __always_inline void
- elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
- Elf32_Word relative_count)
- {
-Index: uClibc-0.9.30.1/ldso/ldso/cris/dl-sysdep.h
-===================================================================
---- uClibc-0.9.30.1/ldso/ldso/cris/dl-sysdep.h (revision 25503)
-+++ uClibc-0.9.30.1/ldso/ldso/cris/dl-sysdep.h (working copy)
-@@ -39,7 +39,7 @@ extern unsigned long _dl_linux_resolver(
- || ((type) == R_CRIS_GLOB_DAT)) * ELF_RTYPE_CLASS_PLT) \
- | (((type) == R_CRIS_COPY) * ELF_RTYPE_CLASS_COPY))
-
--static __inline__ Elf32_Addr
-+static __always_inline Elf32_Addr
- elf_machine_dynamic(void)
- {
- /* Don't just set this to an asm variable "r0" since that's not logical
-@@ -61,7 +61,7 @@ elf_machine_dynamic(void)
- there's some other symbol we could use, that we don't *have* to force a
- GOT entry for. */
-
--static __inline__ Elf32_Addr
-+static __always_inline Elf32_Addr
- elf_machine_load_address(void)
- {
- Elf32_Addr gotaddr_diff;
-@@ -95,7 +95,7 @@ elf_machine_load_address(void)
- return gotaddr_diff;
- }
-
--static __inline__ void
-+static __always_inline void
- elf_machine_relative(Elf32_Addr load_off, const Elf32_Addr rel_addr,
- Elf32_Word relative_count)
- {
-Index: uClibc-0.9.30.1/ldso/ldso/xtensa/dl-sysdep.h
-===================================================================
---- uClibc-0.9.30.1/ldso/ldso/xtensa/dl-sysdep.h (revision 25503)
-+++ uClibc-0.9.30.1/ldso/ldso/xtensa/dl-sysdep.h (working copy)
-@@ -87,7 +87,7 @@ extern unsigned long _dl_linux_resolver
- (((type) == R_XTENSA_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)
-
- /* Return the link-time address of _DYNAMIC. */
--static __inline__ Elf32_Addr
-+static __always_inline Elf32_Addr
- elf_machine_dynamic (void)
- {
- /* This function is only used while bootstrapping the runtime linker.
-@@ -97,7 +97,7 @@ elf_machine_dynamic (void)
- }
-
- /* Return the run-time load address of the shared object. */
--static __inline__ Elf32_Addr
-+static __always_inline Elf32_Addr
- elf_machine_load_address (void)
- {
- Elf32_Addr addr, tmp;
-@@ -118,7 +118,7 @@ elf_machine_load_address (void)
- return addr - 3;
- }
-
--static __inline__ void
-+static __always_inline void
- elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
- Elf32_Word relative_count)
- {
-Index: uClibc-0.9.30.1/ldso/ldso/sparc/dl-sysdep.h
-===================================================================
---- uClibc-0.9.30.1/ldso/ldso/sparc/dl-sysdep.h (revision 25503)
-+++ uClibc-0.9.30.1/ldso/ldso/sparc/dl-sysdep.h (working copy)
-@@ -49,7 +49,7 @@ unsigned long _dl_linux_resolver(struct
-
- #ifndef COMPILE_ASM
- /* Cheap modulo implementation, taken from arm/ld_sysdep.h. */
--static __inline__ unsigned long
-+static __always_inline unsigned long
- sparc_mod(unsigned long m, unsigned long p)
- {
- unsigned long i, t, inc;
-@@ -127,7 +127,7 @@ do { register Elf32_Addr pc __asm__("
- /* Return the link-time address of _DYNAMIC. Conveniently, this is the
- first element of the GOT. This must be inlined in a function which
- uses global data. */
--static __inline__ Elf32_Addr
-+static __always_inline Elf32_Addr
- elf_machine_dynamic (void)
- {
- register Elf32_Addr *got __asm__ ("%l7");
-@@ -138,7 +138,7 @@ elf_machine_dynamic (void)
- }
-
- /* Return the run-time load address of the shared object. */
--static __inline__ Elf32_Addr
-+static __always_inline Elf32_Addr
- elf_machine_load_address (void)
- {
- register Elf32_Addr *pc __asm__ ("%o7"), *got __asm__ ("%l7");
-@@ -157,7 +157,7 @@ elf_machine_load_address (void)
- return (Elf32_Addr) got - *got + (pc[2] - pc[3]) * 4 - 4;
- }
-
--static __inline__ void
-+static __always_inline void
- elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
- Elf32_Word relative_count)
- {
-Index: uClibc-0.9.30.1/ldso/ldso/mips/dl-sysdep.h
-===================================================================
---- uClibc-0.9.30.1/ldso/ldso/mips/dl-sysdep.h (revision 25503)
-+++ uClibc-0.9.30.1/ldso/ldso/mips/dl-sysdep.h (working copy)
-@@ -163,7 +163,7 @@ void _dl_perform_mips_global_got_relocat
-
- #define OFFSET_GP_GOT 0x7ff0
-
--static __inline__ ElfW(Addr) *
-+static __always_inline ElfW(Addr) *
- elf_mips_got_from_gpreg (ElfW(Addr) gpreg)
- {
- /* FIXME: the offset of gp from GOT may be system-dependent. */
-@@ -173,7 +173,7 @@ elf_mips_got_from_gpreg (ElfW(Addr) gpre
- /* Return the link-time address of _DYNAMIC. Conveniently, this is the
- first element of the GOT. This must be inlined in a function which
- uses global data. We assume its $gp points to the primary GOT. */
--static __inline__ ElfW(Addr)
-+static __always_inline ElfW(Addr)
- elf_machine_dynamic (void)
- {
- register ElfW(Addr) gp __asm__ ("$28");
-@@ -192,7 +192,7 @@ elf_machine_dynamic (void)
- #endif
-
- /* Return the run-time load address of the shared object. */
--static __inline__ ElfW(Addr)
-+static __always_inline ElfW(Addr)
- elf_machine_load_address (void)
- {
- ElfW(Addr) addr;
-@@ -208,7 +208,7 @@ elf_machine_load_address (void)
- return addr;
- }
-
--static __inline__ void
-+static __always_inline void
- elf_machine_relative (ElfW(Addr) load_off, const ElfW(Addr) rel_addr,
- ElfW(Word) relative_count)
- {
-Index: uClibc-0.9.30.1/ldso/ldso/sh/dl-sysdep.h
-===================================================================
---- uClibc-0.9.30.1/ldso/ldso/sh/dl-sysdep.h (revision 25503)
-+++ uClibc-0.9.30.1/ldso/ldso/sh/dl-sysdep.h (working copy)
-@@ -25,7 +25,7 @@
- struct elf_resolve;
- extern unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry);
-
--static __inline__ unsigned int
-+static __always_inline unsigned int
- _dl_urem(unsigned int n, unsigned int base)
- {
- int res;
-@@ -100,7 +100,7 @@ _dl_urem(unsigned int n, unsigned int ba
- /* Return the link-time address of _DYNAMIC. Conveniently, this is the
- first element of the GOT. This must be inlined in a function which
- uses global data. */
--static __inline__ Elf32_Addr __attribute__ ((unused))
-+static __always_inline Elf32_Addr __attribute__ ((unused))
- elf_machine_dynamic (void)
- {
- register Elf32_Addr *got;
-@@ -109,7 +109,7 @@ elf_machine_dynamic (void)
- }
-
- /* Return the run-time load address of the shared object. */
--static __inline__ Elf32_Addr __attribute__ ((unused))
-+static __always_inline Elf32_Addr __attribute__ ((unused))
- elf_machine_load_address (void)
- {
- Elf32_Addr addr;
-@@ -151,7 +151,7 @@ elf_machine_load_address (void)
- } \
- }
-
--static __inline__ void
-+static __always_inline void
- elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
- Elf32_Word relative_count)
- {
-Index: uClibc-0.9.30.1/ldso/ldso/bfin/dl-sysdep.h
-===================================================================
---- uClibc-0.9.30.1/ldso/ldso/bfin/dl-sysdep.h (revision 25503)
-+++ uClibc-0.9.30.1/ldso/ldso/bfin/dl-sysdep.h (working copy)
-@@ -213,7 +213,7 @@ while (0)
- #endif
-
- #include <elf.h>
--static __inline__ void
-+static __always_inline void
- elf_machine_relative (DL_LOADADDR_TYPE load_off, const Elf32_Addr rel_addr,
- Elf32_Word relative_count)
- {
diff --git a/toolchain/uClibc/patches-0.9.30.1/300-fix-ppoll.diff b/toolchain/uClibc/patches-0.9.30.1/300-fix-ppoll.diff
deleted file mode 100644
index c2970daf69..0000000000
--- a/toolchain/uClibc/patches-0.9.30.1/300-fix-ppoll.diff
+++ /dev/null
@@ -1,38 +0,0 @@
-
-It will match kernel's sigset_t starting from 0.9.31.
-
-Please try attached patch.
---
-vda
-
---- uClibc.0/libc/sysdeps/linux/common/ppoll.c
-+++ uClibc.1/libc/sysdeps/linux/common/ppoll.c
-@@ -17,6 +17,7 @@
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-+#include <signal.h>
- #include <sys/syscall.h>
- #include <sys/poll.h>
-
-@@ -26,9 +27,9 @@
-
- # define __NR___libc_ppoll __NR_ppoll
- static __always_inline
--_syscall4(int, __libc_ppoll, struct pollfd *, fds,
-+_syscall5(int, __libc_ppoll, struct pollfd *, fds,
- nfds_t, nfds, const struct timespec *, timeout,
-- const __sigset_t *, sigmask)
-+ const __sigset_t *, sigmask, size_t, sigsetsize)
-
- int
- ppoll (struct pollfd *fds, nfds_t nfds, const struct timespec *timeout,
-@@ -43,7 +44,7 @@
- timeout = &tval;
- }
-
-- return __libc_ppoll(fds, nfds, timeout, sigmask);
-+ return __libc_ppoll(fds, nfds, timeout, sigmask, _NSIG / 8);
- }
- libc_hidden_def(ppoll)
-
diff --git a/toolchain/uClibc/patches-0.9.30.1/400-gcc4.4-fixes.patch b/toolchain/uClibc/patches-0.9.30.1/400-gcc4.4-fixes.patch
deleted file mode 100644
index 1b6eee8305..0000000000
--- a/toolchain/uClibc/patches-0.9.30.1/400-gcc4.4-fixes.patch
+++ /dev/null
@@ -1,916 +0,0 @@
-The gcc-4.4 documentation still suggests that the compiler will automatically
-do format checking for the standard format function prototypes, but it is now
-also barking warnings suggesting that we add them for this lot too. So added.
-
-Signed-off-by: Ron Lee <ron@debian.org>
----
- include/stdio.h | 15 ++++++++++-----
- 1 files changed, 10 insertions(+), 5 deletions(-)
-
-Index: uClibc-0.9.30.1/include/stdio.h
-===================================================================
---- uClibc-0.9.30.1.orig/include/stdio.h 2008-09-30 14:17:04.000000000 +0200
-+++ uClibc-0.9.30.1/include/stdio.h 2009-07-06 21:16:14.000000000 +0200
-@@ -325,7 +325,8 @@
- extern int printf (__const char *__restrict __format, ...);
- /* Write formatted output to S. */
- extern int sprintf (char *__restrict __s,
-- __const char *__restrict __format, ...) __THROW;
-+ __const char *__restrict __format, ...)
-+ __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
-
- /* Write formatted output to S from argument list ARG.
-
-@@ -340,7 +341,8 @@
- extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg);
- /* Write formatted output to S from argument list ARG. */
- extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
-- __gnuc_va_list __arg) __THROW;
-+ __gnuc_va_list __arg)
-+ __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
- __END_NAMESPACE_STD
-
- #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
-@@ -391,15 +393,18 @@
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
- extern int fscanf (FILE *__restrict __stream,
-- __const char *__restrict __format, ...) __wur;
-+ __const char *__restrict __format, ...)
-+ __attribute__ ((__format__ (__scanf__, 2, 3))) __wur;
- /* Read formatted input from stdin.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
--extern int scanf (__const char *__restrict __format, ...) __wur;
-+extern int scanf (__const char *__restrict __format, ...)
-+ __attribute__ ((__format__ (__scanf__, 1, 2))) __wur;
- /* Read formatted input from S. */
- extern int sscanf (__const char *__restrict __s,
-- __const char *__restrict __format, ...) __THROW;
-+ __const char *__restrict __format, ...)
-+ __THROW __attribute__ ((__format__ (__scanf__, 2, 3)));
- __END_NAMESPACE_STD
-
- #ifdef __USE_ISOC99
-gcc-4.4 now barks about this, so appease it.
-
-Signed-off-by: Ron Lee <ron@debian.org>
----
- ldso/ldso/arm/dl-sysdep.h | 3 ++-
- 1 files changed, 2 insertions(+), 1 deletions(-)
-
-diff --git a/ldso/ldso/arm/dl-sysdep.h b/ldso/ldso/arm/dl-sysdep.h
-index 5191dd7..75c58b0 100644
---- a/ldso/ldso/arm/dl-sysdep.h
-+++ b/ldso/ldso/arm/dl-sysdep.h
-@@ -98,11 +98,12 @@ elf_machine_dynamic (void)
- return dynamic;
- }
-
-+extern void __dl_start __asm__ ("_dl_start");
-+
- /* Return the run-time load address of the shared object. */
- static __always_inline Elf32_Addr __attribute__ ((unused))
- elf_machine_load_address (void)
- {
-- extern void __dl_start __asm__ ("_dl_start");
- Elf32_Addr got_addr = (Elf32_Addr) &__dl_start;
- Elf32_Addr pcrel_addr;
- #if defined __OPTIMIZE__ && !defined __thumb__
-usage() is also made static in answer to warnings about no prototype.
-In __pthread_manager_event() we also have to drop the return statement,
-else gcc will in turn complain about a non-returning function having one.
-
-Signed-off-by: Ron Lee <ron@debian.org>
----
- libpthread/linuxthreads.old/manager.c | 4 ++--
- utils/ldconfig.c | 4 ++--
- 2 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/libpthread/linuxthreads.old/manager.c b/libpthread/linuxthreads.old/manager.c
-index 19be92f..0617d7d 100644
---- a/libpthread/linuxthreads.old/manager.c
-+++ b/libpthread/linuxthreads.old/manager.c
-@@ -248,7 +248,7 @@ int attribute_noreturn __pthread_manager(void *arg)
- }
- }
-
--int __pthread_manager_event(void *arg)
-+int attribute_noreturn __pthread_manager_event(void *arg)
- {
- /* If we have special thread_self processing, initialize it. */
- #ifdef INIT_THREAD_SELF
-@@ -260,7 +260,7 @@ int __pthread_manager_event(void *arg)
- /* Free it immediately. */
- __pthread_unlock (THREAD_GETMEM((&__pthread_manager_thread), p_lock));
-
-- return __pthread_manager(arg);
-+ __pthread_manager(arg);
- }
-
- /* Process creation */
-diff --git a/utils/ldconfig.c b/utils/ldconfig.c
-index c52b170..f6aec5c 100644
---- a/utils/ldconfig.c
-+++ b/utils/ldconfig.c
-@@ -114,7 +114,7 @@ static void warnx(const char *s, ...)
- fprintf(stderr, "\n");
- }
-
--static void err(int errnum, const char *s, ...)
-+static void attribute_noreturn err(int errnum, const char *s, ...)
- {
- va_list p;
-
-@@ -783,7 +783,7 @@ void cache_print(void)
- }
- #endif
-
--void usage(void)
-+static void attribute_noreturn usage(void)
- {
- fprintf(stderr,
- #ifdef __LDSO_CACHE_SUPPORT__
---
-This keeps gcc-4.4 from nagging that they have no prototypes.
-
-Signed-off-by: Ron Lee <ron@debian.org>
----
- utils/ldconfig.c | 16 ++++++++--------
- utils/ldd.c | 12 ++++++------
- utils/readsoname2.c | 2 +-
- 3 files changed, 15 insertions(+), 15 deletions(-)
-
-diff --git a/utils/ldconfig.c b/utils/ldconfig.c
-index f6aec5c..3bd7cee 100644
---- a/utils/ldconfig.c
-+++ b/utils/ldconfig.c
-@@ -173,8 +173,8 @@ static char *xstrdup(const char *str)
- #define readsonameXX readsoname64
- #define __ELF_NATIVE_CLASS 64
- #include "readsoname2.c"
--char *readsoname(char *name, FILE *infile, int expected_type,
-- int *type, int elfclass)
-+static char *readsoname(char *name, FILE *infile, int expected_type,
-+ int *type, int elfclass)
- {
- char *res;
-
-@@ -206,8 +206,8 @@ char *readsoname(char *name, FILE *infile, int expected_type,
- * If the expected, actual/deduced types missmatch we display a warning
- * and use the actual/deduced type.
- */
--char *is_shlib(const char *dir, const char *name, int *type,
-- int *islink, int expected_type)
-+static char *is_shlib(const char *dir, const char *name, int *type,
-+ int *islink, int expected_type)
- {
- char *good = NULL;
- char *cp, *cp2;
-@@ -323,7 +323,7 @@ char *is_shlib(const char *dir, const char *name, int *type,
- }
-
- /* update the symlink to new library */
--void link_shlib(const char *dir, const char *file, const char *so)
-+static void link_shlib(const char *dir, const char *file, const char *so)
- {
- int change = 1;
- char libname[BUFFER_SIZE];
-@@ -380,7 +380,7 @@ void link_shlib(const char *dir, const char *file, const char *so)
- }
-
- /* figure out which library is greater */
--int libcmp(char *p1, char *p2)
-+static int libcmp(char *p1, char *p2)
- {
- while (*p1) {
- if (isdigit(*p1) && isdigit(*p2)) {
-@@ -412,7 +412,7 @@ struct lib {
- };
-
- /* update all shared library links in a directory */
--void scan_dir(const char *rawname)
-+static void scan_dir(const char *rawname)
- {
- DIR *dir;
- const char *name;
-@@ -554,7 +554,7 @@ void cache_write(void)
- }
- #else
- /* return the list of system-specific directories */
--char *get_extpath(void)
-+static char *get_extpath(void)
- {
- char *res = NULL, *cp;
- FILE *file;
-diff --git a/utils/ldd.c b/utils/ldd.c
-index 1f1dc25..02b37f1 100644
---- a/utils/ldd.c
-+++ b/utils/ldd.c
-@@ -214,7 +214,7 @@ static char *elf_find_rpath(ElfW(Ehdr) *ehdr, ElfW(Dyn) *dynamic)
- return NULL;
- }
-
--int check_elf_header(ElfW(Ehdr) *const ehdr)
-+static int check_elf_header(ElfW(Ehdr) *const ehdr)
- {
- if (!ehdr || *(uint32_t*)ehdr != ELFMAG_U32
- || ehdr->e_ident[EI_CLASS] != ELFCLASSM
-@@ -249,7 +249,7 @@ int check_elf_header(ElfW(Ehdr) *const ehdr)
- static caddr_t cache_addr = NULL;
- static size_t cache_size = 0;
-
--int map_cache(void)
-+static int map_cache(void)
- {
- int fd;
- struct stat st;
-@@ -306,7 +306,7 @@ fail:
- return -1;
- }
-
--int unmap_cache(void)
-+static int unmap_cache(void)
- {
- if (cache_addr == NULL || cache_addr == (caddr_t) - 1)
- return -1;
-@@ -372,8 +372,8 @@ static void search_for_named_library(char *name, char *result,
- *result = '\0';
- }
-
--void locate_library_file(ElfW(Ehdr) *ehdr, ElfW(Dyn) *dynamic, int is_suid,
-- struct library *lib)
-+static void locate_library_file(ElfW(Ehdr) *ehdr, ElfW(Dyn) *dynamic,
-+ int is_suid, struct library *lib)
- {
- char *buf;
- char *path;
-@@ -608,7 +608,7 @@ static struct library *find_elf_interpreter(ElfW(Ehdr) *ehdr)
- /*
- #warning "There may be two warnings here about vfork() clobbering, ignore them"
- */
--int find_dependancies(char *filename)
-+static int find_dependancies(char *filename)
- {
- int is_suid = 0;
- FILE *thefile;
-diff --git a/utils/readsoname2.c b/utils/readsoname2.c
-index a74b46a..5cda331 100644
---- a/utils/readsoname2.c
-+++ b/utils/readsoname2.c
-@@ -1,4 +1,4 @@
--char *readsonameXX(char *name, FILE *infile, int expected_type, int *type)
-+static char *readsonameXX(char *name, FILE *infile, int expected_type, int *type)
- {
- ElfW(Ehdr) *epnt;
- ElfW(Phdr) *ppnt;
---
-This cuts down on a lot of noise from gcc-4.4
-
-Signed-off-by: Ron Lee <ron@debian.org>
----
- libc/misc/elf/dl-support.c | 5 ++---
- libc/sysdeps/linux/arm/aeabi_assert.c | 5 ++---
- libc/sysdeps/linux/arm/aeabi_atexit.c | 4 ++--
- libc/sysdeps/linux/arm/aeabi_errno_addr.c | 4 ++--
- libc/sysdeps/linux/arm/aeabi_localeconv.c | 4 ++--
- libc/sysdeps/linux/arm/aeabi_memclr.c | 4 ++--
- libc/sysdeps/linux/arm/aeabi_memcpy.c | 4 ++--
- libc/sysdeps/linux/arm/aeabi_memmove.c | 4 ++--
- libc/sysdeps/linux/arm/aeabi_memset.c | 4 ++--
- libc/sysdeps/linux/arm/aeabi_unwind_cpp_pr1.c | 15 ++++++---------
- libc/sysdeps/linux/arm/find_exidx.c | 4 ++--
- .../linuxthreads.old/sysdeps/arm/pt-machine.h | 4 ++--
- utils/chroot_realpath.c | 3 +++
- 13 files changed, 31 insertions(+), 33 deletions(-)
-
-diff --git a/libc/misc/elf/dl-support.c b/libc/misc/elf/dl-support.c
-index 3c1d853..4dd155e 100644
---- a/libc/misc/elf/dl-support.c
-+++ b/libc/misc/elf/dl-support.c
-@@ -17,9 +17,8 @@
- ElfW(Phdr) *_dl_phdr;
- size_t _dl_phnum;
-
--void
--internal_function
--_dl_aux_init (ElfW(auxv_t) *av)
-+void internal_function _dl_aux_init (ElfW(auxv_t) *av);
-+void internal_function _dl_aux_init (ElfW(auxv_t) *av)
- {
- /* Get the program headers base address from the aux vect */
- _dl_phdr = (ElfW(Phdr) *) av[AT_PHDR].a_un.a_val;
-diff --git a/libc/sysdeps/linux/arm/aeabi_assert.c b/libc/sysdeps/linux/arm/aeabi_assert.c
-index 53943ac..348ca9b 100644
---- a/libc/sysdeps/linux/arm/aeabi_assert.c
-+++ b/libc/sysdeps/linux/arm/aeabi_assert.c
-@@ -22,9 +22,8 @@
-
- /* libc_hidden_proto(__assert) */
-
--void
--__aeabi_assert (const char *assertion, const char *file,
-- unsigned int line)
-+void __aeabi_assert(const char *assertion, const char *file, unsigned int line);
-+void __aeabi_assert(const char *assertion, const char *file, unsigned int line)
- {
- __assert (assertion, file, line, NULL);
- }
-diff --git a/libc/sysdeps/linux/arm/aeabi_atexit.c b/libc/sysdeps/linux/arm/aeabi_atexit.c
-index 4a7a6f1..ebb233b 100644
---- a/libc/sysdeps/linux/arm/aeabi_atexit.c
-+++ b/libc/sysdeps/linux/arm/aeabi_atexit.c
-@@ -24,8 +24,8 @@ libc_hidden_proto(__cxa_atexit)
- /* Register a function to be called by exit or when a shared library
- is unloaded. This routine is like __cxa_atexit, but uses the
- calling sequence required by the ARM EABI. */
--int
--__aeabi_atexit (void *arg, void (*func) (void *), void *d)
-+int __aeabi_atexit (void *arg, void (*func) (void *), void *d);
-+int __aeabi_atexit (void *arg, void (*func) (void *), void *d)
- {
- return __cxa_atexit (func, arg, d);
- }
-diff --git a/libc/sysdeps/linux/arm/aeabi_errno_addr.c b/libc/sysdeps/linux/arm/aeabi_errno_addr.c
-index 09bdc1e..5e262a6 100644
---- a/libc/sysdeps/linux/arm/aeabi_errno_addr.c
-+++ b/libc/sysdeps/linux/arm/aeabi_errno_addr.c
-@@ -18,8 +18,8 @@
-
- #include <errno.h>
-
--volatile int *
--__aeabi_errno_addr (void)
-+volatile int * __aeabi_errno_addr (void);
-+volatile int * __aeabi_errno_addr (void)
- {
- return &errno;
- }
-diff --git a/libc/sysdeps/linux/arm/aeabi_localeconv.c b/libc/sysdeps/linux/arm/aeabi_localeconv.c
-index 6fa29bb..4c34f57 100644
---- a/libc/sysdeps/linux/arm/aeabi_localeconv.c
-+++ b/libc/sysdeps/linux/arm/aeabi_localeconv.c
-@@ -20,8 +20,8 @@
-
- /* libc_hidden_proto(localeconv) */
-
--struct lconv *
--__aeabi_localeconv (void)
-+struct lconv * __aeabi_localeconv (void);
-+struct lconv * __aeabi_localeconv (void)
- {
- return localeconv ();
- }
-diff --git a/libc/sysdeps/linux/arm/aeabi_memclr.c b/libc/sysdeps/linux/arm/aeabi_memclr.c
-index c0f9021..9125bac 100644
---- a/libc/sysdeps/linux/arm/aeabi_memclr.c
-+++ b/libc/sysdeps/linux/arm/aeabi_memclr.c
-@@ -22,8 +22,8 @@
-
- /* Clear memory. Can't alias to bzero because it's not defined in the
- same translation unit. */
--void
--__aeabi_memclr (void *dest, size_t n)
-+void __aeabi_memclr (void *dest, size_t n);
-+void __aeabi_memclr (void *dest, size_t n)
- {
- memset (dest, 0, n);
- }
-diff --git a/libc/sysdeps/linux/arm/aeabi_memcpy.c b/libc/sysdeps/linux/arm/aeabi_memcpy.c
-index 83eac0b..604c139 100644
---- a/libc/sysdeps/linux/arm/aeabi_memcpy.c
-+++ b/libc/sysdeps/linux/arm/aeabi_memcpy.c
-@@ -23,8 +23,8 @@
- /* Copy memory like memcpy, but no return value required. Can't alias
- to memcpy because it's not defined in the same translation
- unit. */
--void
--__aeabi_memcpy (void *dest, const void *src, size_t n)
-+void __aeabi_memcpy (void *dest, const void *src, size_t n);
-+void __aeabi_memcpy (void *dest, const void *src, size_t n)
- {
- memcpy (dest, src, n);
- }
-diff --git a/libc/sysdeps/linux/arm/aeabi_memmove.c b/libc/sysdeps/linux/arm/aeabi_memmove.c
-index 164d72b..7ecfbb7 100644
---- a/libc/sysdeps/linux/arm/aeabi_memmove.c
-+++ b/libc/sysdeps/linux/arm/aeabi_memmove.c
-@@ -23,8 +23,8 @@
- /* Copy memory like memmove, but no return value required. Can't
- alias to memmove because it's not defined in the same translation
- unit. */
--void
--__aeabi_memmove (void *dest, const void *src, size_t n)
-+void __aeabi_memmove (void *dest, const void *src, size_t n);
-+void __aeabi_memmove (void *dest, const void *src, size_t n)
- {
- memmove (dest, src, n);
- }
-diff --git a/libc/sysdeps/linux/arm/aeabi_memset.c b/libc/sysdeps/linux/arm/aeabi_memset.c
-index f1c366f..a37e21f 100644
---- a/libc/sysdeps/linux/arm/aeabi_memset.c
-+++ b/libc/sysdeps/linux/arm/aeabi_memset.c
-@@ -22,8 +22,8 @@
-
- /* Set memory like memset, but different argument order and no return
- value required. */
--void
--__aeabi_memset (void *dest, size_t n, int c)
-+void __aeabi_memset (void *dest, size_t n, int c);
-+void __aeabi_memset (void *dest, size_t n, int c)
- {
- memset (dest, c, n);
- }
-diff --git a/libc/sysdeps/linux/arm/aeabi_unwind_cpp_pr1.c b/libc/sysdeps/linux/arm/aeabi_unwind_cpp_pr1.c
-index e657d38..4544dc7 100644
---- a/libc/sysdeps/linux/arm/aeabi_unwind_cpp_pr1.c
-+++ b/libc/sysdeps/linux/arm/aeabi_unwind_cpp_pr1.c
-@@ -24,20 +24,17 @@
-
- #include <stdlib.h>
-
--attribute_hidden
--void
--__aeabi_unwind_cpp_pr0 (void)
-+attribute_hidden void __aeabi_unwind_cpp_pr0 (void);
-+attribute_hidden void __aeabi_unwind_cpp_pr0 (void)
- {
- }
-
--attribute_hidden
--void
--__aeabi_unwind_cpp_pr1 (void)
-+attribute_hidden void __aeabi_unwind_cpp_pr1 (void);
-+attribute_hidden void __aeabi_unwind_cpp_pr1 (void)
- {
- }
-
--attribute_hidden
--void
--__aeabi_unwind_cpp_pr2 (void)
-+attribute_hidden void __aeabi_unwind_cpp_pr2 (void);
-+attribute_hidden void __aeabi_unwind_cpp_pr2 (void)
- {
- }
-diff --git a/libc/sysdeps/linux/arm/find_exidx.c b/libc/sysdeps/linux/arm/find_exidx.c
-index 9e4f401..a16534b 100644
---- a/libc/sysdeps/linux/arm/find_exidx.c
-+++ b/libc/sysdeps/linux/arm/find_exidx.c
-@@ -65,8 +65,8 @@ find_exidx_callback (struct dl_phdr_info * info, size_t size, void * ptr)
-
- /* Find the exception index table containing PC. */
-
--_Unwind_Ptr
--__gnu_Unwind_Find_exidx (_Unwind_Ptr pc, int * pcount)
-+_Unwind_Ptr __gnu_Unwind_Find_exidx (_Unwind_Ptr pc, int * pcount);
-+_Unwind_Ptr __gnu_Unwind_Find_exidx (_Unwind_Ptr pc, int * pcount)
- {
- struct unw_eh_callback_data data;
-
-diff --git a/libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h
-index 14eb6f6..583eb68 100644
---- a/libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h
-+++ b/libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h
-@@ -33,8 +33,8 @@
- time; let's hope nobody tries to use one. */
-
- /* Spinlock implementation; required. */
--PT_EI long int
--testandset (int *spinlock)
-+PT_EI long int testandset (int *spinlock);
-+PT_EI long int testandset (int *spinlock)
- {
- register unsigned int ret;
-
-diff --git a/utils/chroot_realpath.c b/utils/chroot_realpath.c
-index 82ccbf6..d912a06 100644
---- a/utils/chroot_realpath.c
-+++ b/utils/chroot_realpath.c
-@@ -25,6 +25,9 @@
- #define MAX_READLINKS 32
-
- char *chroot_realpath(const char *chroot, const char *path,
-+ char resolved_path[]);
-+
-+char *chroot_realpath(const char *chroot, const char *path,
- char resolved_path[])
- {
- char copy_path[PATH_MAX];
---
-Once again all of these reduce the noise from gcc-4.4.
-Replaces a few more (USE_TLS && HAVE___THREAD) with USE___THREAD while we need
-to mess with them for this anyhow.
-
-Signed-off-by: Ron Lee <ron@debian.org>
----
- libc/misc/fnmatch/fnmatch.c | 2 +-
- libpthread/linuxthreads.old/cancel.c | 6 +++---
- libpthread/linuxthreads.old/libc_pthread_init.c | 4 ++--
- libpthread/linuxthreads.old/pthread.c | 2 +-
- libpthread/linuxthreads.old/ptlongjmp.c | 4 ++--
- libpthread/linuxthreads.old/specific.c | 2 +-
- .../linuxthreads.old_db/td_thr_tls_get_addr.c | 2 +-
- 7 files changed, 11 insertions(+), 11 deletions(-)
-
-Index: uClibc-0.9.30.1/libc/misc/fnmatch/fnmatch.c
-===================================================================
---- uClibc-0.9.30.1.orig/libc/misc/fnmatch/fnmatch.c 2008-06-01 22:44:48.000000000 +0200
-+++ uClibc-0.9.30.1/libc/misc/fnmatch/fnmatch.c 2009-07-06 21:16:29.000000000 +0200
-@@ -17,7 +17,7 @@
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
--#if HAVE_CONFIG_H
-+#ifdef HAVE_CONFIG_H
- # include <config.h>
- #endif
-
-Index: uClibc-0.9.30.1/libpthread/linuxthreads.old/cancel.c
-===================================================================
---- uClibc-0.9.30.1.orig/libpthread/linuxthreads.old/cancel.c 2008-07-23 13:23:36.000000000 +0200
-+++ uClibc-0.9.30.1/libpthread/linuxthreads.old/cancel.c 2009-07-06 21:16:29.000000000 +0200
-@@ -31,7 +31,7 @@
-
- #ifdef _STACK_GROWS_DOWN
- # define FRAME_LEFT(frame, other) ((char *) frame >= (char *) other)
--#elif _STACK_GROWS_UP
-+#elif defined _STACK_GROWS_UP
- # define FRAME_LEFT(frame, other) ((char *) frame <= (char *) other)
- #else
- # error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
-@@ -193,10 +193,10 @@
-
- for (c = THREAD_GETMEM(self, p_cleanup); c != NULL; c = c->__prev)
- {
--#if _STACK_GROWS_DOWN
-+#ifdef _STACK_GROWS_DOWN
- if ((char *) c <= currentframe)
- break;
--#elif _STACK_GROWS_UP
-+#elif defined _STACK_GROWS_UP
- if ((char *) c >= currentframe)
- break;
- #else
-Index: uClibc-0.9.30.1/libpthread/linuxthreads.old/libc_pthread_init.c
-===================================================================
---- uClibc-0.9.30.1.orig/libpthread/linuxthreads.old/libc_pthread_init.c 2008-05-20 10:47:51.000000000 +0200
-+++ uClibc-0.9.30.1/libpthread/linuxthreads.old/libc_pthread_init.c 2009-07-06 21:17:10.000000000 +0200
-@@ -26,7 +26,7 @@
-
- /* Experimentally off - libc_hidden_proto(memcpy) */
-
--#if !(USE_TLS && HAVE___THREAD) && defined __UCLIBC_HAS_XLOCALE__
-+#if ! defined USE___THREAD && defined __UCLIBC_HAS_XLOCALE__
- libc_hidden_proto(uselocale)
- #endif
-
-@@ -42,7 +42,7 @@
- sizeof (__libc_pthread_functions));
- #endif
-
--#if !(USE_TLS && HAVE___THREAD) && defined __UCLIBC_HAS_XLOCALE__
-+#if ! defined USE___THREAD && defined __UCLIBC_HAS_XLOCALE__
- /* Initialize thread-locale current locale to point to the global one.
- With __thread support, the variable's initializer takes care of this. */
- uselocale (LC_GLOBAL_LOCALE);
-Index: uClibc-0.9.30.1/libpthread/linuxthreads.old/pthread.c
-===================================================================
---- uClibc-0.9.30.1.orig/libpthread/linuxthreads.old/pthread.c 2008-10-03 15:59:52.000000000 +0200
-+++ uClibc-0.9.30.1/libpthread/linuxthreads.old/pthread.c 2009-07-06 21:17:53.000000000 +0200
-@@ -321,7 +321,7 @@
-
- struct pthread_functions __pthread_functions =
- {
--#if !(USE_TLS && HAVE___THREAD)
-+#ifndef USE___THREAD
- .ptr_pthread_internal_tsd_set = __pthread_internal_tsd_set,
- .ptr_pthread_internal_tsd_get = __pthread_internal_tsd_get,
- .ptr_pthread_internal_tsd_address = __pthread_internal_tsd_address,
-Index: uClibc-0.9.30.1/libpthread/linuxthreads.old/ptlongjmp.c
-===================================================================
---- uClibc-0.9.30.1.orig/libpthread/linuxthreads.old/ptlongjmp.c 2006-11-09 09:11:33.000000000 +0100
-+++ uClibc-0.9.30.1/libpthread/linuxthreads.old/ptlongjmp.c 2009-07-06 21:16:29.000000000 +0200
-@@ -35,13 +35,13 @@
- c != NULL && _JMPBUF_UNWINDS(target, c);
- c = c->__prev)
- {
--#if _STACK_GROWS_DOWN
-+#ifdef _STACK_GROWS_DOWN
- if ((char *) c <= currentframe)
- {
- c = NULL;
- break;
- }
--#elif _STACK_GROWS_UP
-+#elif defined _STACK_GROWS_UP
- if ((char *) c >= currentframe)
- {
- c = NULL;
-Index: uClibc-0.9.30.1/libpthread/linuxthreads.old/specific.c
-===================================================================
---- uClibc-0.9.30.1.orig/libpthread/linuxthreads.old/specific.c 2008-05-20 10:47:51.000000000 +0200
-+++ uClibc-0.9.30.1/libpthread/linuxthreads.old/specific.c 2009-07-06 21:18:28.000000000 +0200
-@@ -167,7 +167,7 @@
- __pthread_unlock(THREAD_GETMEM(self, p_lock));
- }
-
--#if !(USE_TLS && HAVE___THREAD)
-+#ifndef USE___THREAD
-
- /* Thread-specific data for libc. */
-
-Index: uClibc-0.9.30.1/libpthread/linuxthreads.old_db/td_thr_tls_get_addr.c
-===================================================================
---- uClibc-0.9.30.1.orig/libpthread/linuxthreads.old_db/td_thr_tls_get_addr.c 2005-11-22 22:32:06.000000000 +0100
-+++ uClibc-0.9.30.1/libpthread/linuxthreads.old_db/td_thr_tls_get_addr.c 2009-07-06 21:16:29.000000000 +0200
-@@ -31,7 +31,7 @@
- size_t offset __attribute__ ((unused)),
- void **address __attribute__ ((unused)))
- {
--#if USE_TLS
-+#ifdef USE_TLS
- size_t modid;
- union dtv pdtv, *dtvp;
-
-elf.h needs __BYTE_ORDER, and s_scalbn.c needs {LONG,INT}_MAX.
-shm.c complains about no prototypes for shm_{open,unlink} without its header.
-
-Signed-off-by: Ron Lee <ron@debian.org>
----
- include/elf.h | 1 +
- libm/s_scalbn.c | 1 +
- librt/shm.c | 1 +
- 3 files changed, 3 insertions(+), 0 deletions(-)
-
-diff --git a/include/elf.h b/include/elf.h
-index 0129f1e..16a6972 100644
---- a/include/elf.h
-+++ b/include/elf.h
-@@ -28,6 +28,7 @@ extern "C" {
- /* Standard ELF types. */
-
- #include <stdint.h>
-+#include <endian.h>
-
- /* Type for a 16-bit quantity. */
- typedef uint16_t Elf32_Half;
-diff --git a/libm/s_scalbn.c b/libm/s_scalbn.c
-index c534467..47983b0 100644
---- a/libm/s_scalbn.c
-+++ b/libm/s_scalbn.c
-@@ -18,6 +18,7 @@
-
- #include "math.h"
- #include "math_private.h"
-+#include <limits.h>
-
- static const double
- two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
---
-gcc-4.4 barks about that.
-
-Signed-off-by: Ron Lee <ron@debian.org>
----
- utils/ldconfig.c | 4 ++--
- 1 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/utils/ldconfig.c b/utils/ldconfig.c
-index 3bd7cee..505316b 100644
---- a/utils/ldconfig.c
-+++ b/utils/ldconfig.c
-@@ -127,14 +127,14 @@ static void attribute_noreturn err(int errnum, const char *s, ...)
-
- static void vperror_msg(const char *s, va_list p)
- {
-- int err = errno;
-+ int e = errno;
-
- if (s == 0)
- s = "";
- verror_msg(s, p);
- if (*s)
- s = ": ";
-- fprintf(stderr, "%s%s\n", s, strerror(err));
-+ fprintf(stderr, "%s%s\n", s, strerror(e));
- }
-
- static void warn(const char *s, ...)
---
-Signed-off-by: Ron Lee <ron@debian.org>
----
- utils/ldconfig.c | 10 +++++-----
- utils/ldd.c | 4 ++--
- 2 files changed, 7 insertions(+), 7 deletions(-)
-
-diff --git a/utils/ldconfig.c b/utils/ldconfig.c
-index 505316b..139b5f9 100644
---- a/utils/ldconfig.c
-+++ b/utils/ldconfig.c
-@@ -558,18 +558,18 @@ static char *get_extpath(void)
- {
- char *res = NULL, *cp;
- FILE *file;
-- struct stat stat;
-+ struct stat st;
- char realconffile[BUFFER_SIZE];
-
- if (!chroot_realpath(chroot_dir, conffile, realconffile))
- return NULL;
-
- if ((file = fopen(realconffile, "r")) != NULL) {
-- fstat(fileno(file), &stat);
-- res = xmalloc(stat.st_size + 1);
-- fread(res, 1, stat.st_size, file);
-+ fstat(fileno(file), &st);
-+ res = xmalloc(st.st_size + 1);
-+ fread(res, 1, st.st_size, file);
- fclose(file);
-- res[stat.st_size] = '\0';
-+ res[st.st_size] = '\0';
-
- /* convert comments fo spaces */
- for (cp = res; *cp; /*nada */ ) {
-diff --git a/utils/ldd.c b/utils/ldd.c
-index 02b37f1..e7a94cb 100644
---- a/utils/ldd.c
-+++ b/utils/ldd.c
-@@ -683,8 +683,8 @@ foo:
- && ehdr->e_ident[EI_VERSION] == EV_CURRENT
- && MATCH_MACHINE(ehdr->e_machine))
- {
-- struct stat statbuf;
-- if (stat(interp->path, &statbuf) == 0 && S_ISREG(statbuf.st_mode)) {
-+ struct stat st;
-+ if (stat(interp->path, &st) == 0 && S_ISREG(st.st_mode)) {
- pid_t pid;
- int status;
- static const char *const environment[] = {
---
-Signed-off-by: Ron Lee <ron@debian.org>
----
- libpthread/linuxthreads.old/manager.c | 4 ++--
- 1 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/libpthread/linuxthreads.old/manager.c b/libpthread/linuxthreads.old/manager.c
-index 0617d7d..88c9253 100644
---- a/libpthread/linuxthreads.old/manager.c
-+++ b/libpthread/linuxthreads.old/manager.c
-@@ -578,9 +578,9 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
- /* See whether the TD_CREATE event bit is set in any of the
- masks. */
- int idx = __td_eventword (TD_CREATE);
-- uint32_t mask = __td_eventmask (TD_CREATE);
-+ uint32_t m = __td_eventmask (TD_CREATE);
-
-- if ((mask & (__pthread_threads_events.event_bits[idx]
-+ if ((m & (__pthread_threads_events.event_bits[idx]
- | event_maskp->event_bits[idx])) != 0)
- {
- /* Lock the mutex the child will use now so that it will stop. */
---
-Signed-off-by: Ron Lee <ron@debian.org>
----
- utils/chroot_realpath.c | 12 ++++++------
- 1 files changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/utils/chroot_realpath.c b/utils/chroot_realpath.c
-index d912a06..0be57bf 100644
---- a/utils/chroot_realpath.c
-+++ b/utils/chroot_realpath.c
-@@ -24,10 +24,10 @@
-
- #define MAX_READLINKS 32
-
--char *chroot_realpath(const char *chroot, const char *path,
-+char *chroot_realpath(const char *root, const char *path,
- char resolved_path[]);
-
--char *chroot_realpath(const char *chroot, const char *path,
-+char *chroot_realpath(const char *root, const char *path,
- char resolved_path[])
- {
- char copy_path[PATH_MAX];
-@@ -41,13 +41,13 @@ char *chroot_realpath(const char *chroot, const char *path,
- int chroot_len;
-
- /* Trivial case. */
-- if (chroot == NULL || *chroot == '\0' ||
-- (*chroot == '/' && chroot[1] == '\0')) {
-+ if (root == NULL || *root == '\0' ||
-+ (*root == '/' && root[1] == '\0')) {
- strcpy(resolved_path, path);
- return resolved_path;
- }
-
-- chroot_len = strlen(chroot);
-+ chroot_len = strlen(root);
-
- if (chroot_len + strlen(path) >= PATH_MAX - 3) {
- errno = ENAMETOOLONG;
-@@ -60,7 +60,7 @@ char *chroot_realpath(const char *chroot, const char *path,
- max_path = copy_path + PATH_MAX - chroot_len - 3;
-
- /* Start with the chroot path. */
-- strcpy(new_path, chroot);
-+ strcpy(new_path, root);
- new_path += chroot_len;
- while (*new_path == '/' && new_path > got_path)
- new_path--;
---
-Signed-off-by: Ron Lee <ron@debian.org>
----
- ldso/ldso/dl-elf.c | 4 +++-
- ldso/ldso/dl-startup.c | 3 ++-
- libc/inet/getaddrinfo.c | 9 ++++++---
- 3 files changed, 11 insertions(+), 5 deletions(-)
-
-Index: uClibc-0.9.30.1/ldso/ldso/dl-elf.c
-===================================================================
---- uClibc-0.9.30.1.orig/ldso/ldso/dl-elf.c 2008-11-18 15:01:35.000000000 +0100
-+++ uClibc-0.9.30.1/ldso/ldso/dl-elf.c 2009-07-06 21:20:03.000000000 +0200
-@@ -341,6 +341,7 @@
- ElfW(Addr) relro_addr = 0;
- size_t relro_size = 0;
- struct stat st;
-+ uint32_t *p32;
- DL_LOADADDR_TYPE lib_loadaddr;
- DL_INIT_LOADADDR_EXTRA_DECLS
-
-Index: uClibc-0.9.30.1/ldso/ldso/dl-startup.c
-===================================================================
---- uClibc-0.9.30.1.orig/ldso/ldso/dl-startup.c 2008-05-30 16:22:26.000000000 +0200
-+++ uClibc-0.9.30.1/ldso/ldso/dl-startup.c 2009-07-06 21:20:03.000000000 +0200
-@@ -122,6 +122,7 @@
- struct elf_resolve *tpnt = &tpnt_tmp;
- ElfW(auxv_t) auxvt[AT_EGID + 1];
- ElfW(Dyn) *dpnt;
-+ uint32_t *p32;
-
- /* WARNING! -- we cannot make _any_ funtion calls until we have
- * taken care of fixing up our own relocations. Making static
-Index: uClibc-0.9.30.1/libc/inet/getaddrinfo.c
-===================================================================
---- uClibc-0.9.30.1.orig/libc/inet/getaddrinfo.c 2009-02-26 13:49:14.000000000 +0100
-+++ uClibc-0.9.30.1/libc/inet/getaddrinfo.c 2009-07-06 21:20:03.000000000 +0200
-@@ -539,7 +539,8 @@
-
- if (scope_delim != NULL) {
- int try_numericscope = 0;
-- if (IN6_IS_ADDR_LINKLOCAL(at->addr) || IN6_IS_ADDR_MC_LINKLOCAL(at->addr)) {
-+ uint32_t *a32 = (uint32_t*)at->addr;
-+ if (IN6_IS_ADDR_LINKLOCAL(a32) || IN6_IS_ADDR_MC_LINKLOCAL(at->addr)) {
- at->scopeid = if_nametoindex(scope_delim + 1);
- if (at->scopeid == 0)
- try_numericscope = 1;
-@@ -617,8 +618,10 @@
- #endif
- if (req->ai_family == 0 || req->ai_family == AF_INET) {
- atr->family = AF_INET;
-- if ((req->ai_flags & AI_PASSIVE) == 0)
-- *(uint32_t*)atr->addr = htonl(INADDR_LOOPBACK);
-+ if ((req->ai_flags & AI_PASSIVE) == 0) {
-+ uint32_t *a = (uint32_t*)atr->addr;
-+ *a = htonl(INADDR_LOOPBACK);
-+ }
- }
- }
-
-From 8ee834680d39677a60e26a0de4ece2f0c1ebbde2 Mon Sep 17 00:00:00 2001
-From: Ron <ron@debian.org>
-Date: Sat, 27 Jun 2009 04:44:27 +0930
-Subject: [PATCH] Avoid warnings about shifting more bits than we have
-
-The test here is a constant expression and will compile out.
-For platforms that don't need the shift the code gets slightly smaller
-and simpler, for those that do the result is unchanged.
-
-Signed-off-by: Ron Lee <ron@debian.org>
-Signed-off-by: Mike Frysinger <vapier@gentoo.org>
----
- libc/sysdeps/linux/arm/posix_fadvise.c | 6 ++++--
- 1 files changed, 4 insertions(+), 2 deletions(-)
-
---- a/libc/sysdeps/linux/arm/posix_fadvise.c
-+++ b/libc/sysdeps/linux/arm/posix_fadvise.c
-@@ -10,6 +10,9 @@
- #include <sys/syscall.h>
- #include <fcntl.h>
- #if defined __NR_arm_fadvise64_64
-+
-+#define HIGH_BITS(x) (sizeof(x) > 4 ? (x) >> 32 : 0)
-+
- /* This is for the ARM version of fadvise64_64 which swaps the params
- * * about to avoid having ABI compat issues
- * */
-@@ -18,8 +21,8 @@
- {
- INTERNAL_SYSCALL_DECL (err);
- int ret = INTERNAL_SYSCALL (arm_fadvise64_64, err, 6, fd, advise,
-- __LONG_LONG_PAIR ((long)(offset >> 32), (long)offset),
-- __LONG_LONG_PAIR ((long)(len >> 32), (long)len));
-+ __LONG_LONG_PAIR (HIGH_BITS(offset), (long)offset),
-+ __LONG_LONG_PAIR (HIGH_BITS(len), (long)len));
-
- if (INTERNAL_SYSCALL_ERROR_P (ret, err))
- return INTERNAL_SYSCALL_ERRNO (ret, err);
diff --git a/toolchain/uClibc/patches-0.9.30.1/410-llvm_workaround.patch b/toolchain/uClibc/patches-0.9.30.1/410-llvm_workaround.patch
deleted file mode 100644
index 3847b720ab..0000000000
--- a/toolchain/uClibc/patches-0.9.30.1/410-llvm_workaround.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/libc/stdio/_stdio.c
-+++ b/libc/stdio/_stdio.c
-@@ -121,7 +121,7 @@ static FILE _stdio_streams[] = {
- __FLAG_NBF|__FLAG_WRITEONLY, \
- 2, \
- NULL, \
-- NULL, \
-+ 0, \
- 0 )
- };
-
diff --git a/toolchain/uClibc/patches-0.9.30.1/420-i386_strrchr_fix.patch b/toolchain/uClibc/patches-0.9.30.1/420-i386_strrchr_fix.patch
deleted file mode 100644
index c47327a1b0..0000000000
--- a/toolchain/uClibc/patches-0.9.30.1/420-i386_strrchr_fix.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/libc/string/i386/strrchr.c
-+++ b/libc/string/i386/strrchr.c
-@@ -45,7 +45,7 @@ char *strrchr(const char *s, int c)
- "leal -1(%%esi),%0\n"
- "2:\ttestb %%al,%%al\n\t"
- "jne 1b"
-- :"=g" (__res), "=&S" (d0), "=&a" (d1) :"0" (0),"1" (s),"2" (c));
-+ :"=r" (__res), "=&S" (d0), "=&a" (d1) :"0" (0),"1" (s),"2" (c));
- return __res;
- }
- libc_hidden_def(strrchr)
diff --git a/toolchain/uClibc/patches-0.9.30.1/430-i386_copysign.patch b/toolchain/uClibc/patches-0.9.30.1/430-i386_copysign.patch
deleted file mode 100644
index 8cc15b7032..0000000000
--- a/toolchain/uClibc/patches-0.9.30.1/430-i386_copysign.patch
+++ /dev/null
@@ -1,96 +0,0 @@
---- a/libc/sysdeps/linux/i386/Makefile.arch
-+++ b/libc/sysdeps/linux/i386/Makefile.arch
-@@ -9,6 +9,7 @@ CSRC := brk.c sigaction.c __syscall_erro
-
- SSRC := \
- __longjmp.S vfork.S clone.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \
-- sync_file_range.S syscall.S mmap.S mmap64.S posix_fadvise64.S
-+ sync_file_range.S syscall.S mmap.S mmap64.S posix_fadvise64.S \
-+ s_copysign.S s_copysignf.S s_copysignl.S
-
- include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch
---- /dev/null
-+++ b/libc/sysdeps/linux/i386/s_copysign.S
-@@ -0,0 +1,25 @@
-+/*
-+ * Written by J.T. Conklin <jtc@netbsd.org>.
-+ * Public domain.
-+ */
-+
-+#define _ERRNO_H 1
-+#include <features.h>
-+#include <bits/errno.h>
-+
-+.text
-+.global copysign
-+.type copysign,%function
-+copysign:
-+ movl 16(%esp),%edx
-+ movl 8(%esp),%eax
-+ andl $0x80000000,%edx
-+ andl $0x7fffffff,%eax
-+ orl %edx,%eax
-+ movl %eax,8(%esp)
-+ fldl 4(%esp)
-+ ret
-+.size copysign,.-copysign
-+
-+libc_hidden_def(copysign)
-+
---- /dev/null
-+++ b/libc/sysdeps/linux/i386/s_copysignf.S
-@@ -0,0 +1,25 @@
-+/*
-+ * Written by J.T. Conklin <jtc@netbsd.org>.
-+ * Public domain.
-+ */
-+
-+#define _ERRNO_H 1
-+#include <features.h>
-+#include <bits/errno.h>
-+
-+.text
-+.global copysignf
-+.type copysignf,%function
-+copysignf:
-+ movl 8(%esp),%edx
-+ movl 4(%esp),%eax
-+ andl $0x80000000,%edx
-+ andl $0x7fffffff,%eax
-+ orl %edx,%eax
-+ movl %eax,4(%esp)
-+ flds 4(%esp)
-+ ret
-+.size copysignf,.-copysignf
-+
-+libc_hidden_def(copysignf)
-+
---- /dev/null
-+++ b/libc/sysdeps/linux/i386/s_copysignl.S
-@@ -0,0 +1,26 @@
-+/*
-+ * Written by J.T. Conklin <jtc@netbsd.org>.
-+ * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
-+ * Public domain.
-+ */
-+
-+#define _ERRNO_H 1
-+#include <features.h>
-+#include <bits/errno.h>
-+
-+.text
-+.global copysignl
-+.type copysignl,%function
-+copysignl:
-+ movl 24(%esp),%edx
-+ movl 12(%esp),%eax
-+ andl $0x8000,%edx
-+ andl $0x7fff,%eax
-+ orl %edx,%eax
-+ movl %eax,12(%esp)
-+ fldt 4(%esp)
-+ ret
-+.size copysignl,.-copysignl
-+
-+libc_hidden_def(copysignl)
-+
diff --git a/toolchain/uClibc/patches-0.9.30.1/440-backport_mips_nonpic.patch b/toolchain/uClibc/patches-0.9.30.1/440-backport_mips_nonpic.patch
deleted file mode 100644
index abcd6ec636..0000000000
--- a/toolchain/uClibc/patches-0.9.30.1/440-backport_mips_nonpic.patch
+++ /dev/null
@@ -1,289 +0,0 @@
---- a/include/elf.h
-+++ b/include/elf.h
-@@ -1547,6 +1547,7 @@ typedef struct
- #define STO_MIPS_INTERNAL 0x1
- #define STO_MIPS_HIDDEN 0x2
- #define STO_MIPS_PROTECTED 0x3
-+#define STO_MIPS_PLT 0x8
- #define STO_MIPS_SC_ALIGN_UNUSED 0xff
-
- /* MIPS specific values for `st_info'. */
-@@ -1692,8 +1693,11 @@ typedef struct
- #define R_MIPS_TLS_TPREL64 48 /* TP-relative offset, 64 bit */
- #define R_MIPS_TLS_TPREL_HI16 49 /* TP-relative offset, high 16 bits */
- #define R_MIPS_TLS_TPREL_LO16 50 /* TP-relative offset, low 16 bits */
-+#define R_MIPS_GLOB_DAT 51
-+#define R_MIPS_COPY 126
-+#define R_MIPS_JUMP_SLOT 127
- /* Keep this the last entry. */
--#define R_MIPS_NUM 51
-+#define R_MIPS_NUM 128
-
- /* Legal values for p_type field of Elf32_Phdr. */
-
-@@ -1759,7 +1763,13 @@ typedef struct
- #define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */
- #define DT_MIPS_GP_VALUE 0x70000030 /* GP value for aux GOTs. */
- #define DT_MIPS_AUX_DYNAMIC 0x70000031 /* Address of aux .dynamic. */
--#define DT_MIPS_NUM 0x32
-+/* The address of .got.plt in an executable using the new non-PIC ABI. */
-+#define DT_MIPS_PLTGOT 0x70000032
-+/* The base of the PLT in an executable using the new non-PIC ABI if that
-+ PLT is writable. For a non-writable PLT, this is omitted or has a zero
-+ value. */
-+#define DT_MIPS_RWPLT 0x70000034
-+#define DT_MIPS_NUM 0x35
-
- /* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry. */
-
---- a/ldso/ldso/dl-hash.c
-+++ b/ldso/ldso/dl-hash.c
-@@ -160,6 +160,11 @@ check_match (const ElfW(Sym) *sym, char
- /* undefined symbol itself */
- return NULL;
-
-+#ifdef __mips__
-+ if (sym->st_shndx == SHN_UNDEF && !(sym->st_other & STO_MIPS_PLT))
-+ return NULL;
-+#endif
-+
- if (sym->st_value == 0)
- /* No value */
- return NULL;
---- a/ldso/ldso/mips/dl-sysdep.h
-+++ b/ldso/ldso/mips/dl-sysdep.h
-@@ -93,10 +93,11 @@ typedef struct
-
- #include <link.h>
-
--#define ARCH_NUM 3
-+#define ARCH_NUM 4
- #define DT_MIPS_GOTSYM_IDX (DT_NUM + OS_NUM)
- #define DT_MIPS_LOCAL_GOTNO_IDX (DT_NUM + OS_NUM +1)
- #define DT_MIPS_SYMTABNO_IDX (DT_NUM + OS_NUM +2)
-+#define DT_MIPS_PLTGOT_IDX (DT_NUM + OS_NUM +3)
-
- #define ARCH_DYNAMIC_INFO(dpnt, dynamic, debug_addr) \
- do { \
-@@ -106,6 +107,8 @@ else if (dpnt->d_tag == DT_MIPS_LOCAL_GO
- dynamic[DT_MIPS_LOCAL_GOTNO_IDX] = dpnt->d_un.d_val; \
- else if (dpnt->d_tag == DT_MIPS_SYMTABNO) \
- dynamic[DT_MIPS_SYMTABNO_IDX] = dpnt->d_un.d_val; \
-+else if (dpnt->d_tag == DT_MIPS_PLTGOT) \
-+ dynamic[DT_MIPS_PLTGOT_IDX] = dpnt->d_un.d_val; \
- else if (dpnt->d_tag == DT_MIPS_RLD_MAP) \
- *(ElfW(Addr) *)(dpnt->d_un.d_ptr) = (ElfW(Addr)) debug_addr; \
- } while (0)
-@@ -114,6 +117,7 @@ else if (dpnt->d_tag == DT_MIPS_RLD_MAP)
- #define INIT_GOT(GOT_BASE,MODULE) \
- do { \
- unsigned long idx; \
-+ unsigned long *pltgot; \
- \
- /* Check if this is the dynamic linker itself */ \
- if (MODULE->libtype == program_interpreter) \
-@@ -123,6 +127,12 @@ do { \
- GOT_BASE[0] = (unsigned long) _dl_runtime_resolve; \
- GOT_BASE[1] = (unsigned long) MODULE; \
- \
-+ pltgot = MODULE->dynamic_info[DT_MIPS_PLTGOT_IDX]; \
-+ if (pltgot) { \
-+ pltgot[0] = (unsigned long) _dl_runtime_pltresolve; \
-+ pltgot[1] = (unsigned long) MODULE; \
-+ } \
-+ \
- /* Add load address displacement to all local GOT entries */ \
- idx = 2; \
- while (idx < MODULE->dynamic_info[DT_MIPS_LOCAL_GOTNO_IDX]) \
-@@ -157,9 +167,9 @@ void _dl_perform_mips_global_got_relocat
- #define OFFS_ALIGN 0x7ffff000
- #endif /* O32 || N32 */
-
--#define elf_machine_type_class(type) ELF_RTYPE_CLASS_PLT
--/* MIPS does not have COPY relocs */
--#define DL_NO_COPY_RELOCS
-+#define elf_machine_type_class(type) \
-+ ((((type) == R_MIPS_JUMP_SLOT) * ELF_RTYPE_CLASS_PLT) \
-+ | (((type) == R_MIPS_COPY) * ELF_RTYPE_CLASS_COPY))
-
- #define OFFSET_GP_GOT 0x7ff0
-
---- a/ldso/ldso/mips/elfinterp.c
-+++ b/ldso/ldso/mips/elfinterp.c
-@@ -30,6 +30,7 @@
- #include "ldso.h"
-
- extern int _dl_runtime_resolve(void);
-+extern int _dl_runtime_pltresolve(void);
-
- #define OFFSET_GP_GOT 0x7ff0
-
-@@ -83,6 +84,61 @@ unsigned long __dl_runtime_resolve(unsig
- return new_addr;
- }
-
-+unsigned long
-+__dl_runtime_pltresolve(struct elf_resolve *tpnt, int reloc_entry)
-+{
-+ int reloc_type;
-+ ELF_RELOC *this_reloc;
-+ char *strtab;
-+ Elf32_Sym *symtab;
-+ int symtab_index;
-+ char *rel_addr;
-+ char *new_addr;
-+ char **got_addr;
-+ unsigned long instr_addr;
-+ char *symname;
-+
-+ rel_addr = (char *)tpnt->dynamic_info[DT_JMPREL];
-+ this_reloc = (ELF_RELOC *)(intptr_t)(rel_addr + reloc_entry);
-+ reloc_type = ELF32_R_TYPE(this_reloc->r_info);
-+ symtab_index = ELF32_R_SYM(this_reloc->r_info);
-+
-+ symtab = (Elf32_Sym *)(intptr_t)tpnt->dynamic_info[DT_SYMTAB];
-+ strtab = (char *)tpnt->dynamic_info[DT_STRTAB];
-+ symname = strtab + symtab[symtab_index].st_name;
-+
-+ /* Address of the jump instruction to fix up. */
-+ instr_addr = ((unsigned long)this_reloc->r_offset +
-+ (unsigned long)tpnt->loadaddr);
-+ got_addr = (char **)instr_addr;
-+
-+ /* Get the address of the GOT entry. */
-+ new_addr = _dl_find_hash(symname, tpnt->symbol_scope, tpnt, ELF_RTYPE_CLASS_PLT);
-+ if (unlikely(!new_addr)) {
-+ _dl_dprintf(2, "%s: can't resolve symbol '%s' in lib '%s'.\n", _dl_progname, symname, tpnt->libname);
-+ _dl_exit(1);
-+ }
-+
-+#if defined (__SUPPORT_LD_DEBUG__)
-+ if ((unsigned long)got_addr < 0x40000000) {
-+ if (_dl_debug_bindings) {
-+ _dl_dprintf(_dl_debug_file, "\nresolve function: %s", symname);
-+ if (_dl_debug_detail)
-+ _dl_dprintf(_dl_debug_file,
-+ "\n\tpatched: %x ==> %x @ %x",
-+ *got_addr, new_addr, got_addr);
-+ }
-+ }
-+ if (!_dl_debug_nofixups) {
-+ *got_addr = new_addr;
-+ }
-+#else
-+ *got_addr = new_addr;
-+#endif
-+
-+ return (unsigned long)new_addr;
-+}
-+
- void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
- unsigned long rel_addr, unsigned long rel_size)
- {
-@@ -115,6 +171,7 @@ int _dl_parse_relocation_information(str
- got = (unsigned long *) tpnt->dynamic_info[DT_PLTGOT];
-
- for (i = 0; i < rel_size; i++, rpnt++) {
-+ char *symname = NULL;
- reloc_addr = (unsigned long *) (tpnt->loadaddr +
- (unsigned long) rpnt->r_offset);
- reloc_type = ELF_R_TYPE(rpnt->r_info);
-@@ -128,6 +185,16 @@ int _dl_parse_relocation_information(str
- old_val = *reloc_addr;
- #endif
-
-+ if (reloc_type == R_MIPS_JUMP_SLOT || reloc_type == R_MIPS_COPY) {
-+ symname = strtab + symtab[symtab_index].st_name;
-+ symbol_addr = (unsigned long)_dl_find_hash(symname,
-+ tpnt->symbol_scope,
-+ tpnt,
-+ elf_machine_type_class(reloc_type));
-+ if (unlikely(!symbol_addr && ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK))
-+ return 1;
-+ }
-+
- switch (reloc_type) {
- #if _MIPS_SIM == _MIPS_SIM_ABI64
- case (R_MIPS_64 << 8) | R_MIPS_REL32:
-@@ -148,6 +215,24 @@ int _dl_parse_relocation_information(str
- *reloc_addr += (unsigned long) tpnt->loadaddr;
- }
- break;
-+ case R_MIPS_JUMP_SLOT:
-+ *reloc_addr = symbol_addr;
-+ break;
-+ case R_MIPS_COPY:
-+ if (symbol_addr) {
-+#if defined (__SUPPORT_LD_DEBUG__)
-+ if (_dl_debug_move)
-+ _dl_dprintf(_dl_debug_file,
-+ "\n%s move %d bytes from %x to %x",
-+ symname, symtab[symtab_index].st_size,
-+ symbol_addr, reloc_addr);
-+#endif
-+
-+ _dl_memcpy((char *)reloc_addr,
-+ (char *)symbol_addr,
-+ symtab[symtab_index].st_size);
-+ }
-+ break;
- case R_MIPS_NONE:
- break;
- default:
---- a/ldso/ldso/mips/resolve.S
-+++ b/ldso/ldso/mips/resolve.S
-@@ -112,3 +112,54 @@ _dl_runtime_resolve:
- .end _dl_runtime_resolve
- .previous
-
-+/* Assembler veneer called from the PLT header code when using the
-+ non-PIC ABI.
-+
-+ Code in each PLT entry puts the caller's return address into t7 ($15),
-+ the PLT entry index into t8 ($24), the address of _dl_runtime_pltresolve
-+ into t9 ($25) and the address of .got.plt into gp ($28). __dl_runtime_pltresolve
-+ needs a0 ($4) to hold the link map and a1 ($5) to hold the index into
-+ .rel.plt (== PLT entry index * 4). */
-+
-+ .text
-+ .align 2
-+ .globl _dl_runtime_pltresolve
-+ .type _dl_runtime_pltresolve,@function
-+ .ent _dl_runtime_pltresolve
-+_dl_runtime_pltresolve:
-+ .frame $29, 40, $31
-+ .set noreorder
-+ # Save arguments and sp value in stack.
-+ subu $29, 40
-+ lw $10, 4($28)
-+ # Modify t9 ($25) so as to point .cpload instruction.
-+ addiu $25, 12
-+ # Compute GP.
-+ .cpload $25
-+ .set reorder
-+
-+ /* Store function arguments from registers to stack */
-+ sw $15, 36($29)
-+ sw $4, 16($29)
-+ sw $5, 20($29)
-+ sw $6, 24($29)
-+ sw $7, 28($29)
-+
-+ /* Setup functions args and call __dl_runtime_pltresolve. */
-+ move $4, $10
-+ sll $5, $24, 3
-+ jal __dl_runtime_pltresolve
-+
-+ /* Restore function arguments from stack to registers */
-+ lw $31, 36($29)
-+ lw $4, 16($29)
-+ lw $5, 20($29)
-+ lw $6, 24($29)
-+ lw $7, 28($29)
-+
-+ /* Do a tail call to the original function */
-+ addiu $29, 40
-+ move $25, $2
-+ jr $25
-+ .end _dl_runtime_pltresolve
-+ .previous
diff --git a/toolchain/uClibc/patches-0.9.30.1/450-powerpc_copysignl.patch b/toolchain/uClibc/patches-0.9.30.1/450-powerpc_copysignl.patch
deleted file mode 100644
index 2bdf1f34cb..0000000000
--- a/toolchain/uClibc/patches-0.9.30.1/450-powerpc_copysignl.patch
+++ /dev/null
@@ -1,103 +0,0 @@
---- 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
-
- SSRC := \
- __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S brk.S \
---- /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.30.1/500-avr32_add_varargs_handling_of_prctl_syscall.patch b/toolchain/uClibc/patches-0.9.30.1/500-avr32_add_varargs_handling_of_prctl_syscall.patch
deleted file mode 100644
index 29d9e2622f..0000000000
--- a/toolchain/uClibc/patches-0.9.30.1/500-avr32_add_varargs_handling_of_prctl_syscall.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-From 2b69e9906e5087a796b3a15e9aabcd102c705b19 Mon Sep 17 00:00:00 2001
-From: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
-Date: Wed, 16 Dec 2009 12:16:08 +0000
-Subject: avr32: add varargs handling of prctl syscall
-
-prctl is defined to use varargs in the header file, hence it needs varargs
-specific handling in the source. This patch properly handles the variodic
-argument before the syscall is passed to the kernel for the AVR32 architecture.
-
-Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
----
-diff --git a/libc/sysdeps/linux/avr32/Makefile.arch b/libc/sysdeps/linux/avr32/Makefile.arch
-index bc5f625..98b85a7 100644
---- a/libc/sysdeps/linux/avr32/Makefile.arch
-+++ b/libc/sysdeps/linux/avr32/Makefile.arch
-@@ -5,7 +5,7 @@
- # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- #
-
--CSRC := brk.c clone.c mmap.c sigaction.c
-+CSRC := brk.c clone.c mmap.c prctl.c sigaction.c
-
- SSRC := __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \
- sigrestorer.S syscall.S vfork.S
-diff --git a/libc/sysdeps/linux/avr32/prctl.c b/libc/sysdeps/linux/avr32/prctl.c
-new file mode 100644
-index 0000000..4e146e3
---- a/dev/null
-+++ b/libc/sysdeps/linux/avr32/prctl.c
-@@ -0,0 +1,36 @@
-+/*
-+ * prctl syscall for AVR32 Linux.
-+ *
-+ * Copyright (C) 2010 Atmel Corporation
-+ *
-+ * This file is subject to the terms and conditions of the GNU Lesser General
-+ * Public License. See the file "COPYING.LIB" in the main directory of this
-+ * archive for more details.
-+ */
-+#include <sys/syscall.h>
-+#include <sys/prctl.h>
-+#include <stdarg.h>
-+
-+#ifdef __NR_prctl
-+#define __NR___syscall_prctl __NR_prctl
-+static inline _syscall5(int, __syscall_prctl, int, option, long, arg2,
-+ long, arg3, long, arg4, long, arg5);
-+
-+int prctl(int __option, ...)
-+{
-+ long arg2;
-+ long arg3;
-+ long arg4;
-+ long arg5;
-+ va_list ap;
-+
-+ va_start(ap, __option);
-+ arg2 = va_arg(ap, long);
-+ arg3 = va_arg(ap, long);
-+ arg4 = va_arg(ap, long);
-+ arg5 = va_arg(ap, long);
-+ va_end(ap);
-+
-+ return INLINE_SYSCALL(prctl, 5, __option, arg2, arg3, arg4, arg5);
-+}
-+#endif
---
-cgit v0.8.2.1
diff --git a/toolchain/uClibc/patches-0.9.30.1/600-ubicom32-uClibc.patch b/toolchain/uClibc/patches-0.9.30.1/600-ubicom32-uClibc.patch
deleted file mode 100644
index 5404f980d5..0000000000
--- a/toolchain/uClibc/patches-0.9.30.1/600-ubicom32-uClibc.patch
+++ /dev/null
@@ -1,4407 +0,0 @@
---- a/Rules.mak
-+++ b/Rules.mak
-@@ -411,6 +411,17 @@ ifeq ($(TARGET_ARCH),microblaze)
- SYMBOL_PREFIX=_
- endif
-
-+ifeq ($(TARGET_ARCH),ubicom32)
-+ OPTIMIZATION+=-fstrict-aliasing
-+ CPU_CFLAGS-$(CONFIG_UBICOM32_V3)+=-march=ubicom32v3
-+ CPU_CFLAGS-$(CONFIG_UBICOM32_V4)+=-march=ubicom32v4
-+ifeq ($(UCLIBC_FORMAT_FDPIC_ELF),y)
-+ CPU_CFLAGS-y:=-mfdpic
-+ CPU_LDFLAGS-y += -Wl,-melf32ubicom32fdpic
-+endif
-+
-+endif
-+
- ifeq ($(TARGET_ARCH),v850)
- SYMBOL_PREFIX=_
- endif
---- a/extra/Configs/Config.in
-+++ b/extra/Configs/Config.in
-@@ -73,6 +73,9 @@ config TARGET_sh64
- config TARGET_sparc
- bool "sparc"
-
-+config TARGET_ubicom32
-+ bool "ubicom32"
-+
- config TARGET_v850
- bool "v850 (BROKEN)"
-
-@@ -174,6 +177,10 @@ if TARGET_sparc
- source "extra/Configs/Config.sparc"
- endif
-
-+if TARGET_ubicom32
-+source "extra/Configs/Config.ubicom32"
-+endif
-+
- if TARGET_v850
- source "extra/Configs/Config.v850"
- endif
---- a/extra/Configs/Config.in.arch
-+++ b/extra/Configs/Config.in.arch
-@@ -148,7 +148,7 @@ config UCLIBC_HAS_SOFT_FLOAT
- config DO_C99_MATH
- bool "Enable full C99 math library support"
- depends on UCLIBC_HAS_FLOATS
-- default n
-+ default y
- help
- If you want the uClibc math library to contain the full set C99
- math library features, then answer Y. If you leave this set to
---- /dev/null
-+++ b/extra/Configs/Config.ubicom32
-@@ -0,0 +1,44 @@
-+#
-+# For a description of the syntax of this configuration file,
-+# see extra/config/Kconfig-language.txt
-+#
-+
-+config TARGET_ARCH
-+ string
-+ default "ubicom32"
-+
-+config FORCE_OPTIONS_FOR_ARCH
-+ bool
-+ default y
-+ select ARCH_BIG_ENDIAN
-+ select ARCH_HAS_NO_MMU
-+
-+choice
-+ prompt "Target Processor Architecture"
-+ default CONFIG_UC_UBICOM32_V3
-+ help
-+ This selects the instruction set architecture of your Ubicom32 CPU. This
-+ information is used for optimizing purposes. To build a library that
-+ will run on any Ubicom32 CPU, you can specify "v3" here.
-+ If you pick anything other than "v3," there is no
-+ guarantee that uClibc will even run on anything other than the
-+ selected processor type.
-+
-+ You should probably select the Ubicom32 ISA that best matches the
-+ CPU you will be using on your device. uClibc will be tuned
-+ for that architecture.
-+
-+ If you don't know what to do, choose "v3"
-+
-+config CONFIG_UC_UBICOM32_V3
-+ bool "ISA v3"
-+
-+config CONFIG_UC_UBICOM32_V4
-+ bool "ISA v4"
-+endchoice
-+
-+config ARCH_CFLAGS
-+ string
-+
-+config CROSS
-+ string
---- a/include/elf.h
-+++ b/include/elf.h
-@@ -331,6 +331,8 @@ typedef struct
-
- #define EM_XSTORMY16 0xad45
-
-+#define EM_UBICOM32 0xde3d /* Ubicom32; no ABI */
-+
- /* FRV magic number - no EABI available??. */
- #define EM_CYGNUS_FRV 0x5441
-
-@@ -3036,6 +3038,55 @@ typedef Elf32_Addr Elf32_Conflict;
- /* Keep this the last entry. */
- #define R_XTENSA_NUM 50
-
-+/* Ubicom32 ELF relocation types */
-+#define R_UBICOM32_NONE 0
-+#define R_UBICOM32_16 1
-+#define R_UBICOM32_32 2
-+#define R_UBICOM32_LO16 3
-+#define R_UBICOM32_HI16 4
-+#define R_UBICOM32_21_PCREL 5
-+#define R_UBICOM32_24_PCREL 6
-+#define R_UBICOM32_HI24 7
-+#define R_UBICOM32_LO7_S 8
-+#define R_UBICOM32_LO7_2_S 9
-+#define R_UBICOM32_LO7_4_S 10
-+#define R_UBICOM32_LO7_D 11
-+#define R_UBICOM32_LO7_2_D 12
-+#define R_UBICOM32_LO7_4_D 13
-+#define R_UBICOM32_32_HARVARD 14
-+#define R_UBICOM32_LO7_CALLI 15
-+#define R_UBICOM32_LO16_CALLI 16
-+#define R_UBICOM32_GOT_HI24 17
-+#define R_UBICOM32_GOT_LO7_S 18
-+#define R_UBICOM32_GOT_LO7_2_S 19
-+#define R_UBICOM32_GOT_LO7_4_S 20
-+#define R_UBICOM32_GOT_LO7_D 21
-+#define R_UBICOM32_GOT_LO7_2_D 22
-+#define R_UBICOM32_GOT_LO7_4_D 23
-+#define R_UBICOM32_FUNCDESC_GOT_HI24 24
-+#define R_UBICOM32_FUNCDESC_GOT_LO7_S 25
-+#define R_UBICOM32_FUNCDESC_GOT_LO7_2_S 26
-+#define R_UBICOM32_FUNCDESC_GOT_LO7_4_S 27
-+#define R_UBICOM32_FUNCDESC_GOT_LO7_D 28
-+#define R_UBICOM32_FUNCDESC_GOT_LO7_2_D 29
-+#define R_UBICOM32_FUNCDESC_GOT_LO7_4_D 30
-+#define R_UBICOM32_GOT_LO7_CALLI 31
-+#define R_UBICOM32_FUNCDESC_GOT_LO7_CALLI 32
-+#define R_UBICOM32_FUNCDESC_VALUE 33
-+#define R_UBICOM32_FUNCDESC 34
-+#define R_UBICOM32_GOTOFFSET_LO 35
-+#define R_UBICOM32_GOTOFFSET_HI 36
-+#define R_UBICOM32_FUNCDESC_GOTOFFSET_LO 37
-+#define R_UBICOM32_FUNCDESC_GOTOFFSET_HI 38
-+#define R_UBICOM32_GNU_VTINHERIT 200
-+#define R_UBICOM32_GNU_VTENTRY 201
-+
-+/* Ubicom32 Flags. */
-+#define EF_UBICOM32_V3 0x00000001 /* -fmarch=ubicom32v3 */
-+#define EF_UBICOM32_V4 0x00000002 /* -fmarch=ubicom32v4 */
-+#define EF_UBICOM32_PIC 0x80000000 /* -fpic */
-+#define EF_UBICOM32_FDPIC 0x40000000 /* -mfdpic */
-+
- __END_DECLS
-
- #endif /* elf.h */
---- a/include/features.h
-+++ b/include/features.h
-@@ -422,4 +422,10 @@ uClibc was built without large file supp
- # define __linux__ 1
- #endif
-
-+#ifndef libc_hidden_proto
-+#define libc_hidden_proto(name, attrs...)
-+#endif
-+#ifndef libm_hidden_proto
-+#define libm_hidden_proto(name, attrs...)
-+#endif
- #endif /* features.h */
---- a/ldso/ldso/dl-startup.c
-+++ b/ldso/ldso/dl-startup.c
-@@ -165,10 +165,13 @@ DL_START(unsigned long args)
- aux_dat += 2;
- }
-
-+#if !defined __FDPIC__
- /* locate the ELF header. We need this done as soon as possible
- * (esp since SEND_STDERR() needs this on some platforms... */
- if (!auxvt[AT_BASE].a_un.a_val)
- auxvt[AT_BASE].a_un.a_val = elf_machine_load_address();
-+#endif
-+
- DL_INIT_LOADADDR_BOOT(load_addr, auxvt[AT_BASE].a_un.a_val);
- header = (ElfW(Ehdr) *) auxvt[AT_BASE].a_un.a_val;
-
---- a/ldso/ldso/ldso.c
-+++ b/ldso/ldso/ldso.c
-@@ -179,10 +179,12 @@ void _dl_get_ready_to_run(struct elf_res
- _dl_progname = argv[0];
- }
-
-+#if 0 // blackfin does this, we do to avoid die during reloc
- if (_start == (void *) auxvt[AT_ENTRY].a_un.a_val) {
- _dl_dprintf(_dl_debug_file, "Standalone execution is not supported yet\n");
- _dl_exit(1);
- }
-+#endif
-
- /* Start to build the tables of the modules that are required for
- * this beast to run. We start with the basic executable, and then
---- /dev/null
-+++ b/ldso/ldso/ubicom32/dl-debug.h
-@@ -0,0 +1,72 @@
-+/* vi: set sw=4 ts=4: */
-+/* Ubicom32 ELF shared library loader suppport
-+ *
-+ * Copyright (c) 2009 Ubicom Inc.
-+ * Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald,
-+ * David Engel, Hongjiu Lu and Mitch D'Souza
-+ * Copyright (C) 2001-2004 Erik Andersen
-+ *
-+ * All rights reserved.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ * 1. Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions and the following disclaimer.
-+ * 2. The name of the above contributors may not be
-+ * used to endorse or promote products derived from this software
-+ * without specific prior written permission.
-+ *
-+ * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
-+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-+ * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE
-+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-+ * SUCH DAMAGE.
-+ */
-+
-+static const char *_dl_reltypes_tab[] =
-+{
-+ "R_UBICOM32_NONE", /* 0 */
-+ "R_UBICOM32_16",
-+ "R_UBICOM32_32",
-+ "R_UBICOM32_LO16",
-+ "R_UBICOM32_HI16",
-+ "R_UBICOM32_21_PCREL", /* 5 */
-+ "R_UBICOM32_24_PCREL",
-+ "R_UBICOM32_HI24",
-+ "R_UBICOM32_LO7_S",
-+ "R_UBICOM32_LO7_2_S",
-+ "R_UBICOM32_LO7_4_S", /* 10 */
-+ "R_UBICOM32_LO7_D",
-+ "R_UBICOM32_LO7_2_D",
-+ "R_UBICOM32_LO7_4_D",
-+ "R_UBICOM32_32_HARVARD",
-+ "R_UBICOM32_LO7_CALLI", /* 15 */
-+ "R_UBICOM32_LO16_CALLI",
-+ "R_UBICOM32_GOT_HI24",
-+ "R_UBICOM32_GOT_LO7_S",
-+ "R_UBICOM32_GOT_LO7_2_S"
-+ "R_UBICOM32_GOT_LO7_4_S", /* 20 */
-+ "R_UBICOM32_GOT_LO7_D",
-+ "R_UBICOM32_GOT_LO7_2_D",
-+ "R_UBICOM32_GOT_LO7_4_D",
-+ "R_UBICOM32_FUNCDESC_GOT_HI24 24",
-+ "R_UBICOM32_FUNCDESC_GOT_LO7_S", /* 25 */
-+ "R_UBICOM32_FUNCDESC_GOT_LO7_2_S",
-+ "R_UBICOM32_FUNCDESC_GOT_LO7_4_S",
-+ "R_UBICOM32_FUNCDESC_GOT_LO7_D",
-+ "R_UBICOM32_FUNCDESC_GOT_LO7_2_D",
-+ "R_UBICOM32_FUNCDESC_GOT_LO7_4_D", /* 30 */
-+ "R_UBICOM32_GOT_LO7_CALLI",
-+ "R_UBICOM32_FUNCDESC_VALUE",
-+ "R_UBICOM32_FUNCDESC",
-+#if 1
-+ [200] "R_UBICOM32_GNU_VTINHERIT" , "R_UBICOM32_GNU_VTENTRY"
-+#endif
-+};
---- /dev/null
-+++ b/ldso/ldso/ubicom32/dl-inlines.h
-@@ -0,0 +1,582 @@
-+ /* Copyright (C) 2003, 2004 Red Hat, Inc.
-+ Contributed by Alexandre Oliva <aoliva@redhat.com>
-+
-+This file is part of uClibc.
-+
-+uClibc 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.
-+
-+uClibc 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
-+Library General Public License for more details.
-+
-+You should have received a copy of the GNU Lesser General Public
-+License along with uClibc; see the file COPYING.LIB. If not, write to
-+the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
-+USA. */
-+
-+//#include <bfin_sram.h>
-+#define SRAM_TEST(x) 0
-+#ifndef _dl_assert
-+# define _dl_assert(expr)
-+#endif
-+
-+/* Initialize a DL_LOADADDR_TYPE given a got pointer and a complete
-+ load map. */
-+static __always_inline void
-+__dl_init_loadaddr_map (struct elf32_fdpic_loadaddr *loadaddr, Elf32_Addr dl_boot_got_pointer,
-+ struct elf32_fdpic_loadmap *map)
-+{
-+ if (map->version != 0)
-+ {
-+ SEND_EARLY_STDERR ("Invalid loadmap version number\n");
-+ _dl_exit(-1);
-+ }
-+ if (map->nsegs == 0)
-+ {
-+ SEND_EARLY_STDERR ("Invalid segment count in loadmap\n");
-+ _dl_exit(-1);
-+ }
-+ loadaddr->got_value = (void*)dl_boot_got_pointer;
-+ loadaddr->map = map;
-+}
-+
-+/* Figure out how many LOAD segments there are in the given headers,
-+ and allocate a block for the load map big enough for them.
-+ got_value will be properly initialized later on, with INIT_GOT. */
-+static __always_inline int
-+__dl_init_loadaddr (struct elf32_fdpic_loadaddr *loadaddr, Elf32_Phdr *ppnt,
-+ int pcnt)
-+{
-+ int count = 0, i;
-+ size_t size;
-+
-+ for (i = 0; i < pcnt; i++)
-+ if (ppnt[i].p_type == PT_LOAD)
-+ count++;
-+
-+ loadaddr->got_value = 0;
-+
-+ size = sizeof (struct elf32_fdpic_loadmap)
-+ + sizeof (struct elf32_fdpic_loadseg) * count;
-+ loadaddr->map = _dl_malloc (size);
-+ if (! loadaddr->map)
-+ _dl_exit (-1);
-+
-+ loadaddr->map->version = 0;
-+ loadaddr->map->nsegs = 0;
-+
-+ return count;
-+}
-+
-+#if defined (__SUPPORT_LD_DEBUG__)
-+extern char *_dl_debug;
-+extern int _dl_debug_file;
-+#endif
-+
-+/* Incrementally initialize a load map. */
-+static __always_inline void
-+__dl_init_loadaddr_hdr (struct elf32_fdpic_loadaddr loadaddr, void *addr,
-+ Elf32_Phdr *phdr, int maxsegs)
-+{
-+ struct elf32_fdpic_loadseg *segdata;
-+
-+ if (loadaddr.map->nsegs == maxsegs)
-+ _dl_exit (-1);
-+
-+ segdata = &loadaddr.map->segs[loadaddr.map->nsegs++];
-+ segdata->addr = (Elf32_Addr) addr;
-+ segdata->p_vaddr = phdr->p_vaddr;
-+ segdata->p_memsz = phdr->p_memsz;
-+
-+#if defined (__SUPPORT_LD_DEBUG__)
-+ {
-+ if (_dl_debug)
-+ _dl_dprintf(_dl_debug_file, "%i: mapped %x at %x, size %x\n",
-+ loadaddr.map->nsegs-1,
-+ segdata->p_vaddr, segdata->addr, segdata->p_memsz);
-+ }
-+#endif
-+}
-+
-+static __always_inline void __dl_loadaddr_unmap
-+(struct elf32_fdpic_loadaddr loadaddr, struct funcdesc_ht *funcdesc_ht);
-+
-+/* Figure out whether the given address is in one of the mapped
-+ segments. */
-+static __always_inline int
-+__dl_addr_in_loadaddr (void *p, struct elf32_fdpic_loadaddr loadaddr)
-+{
-+ struct elf32_fdpic_loadmap *map = loadaddr.map;
-+ int c;
-+
-+ for (c = 0; c < map->nsegs; c++)
-+ if ((void*)map->segs[c].addr <= p
-+ && (char*)p < (char*)map->segs[c].addr + map->segs[c].p_memsz)
-+ return 1;
-+
-+ return 0;
-+}
-+
-+static __always_inline void * _dl_funcdesc_for (void *entry_point, void *got_value);
-+
-+/* The hashcode handling code below is heavily inspired in libiberty's
-+ hashtab code, but with most adaptation points and support for
-+ deleting elements removed.
-+
-+ Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
-+ Contributed by Vladimir Makarov (vmakarov@cygnus.com). */
-+
-+static __always_inline unsigned long
-+higher_prime_number (unsigned long n)
-+{
-+ /* These are primes that are near, but slightly smaller than, a
-+ power of two. */
-+ static const unsigned long primes[] = {
-+ (unsigned long) 7,
-+ (unsigned long) 13,
-+ (unsigned long) 31,
-+ (unsigned long) 61,
-+ (unsigned long) 127,
-+ (unsigned long) 251,
-+ (unsigned long) 509,
-+ (unsigned long) 1021,
-+ (unsigned long) 2039,
-+ (unsigned long) 4093,
-+ (unsigned long) 8191,
-+ (unsigned long) 16381,
-+ (unsigned long) 32749,
-+ (unsigned long) 65521,
-+ (unsigned long) 131071,
-+ (unsigned long) 262139,
-+ (unsigned long) 524287,
-+ (unsigned long) 1048573,
-+ (unsigned long) 2097143,
-+ (unsigned long) 4194301,
-+ (unsigned long) 8388593,
-+ (unsigned long) 16777213,
-+ (unsigned long) 33554393,
-+ (unsigned long) 67108859,
-+ (unsigned long) 134217689,
-+ (unsigned long) 268435399,
-+ (unsigned long) 536870909,
-+ (unsigned long) 1073741789,
-+ (unsigned long) 2147483647,
-+ /* 4294967291L */
-+ ((unsigned long) 2147483647) + ((unsigned long) 2147483644),
-+ };
-+
-+ const unsigned long *low = &primes[0];
-+ const unsigned long *high = &primes[sizeof(primes) / sizeof(primes[0])];
-+
-+ while (low != high)
-+ {
-+ const unsigned long *mid = low + (high - low) / 2;
-+ if (n > *mid)
-+ low = mid + 1;
-+ else
-+ high = mid;
-+ }
-+
-+#if 0
-+ /* If we've run out of primes, abort. */
-+ if (n > *low)
-+ {
-+ fprintf (stderr, "Cannot find prime bigger than %lu\n", n);
-+ abort ();
-+ }
-+#endif
-+
-+ return *low;
-+}
-+
-+struct funcdesc_ht
-+{
-+ /* Table itself. */
-+ struct funcdesc_value **entries;
-+
-+ /* Current size (in entries) of the hash table */
-+ size_t size;
-+
-+ /* Current number of elements. */
-+ size_t n_elements;
-+};
-+
-+static __always_inline int
-+hash_pointer (const void *p)
-+{
-+ return (int) ((long)p >> 3);
-+}
-+
-+static __always_inline struct funcdesc_ht *
-+htab_create (void)
-+{
-+ struct funcdesc_ht *ht = _dl_malloc (sizeof (struct funcdesc_ht));
-+
-+ if (! ht)
-+ return NULL;
-+ ht->size = 3;
-+ ht->entries = _dl_malloc (sizeof (struct funcdesc_ht_value *) * ht->size);
-+ if (! ht->entries)
-+ return NULL;
-+
-+ ht->n_elements = 0;
-+
-+ _dl_memset (ht->entries, 0, sizeof (struct funcdesc_ht_value *) * ht->size);
-+
-+ return ht;
-+}
-+
-+/* This is only called from _dl_loadaddr_unmap, so it's safe to call
-+ _dl_free(). See the discussion below. */
-+static __always_inline void
-+htab_delete (struct funcdesc_ht *htab)
-+{
-+ int i;
-+
-+ for (i = htab->size - 1; i >= 0; i--)
-+ if (htab->entries[i])
-+ _dl_free (htab->entries[i]);
-+
-+ _dl_free (htab->entries);
-+ _dl_free (htab);
-+}
-+
-+/* Similar to htab_find_slot, but without several unwanted side effects:
-+ - Does not call htab->eq_f when it finds an existing entry.
-+ - Does not change the count of elements/searches/collisions in the
-+ hash table.
-+ This function also assumes there are no deleted entries in the table.
-+ HASH is the hash value for the element to be inserted. */
-+
-+static __always_inline struct funcdesc_value **
-+find_empty_slot_for_expand (struct funcdesc_ht *htab, int hash)
-+{
-+ size_t size = htab->size;
-+ unsigned int index = hash % size;
-+ struct funcdesc_value **slot = htab->entries + index;
-+ int hash2;
-+
-+ if (! *slot)
-+ return slot;
-+
-+ hash2 = 1 + hash % (size - 2);
-+ for (;;)
-+ {
-+ index += hash2;
-+ if (index >= size)
-+ index -= size;
-+
-+ slot = htab->entries + index;
-+ if (! *slot)
-+ return slot;
-+ }
-+}
-+
-+/* The following function changes size of memory allocated for the
-+ entries and repeatedly inserts the table elements. The occupancy
-+ of the table after the call will be about 50%. Naturally the hash
-+ table must already exist. Remember also that the place of the
-+ table entries is changed. If memory allocation failures are allowed,
-+ this function will return zero, indicating that the table could not be
-+ expanded. If all goes well, it will return a non-zero value. */
-+
-+static __always_inline int
-+htab_expand (struct funcdesc_ht *htab)
-+{
-+ struct funcdesc_value **oentries;
-+ struct funcdesc_value **olimit;
-+ struct funcdesc_value **p;
-+ struct funcdesc_value **nentries;
-+ size_t nsize;
-+
-+ oentries = htab->entries;
-+ olimit = oentries + htab->size;
-+
-+ /* Resize only when table after removal of unused elements is either
-+ too full or too empty. */
-+ if (htab->n_elements * 2 > htab->size)
-+ nsize = higher_prime_number (htab->n_elements * 2);
-+ else
-+ nsize = htab->size;
-+
-+ nentries = _dl_malloc (sizeof (struct funcdesc_value *) * nsize);
-+ _dl_memset (nentries, 0, sizeof (struct funcdesc_value *) * nsize);
-+ if (nentries == NULL)
-+ return 0;
-+ htab->entries = nentries;
-+ htab->size = nsize;
-+
-+ p = oentries;
-+ do
-+ {
-+ if (*p)
-+ *find_empty_slot_for_expand (htab, hash_pointer ((*p)->entry_point))
-+ = *p;
-+
-+ p++;
-+ }
-+ while (p < olimit);
-+
-+#if 0 /* We can't tell whether this was allocated by the _dl_malloc()
-+ built into ld.so or malloc() in the main executable or libc,
-+ and calling free() for something that wasn't malloc()ed could
-+ do Very Bad Things (TM). Take the conservative approach
-+ here, potentially wasting as much memory as actually used by
-+ the hash table, even if multiple growths occur. That's not
-+ so bad as to require some overengineered solution that would
-+ enable us to keep track of how it was allocated. */
-+ _dl_free (oentries);
-+#endif
-+ return 1;
-+}
-+
-+/* This function searches for a hash table slot containing an entry
-+ equal to the given element. To delete an entry, call this with
-+ INSERT = 0, then call htab_clear_slot on the slot returned (possibly
-+ after doing some checks). To insert an entry, call this with
-+ INSERT = 1, then write the value you want into the returned slot.
-+ When inserting an entry, NULL may be returned if memory allocation
-+ fails. */
-+
-+static __always_inline struct funcdesc_value **
-+htab_find_slot (struct funcdesc_ht *htab, void *ptr, int insert)
-+{
-+ unsigned int index;
-+ int hash, hash2;
-+ size_t size;
-+ struct funcdesc_value **entry;
-+
-+ if (htab->size * 3 <= htab->n_elements * 4
-+ && htab_expand (htab) == 0)
-+ return NULL;
-+
-+ hash = hash_pointer (ptr);
-+
-+ size = htab->size;
-+ index = hash % size;
-+
-+ entry = &htab->entries[index];
-+ if (!*entry)
-+ goto empty_entry;
-+ else if ((*entry)->entry_point == ptr)
-+ return entry;
-+
-+ hash2 = 1 + hash % (size - 2);
-+ for (;;)
-+ {
-+ index += hash2;
-+ if (index >= size)
-+ index -= size;
-+
-+ entry = &htab->entries[index];
-+ if (!*entry)
-+ goto empty_entry;
-+ else if ((*entry)->entry_point == ptr)
-+ return entry;
-+ }
-+
-+ empty_entry:
-+ if (!insert)
-+ return NULL;
-+
-+ htab->n_elements++;
-+ return entry;
-+}
-+
-+void *
-+_dl_funcdesc_for (void *entry_point, void *got_value)
-+{
-+ struct elf_resolve *tpnt = ((void**)got_value)[2];
-+ struct funcdesc_ht *ht = tpnt->funcdesc_ht;
-+ struct funcdesc_value **entry;
-+
-+ _dl_assert (got_value == tpnt->loadaddr.got_value);
-+
-+ if (! ht)
-+ {
-+ ht = htab_create ();
-+ if (! ht)
-+ return (void*)-1;
-+ tpnt->funcdesc_ht = ht;
-+ }
-+
-+ entry = htab_find_slot (ht, entry_point, 1);
-+ if (*entry)
-+ {
-+ _dl_assert ((*entry)->entry_point == entry_point);
-+ return _dl_stabilize_funcdesc (*entry);
-+ }
-+
-+ *entry = _dl_malloc (sizeof (struct funcdesc_value));
-+ (*entry)->entry_point = entry_point;
-+ (*entry)->got_value = got_value;
-+
-+ return _dl_stabilize_funcdesc (*entry);
-+}
-+
-+static __always_inline void const *
-+_dl_lookup_address (void const *address)
-+{
-+ struct elf_resolve *rpnt;
-+ struct funcdesc_value const *fd;
-+
-+ /* Make sure we don't make assumptions about its alignment. */
-+ __asm__ ("" : "+r" (address));
-+
-+ if ((Elf32_Addr)address & 7)
-+ /* It's not a function descriptor. */
-+ return address;
-+
-+ fd = (struct funcdesc_value const *)address;
-+
-+ for (rpnt = _dl_loaded_modules; rpnt; rpnt = rpnt->next)
-+ {
-+ if (! rpnt->funcdesc_ht)
-+ continue;
-+
-+ if (fd->got_value != rpnt->loadaddr.got_value)
-+ continue;
-+
-+ address = htab_find_slot (rpnt->funcdesc_ht, (void*)fd->entry_point, 0);
-+
-+ if (address && *(struct funcdesc_value *const*)address == fd)
-+ {
-+ address = (*(struct funcdesc_value *const*)address)->entry_point;
-+ break;
-+ }
-+ else
-+ address = fd;
-+ }
-+
-+ return address;
-+}
-+
-+void
-+__dl_loadaddr_unmap (struct elf32_fdpic_loadaddr loadaddr,
-+ struct funcdesc_ht *funcdesc_ht)
-+{
-+ int i;
-+
-+ for (i = 0; i < loadaddr.map->nsegs; i++)
-+ {
-+ struct elf32_fdpic_loadseg *segdata;
-+ ssize_t offs;
-+ segdata = loadaddr.map->segs + i;
-+
-+#if 0 /* SRAM */
-+ /* FIXME:
-+ A more cleaner way is to add type for struct elf32_fdpic_loadseg,
-+ and release the memory according to the type.
-+ Currently, we hardcode the memory address of L1 SRAM. */
-+ if ((segdata->addr & 0xff800000) == 0xff800000)
-+ {
-+ _dl_sram_free ((void *)segdata->addr);
-+ continue;
-+ }
-+#endif
-+ offs = (segdata->p_vaddr & ADDR_ALIGN);
-+ _dl_munmap ((void*)segdata->addr - offs,
-+ segdata->p_memsz + offs);
-+ }
-+ /* _dl_unmap is only called for dlopen()ed libraries, for which
-+ calling free() is safe, or before we've completed the initial
-+ relocation, in which case calling free() is probably pointless,
-+ but still safe. */
-+ _dl_free (loadaddr.map);
-+ if (funcdesc_ht)
-+ htab_delete (funcdesc_ht);
-+}
-+
-+#if 0 /* XXX TODO will look at enabling this if we decide to add support for OCM
-+ * code/data */
-+// OLD BLACKFIN CODE
-+static __always_inline int
-+__dl_is_special_segment (Elf32_Ehdr *epnt,
-+ Elf32_Phdr *ppnt)
-+{
-+ if (ppnt->p_type != PT_LOAD)
-+ return 0;
-+
-+ if ((epnt->e_flags & EF_BFIN_CODE_IN_L1)
-+ && !(ppnt->p_flags & PF_W)
-+ && (ppnt->p_flags & PF_X))
-+ return 1;
-+
-+ if ((epnt->e_flags & EF_BFIN_DATA_IN_L1)
-+ && (ppnt->p_flags & PF_W)
-+ && !(ppnt->p_flags & PF_X))
-+ return 1;
-+
-+ /* 0xff700000, 0xff800000, 0xff900000 and 0xffa00000 are also used in
-+ GNU ld and linux kernel. They need to be keep synchronized. */
-+ if (ppnt->p_vaddr == 0xff700000
-+ || ppnt->p_vaddr == 0xff800000
-+ || ppnt->p_vaddr == 0xff900000
-+ || ppnt->p_vaddr == 0xffa00000)
-+ return 1;
-+
-+ return 0;
-+}
-+
-+static __always_inline char *
-+__dl_map_segment (Elf32_Ehdr *epnt,
-+ Elf32_Phdr *ppnt,
-+ int infile,
-+ int flags)
-+{
-+ char *status, *tryaddr, *l1addr;
-+ size_t size;
-+
-+
-+ if (((epnt->e_flags & EF_BFIN_CODE_IN_L1) || ppnt->p_vaddr == 0xffa00000)
-+ && !(ppnt->p_flags & PF_W)
-+ && (ppnt->p_flags & PF_X)) {
-+ status = (char *) _dl_mmap
-+ (tryaddr = 0,
-+ size = (ppnt->p_vaddr & ADDR_ALIGN) + ppnt->p_filesz,
-+ LXFLAGS(ppnt->p_flags),
-+ flags | MAP_EXECUTABLE | MAP_DENYWRITE,
-+ infile, ppnt->p_offset & OFFS_ALIGN);
-+ if (_dl_mmap_check_error(status)
-+ || (tryaddr && tryaddr != status))
-+ return NULL;
-+ l1addr = (char *) _dl_sram_alloc (ppnt->p_filesz, L1_INST_SRAM);
-+ if (l1addr != NULL)
-+ _dl_dma_memcpy (l1addr, status + (ppnt->p_vaddr & ADDR_ALIGN), ppnt->p_filesz);
-+ _dl_munmap (status, size);
-+ if (l1addr == NULL)
-+ _dl_dprintf(2, "%s:%i: L1 allocation failed\n", _dl_progname, __LINE__);
-+ return l1addr;
-+ }
-+
-+ if (((epnt->e_flags & EF_BFIN_DATA_IN_L1)
-+ || ppnt->p_vaddr == 0xff700000
-+ || ppnt->p_vaddr == 0xff800000
-+ || ppnt->p_vaddr == 0xff900000)
-+ && (ppnt->p_flags & PF_W)
-+ && !(ppnt->p_flags & PF_X)) {
-+ if (ppnt->p_vaddr == 0xff800000)
-+ l1addr = (char *) _dl_sram_alloc (ppnt->p_memsz, L1_DATA_A_SRAM);
-+ else if (ppnt->p_vaddr == 0xff900000)
-+ l1addr = (char *) _dl_sram_alloc (ppnt->p_memsz, L1_DATA_B_SRAM);
-+ else
-+ l1addr = (char *) _dl_sram_alloc (ppnt->p_memsz, L1_DATA_SRAM);
-+ if (l1addr == NULL) {
-+ _dl_dprintf(2, "%s:%i: L1 allocation failed\n", _dl_progname, __LINE__);
-+ } else {
-+ if (_DL_PREAD (infile, l1addr, ppnt->p_filesz, ppnt->p_offset) != ppnt->p_filesz) {
-+ _dl_sram_free (l1addr);
-+ return NULL;
-+ }
-+ if (ppnt->p_filesz < ppnt->p_memsz)
-+ _dl_memset (l1addr + ppnt->p_filesz, 0, ppnt->p_memsz - ppnt->p_filesz);
-+ }
-+ return l1addr;
-+ }
-+ return 0;
-+}
-+#endif
---- /dev/null
-+++ b/ldso/ldso/ubicom32/dl-startup.h
-@@ -0,0 +1,232 @@
-+/*
-+ Copyright (C) 2009 Ubicom, Inc.
-+ Copyright (C) 2003 Red Hat, Inc.
-+ Contributed by Alexandre Oliva <aoliva@redhat.com>
-+
-+This file is part of uClibc.
-+
-+uClibc 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.
-+
-+uClibc 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
-+Library General Public License for more details.
-+
-+You should have received a copy of the GNU Lesser General Public
-+License along with uClibc; see the file COPYING.LIB. If not, write to
-+the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
-+USA. */
-+
-+/* Any assembly language/system dependent hacks needed to setup
-+ * boot1.c so it will work as expected and cope with whatever platform
-+ * specific wierdness is needed for this architecture.
-+
-+ * We override the default _dl_boot function, and replace it with a
-+ * bit of asm. Then call the real _dl_boot function, which is now
-+ * named _dl_boot2. */
-+
-+/* At program start-up, p0 contains a pointer to a
-+ elf32_fdpic_loadmap that describes how the executable was loaded
-+ into memory. p1 contains a pointer to the interpreter (our!)
-+ loadmap, if there is an interpreter, or 0 if we're being run as an
-+ executable. p2 holds a pointer to the interpreter's dynamic
-+ section, if there is an interpreter, or to the executable's dynamic
-+ section, otherwise. If the executable is not dynamic, gr18 is 0.
-+
-+ We rely on the fact that the linker adds a pointer to the
-+ _GLOBAL_OFFSET_TABLE_ as the last ROFIXUP entry, and that
-+ __self_reloc returns the relocated pointer to us, so that we can
-+ use this value to initialize the PIC register. */
-+
-+
-+/*
-+ * _dl_boot is the entry point for ldso.
-+ *
-+ * The kernel leaves the main apps args on the stack (positive offsets), and
-+ * communicates the load maps as follows
-+ *
-+ * - d1 is set to the exec_map_addr (struct elf32_fdpic_loadmap *), which is the
-+ * current state of the mapped application.
-+ *
-+ * - d2 is set to interp_map_addr (struct elf32_fdpic_loadmap *), which is use
-+ * by ldso to relocate itself.
-+ *
-+ * - d3 is dynamic_addr which as far as I can tell is the stack pointer.
-+ *
-+ * - a1 is set to zero and will later be initialised to ldso _dl_fini funcdesc
-+ */
-+
-+__asm__(
-+ " .text \n\t"
-+ " .global _start \n\t"
-+ " .type _start,@function \n\t"
-+ "_start:\n\t"
-+ /*
-+ * Jump to .Lcall storing the location .Lcall in a5
-+ */
-+ " call a5, .Lcall \n\t"
-+ ".Lcall: \n\t"
-+ /*
-+ * Reserve and Push inputs to stack.
-+ * 32 byte stack layout as follows
-+ * offset 0 exec_map_addr
-+ * 4 interp_map_addr
-+ * 8 dynamic_addr
-+ * 12 not used
-+ * 16 dl_main_funcdesc structure for _dl_boot
-+ * (12 bytes sizeof funcdesc_value)
-+ * 28 reserved
-+ * 32 start of &original stack
-+ */
-+ " pdec sp, 32(sp); reserve stack space \n\t"
-+ " move.4 0(sp), d1 ; exec_map_addr \n\t"
-+ " move.4 4(sp), d2 ; interp_map_addr \n\t"
-+ " move.4 8(sp), d3; dynamic_addr \n\t"
-+
-+ /*
-+ * Load linker version of .Lcall in to d0
-+ */
-+ " moveai a3, #%hi(.Lcall) \n\t"
-+ " lea.1 d0, %lo(.Lcall)(a3) \n\t"
-+
-+ /*
-+ * Determine the offset from loaded .Lcall and put it in d0.
-+ */
-+ " sub.4 d0, a5, d0 \n\t"
-+
-+ /*
-+ * Load linker version of __ROFIXUP_LIST__ and __ROFIXUP_END__ in to d1
-+ * and d2.
-+ */
-+ " moveai a3, #%hi(__ROFIXUP_LIST__) \n\t"
-+ " lea.1 d1, %lo(__ROFIXUP_LIST__)(a3) \n\t"
-+ " moveai a3, #%hi(__ROFIXUP_END__) \n\t"
-+ " lea.1 d2, %lo(__ROFIXUP_END__)(a3) \n\t"
-+ /*
-+ * Use offset determined above to find the loaded versions.
-+ */
-+ " add.4 d1, d1, d0 \n\t"
-+ " add.4 d2, d2, d0 \n\t"
-+
-+ /*
-+ * Load interp_map_addr into d0, if interp_map_addr is null use
-+ * exec_map_addr.
-+ */
-+ " move.4 d0, 4(sp) ; load interp_map_addr \n\t"
-+ " cmpi d0, #0 \n\t"
-+ " jmpne.f 1f \n\t"
-+ " move.4 d0, 0(sp) ; load exec_map_addr \n\t"
-+
-+ /*
-+ * call __self_reloc(map, void ***p, void ***e)
-+ * it returns the the GOT in d0.
-+ */
-+ "1: call a5, __self_reloc ; returns a0 in d0 \n\t"
-+ " move.4 a0, d0 ; set GOT \n\t"
-+ " move.4 a2, d0 ; save GOT \n\t"
-+
-+ /*
-+ * now setup to call
-+ * _dl_start (Elf32_Addr dl_boot_got_pointer, (d0)
-+ * struct elf32_fdpic_loadmap *dl_boot_progmap, (d1)
-+ * struct elf32_fdpic_loadmap *dl_boot_ldsomap, (d2)
-+ * Elf32_Dyn *dl_boot_ldso_dyn_pointer, (d3)
-+ * struct funcdesc_value *dl_main_funcdesc, (d4)
-+ * unsigned long args (d5)
-+ *
-+ * NOTE: for dl_main_funcdesc we reserved space on the stack for this
-+ * structure.
-+ */
-+ " move.4 d1, 0(sp) ; d1 = exec_map_addr \n\t"
-+ " move.4 d2, 4(sp) ; d2 = interp_map_addr \n\t"
-+ " move.4 d3, 8(sp) ; d3 = dynamic_addr \n\t"
-+ " lea.1 d4, 16(sp) ; d4 = &dl_main_funcdesc \n\t"
-+ " lea.1 d5, 32(sp) ; d5 = original stack ptr (args)\n\t"
-+ " call a5, _dl_start \n\t"
-+
-+ /*
-+ * Setup to call the main entry point, starting with passing our FINI
-+ * ptr() to the user in a1 (remember we saved the got in a2)
-+ */
-+ " movei d15, #%got_funcdesc_lo(_dl_fini) \n\t"
-+ " move.4 a1, (a2, d15) \n\t"
-+
-+ /*
-+ * restore the load map from the kernel.
-+ */
-+ " move.4 d1, 0(sp) ; restore exec_map_addr \n\t"
-+ " move.4 d2, 4(sp) ; restore interp_map_addr \n\t"
-+ " move.4 d3, 8(sp) ; restore dynamic_addr \n\t"
-+
-+ /*
-+ * _dl_start returned the main apps entry point in dl_main_funcdesc,
-+ * load that information now.
-+ */
-+ " move.4 a5, 16(sp) ; a5 = dl_main_funcdesc.entry_point \n\t"
-+ " move.4 a0, 20(sp) ; a0 = dl_main_funcdesc.got_value \n\t"
-+ " lea.1 sp, 32(sp); restore original stack ptr (args) \n\t"
-+ " calli a5, 0(a5) \n\t"
-+ " bkpt -1; should never get here \n\t"
-+ " .size _start, . - _start \n\t"
-+);
-+
-+#undef DL_START
-+#define DL_START(X) \
-+static void __attribute__ ((used)) \
-+_dl_start (Elf32_Addr dl_boot_got_pointer, \
-+ struct elf32_fdpic_loadmap *dl_boot_progmap, \
-+ struct elf32_fdpic_loadmap *dl_boot_ldsomap, \
-+ Elf32_Dyn *dl_boot_ldso_dyn_pointer, \
-+ struct funcdesc_value *dl_main_funcdesc, \
-+ X)
-+
-+struct elf32_fdpic_loadmap;
-+
-+/*
-+ * Get a pointer to the argv array. On many platforms this can be just
-+ * the address if the first argument, on other platforms we need to
-+ * do something a little more subtle here.
-+ */
-+#define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long*) ARGS) + 1)
-+
-+/*
-+ * Here is a macro to perform a relocation. This is only used when
-+ * bootstrapping the dynamic loader. RELP is the relocation that we
-+ * are performing, REL is the pointer to the address we are relocating.
-+ * SYMBOL is the symbol involved in the relocation, and LOAD is the
-+ * load address.
-+ */
-+#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \
-+ switch(ELF32_R_TYPE((RELP)->r_info)){ \
-+ case R_UBICOM32_32: \
-+ *(REL) += (SYMBOL); \
-+ break; \
-+ case R_UBICOM32_FUNCDESC_VALUE: \
-+ { \
-+ struct funcdesc_value fv = { \
-+ (void*)((SYMBOL) + *(REL)), \
-+ (LOAD).got_value \
-+ }; \
-+ *(struct funcdesc_value volatile *)(REL) = fv; \
-+ break; \
-+ } \
-+ default: \
-+ _dl_exit(1); \
-+ }
-+
-+/*
-+ * Transfer control to the user's application, once the dynamic loader
-+ * is done. We return the address of the function's entry point to
-+ * _dl_boot, see boot1_arch.h.
-+ */
-+#define START() do { \
-+ struct elf_resolve *exec_mod = _dl_loaded_modules; \
-+ dl_main_funcdesc->entry_point = _dl_elf_main; \
-+ while (exec_mod->libtype != elf_executable) \
-+ exec_mod = exec_mod->next; \
-+ dl_main_funcdesc->got_value = exec_mod->loadaddr.got_value; \
-+ return; \
-+} while (0)
---- /dev/null
-+++ b/ldso/ldso/ubicom32/dl-syscalls.h
-@@ -0,0 +1,206 @@
-+/* Copyright (C) 2003, 2004 Red Hat, Inc.
-+ Contributed by Alexandre Oliva <aoliva@redhat.com>
-+
-+This file is part of uClibc.
-+
-+uClibc 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.
-+
-+uClibc 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
-+Library General Public License for more details.
-+
-+You should have received a copy of the GNU Lesser General Public
-+License along with uClibc; see the file COPYING.LIB. If not, write to
-+the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
-+USA. */
-+
-+/* We can't use the real errno in ldso, since it has not yet
-+ * been dynamicly linked in yet. */
-+#include "sys/syscall.h"
-+extern int _dl_errno;
-+#undef __set_errno
-+#define __set_errno(X) {(_dl_errno) = (X);}
-+#include <sys/mman.h>
-+
-+/* The code below is extracted from libc/sysdeps/linux/frv/_mmap.c */
-+
-+#if defined(DYNAMIC_LOADER_IN_SIMULATOR) && DYNAMIC_LOADER_IN_SIMULATOR
-+#define __NR___syscall_mmap2 __NR_mmap2
-+static __inline__ _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr,
-+ size_t, len, int, prot, int, flags, int, fd, off_t, offset);
-+
-+/* Make sure we don't get another definition of _dl_mmap from the
-+ machine-independent code. */
-+#undef __NR_mmap
-+#undef __NR_mmap2
-+
-+/* This is always 12, even on architectures where PAGE_SHIFT != 12. */
-+# ifndef MMAP2_PAGE_SHIFT
-+# define MMAP2_PAGE_SHIFT 12
-+# endif
-+
-+#include <bits/uClibc_page.h> /* for PAGE_SIZE */
-+static __always_inline void *_dl_memset(void*,int,size_t);
-+static __always_inline ssize_t _dl_pread(int fd, void *buf, size_t count, off_t offset);
-+
-+static __ptr_t
-+_dl_mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset)
-+{
-+ size_t plen = (len + PAGE_SIZE - 1) & -PAGE_SIZE;
-+
-+/* This is a hack to enable the dynamic loader to run within a
-+ simulator that doesn't support mmap, with a number of very ugly
-+ tricks. Also, it's not as useful as it sounds, since only dynamic
-+ executables without DT_NEEDED dependencies can be run. AFAIK, they
-+ can only be created with -pie. This trick suffices to enable the
-+ dynamic loader to obtain a blank page that it maps early in the
-+ bootstrap. */
-+ if ((flags & MAP_FIXED) == 0)
-+ {
-+ void *_dl_mmap_base = 0;
-+ __ptr_t *ret = 0;
-+
-+ if (! _dl_mmap_base)
-+ {
-+ void *stack;
-+ __asm__ ("mov sp, %0" : "=r" (stack));
-+ _dl_mmap_base = (void *)(((long)stack + 2 * PAGE_SIZE) & -PAGE_SIZE);
-+ retry:
-+ if (((void **)_dl_mmap_base)[0] == _dl_mmap_base
-+ && ((void **)_dl_mmap_base)[1023] == _dl_mmap_base
-+ && (((void **)_dl_mmap_base)[177]
-+ == ((void **)_dl_mmap_base)[771]))
-+ {
-+ while (((void**)_dl_mmap_base)[177])
-+ {
-+ _dl_mmap_base = ((void**)_dl_mmap_base)[177];
-+ if (!(((void **)_dl_mmap_base)[0] == _dl_mmap_base
-+ && ((void **)_dl_mmap_base)[1023] == _dl_mmap_base
-+ && (((void **)_dl_mmap_base)[177]
-+ == ((void**)_dl_mmap_base)[771])))
-+ ((void(*)())0)();
-+ }
-+ }
-+ else
-+ {
-+ int i;
-+ for (i = 0; i < (int)PAGE_SIZE; i++)
-+ if (*(char*)(_dl_mmap_base + i))
-+ break;
-+ if (i != PAGE_SIZE)
-+ {
-+ _dl_mmap_base = (void*)((long)_dl_mmap_base + PAGE_SIZE);
-+ goto retry;
-+ }
-+ ((void**)_dl_mmap_base)[-1] =
-+ ((void**)_dl_mmap_base)[0] =
-+ ((void**)_dl_mmap_base)[1023] =
-+ _dl_mmap_base;
-+ }
-+ }
-+
-+ if (_dl_mmap_base)
-+ {
-+ if (!(((void **)_dl_mmap_base)[0] == _dl_mmap_base
-+ && ((void **)_dl_mmap_base)[1023] == _dl_mmap_base
-+ && (((void **)_dl_mmap_base)[177]
-+ == ((void**)_dl_mmap_base)[771])))
-+ ((void(*)())0)();
-+ ret = (__ptr_t)((char*)_dl_mmap_base + PAGE_SIZE);
-+ _dl_mmap_base =
-+ ((void**)_dl_mmap_base)[177] =
-+ ((void**)_dl_mmap_base)[771] =
-+ (char*)_dl_mmap_base + plen + PAGE_SIZE;
-+ ((void**)_dl_mmap_base)[0] =
-+ ((void**)_dl_mmap_base)[1023] =
-+ _dl_mmap_base;
-+ }
-+
-+ if ((flags & MAP_ANONYMOUS) != 0)
-+ {
-+ _dl_memset (ret, 0, plen);
-+ return ret;
-+ }
-+
-+ flags |= MAP_FIXED;
-+ addr = ret;
-+ }
-+ if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)) {
-+#if 0
-+ __set_errno (EINVAL);
-+#endif
-+ return MAP_FAILED;
-+ }
-+ if ((flags & MAP_FIXED) != 0)
-+ {
-+ if (_dl_pread(fd, addr, len, offset) != (ssize_t)len)
-+ return (void*)MAP_FAILED;
-+ if (plen != len)
-+ _dl_memset (addr + len, 0, plen - len);
-+ return addr;
-+ }
-+ return(__syscall_mmap2(addr, len, prot, flags, fd, (off_t) (offset >> MMAP2_PAGE_SHIFT)));
-+}
-+#endif
-+
-+#ifdef __NR_pread64
-+#ifdef DYNAMIC_LOADER_IN_SIMULATOR
-+#include <unistd.h>
-+
-+#define __NR___syscall_lseek __NR_lseek
-+static __always_inline unsigned long _dl_read(int fd, const void *buf, unsigned long count);
-+
-+static __always_inline _syscall3(__off_t, __syscall_lseek, int, fd, __off_t, offset,
-+ int, whence);
-+static __always_inline ssize_t
-+_dl_pread(int fd, void *buf, size_t count, off_t offset)
-+{
-+ __off_t orig = __syscall_lseek (fd, 0, SEEK_CUR);
-+ ssize_t ret;
-+
-+ if (orig == -1)
-+ return -1;
-+
-+ if (__syscall_lseek (fd, offset, SEEK_SET) != offset)
-+ return -1;
-+
-+ ret = _dl_read (fd, buf, count);
-+
-+ if (__syscall_lseek (fd, orig, SEEK_SET) != orig)
-+ ((void(*)())0)();
-+
-+ return ret;
-+}
-+#else
-+#define __NR___syscall_pread __NR_pread64
-+static __always_inline _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf,
-+ size_t, count, off_t, offset_hi, off_t, offset_lo);
-+
-+static __always_inline ssize_t
-+_dl_pread(int fd, void *buf, size_t count, off_t offset)
-+{
-+ return(__syscall_pread(fd,buf,count,__LONG_LONG_PAIR (offset >> 31, offset)));
-+}
-+#endif
-+#endif
-+
-+#ifdef __NR_sram_alloc
-+#define __NR__dl_sram_alloc __NR_sram_alloc
-+static __always_inline _syscall2(__ptr_t, _dl_sram_alloc,
-+ size_t, len, unsigned long, flags);
-+#endif
-+
-+#ifdef __NR_sram_free
-+#define __NR__dl_sram_free __NR_sram_free
-+static __always_inline _syscall1(int, _dl_sram_free, __ptr_t, addr);
-+#endif
-+
-+#ifdef __NR_dma_memcpy
-+#define __NR__dl_dma_memcpy __NR_dma_memcpy
-+static __always_inline _syscall3(__ptr_t, _dl_dma_memcpy,
-+ __ptr_t, dest, __ptr_t, src, size_t, len);
-+#endif
---- /dev/null
-+++ b/ldso/ldso/ubicom32/dl-sysdep.h
-@@ -0,0 +1,243 @@
-+ /* Copyright (C) 2003, 2004 Red Hat, Inc.
-+ Contributed by Alexandre Oliva <aoliva@redhat.com>
-+ Based on ../i386/dl-sysdep.h
-+
-+This file is part of uClibc.
-+
-+uClibc 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.
-+
-+uClibc 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
-+Library General Public License for more details.
-+
-+You should have received a copy of the GNU Lesser General Public
-+License along with uClibc; see the file COPYING.LIB. If not, write to
-+the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
-+USA. */
-+
-+/*
-+ * Various assembly language/system dependent hacks that are required
-+ * so that we can minimize the amount of platform specific code.
-+ */
-+
-+/*
-+ * Define this if the system uses RELOCA.
-+ */
-+#undef ELF_USES_RELOCA
-+
-+/* JMPREL relocs are inside the DT_RELA table. */
-+#define ELF_MACHINE_PLTREL_OVERLAP
-+
-+#define DL_NO_COPY_RELOCS
-+
-+#define HAVE_DL_INLINES_H
-+
-+/*
-+ * Initialization sequence for a GOT. Copy the resolver function
-+ * descriptor and the pointer to the elf_resolve/link_map data
-+ * structure. Initialize the got_value in the module while at that.
-+ */
-+#define INIT_GOT(GOT_BASE,MODULE) \
-+{ \
-+ (MODULE)->loadaddr.got_value = (GOT_BASE); \
-+ GOT_BASE[0] = ((unsigned long *)&_dl_linux_resolve)[0]; \
-+ GOT_BASE[1] = ((unsigned long *)&_dl_linux_resolve)[1]; \
-+ GOT_BASE[2] = (unsigned long) MODULE; \
-+}
-+
-+/* Here we define the magic numbers that this dynamic loader should accept */
-+#define MAGIC1 EM_UBICOM32
-+#undef MAGIC2
-+
-+/* Used for error messages */
-+#define ELF_TARGET "UBICOM32"
-+
-+struct elf_resolve;
-+
-+struct funcdesc_value
-+{
-+ void *entry_point;
-+ void *got_value;
-+/*int relocation; not sure if this required, but it does exist */
-+};
-+
-+extern int _dl_linux_resolve(void) __attribute__((__visibility__("hidden")));
-+extern struct funcdesc_value volatile *__attribute__((__visibility__("hidden")))
-+ _dl_linux_resolver (struct elf_resolve *tpnt, int reloc_entry);
-+
-+/* 4KiB page alignment. Should perhaps be made dynamic using
-+ getpagesize(), based on AT_PAGESZ from auxvt? */
-+#define PAGE_ALIGN 0xfffff000
-+#define ADDR_ALIGN 0xfff
-+#define OFFS_ALIGN 0x7ffff000
-+
-+struct funcdesc_ht;
-+
-+/*
-+ * This asm does a quick relcation of string S (which is stored in the text
-+ * section as thats all we can use
-+ */
-+#undef SEND_EARLY_STDERR
-+#define SEND_EARLY_STDERR(S) \
-+do { \
-+ static const char __attribute__((section(".text"))) __s[] = (S); \
-+ const char *__p, *__scratch; \
-+ __asm__ ( \
-+ " call a3, 1f; \n\t" \
-+ "1: movei %0, #%%got_lo(1b) \n\t" \
-+ " move.4 %0, (%3, %0) \n\t" \
-+ " sub.4 %1, a3, %0; \n\t" \
-+ " add.4 %1, %1, %2; \n\t" \
-+ : "=&d" (__scratch), "=&d" (__p) \
-+ : "d" (__s), "a" (dl_boot_got_pointer) \
-+ : "a3", "a4", "d15"); \
-+ SEND_STDERR (__p); \
-+ { int __t; \
-+ for (__t = 0; __t < 0x100000; __t++) __asm__ __volatile__ (""); } \
-+} while (0)
-+
-+#define DL_LOADADDR_TYPE struct elf32_fdpic_loadaddr
-+
-+#define DL_RELOC_ADDR(LOADADDR, ADDR) \
-+ ((ElfW(Addr))__reloc_pointer ((void*)(ADDR), (LOADADDR).map))
-+
-+#define DL_ADDR_TO_FUNC_PTR(ADDR, LOADADDR) \
-+ ((void(*)(void)) _dl_funcdesc_for ((void*)(ADDR), (LOADADDR).got_value))
-+
-+#define _dl_stabilize_funcdesc(val) \
-+ ({ __asm__ ("" : "+m" (*(val))); (val); })
-+
-+#define DL_CALL_FUNC_AT_ADDR(ADDR, LOADADDR, SIGNATURE, ...) \
-+ ({ struct funcdesc_value fd = { (void*)(ADDR), (LOADADDR).got_value }; \
-+ void (*pf)(void) = (void*) _dl_stabilize_funcdesc (&fd); \
-+ (* SIGNATURE pf)(__VA_ARGS__); })
-+
-+#define DL_INIT_LOADADDR_BOOT(LOADADDR, BASEADDR) \
-+ (__dl_init_loadaddr_map (&(LOADADDR), dl_boot_got_pointer, \
-+ dl_boot_ldsomap ?: dl_boot_progmap))
-+
-+#define DL_INIT_LOADADDR_PROG(LOADADDR, BASEADDR) \
-+ (__dl_init_loadaddr_map (&(LOADADDR), 0, dl_boot_progmap))
-+
-+#define DL_INIT_LOADADDR_EXTRA_DECLS \
-+ int dl_init_loadaddr_load_count;
-+#define DL_INIT_LOADADDR(LOADADDR, BASEADDR, PHDR, PHDRCNT) \
-+ (dl_init_loadaddr_load_count = \
-+ __dl_init_loadaddr (&(LOADADDR), (PHDR), (PHDRCNT)))
-+#define DL_INIT_LOADADDR_HDR(LOADADDR, ADDR, PHDR) \
-+ (__dl_init_loadaddr_hdr ((LOADADDR), (ADDR), (PHDR), \
-+ dl_init_loadaddr_load_count))
-+#define DL_LOADADDR_UNMAP(LOADADDR, LEN) \
-+ (__dl_loadaddr_unmap ((LOADADDR), (NULL)))
-+#define DL_LIB_UNMAP(LIB, LEN) \
-+ (__dl_loadaddr_unmap ((LIB)->loadaddr, (LIB)->funcdesc_ht))
-+#define DL_LOADADDR_BASE(LOADADDR) \
-+ ((LOADADDR).got_value)
-+
-+/* This is called from dladdr(), such that we map a function
-+ descriptor's address to the function's entry point before trying to
-+ find in which library it's defined. */
-+#define DL_LOOKUP_ADDRESS(ADDRESS) (_dl_lookup_address (ADDRESS))
-+
-+#define DL_ADDR_IN_LOADADDR(ADDR, TPNT, TFROM) \
-+ (! (TFROM) && __dl_addr_in_loadaddr ((void*)(ADDR), (TPNT)->loadaddr))
-+
-+/*
-+ * Compute the GOT address. On several platforms, we use assembly
-+ * here. on FR-V FDPIC, there's no way to compute the GOT address,
-+ * since the offset between text and data is not fixed, so we arrange
-+ * for the assembly _dl_boot to pass this value as an argument to
-+ * _dl_boot. */
-+#define DL_BOOT_COMPUTE_GOT(got) ((got) = dl_boot_got_pointer)
-+
-+#define DL_BOOT_COMPUTE_DYN(dpnt, got, load_addr) \
-+ ((dpnt) = dl_boot_ldso_dyn_pointer)
-+
-+/* We only support loading FDPIC independently-relocatable shared
-+ libraries. It probably wouldn't be too hard to support loading
-+ shared libraries that require relocation by the same amount, but we
-+ don't know that they exist or would be useful, and the dynamic
-+ loader code could leak the whole-library map unless we keeping a
-+ bit more state for DL_LOADADDR_UNMAP and DL_LIB_UNMAP, so let's
-+ keep things simple for now. */
-+#define DL_CHECK_LIB_TYPE(epnt, piclib, _dl_progname, libname) \
-+do \
-+{ \
-+ if (((epnt)->e_flags & EF_UBICOM32_FDPIC) && ! ((epnt)->e_flags & EF_UBICOM32_PIC)) \
-+ (piclib) = 2; \
-+ else \
-+ { \
-+ _dl_internal_error_number = LD_ERROR_NOTDYN; \
-+ _dl_dprintf(2, "%s: '%s' is not an FDPIC shared library" \
-+ "\n", (_dl_progname), (libname)); \
-+ _dl_close(infile); \
-+ return NULL; \
-+ } \
-+\
-+} \
-+while (0)
-+
-+/* We want want to apply all relocations in the interpreter during
-+ bootstrap. Because of this, we have to skip the interpreter
-+ relocations in _dl_parse_relocation_information(), see
-+ elfinterp.c. */
-+#define DL_SKIP_BOOTSTRAP_RELOC(SYMTAB, INDEX, STRTAB) 0
-+
-+#ifdef __NR_pread64
-+#define _DL_PREAD(FD, BUF, SIZE, OFFSET) \
-+ (_dl_pread((FD), (BUF), (SIZE), (OFFSET)))
-+#endif
-+
-+/* We want to return to dlsym() a function descriptor if the symbol
-+ turns out to be a function. */
-+#define DL_FIND_HASH_VALUE(TPNT, TYPE_CLASS, SYM) \
-+ (((TYPE_CLASS) & ELF_RTYPE_CLASS_DLSYM) \
-+ && ELF32_ST_TYPE((SYM)->st_info) == STT_FUNC \
-+ ? _dl_funcdesc_for ((void *)DL_RELOC_ADDR ((TPNT)->loadaddr, (SYM)->st_value), \
-+ (TPNT)->loadaddr.got_value) \
-+ : DL_RELOC_ADDR ((TPNT)->loadaddr, (SYM)->st_value))
-+
-+#if 0 /* XXX TODO will look at enabling this if we decide to add support for OCM
-+ * code/data */
-+
-+#define DL_IS_SPECIAL_SEGMENT(EPNT, PPNT) \
-+ __dl_is_special_segment(EPNT, PPNT)
-+#define DL_MAP_SEGMENT(EPNT, PPNT, INFILE, FLAGS) \
-+ __dl_map_segment (EPNT, PPNT, INFILE, FLAGS)
-+
-+#endif
-+
-+
-+#define DL_GET_READY_TO_RUN_EXTRA_PARMS \
-+ , struct elf32_fdpic_loadmap *dl_boot_progmap, Elf32_Addr dl_boot_got_pointer
-+#define DL_GET_READY_TO_RUN_EXTRA_ARGS \
-+ , dl_boot_progmap, dl_boot_got_pointer
-+
-+
-+#ifdef __USE_GNU
-+# include <link.h>
-+#else
-+# define __USE_GNU
-+# include <link.h>
-+# undef __USE_GNU
-+#endif
-+
-+#include <elf.h>
-+static __inline__ void
-+elf_machine_relative (DL_LOADADDR_TYPE load_off, const Elf32_Addr rel_addr,
-+ Elf32_Word relative_count)
-+{
-+#if 0
-+ Elf32_Rel * rpnt = (void *) rel_addr;
-+ --rpnt;
-+ do {
-+ Elf32_Addr *const reloc_addr = (void *) (load_off + (++rpnt)->r_offset);
-+
-+ *reloc_addr = DL_RELOC_ADDR (load_off, *reloc_addr);
-+ } while (--relative_count);
-+#endif
-+}
---- /dev/null
-+++ b/ldso/ldso/ubicom32/elfinterp.c
-@@ -0,0 +1,366 @@
-+/* Blackfin ELF shared library loader suppport
-+ Copyright (C) 2003, 2004 Red Hat, Inc.
-+ Contributed by Alexandre Oliva <aoliva@redhat.com>
-+ Lots of code copied from ../i386/elfinterp.c, so:
-+ Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald,
-+ David Engel, Hongjiu Lu and Mitch D'Souza
-+ Copyright (C) 2001-2002, Erik Andersen
-+ All rights reserved.
-+
-+This file is part of uClibc.
-+
-+uClibc 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.
-+
-+uClibc 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
-+Library General Public License for more details.
-+
-+You should have received a copy of the GNU Lesser General Public
-+License along with uClibc; see the file COPYING.LIB. If not, write to
-+the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
-+USA. */
-+
-+#include <sys/cdefs.h> /* __attribute_used__ */
-+
-+/* Program to load an ELF binary on a linux system, and run it.
-+ References to symbols in sharable libraries can be resolved by either
-+ an ELF sharable library or a linux style of shared library. */
-+
-+/* Disclaimer: I have never seen any AT&T source code for SVr4, nor have
-+ I ever taken any courses on internals. This program was developed using
-+ information available through the book "UNIX SYSTEM V RELEASE 4,
-+ Programmers guide: Ansi C and Programming Support Tools", which did
-+ a more than adequate job of explaining everything required to get this
-+ working. */
-+extern int _dl_ubicom32_resolve_pending(void) __attribute__((__visibility__("hidden")));
-+
-+struct funcdesc_value volatile *__attribute__((__visibility__("hidden")))
-+_dl_linux_resolver (struct elf_resolve *tpnt, int reloc_entry)
-+{
-+ int reloc_type;
-+ ELF_RELOC *this_reloc;
-+ char *strtab;
-+ ElfW(Sym) *symtab;
-+ int symtab_index;
-+ char *rel_addr;
-+ struct elf_resolve *new_tpnt;
-+ char *new_addr;
-+ struct funcdesc_value funcval;
-+ struct funcdesc_value volatile *got_entry;
-+ char *symname;
-+
-+ rel_addr = (char *)tpnt->dynamic_info[DT_JMPREL];
-+
-+ this_reloc = (ELF_RELOC *)(intptr_t)(rel_addr + reloc_entry);
-+ reloc_type = ELF_R_TYPE(this_reloc->r_info);
-+ symtab_index = ELF_R_SYM(this_reloc->r_info);
-+
-+ symtab = (Elf32_Sym *) tpnt->dynamic_info[DT_SYMTAB];
-+ strtab = (char *) tpnt->dynamic_info[DT_STRTAB];
-+ symname= strtab + symtab[symtab_index].st_name;
-+
-+ if (reloc_type != R_UBICOM32_FUNCDESC_VALUE) {
-+ _dl_dprintf(2, "%s: Incorrect relocation type in jump relocations\n",
-+ _dl_progname);
-+ _dl_exit(1);
-+ }
-+
-+ /* Address of GOT entry fix up */
-+ got_entry = (struct funcdesc_value *) DL_RELOC_ADDR(tpnt->loadaddr, this_reloc->r_offset);
-+
-+ /* Get the address to be used to fill in the GOT entry. */
-+ new_addr = _dl_lookup_hash(symname, tpnt->symbol_scope, NULL, 0, &new_tpnt);
-+ if (!new_addr) {
-+ new_addr = _dl_lookup_hash(symname, NULL, NULL, 0, &new_tpnt);
-+ if (!new_addr) {
-+ _dl_dprintf(2, "%s: can't resolve symbol '%s'\n",
-+ _dl_progname, symname);
-+ _dl_exit(1);
-+ }
-+ }
-+
-+ funcval.entry_point = new_addr;
-+ funcval.got_value = new_tpnt->loadaddr.got_value;
-+
-+#if defined (__SUPPORT_LD_DEBUG__)
-+ if (_dl_debug_bindings) {
-+ _dl_dprintf(_dl_debug_file, "\nresolve function: %s", symname);
-+ if (_dl_debug_detail)
-+ _dl_dprintf(_dl_debug_file,
-+ "\n\tpatched (%x,%x) ==> (%x,%x) @ %x\n",
-+ got_entry->entry_point, got_entry->got_value,
-+ funcval.entry_point, funcval.got_value,
-+ got_entry);
-+ }
-+ if (1 || !_dl_debug_nofixups) {
-+ got_entry->entry_point = ((unsigned long *)&_dl_ubicom32_resolve_pending)[0];
-+ got_entry->got_value = funcval.got_value;
-+ got_entry->entry_point = funcval.entry_point;
-+ }
-+#else
-+ /*
-+ * initially set the entry point to resolve pending before starting
-+ * the update. This has the effect of putting all other requests in a
-+ * holding pattern until the resolution is completed.
-+ */
-+ got_entry->entry_point = ((unsigned long *)&_dl_ubicom32_resolve_pending)[0];
-+ got_entry->got_value = funcval.got_value;
-+ got_entry->entry_point = funcval.entry_point;
-+#endif
-+
-+ return got_entry;
-+}
-+
-+static int
-+_dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
-+ unsigned long rel_addr, unsigned long rel_size,
-+ int (*reloc_fnc) (struct elf_resolve *tpnt, struct dyn_elf *scope,
-+ ELF_RELOC *rpnt, ElfW(Sym) *symtab, char *strtab))
-+{
-+ unsigned int i;
-+ char *strtab;
-+ ElfW(Sym) *symtab;
-+ ELF_RELOC *rpnt;
-+ int symtab_index;
-+
-+ /* Now parse the relocation information */
-+ rpnt = (ELF_RELOC *) rel_addr;
-+ rel_size = rel_size / sizeof(ELF_RELOC);
-+
-+ symtab = (ElfW(Sym) *) tpnt->dynamic_info[DT_SYMTAB];
-+ strtab = (char *) tpnt->dynamic_info[DT_STRTAB];
-+
-+ for (i = 0; i < rel_size; i++, rpnt++) {
-+ int res;
-+
-+ symtab_index = ELF_R_SYM(rpnt->r_info);
-+ debug_sym(symtab,strtab,symtab_index);
-+ debug_reloc(symtab,strtab,rpnt);
-+
-+ res = reloc_fnc (tpnt, scope, rpnt, symtab, strtab);
-+
-+ if (res==0) continue;
-+
-+ _dl_dprintf(2, "\n%s: ",_dl_progname);
-+
-+ if (symtab_index)
-+ _dl_dprintf(2, "symbol '%s': ", strtab + symtab[symtab_index].st_name);
-+
-+ if (res <0) {
-+ int reloc_type = ELF_R_TYPE(rpnt->r_info);
-+#if defined (__SUPPORT_LD_DEBUG__)
-+ _dl_dprintf(2, "can't handle reloc type %s\n ", _dl_reltypes(reloc_type));
-+#else
-+ _dl_dprintf(2, "can't handle reloc type %x\n", reloc_type);
-+#endif
-+ _dl_exit(-res);
-+ } else if (res >0) {
-+ _dl_dprintf(2, "can't resolve symbol\n");
-+ return res;
-+ }
-+ }
-+ return 0;
-+}
-+
-+static int
-+_dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
-+ ELF_RELOC *rpnt, ElfW(Sym) *symtab, char *strtab)
-+{
-+ int reloc_type;
-+ int symtab_index;
-+ char *symname;
-+ unsigned long reloc_value = 0, *reloc_addr;
-+ struct { unsigned long v; } __attribute__((__packed__))
-+ *reloc_addr_packed;
-+ unsigned long symbol_addr;
-+ struct elf_resolve *symbol_tpnt;
-+ struct funcdesc_value funcval;
-+#if defined (__SUPPORT_LD_DEBUG__)
-+ unsigned long old_val;
-+#endif
-+
-+ reloc_addr = (unsigned long *) DL_RELOC_ADDR(tpnt->loadaddr, rpnt->r_offset);
-+ __asm__ ("" : "=r" (reloc_addr_packed) : "0" (reloc_addr));
-+ reloc_type = ELF_R_TYPE(rpnt->r_info);
-+ symtab_index = ELF_R_SYM(rpnt->r_info);
-+ symbol_addr = 0;
-+ symname = strtab + symtab[symtab_index].st_name;
-+
-+ if (ELF_ST_BIND (symtab[symtab_index].st_info) == STB_LOCAL) {
-+ symbol_addr = (unsigned long) DL_RELOC_ADDR(tpnt->loadaddr, symtab[symtab_index].st_value);
-+ symbol_tpnt = tpnt;
-+ } else {
-+
-+ symbol_addr = (unsigned long)
-+ _dl_lookup_hash(symname, scope, NULL, 0, &symbol_tpnt);
-+
-+ /*
-+ * We want to allow undefined references to weak symbols - this might
-+ * have been intentional. We should not be linking local symbols
-+ * here, so all bases should be covered.
-+ */
-+
-+ if (!symbol_addr && ELF_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK) {
-+ _dl_dprintf (2, "%s: can't resolve symbol '%s'\n",
-+ _dl_progname, strtab + symtab[symtab_index].st_name);
-+ _dl_exit (1);
-+ }
-+ }
-+
-+#if defined (__SUPPORT_LD_DEBUG__)
-+ if (_dl_debug_reloc && _dl_debug_detail)
-+ {
-+ if ((long)reloc_addr_packed & 3)
-+ old_val = reloc_addr_packed->v;
-+ else
-+ old_val = *reloc_addr;
-+ }
-+ else
-+ old_val = 0;
-+#endif
-+ switch (reloc_type) {
-+ case R_UBICOM32_NONE:
-+ break;
-+ case R_UBICOM32_32:
-+ if ((long)reloc_addr_packed & 3)
-+ reloc_value = reloc_addr_packed->v += symbol_addr;
-+ else
-+ reloc_value = *reloc_addr += symbol_addr;
-+ break;
-+ case R_UBICOM32_FUNCDESC_VALUE:
-+ funcval.entry_point = (void*)symbol_addr;
-+ /* The addend of FUNCDESC_VALUE
-+ relocations referencing global
-+ symbols must be ignored, because it
-+ may hold the address of a lazy PLT
-+ entry. */
-+ if (ELF_ST_BIND(symtab[symtab_index].st_info) == STB_LOCAL)
-+ funcval.entry_point += *reloc_addr;
-+ reloc_value = (unsigned long)funcval.entry_point;
-+ if (symbol_addr)
-+ funcval.got_value
-+ = symbol_tpnt->loadaddr.got_value;
-+ else
-+ funcval.got_value = 0;
-+
-+/// XXX this is my best guess as to what I should be doing, but I'm
-+/// putting a break-point here so I can inspect the first time this is
-+/// used.
-+ __asm__ (
-+ " move.4 4(%0), 4(%1) \n\t"
-+ " move.4 0(%0), 0(%1) \n\t" /* Must to entry_point last */
-+ :
-+ : "a" (reloc_addr), "a" (&funcval)
-+ : "memory" );
-+ break;
-+ case R_UBICOM32_FUNCDESC:
-+ if ((long)reloc_addr_packed & 3)
-+ reloc_value = reloc_addr_packed->v;
-+ else
-+ reloc_value = *reloc_addr;
-+ if (symbol_addr)
-+ reloc_value = (unsigned long)_dl_funcdesc_for
-+ ((char *)symbol_addr + reloc_value,
-+ symbol_tpnt->loadaddr.got_value);
-+ else
-+ reloc_value = 0;
-+ if ((long)reloc_addr_packed & 3)
-+ reloc_addr_packed->v = reloc_value;
-+ else
-+ *reloc_addr = reloc_value;
-+ break;
-+ default:
-+ return -1;
-+ }
-+#if defined (__SUPPORT_LD_DEBUG__)
-+ if (_dl_debug_reloc && _dl_debug_detail) {
-+ _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x", old_val, reloc_value, reloc_addr);
-+ switch (reloc_type) {
-+ case R_UBICOM32_FUNCDESC_VALUE:
-+ _dl_dprintf(_dl_debug_file, " got %x", ((struct funcdesc_value *)reloc_value)->got_value);
-+ break;
-+ case R_UBICOM32_FUNCDESC:
-+ if (! reloc_value)
-+ break;
-+ _dl_dprintf(_dl_debug_file, " funcdesc (%x,%x)",
-+ ((struct funcdesc_value *)reloc_value)->entry_point,
-+ ((struct funcdesc_value *)reloc_value)->got_value);
-+ break;
-+ }
-+ }
-+#endif
-+
-+ return 0;
-+}
-+
-+static int
-+_dl_do_lazy_reloc (struct elf_resolve *tpnt,
-+ struct dyn_elf *scope __attribute__((unused)),
-+ ELF_RELOC *rpnt, ElfW(Sym) *symtab __attribute__((unused)),
-+ char *strtab __attribute__((unused)))
-+{
-+ int reloc_type;
-+ struct funcdesc_value volatile *reloc_addr;
-+ struct funcdesc_value funcval;
-+#if defined (__SUPPORT_LD_DEBUG__)
-+ unsigned long old_val;
-+#endif
-+
-+ reloc_addr = (struct funcdesc_value *) DL_RELOC_ADDR(tpnt->loadaddr, rpnt->r_offset);
-+ reloc_type = ELF_R_TYPE(rpnt->r_info);
-+
-+#if defined (__SUPPORT_LD_DEBUG__)
-+ old_val = (unsigned long)reloc_addr->entry_point;
-+#endif
-+ switch (reloc_type) {
-+ case R_UBICOM32_NONE:
-+ break;
-+ case R_UBICOM32_FUNCDESC_VALUE:
-+ funcval = *reloc_addr;
-+ funcval.entry_point = (void*)DL_RELOC_ADDR(tpnt->loadaddr, funcval.entry_point);
-+ funcval.got_value = tpnt->loadaddr.got_value;
-+ *reloc_addr = funcval;
-+ break;
-+ default:
-+ return -1;
-+ }
-+#if defined (__SUPPORT_LD_DEBUG__)
-+ if (_dl_debug_reloc && _dl_debug_detail)
-+ _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x", old_val, reloc_addr->entry_point, reloc_addr);
-+#endif
-+ return 0;
-+
-+}
-+
-+void
-+_dl_parse_lazy_relocation_information
-+(struct dyn_elf *rpnt, unsigned long rel_addr, unsigned long rel_size)
-+{
-+ _dl_parse(rpnt->dyn, NULL, rel_addr, rel_size, _dl_do_lazy_reloc);
-+}
-+
-+int
-+_dl_parse_relocation_information
-+(struct dyn_elf *rpnt, unsigned long rel_addr, unsigned long rel_size)
-+{
-+ return _dl_parse(rpnt->dyn, rpnt->dyn->symbol_scope, rel_addr, rel_size, _dl_do_reloc);
-+}
-+
-+#if 0
-+/* We don't have copy relocs. */
-+int
-+_dl_parse_copy_information
-+(struct dyn_elf *rpnt __attribute__((unused)),
-+ unsigned long rel_addr __attribute__((unused)),
-+ unsigned long rel_size __attribute__((unused)))
-+{
-+ return 0;
-+}
-+#endif
-+#ifndef IS_IN_libdl
-+# include "../../libc/sysdeps/linux/ubicom32/crtreloc.c"
-+#endif
---- /dev/null
-+++ b/ldso/ldso/ubicom32/resolve.S
-@@ -0,0 +1,161 @@
-+ /* Copyright (C) 2003 Red Hat, Inc.
-+ Contributed by Alexandre Oliva <aoliva@redhat.com>
-+
-+ Copyright (C) 2009 Ubicom Inc.
-+ Ported to Ubicom32 by Ubicom Inc.
-+
-+This file is part of uClibc.
-+
-+uClibc 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.
-+
-+uClibc 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
-+Library General Public License for more details.
-+
-+You should have received a copy of the GNU Lesser General Public
-+License along with uClibc; see the file COPYING.LIB. If not, write to
-+the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
-+USA. */
-+
-+
-+/*
-+ * The function below is tail-called by resolver stubs when a lazily-bound *
-+ * function is called. It must preserve all registers that could * be used to
-+ * pass arguments to the actual function.
-+ *
-+ * On entry to the function d0-d13 contain parameters to the actual function of
-+ * interest
-+ *
-+ * a5 contains the return address
-+ * a0 is pointing to the GOT table for the original function
-+ * (a0) _dl_linux_resolve
-+ * 4(a0) GOT for _dl_linux_resolve
-+ * 8(a0) is pointer to "structure elf_resolve" of the module where the call
-+ * originated from
-+ *
-+ * a3 is pointing to the function descriptor in the GOT table, and 8(a3) the
-+ * resolver lookup information.
-+ *
-+ * _dl_linux_resolve calls _dl_linux_resolver passing it pointer to
-+ * struct elf_resolve and the relocation entry.
-+ *
-+ * _dl_linux_resolver() figures out where the jump symbol is _really_ supposed
-+ * to have jumped to and returns that to us. Once we have that, we prepare to
-+ * tail-call the actual function, clean up after ourselves, restoring the
-+ * original arguments, then jump to the fixed up address.
-+ */
-+
-+#if 0
-+ /*
-+ * Here is what the linker will use for the PLT.
-+ */
-+sample_PLT_functionX: /* (at entry a0 contains GOT for this library) */
-+ movei d15, # -%lo(got_funcdescX) ; load offset for GOT
-+ lea.4 a3, (a0, d15) ; a4 is now the function descriptor
-+ move.4 a4, 0(a3) ; get entry_point
-+ move.4 a0, 4(a3) ; set new GOT
-+
-+ /*
-+ * jump to resovled function OR PLT_trampoline Nat had some code here
-+ * that uses the stack instead of a3 to reduces hazards.
-+ */
-+ calli a4, 0(a4)
-+
-+
-+sample_PLT_trampoline:
-+ /*
-+ * find the old got by undoing what was done above. An alternative
-+ * could have been to ‘save’ the old got in say d14 but that would add 1
-+ * instruction to every PLT and there is only 1 PLT trampoline per library.
-+ */
-+ ret (a0) ; jump to _dl_linux_resolve
-+#endif
-+
-+ .text
-+ .p2align 4
-+
-+ .hidden _dl_linux_resolve
-+ .global _dl_linux_resolve
-+ .type _dl_linux_resolve,@function
-+_dl_linux_resolve:
-+ /* Preserve arguments and return address */
-+ move.4 -4(sp)++, d0
-+ move.4 -4(sp)++, d1
-+ move.4 -4(sp)++, d2
-+ move.4 -4(sp)++, d3
-+ move.4 -4(sp)++, d4
-+ move.4 -4(sp)++, d5
-+ move.4 -4(sp)++, d6
-+ move.4 -4(sp)++, d7
-+ move.4 -4(sp)++, d8
-+ move.4 -4(sp)++, d9
-+ move.4 -4(sp)++, d10
-+ move.4 -4(sp)++, d11
-+ move.4 -4(sp)++, d12
-+ move.4 -4(sp)++, d13
-+ move.4 -4(sp)++, a5
-+
-+ /* Prepare to call _dl_linux_resolver. */
-+ move.4 d0, 8(a0) ; reference to elf_resolve
-+ /* Not aligned for space reasons. */
-+ move.4 d1, mac_hi ; reference to GOT table entry which
-+ ; contains the relocation information.
-+
-+ move.4 a0, 4(a0) ; switch to GOT for _dl_linux_resolve
-+ call a5, _dl_linux_resolver;
-+
-+ /* Move aside return value that contains the FUNCDESC_VALUE. */
-+ ;P3 = R0;
-+ move.4 a3, d0;
-+
-+ /* Restore arguments. */
-+ move.4 a5, (sp)4++
-+ move.4 d13, (sp)4++
-+ move.4 d12, (sp)4++
-+ move.4 d11, (sp)4++
-+ move.4 d10, (sp)4++
-+ move.4 d9, (sp)4++
-+ move.4 d8, (sp)4++
-+ move.4 d7, (sp)4++
-+ move.4 d6, (sp)4++
-+ move.4 d5, (sp)4++
-+ move.4 d4, (sp)4++
-+ move.4 d3, (sp)4++
-+ move.4 d2, (sp)4++
-+ move.4 d1, (sp)4++
-+ move.4 d0, (sp)4++
-+
-+ /* Now jump to the actual function. */
-+ /* a3 contains func_desc resolution */
-+ move.4 a4, 0(a3) ; address of function X
-+ move.4 a0, 4(a3) ; switch to GOT for function X
-+ calli a4, 0(a4) ; call through a4, a5 remains
-+
-+ .size _dl_linux_resolve, . - _dl_linux_resolve
-+
-+ .hidden _dl_ubicom32_resolve_pending
-+ .global _dl_ubicom32_resolve_pending
-+ .type _dl_ubicom32_resolve_pending,@function
-+
-+_dl_ubicom32_resolve_pending:
-+ /*
-+ * A special function that is used to ensure thread saftly when the fd
-+ * for a particular resolution is being updated.
-+ *
-+ * At entry, a3 must point to the FD. While the FD is being updated the
-+ * entry_point will continue to point to _dl_ubicom32_resolve_pending so
-+ * we will effectively spin until the resolver update is complete.
-+ */
-+
-+ move.4 a4, 0(a3) ; get entry_point
-+ move.4 a0, 4(a3) ; set new GOT
-+
-+ /*
-+ * jump to resovled function or back to _dl_ubicom32_resolve_pending.
-+ */
-+ calli a4, 0(a4)
-+ .size _dl_ubicom32_resolve_pending, . - _dl_ubicom32_resolve_pending
---- a/libc/misc/Makefile.in
-+++ b/libc/misc/Makefile.in
-@@ -12,7 +12,9 @@ include $(top_srcdir)libc/misc/assert/Ma
- include $(top_srcdir)libc/misc/ctype/Makefile.in
- include $(top_srcdir)libc/misc/dirent/Makefile.in
- include $(top_srcdir)libc/misc/error/Makefile.in
-+ifneq ($(ARCH_HAS_NO_LDSO),y)
- include $(top_srcdir)libc/misc/elf/Makefile.in
-+endif
- include $(top_srcdir)libc/misc/file/Makefile.in
- include $(top_srcdir)libc/misc/fnmatch/Makefile.in
- include $(top_srcdir)libc/misc/ftw/Makefile.in
---- a/libc/misc/elf/dl-iterate-phdr.c
-+++ b/libc/misc/elf/dl-iterate-phdr.c
-@@ -14,7 +14,7 @@
-
- #include <link.h>
- #include <ldso.h>
--
-+#include <memory.h>
- /* we want this in libc but nowhere else */
- #ifdef __USE_GNU
-
-@@ -60,7 +60,11 @@ dl_iterate_phdr (int (*callback) (struct
- /* This entry describes this statically-linked program itself. */
- struct dl_phdr_info info;
- int ret;
-+#if !defined(__FDPIC__)
- info.dlpi_addr = 0;
-+#else
-+ memset(&info.dlpi_addr, 0, sizeof(info.dlpi_addr));
-+#endif
- info.dlpi_name = "";
- info.dlpi_phdr = _dl_phdr;
- info.dlpi_phnum = _dl_phnum;
---- a/libc/stdlib/malloc/malloc.c
-+++ b/libc/stdlib/malloc/malloc.c
-@@ -25,7 +25,7 @@ libc_hidden_proto(sbrk)
-
- /* The malloc heap. We provide a bit of initial static space so that
- programs can do a little mallocing without mmaping in more space. */
--HEAP_DECLARE_STATIC_FREE_AREA (initial_fa, 256);
-+HEAP_DECLARE_STATIC_FREE_AREA (initial_fa, 32768);
- struct heap_free_area *__malloc_heap = HEAP_INIT_WITH_FA (initial_fa);
- #ifdef HEAP_USE_LOCKING
- malloc_mutex_t __malloc_heap_lock = PTHREAD_MUTEX_INITIALIZER;
---- /dev/null
-+++ b/libc/string/ubicom32/Makefile
-@@ -0,0 +1,13 @@
-+# Makefile for uClibc
-+#
-+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
-+#
-+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-+#
-+
-+top_srcdir:=../../../
-+top_builddir:=../../../
-+all: objs
-+include $(top_builddir)Rules.mak
-+include ../Makefile.in
-+include $(top_srcdir)Makerules
---- /dev/null
-+++ b/libc/string/ubicom32/memcpy.c
-@@ -0,0 +1,152 @@
-+/* Copy memory to memory until the specified number of bytes
-+ has been copied. Overlap is NOT handled correctly.
-+ Copyright (C) 1991, 1997, 2003 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Torbjorn Granlund (tege@sics.se).
-+
-+ 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, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <string.h>
-+
-+typedef unsigned long addr_t;
-+
-+libc_hidden_proto(memcpy)
-+
-+void *memcpy (void *dest, const void *src, size_t n)
-+{
-+ void *dest_ret = dest;
-+ void *aligned_start;
-+
-+ if (likely((((addr_t)dest ^ (addr_t)src) & 3) == 0) && likely(n > 6)) {
-+ size_t m;
-+ n -= (4 - (addr_t)dest) & 0x03;
-+ m = n >> 2;
-+ __asm__ volatile (
-+ " call %4, 99f \n\t" // load %4 with address of 99
-+ "99: movei d15, #%%lo(1f-99b) \n\t" // load d15 with offset to 1 from 99
-+ " add.4 %4, %4, d15 \n\t" // add difference
-+
-+ " sub.4 d15, #0, %2 \n\t" // set up for jump table
-+ " and.4 d15, #(32-1), d15 \n\t" // d15 = (-m) & (32 - 1)
-+ " lea.4 %4, (%4,d15) \n\t"
-+
-+ " bfextu d15, %0, #2 \n\t" // d15 = (dest & 3)
-+ " jmpne.w.f 100f \n\t"
-+ " calli %4, 0(%4) \n\t" // 4-byte alignment
-+
-+ "100: cmpi d15, #2 \n\t"
-+ " jmpne.s.f 101f \n\t"
-+ " move.2 (%0)2++, (%1)2++ \n\t"
-+ " calli %4, 0(%4) \n\t" // 2-byte alignment
-+
-+ "101: move.1 (%0)1++, (%1)1++ \n\t"
-+ " jmpgt.s.f 102f \n\t" // 3-byte alignment
-+ " move.2 (%0)2++, (%1)2++ \n\t" // 1-byte alignment
-+ "102: calli %4, 0(%4) \n\t"
-+
-+ "200: cmpi %3, #2 \n\t"
-+ " jmplt.s.f 201f \n\t"
-+ " move.2 (%0)2++, (%1)2++ \n\t"
-+ " jmpeq.s.t 2f \n\t"
-+ "201: move.1 (%0)1++, (%1)1++ \n\t"
-+ " jmpt.w.t 2f \n\t"
-+
-+ "1: .rept 25 \n\t"
-+ " movea (%0)4++, (%1)4++ \n\t"
-+ " .endr \n\t"
-+ " .rept 7 \n\t"
-+ " move.4 (%0)4++, (%1)4++ \n\t"
-+ " .endr \n\t"
-+ " add.4 %2, #-32, %2 \n\t"
-+ " jmpgt.w.f 1b \n\t"
-+
-+ " and.4 %3, #3, %3 \n\t" // check n
-+ " jmpne.w.f 200b \n\t"
-+ "2: \n\t"
-+ : "+a"(dest), "+a"(src), "+d"(m), "+d"(n), "=a"(aligned_start)
-+ :
-+ : "d15", "memory", "cc"
-+ );
-+
-+ return dest_ret;
-+ }
-+
-+ if (likely((((addr_t)dest ^ (addr_t)src) & 1) == 0) && likely(n > 2)) {
-+ size_t m;
-+ n -= (addr_t)dest & 0x01;
-+ m = n >> 1;
-+ __asm__ volatile (
-+ " call %4, 99f \n\t" // load %4 with address of 99
-+ "99: movei d15, #%%lo(1f-99b) \n\t" // load d15 with offset to 1 from 99
-+ " add.4 %4, %4, d15 \n\t" // add difference
-+
-+ " sub.4 d15, #0, %2 \n\t" // set up for jump table
-+ " and.4 d15, #(32-1), d15 \n\t" // d15 = (-m) & (32 - 1)
-+ " lea.4 %4, (%4,d15) \n\t"
-+
-+ " btst %0, #0 \n\t" // check bit 0
-+ " jmpne.w.f 100f \n\t"
-+ " calli %4, 0(%4) \n\t" // 4-byte alignment
-+
-+ "100: move.1 (%0)1++, (%1)1++ \n\t"
-+ " calli %4, 0(%4) \n\t"
-+
-+ "200: move.1 (%0)1++, (%1)1++ \n\t"
-+ " jmpt.w.t 2f \n\t"
-+
-+ "1: .rept 32 \n\t"
-+ " move.2 (%0)2++, (%1)2++ \n\t"
-+ " .endr \n\t"
-+ " add.4 %2, #-32, %2 \n\t"
-+ " jmpgt.w.f 1b \n\t"
-+
-+ " and.4 %3, #1, %3 \n\t" // check n
-+ " jmpne.w.f 200b \n\t"
-+ "2: \n\t"
-+
-+ : "+a"(dest), "+a"(src), "+d"(m), "+d"(n), "=a"(aligned_start)
-+ :
-+ : "d15", "memory", "cc"
-+ );
-+ return dest_ret;
-+ }
-+
-+ __asm__ volatile (
-+ " call %3, 99f \n\t" // load %3 with address of 99
-+ "99: movei d15, #%%lo(1f-99b) \n\t" // load d15 with offset to 1 from 99
-+ " add.4 %3, %3, d15 \n\t" // add difference
-+
-+ " sub.4 d15, #0, %2 \n\t"
-+ " jmpeq.w.f 2f \n\t"
-+ " and.4 d15, #(16-1), d15 \n\t" // d15 = (-n) & (16 - 1)
-+ " lea.4 %3, (%3,d15) \n\t"
-+ " calli %3, 0(%3) \n\t"
-+
-+ "1: .rept 16 \n\t"
-+ " move.1 (%0)1++, (%1)1++ \n\t"
-+ " .endr \n\t"
-+ " add.4 %2, #-16, %2 \n\t"
-+ " jmpgt.w.f 1b \n\t"
-+ "2: \n\t"
-+
-+ : "+a"(dest), "+a"(src), "+d"(n), "=a"(aligned_start)
-+ :
-+ : "d15", "memory", "cc"
-+ );
-+
-+ return dest_ret;
-+}
-+libc_hidden_def(memcpy)
---- /dev/null
-+++ b/libc/string/ubicom32/memset.c
-@@ -0,0 +1,107 @@
-+/* Copyright (C) 1991, 1997, 2003 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, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <string.h>
-+
-+typedef unsigned long addr_t;
-+
-+libc_hidden_proto(memset)
-+void *memset (void *s, int c, size_t n)
-+{
-+ void *s_ret = s;
-+ void *aligned_start;
-+ if (likely(n > 6)) {
-+ size_t m;
-+ n -= (4 - (addr_t)s) & 0x03;
-+ m = n >> 2;
-+ __asm__ volatile (
-+ " call %4, 99f \n\t" // load %4 with address of 99
-+ "99: movei d15, #%%lo(1f-99b) \n\t" // load d15 with offset to 1 from 99
-+ " add.4 %4, %4, d15 \n\t" // add difference
-+
-+ " sub.4 d15, #0, %2 \n\t" // set up for jump table
-+ " and.4 d15, #(32-1), d15 \n\t" // d15 = (-m) & (32 - 1)
-+ " shmrg.1 %1, %1, %1 \n\t"
-+ " shmrg.2 %1, %1, %1 \n\t" // %1 = (c<<24)|(c<<16)|(c<<8)|c
-+ " lea.4 %4, (%4,d15) \n\t"
-+
-+ " bfextu d15, %0, #2 \n\t" // d15 = (s & 3)
-+ " jmpne.w.f 100f \n\t"
-+ " calli %4, 0(%4) \n\t" // 4-byte alignment
-+
-+ "100: cmpi d15, #2 \n\t"
-+ " jmpne.s.f 101f \n\t"
-+ " move.2 (%0)2++, %1 \n\t"
-+ " calli %4, 0(%4) \n\t" // 2-byte alignment
-+
-+ "101: move.1 (%0)1++, %1 \n\t"
-+ " jmpgt.s.f 102f \n\t" // 3-byte alignment
-+ " move.2 (%0)2++, %1 \n\t" // 1-byte alignment
-+ "102: calli %4, 0(%4) \n\t"
-+
-+ "200: cmpi %3, #2 \n\t"
-+ " jmplt.s.f 201f \n\t"
-+ " move.2 (%0)2++, %1 \n\t"
-+ " jmpeq.s.t 2f \n\t"
-+ "201: move.1 (%0)1++, %1 \n\t"
-+ " jmpt.w.t 2f \n\t"
-+
-+ "1: .rept 25 \n\t"
-+ " movea (%0)4++, %1 \n\t"
-+ " .endr \n\t"
-+ " .rept 7 \n\t"
-+ " move.4 (%0)4++, %1 \n\t"
-+ " .endr \n\t"
-+ " add.4 %2, #-32, %2 \n\t"
-+ " jmpgt.w.f 1b \n\t"
-+
-+ " and.4 %3, #3, %3 \n\t" // test bit 1 of n
-+ " jmpne.w.f 200b \n\t"
-+ "2: \n\t"
-+ : "+a"(s), "+d"(c), "+d"(m), "+d"(n), "=a"(aligned_start)
-+ :
-+ : "d15", "memory", "cc"
-+ );
-+
-+ return s_ret;
-+ }
-+
-+ __asm__ volatile (
-+ " call %3, 99f \n\t" // load %3 with address of 99
-+ "99: movei d15, #%%lo(1f-99b) \n\t" // load d15 with offset to 1 from 99
-+ " add.4 %3, %3, d15 \n\t" // add difference
-+
-+ " sub.4 d15, #0, %2 \n\t"
-+ " jmpeq.w.f 2f \n\t"
-+ " and.4 d15, #(8-1), d15 \n\t" // d15 = (-%2) & (16 - 1)
-+ " lea.4 %3, (%3,d15) \n\t"
-+ " calli %3, 0(%3) \n\t"
-+
-+ "1: .rept 8 \n\t"
-+ " move.1 (%0)1++, %1 \n\t"
-+ " .endr \n\t"
-+ "2: \n\t"
-+
-+ : "+a"(s), "+d"(c), "+d"(n), "=a"(aligned_start)
-+ :
-+ : "d15", "memory", "cc"
-+ );
-+
-+ return s_ret;
-+}
-+libc_hidden_def(memset)
---- a/libc/sysdeps/linux/common/sys/user.h
-+++ b/libc/sysdeps/linux/common/sys/user.h
-@@ -1 +1,4 @@
-+#if 0
-+/* As of linux v2.6.25 this is not part of the exported linux headers */
- #include <linux/user.h>
-+#endif
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/Makefile
-@@ -0,0 +1,13 @@
-+# Makefile for uClibc
-+#
-+# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
-+#
-+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-+#
-+
-+top_srcdir=../../../../
-+top_builddir=../../../../
-+all: objs
-+include $(top_builddir)Rules.mak
-+include Makefile.arch
-+include $(top_srcdir)Makerules
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/Makefile.arch
-@@ -0,0 +1,28 @@
-+# Makefile for uClibc
-+#
-+# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
-+#
-+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-+#
-+
-+#CSRC := \
-+# brk.c \
-+# crtbegin.c \
-+# crtend.c
-+#
-+#SSRC := \
-+# __longjmp.S \
-+# bsd-_setjmp.S \
-+# bsd-setjmp.S \
-+# setjmp.S \
-+# clone.S \
-+# vfork.S
-+
-+CSRC := \
-+ syscall.c __syscall_error.c
-+
-+SSRC := \
-+ clone.S setjmp.S vfork.S
-+
-+ARCH_CFLAGS := $(CPU_CFLAGS-y)
-+include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/__syscall_error.c
-@@ -0,0 +1,11 @@
-+#include <errno.h>
-+#include <features.h>
-+
-+/* This routine is jumped to by some of the syscall handlers, to stash
-+ * an error number into errno. */
-+int __syscall_error(int err_no) attribute_hidden;
-+int __syscall_error(int err_no)
-+{
-+ __set_errno(err_no);
-+ return -1;
-+}
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/bits/elf-fdpic.h
-@@ -0,0 +1,115 @@
-+/* Copyright 2003, 2004 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.
-+
-+In addition to the permissions in the GNU Lesser General Public
-+License, the Free Software Foundation gives you unlimited
-+permission to link the compiled version of this file with other
-+programs, and to distribute those programs without any restriction
-+coming from the use of this file. (The GNU Lesser General Public
-+License restrictions do apply in other respects; for example, they
-+cover modification of the file, and distribution when not linked
-+into another program.)
-+
-+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
-+Library 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; see the file COPYING.LIB. If
-+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-+Cambridge, MA 02139, USA. */
-+
-+#ifndef _BITS_ELF_FDPIC_H
-+#define _BITS_ELF_FDPIC_H
-+
-+/* These data structures are described in the FDPIC ABI extension.
-+ The kernel passes a process a memory map, such that for every LOAD
-+ segment there is an elf32_fdpic_loadseg entry. A pointer to an
-+ elf32_fdpic_loadmap is passed in d8 at start-up, and a pointer to
-+ an additional such map is passed in d9 for the interpreter, when
-+ there is one. */
-+
-+#include <elf.h>
-+
-+/* This data structure represents a PT_LOAD segment. */
-+struct elf32_fdpic_loadseg
-+{
-+ /* Core address to which the segment is mapped. */
-+ Elf32_Addr addr;
-+ /* VMA recorded in the program header. */
-+ Elf32_Addr p_vaddr;
-+ /* Size of this segment in memory. */
-+ Elf32_Word p_memsz;
-+};
-+
-+struct elf32_fdpic_loadmap {
-+ /* Protocol version number, must be zero. */
-+ Elf32_Half version;
-+ /* Number of segments in this map. */
-+ Elf32_Half nsegs;
-+ /* The actual memory map. */
-+ struct elf32_fdpic_loadseg segs[/*nsegs*/];
-+};
-+
-+struct elf32_fdpic_loadaddr {
-+ struct elf32_fdpic_loadmap *map;
-+ void *got_value;
-+};
-+
-+/* Map a pointer's VMA to its corresponding address according to the
-+ load map. */
-+static __always_inline void *
-+__reloc_pointer (void *p,
-+ const struct elf32_fdpic_loadmap *map)
-+{
-+ int c;
-+
-+#if 0
-+ if (map->version != 0)
-+ /* Crash. */
-+ ((void(*)())0)();
-+#endif
-+
-+ /* No special provision is made for NULL. We don't want NULL
-+ addresses to go through relocation, so they shouldn't be in
-+ .rofixup sections, and, if they're present in dynamic
-+ relocations, they shall be mapped to the NULL address without
-+ undergoing relocations. */
-+
-+ for (c = 0;
-+ /* Take advantage of the fact that the loadmap is ordered by
-+ virtual addresses. In general there will only be 2 entries,
-+ so it's not profitable to do a binary search. */
-+ c < map->nsegs && p >= (void*)map->segs[c].p_vaddr;
-+ c++)
-+ {
-+ /* This should be computed as part of the pointer comparison
-+ above, but we want to use the carry in the comparison, so we
-+ can't convert it to an integer type beforehand. */
-+ unsigned long offset = p - (void*)map->segs[c].p_vaddr;
-+ /* We only check for one-past-the-end for the last segment,
-+ assumed to be the data segment, because other cases are
-+ ambiguous in the absence of padding between segments, and
-+ rofixup already serves as padding between text and data.
-+ Unfortunately, unless we special-case the last segment, we
-+ fail to relocate the _end symbol. */
-+ if (offset < map->segs[c].p_memsz
-+ || (offset == map->segs[c].p_memsz && c + 1 == map->nsegs))
-+ return (char*)map->segs[c].addr + offset;
-+ }
-+
-+ /* We might want to crash instead. */
-+ return (void*)-1;
-+}
-+
-+# define __RELOC_POINTER(ptr, loadaddr) \
-+ (__reloc_pointer ((void*)(ptr), \
-+ (loadaddr).map))
-+
-+#endif /* _BITS_ELF_FDPIC_H */
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/bits/endian.h
-@@ -0,0 +1,7 @@
-+/* Ubicom32 is big-endian. */
-+
-+#ifndef _ENDIAN_H
-+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
-+#endif
-+
-+#define __BYTE_ORDER __BIG_ENDIAN
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/bits/fcntl.h
-@@ -0,0 +1,224 @@
-+/* O_*, F_*, FD_* bit values for Linux.
-+ Copyright (C) 2000 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, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#ifndef _FCNTL_H
-+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
-+#endif
-+
-+
-+#include <sys/types.h>
-+#ifdef __USE_GNU
-+# include <bits/uio.h>
-+#endif
-+
-+/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
-+ located on an ext2 file system */
-+#define O_ACCMODE 0003
-+#define O_RDONLY 00
-+#define O_WRONLY 01
-+#define O_RDWR 02
-+#define O_CREAT 0100 /* not fcntl */
-+#define O_EXCL 0200 /* not fcntl */
-+#define O_NOCTTY 0400 /* not fcntl */
-+#define O_TRUNC 01000 /* not fcntl */
-+#define O_APPEND 02000
-+#define O_NONBLOCK 04000
-+#define O_NDELAY O_NONBLOCK
-+#define O_SYNC 010000
-+#define O_FSYNC O_SYNC
-+#define O_ASYNC 020000
-+
-+#ifdef __USE_GNU
-+# define O_DIRECTORY 040000 /* Must be a directory. */
-+# define O_NOFOLLOW 0100000 /* Do not follow links. */
-+# define O_DIRECT 0200000 /* Direct disk access. */
-+# define O_STREAMING 04000000/* streaming access */
-+#endif
-+
-+/* For now Linux has synchronisity options for data and read operations.
-+ We define the symbols here but let them do the same as O_SYNC since
-+ this is a superset. */
-+#if defined __USE_POSIX199309 || defined __USE_UNIX98
-+# define O_DSYNC O_SYNC /* Synchronize data. */
-+# define O_RSYNC O_SYNC /* Synchronize read operations. */
-+#endif
-+
-+#ifdef __USE_LARGEFILE64
-+# define O_LARGEFILE 0400000
-+#endif
-+
-+/* Values for the second argument to `fcntl'. */
-+#define F_DUPFD 0 /* Duplicate file descriptor. */
-+#define F_GETFD 1 /* Get file descriptor flags. */
-+#define F_SETFD 2 /* Set file descriptor flags. */
-+#define F_GETFL 3 /* Get file status flags. */
-+#define F_SETFL 4 /* Set file status flags. */
-+#ifndef __USE_FILE_OFFSET64
-+# define F_GETLK 5 /* Get record locking info. */
-+# define F_SETLK 6 /* Set record locking info (non-blocking). */
-+# define F_SETLKW 7 /* Set record locking info (blocking). */
-+#else
-+# define F_GETLK F_GETLK64 /* Get record locking info. */
-+# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/
-+# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */
-+#endif
-+#define F_GETLK64 12 /* Get record locking info. */
-+#define F_SETLK64 13 /* Set record locking info (non-blocking). */
-+#define F_SETLKW64 14 /* Set record locking info (blocking). */
-+
-+#if defined __USE_BSD || defined __USE_XOPEN2K
-+# define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */
-+# define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */
-+#endif
-+
-+#ifdef __USE_GNU
-+# define F_SETSIG 10 /* Set number of signal to be sent. */
-+# define F_GETSIG 11 /* Get number of signal to be sent. */
-+#endif
-+
-+#ifdef __USE_GNU
-+# define F_SETLEASE 1024 /* Set a lease. */
-+# define F_GETLEASE 1025 /* Enquire what lease is active. */
-+# define F_NOTIFY 1026 /* Request notfications on a directory. */
-+#endif
-+
-+/* For F_[GET|SET]FL. */
-+#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
-+
-+/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
-+#define F_RDLCK 0 /* Read lock. */
-+#define F_WRLCK 1 /* Write lock. */
-+#define F_UNLCK 2 /* Remove lock. */
-+
-+/* For old implementation of bsd flock(). */
-+#define F_EXLCK 4 /* or 3 */
-+#define F_SHLCK 8 /* or 4 */
-+
-+#ifdef __USE_BSD
-+/* Operations for bsd flock(), also used by the kernel implementation. */
-+# define LOCK_SH 1 /* shared lock */
-+# define LOCK_EX 2 /* exclusive lock */
-+# define LOCK_NB 4 /* or'd with one of the above to prevent
-+ blocking */
-+# define LOCK_UN 8 /* remove lock */
-+#endif
-+
-+#ifdef __USE_GNU
-+# define LOCK_MAND 32 /* This is a mandatory flock: */
-+# define LOCK_READ 64 /* ... which allows concurrent read operations. */
-+# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */
-+# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */
-+#endif
-+
-+#ifdef __USE_GNU
-+/* Types of directory notifications that may be requested with F_NOTIFY. */
-+# define DN_ACCESS 0x00000001 /* File accessed. */
-+# define DN_MODIFY 0x00000002 /* File modified. */
-+# define DN_CREATE 0x00000004 /* File created. */
-+# define DN_DELETE 0x00000008 /* File removed. */
-+# define DN_RENAME 0x00000010 /* File renamed. */
-+# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
-+# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
-+#endif
-+
-+struct flock
-+ {
-+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
-+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
-+#ifndef __USE_FILE_OFFSET64
-+ __off_t l_start; /* Offset where the lock begins. */
-+ __off_t l_len; /* Size of the locked area; zero means until EOF. */
-+#else
-+ __off64_t l_start; /* Offset where the lock begins. */
-+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
-+#endif
-+ __pid_t l_pid; /* Process holding the lock. */
-+ };
-+
-+#ifdef __USE_LARGEFILE64
-+struct flock64
-+ {
-+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
-+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
-+ __off64_t l_start; /* Offset where the lock begins. */
-+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
-+ __pid_t l_pid; /* Process holding the lock. */
-+ };
-+#endif
-+
-+/* Define some more compatibility macros to be backward compatible with
-+ BSD systems which did not managed to hide these kernel macros. */
-+#ifdef __USE_BSD
-+# define FAPPEND O_APPEND
-+# define FFSYNC O_FSYNC
-+# define FASYNC O_ASYNC
-+# define FNONBLOCK O_NONBLOCK
-+# define FNDELAY O_NDELAY
-+#endif /* Use BSD. */
-+
-+/* Advise to `posix_fadvise'. */
-+#ifdef __USE_XOPEN2K
-+# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
-+# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
-+# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
-+# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
-+# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
-+# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
-+#endif
-+
-+#ifdef __USE_GNU
-+# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
-+ in the range before performing the
-+ write. */
-+# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those
-+ dirty pages in the range which are
-+ not presently under writeback. */
-+# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
-+ the range after performing the
-+ write. */
-+#endif
-+
-+__BEGIN_DECLS
-+
-+#ifdef __USE_GNU
-+
-+/* Provide kernel hint to read ahead. */
-+extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
-+ __THROW;
-+
-+/* Selective file content synch'ing. */
-+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
-+ unsigned int __flags);
-+
-+/* Splice address range into a pipe. */
-+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
-+ size_t __count, unsigned int __flags);
-+
-+/* Splice two files together. */
-+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
-+ __off64_t *__offout, size_t __len,
-+ unsigned int __flags);
-+
-+/* In-kernel implementation of tee for pipe buffers. */
-+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
-+ unsigned int __flags);
-+
-+#endif
-+
-+__END_DECLS
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/bits/kernel_stat.h
-@@ -0,0 +1,61 @@
-+#ifndef _BITS_STAT_STRUCT_H
-+#define _BITS_STAT_STRUCT_H
-+
-+#ifndef _LIBC
-+#error bits/kernel_stat.h is for internal uClibc use only!
-+#endif
-+
-+/* This file provides whatever this particular arch's kernel thinks
-+ * struct kernel_stat should look like... It turns out each arch has a
-+ * different opinion on the subject... */
-+
-+struct kernel_stat {
-+ unsigned short st_dev;
-+ unsigned short __pad1;
-+ unsigned long st_ino;
-+ unsigned short st_mode;
-+ unsigned short st_nlink;
-+ unsigned short st_uid;
-+ unsigned short st_gid;
-+ unsigned short st_rdev;
-+ unsigned short __pad2;
-+ unsigned long st_size;
-+ unsigned long st_blksize;
-+ unsigned long st_blocks;
-+ unsigned long st_atime;
-+ unsigned long __unused1;
-+ unsigned long st_mtime;
-+ unsigned long __unused2;
-+ unsigned long st_ctime;
-+ unsigned long __unused3;
-+ unsigned long __unused4;
-+ unsigned long __unused5;
-+};
-+
-+struct kernel_stat64 {
-+ unsigned char __pad0[6];
-+ unsigned short st_dev;
-+ unsigned char __pad1[4];
-+#define _HAVE_STAT64___ST_INO
-+ unsigned long __st_ino;
-+ unsigned int st_mode;
-+ unsigned int st_nlink;
-+ unsigned long st_uid;
-+ unsigned long st_gid;
-+ unsigned char __pad2[6];
-+ unsigned short st_rdev;
-+ unsigned char __pad3[4];
-+ long long st_size;
-+ unsigned long st_blksize;
-+ unsigned long st_blocks; /* Number 512-byte blocks allocated. */
-+ unsigned long __pad4; /* future possible st_blocks high bits */
-+ unsigned long st_atime;
-+ unsigned long __pad5;
-+ unsigned long st_mtime;
-+ unsigned long __pad6;
-+ unsigned long st_ctime;
-+ unsigned long __pad7; /* will be high 32 bits of ctime someday */
-+ unsigned long long st_ino;
-+};
-+
-+#endif /* _BITS_STAT_STRUCT_H */
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/bits/kernel_types.h
-@@ -0,0 +1,44 @@
-+/* Note that we use the exact same include guard #define names
-+ * as asm/posix_types.h. This will avoid gratuitous conflicts
-+ * with the posix_types.h kernel header, and will ensure that
-+ * our private content, and not the kernel header, will win.
-+ * -Erik
-+ */
-+#ifndef __ARCH_UBICOM32_POSIX_TYPES_H
-+#define __ARCH_UBICOM32_POSIX_TYPES_H
-+
-+typedef unsigned long __kernel_dev_t;
-+typedef unsigned long __kernel_ino_t;
-+typedef unsigned short __kernel_mode_t;
-+typedef unsigned short __kernel_nlink_t;
-+typedef long __kernel_off_t;
-+typedef int __kernel_pid_t;
-+typedef unsigned short __kernel_ipc_pid_t;
-+typedef unsigned short __kernel_uid_t;
-+typedef unsigned short __kernel_gid_t;
-+typedef unsigned int __kernel_size_t;
-+typedef int __kernel_ssize_t;
-+typedef int __kernel_ptrdiff_t;
-+typedef long __kernel_time_t;
-+typedef long __kernel_suseconds_t;
-+typedef long __kernel_clock_t;
-+typedef int __kernel_daddr_t;
-+typedef char * __kernel_caddr_t;
-+typedef unsigned short __kernel_uid16_t;
-+typedef unsigned short __kernel_gid16_t;
-+typedef unsigned int __kernel_uid32_t;
-+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 long __kernel_loff_t;
-+
-+typedef struct {
-+#ifdef __USE_ALL
-+ int val[2];
-+#else
-+ int __val[2];
-+#endif
-+} __kernel_fsid_t;
-+
-+#endif /* __ARCH_UBICOM32_POSIX_TYPES_H */
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/bits/mman.h
-@@ -0,0 +1,102 @@
-+/* Definitions for POSIX memory map interface. Linux/m68k version.
-+ Copyright (C) 1997, 2000, 2003, 2005 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, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#ifndef _SYS_MMAN_H
-+# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
-+#endif
-+
-+/* The following definitions basically come from the kernel headers.
-+ But the kernel header is not namespace clean. */
-+
-+
-+/* Protections are chosen from these bits, OR'd together. The
-+ implementation does not necessarily support PROT_EXEC or PROT_WRITE
-+ without PROT_READ. The only guarantees are that no writing will be
-+ allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
-+
-+#define PROT_READ 0x1 /* Page can be read. */
-+#define PROT_WRITE 0x2 /* Page can be written. */
-+#define PROT_EXEC 0x4 /* Page can be executed. */
-+#define PROT_NONE 0x0 /* Page can not be accessed. */
-+#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of
-+ growsdown vma (mprotect only). */
-+#define PROT_GROWSUP 0x02000000 /* Extend change to start of
-+ growsup vma (mprotect only). */
-+
-+/* Sharing types (must choose one and only one of these). */
-+#define MAP_SHARED 0x01 /* Share changes. */
-+#define MAP_PRIVATE 0x02 /* Changes are private. */
-+#ifdef __USE_MISC
-+# define MAP_TYPE 0x0f /* Mask for type of mapping. */
-+#endif
-+
-+/* Other flags. */
-+#define MAP_FIXED 0x10 /* Interpret addr exactly. */
-+#ifdef __USE_MISC
-+# define MAP_FILE 0
-+# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
-+# define MAP_ANON MAP_ANONYMOUS
-+#endif
-+
-+/* These are Linux-specific. */
-+#ifdef __USE_MISC
-+# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */
-+# define MAP_DENYWRITE 0x00800 /* ETXTBSY */
-+# define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */
-+# define MAP_LOCKED 0x02000 /* Lock the mapping. */
-+# define MAP_NORESERVE 0x04000 /* Don't check for reservations. */
-+# define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */
-+# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */
-+#endif
-+
-+/* Flags to `msync'. */
-+#define MS_ASYNC 1 /* Sync memory asynchronously. */
-+#define MS_SYNC 4 /* Synchronous memory sync. */
-+#define MS_INVALIDATE 2 /* Invalidate the caches. */
-+
-+/* Flags for `mlockall'. */
-+#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
-+#define MCL_FUTURE 2 /* Lock all additions to address
-+ space. */
-+
-+/* Flags for `mremap'. */
-+#ifdef __USE_GNU
-+# define MREMAP_MAYMOVE 1
-+# define MREMAP_FIXED 2
-+#endif
-+
-+/* Advice to `madvise'. */
-+#ifdef __USE_BSD
-+# define MADV_NORMAL 0 /* No further special treatment. */
-+# define MADV_RANDOM 1 /* Expect random page references. */
-+# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
-+# define MADV_WILLNEED 3 /* Will need these pages. */
-+# define MADV_DONTNEED 4 /* Don't need these pages. */
-+# define MADV_DONTFORK 10 /* Do not inherit across fork. */
-+# define MADV_DOFORK 11 /* Do inherit across fork. */
-+#endif
-+
-+/* The POSIX people had to invent similar names for the same things. */
-+#ifdef __USE_XOPEN2K
-+# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
-+# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
-+# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
-+# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
-+# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
-+#endif
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/bits/setjmp.h
-@@ -0,0 +1,52 @@
-+/* Define the machine-dependent type `jmp_buf'. Ubicom32 version.
-+ Copyright (C) 1992,93,95,97,2000 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, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#ifndef _BITS_SETJMP_H
-+#define _BITS_SETJMP_H 1
-+
-+#if !defined _SETJMP_H && !defined _PTHREAD_H
-+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
-+#endif
-+
-+#ifndef _ASM
-+/*
-+ * This is the structure where we are going to save D10-D13, A0, A1, A2, A5, A6 and SP(A7).
-+ * A5 is the return address. Call to setjmp will save these. Call to longjmp will return
-+ * Control to the address in A5.
-+ */
-+typedef struct setjmp_save_struct {
-+ unsigned long d10; /* D10 */
-+ unsigned long d11; /* D11 */
-+ unsigned long d12; /* D12 */
-+ unsigned long d13; /* D13 */
-+ unsigned long a1; /* A1 */
-+ unsigned long a2; /* A2 */
-+ unsigned long a5; /* A5 return address. */
-+ unsigned long a6; /* A6 */
-+ unsigned long sp; /* A7 stack pointer. */
-+} __jmp_buf[1];
-+
-+#endif
-+
-+/* Test if longjmp to JMPBUF would unwind the frame
-+ containing a local variable at ADDRESS. */
-+#define _JMPBUF_UNWINDS(jmpbuf, address) \
-+ ((void *) (address) < (void*)(jmpbuf)->sp)
-+
-+#endif /* bits/setjmp.h */
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/bits/stackinfo.h
-@@ -0,0 +1,28 @@
-+/* Copyright (C) 1999 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, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+/* This file contains a bit of information about the stack allocation
-+ of the processor. */
-+
-+#ifndef _STACKINFO_H
-+#define _STACKINFO_H 1
-+
-+/* On Ubicom32 the stack grows down. */
-+#define _STACK_GROWS_DOWN 1
-+
-+#endif /* stackinfo.h */
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/bits/syscalls.h
-@@ -0,0 +1,169 @@
-+#ifndef _BITS_SYSCALLS_H
-+#define _BITS_SYSCALLS_H
-+#ifndef _SYSCALL_H
-+# error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead."
-+#endif
-+
-+/* m68k headers does stupid stuff with __NR_iopl / __NR_vm86:
-+ * #define __NR_iopl not supported
-+ * #define __NR_vm86 not supported
-+ */
-+#undef __NR_iopl
-+#undef __NR_vm86
-+
-+#ifndef __ASSEMBLER__
-+
-+#include <errno.h>
-+
-+/* Linux takes system call arguments in registers:
-+
-+ syscall number %d8
-+ arg 1 %d0
-+ arg 2 %d1
-+ arg 3 %d2
-+ arg 4 %d3
-+ arg 5 %d4
-+ arg 6 %d5
-+*/
-+
-+#define __syscall_return(type, res) \
-+ do { \
-+ if (likely((unsigned long)(res) < (unsigned long)(-125))) { \
-+ return (type) (res); \
-+ } else { \
-+ /* avoid using res which is declared to be in register d0; \
-+ errno might expand to a function call and clobber it. */ \
-+ int __err = -(res); \
-+ __set_errno(__err); \
-+ return (type) -1; \
-+ } \
-+ } while (0)
-+
-+extern void __illegally_sized_syscall_arg1 (void);
-+extern void __illegally_sized_syscall_arg2 (void);
-+extern void __illegally_sized_syscall_arg3 (void);
-+extern void __illegally_sized_syscall_arg4 (void);
-+extern void __illegally_sized_syscall_arg5 (void);
-+extern void __illegally_sized_syscall_arg6 (void);
-+
-+#define __loadargs_0(name, dummy) \
-+ d8 = name
-+
-+#define __loadargs_1(name, __arg1) \
-+ __loadargs_0(name, 0); \
-+ if (__builtin_classify_type (__arg1) != 5 && sizeof (__arg1) > 4) \
-+ __illegally_sized_syscall_arg1 (); \
-+ d0_retval = (long int) __arg1
-+#define __loadargs_2(name, __arg1, __arg2) \
-+ __loadargs_1(name, __arg1); \
-+ if (__builtin_classify_type (__arg2) != 5 && sizeof (__arg2) > 4) \
-+ __illegally_sized_syscall_arg2 (); \
-+ d1 = (long int) __arg2
-+
-+#define __loadargs_3(name, __arg1, __arg2, __arg3) \
-+ __loadargs_2(name, __arg1, __arg2); \
-+ if (__builtin_classify_type (__arg3) != 5 && sizeof (__arg3) > 4) \
-+ __illegally_sized_syscall_arg3 (); \
-+ d2 = (long int) __arg3
-+
-+#define __loadargs_4(name, __arg1, __arg2, __arg3, __arg4) \
-+ __loadargs_3(name, __arg1, __arg2, __arg3); \
-+ if (__builtin_classify_type (__arg4) != 5 && sizeof (__arg4) > 4) \
-+ __illegally_sized_syscall_arg4 (); \
-+ d3 = (long int)__arg4
-+
-+#define __loadargs_5(name, __arg1, __arg2, __arg3, __arg4, __arg5) \
-+ __loadargs_4(name, __arg1, __arg2, __arg3, __arg4); \
-+ if (__builtin_classify_type (__arg5) != 5 && sizeof (__arg5) > 4) \
-+ __illegally_sized_syscall_arg5 (); \
-+ d4 = (long int)__arg5
-+
-+#define __loadargs_6(name, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6) \
-+ __loadargs_5(name, __arg1, __arg2, __arg3, __arg4, __arg5); \
-+ if (__builtin_classify_type (__arg6) != 5 && sizeof (__arg6) > 4) \
-+ __illegally_sized_syscall_arg6 (); \
-+ d5 = (long int)__arg6
-+
-+#define __internal_syscall_body(name, nr, args...) \
-+ register long int d0_retval __asm__ ("d0"); \
-+ register long int d1 __asm__ ("d1"); \
-+ register long int d2 __asm__ ("d2"); \
-+ register long int d3 __asm__ ("d3"); \
-+ register long int d4 __asm__ ("d4"); \
-+ register long int d5 __asm__ ("d5"); \
-+ register long int d8 __asm__ ("d8"); \
-+ __loadargs_##nr (__NR_##name, args); \
-+ __asm__ __volatile__ ( \
-+ " moveai a5, #%%hi(0x40400000)\n\t" \
-+ " calli a5, 16(a5)\n\t" \
-+ : "+r" (d0_retval), "+r" (d1), "+r" (d2), "+r" (d3), \
-+ "+r" (d4), "+r" (d5), "+r" (d8) : \
-+ : "cc", "memory", \
-+ "acc0_lo", "acc0_hi", "acc1_lo", "acc1_hi", \
-+ "source3", \
-+ "a0", "a3", "a4", "a5", \
-+ "d6", "d7", "d9", "d14", "d15" \
-+ );
-+
-+#define INLINE_SYSCALL(name, nr, args...) \
-+ ({ \
-+ __internal_syscall_body(name, nr, args); \
-+ if (unlikely((unsigned long)(d0_retval) >= (unsigned long)(-125))) { \
-+ __set_errno (-d0_retval); \
-+ d0_retval = -1L; \
-+ } \
-+ d0_retval; \
-+ })
-+
-+
-+#undef _syscall0
-+#define _syscall0(type,name) \
-+type name(void){ \
-+ __internal_syscall_body(name, 0); \
-+ __syscall_return(type, d0_retval); \
-+}
-+
-+#undef _syscall1
-+#define _syscall1(type,name,type1,arg1) \
-+type name(type1 arg1){ \
-+ __internal_syscall_body(name, 1, arg1); \
-+ __syscall_return(type, d0_retval); \
-+}
-+
-+#undef _syscall2
-+#define _syscall2(type,name,type1,arg1,type2,arg2) \
-+type name(type1 arg1, type2 arg2){ \
-+ __internal_syscall_body(name, 2, arg1, arg2); \
-+ __syscall_return(type, d0_retval); \
-+}
-+
-+#undef _syscall3
-+#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
-+type name(type1 arg1, type2 arg2, type3 arg3){ \
-+ __internal_syscall_body(name, 3, arg1, arg2, arg3); \
-+ __syscall_return(type, d0_retval); \
-+}
-+
-+#undef _syscall4
-+#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
-+type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4){ \
-+ __internal_syscall_body(name, 4, arg1, arg2, arg3, arg4); \
-+ __syscall_return(type, d0_retval); \
-+}
-+
-+#undef _syscall5
-+#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
-+type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5){ \
-+ __internal_syscall_body(name, 5, arg1, arg2, arg3, arg4, arg5); \
-+ __syscall_return(type, d0_retval); \
-+}
-+
-+#undef _syscall6
-+#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \
-+type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6){ \
-+ __internal_syscall_body(name, 6, arg1, arg2, arg3, arg4, arg5, arg6); \
-+ __syscall_return(type, d0_retval); \
-+}
-+
-+#endif /* __ASSEMBLER__ */
-+#endif /* _BITS_SYSCALLS_H */
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/bits/uClibc_arch_features.h
-@@ -0,0 +1,45 @@
-+/*
-+ * Track misc arch-specific features that aren't config options
-+ */
-+
-+#ifndef _BITS_UCLIBC_ARCH_FEATURES_H
-+#define _BITS_UCLIBC_ARCH_FEATURES_H
-+
-+/* instruction used when calling abort() to kill yourself */
-+/*#define __UCLIBC_ABORT_INSTRUCTION__ "asm instruction"*/
-+#undef __UCLIBC_ABORT_INSTRUCTION__
-+
-+/* can your target use syscall6() for mmap ? */
-+#undef __UCLIBC_MMAP_HAS_6_ARGS__
-+
-+/* does your target use syscall4() for truncate64 ? (32bit arches only) */
-+#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__
-+
-+/* does your target have a broken create_module() ? */
-+#undef __UCLIBC_BROKEN_CREATE_MODULE__
-+
-+/* does your target have to worry about older [gs]etrlimit() ? */
-+#undef __UCLIBC_HANDLE_OLDER_RLIMIT__
-+
-+/* does your target prefix all symbols with an _ ? */
-+#define __UCLIBC_NO_UNDERSCORES__
-+
-+/* does your target have an asm .set ? */
-+#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
-+
-+/* define if target doesn't like .global */
-+#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__
-+
-+/* define if target supports .weak */
-+#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__
-+
-+/* define if target supports .weakext */
-+#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__
-+
-+/* needed probably only for ppc64 */
-+#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__
-+
-+/* define if target supports IEEE signed zero floats */
-+#define __UCLIBC_HAVE_SIGNED_ZERO__
-+
-+#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/bits/wordsize.h
-@@ -0,0 +1,19 @@
-+/* Copyright (C) 1999 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, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#define __WORDSIZE 32
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/clone.S
-@@ -0,0 +1,71 @@
-+#include <sys/syscall.h>
-+
-+ .global __syscall_error
-+
-+/* int _clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
-+ .text
-+ .type clone,@function
-+ .global clone
-+clone:
-+ /* Sanity check arguments. */
-+ sub.4 #0, #0, d0 /* Test if fn is zero. */
-+ jmpeq.f 1f /* arg bad */
-+ sub.4 #0, #0, d1 /* Test if child_stack is zero. */
-+ jmpeq.f 1f /* arg bad */
-+
-+ /* Set up child_stack frame.. arg and fn */
-+ move.4 a3, d1
-+ move.4 -4(a3)++, d3 /* push 'arg' to child stack */
-+ move.4 -4(a3)++, d0 /* push fn to child stack, this will become a5
-+ * on new child */
-+ move.4 d1, a3
-+ move.4 -4(sp)++, a5 /* push a5 to our stack */
-+
-+ /*
-+ * The syscall clone is clone(int flags, void *child_stack) so we set
-+ * that up now
-+ */
-+ move.4 d0, d2 /* Move flags to d0 */
-+
-+ /* Do Clone syscall */
-+ movei d8, #__NR_clone
-+ moveai a5, #%hi(0x40400000)
-+ calli a5, 0x10(a5)
-+ move.4 a5, (sp)4++ /* pop a5 from stack */
-+
-+ /* Clone Complete */
-+ cmpi d0, #0 /* Test if d0 is less than zero. If it is we
-+ * return the error */
-+ jmplt.f 2f /* If return is less than we had an error */
-+ jmpeq.f 3f /* If return is 0 we are in the clone, jump to
-+ * thread start */
-+ ret a5 /* d0 is pid */
-+
-+ /* Invalid Value */
-+1: movei d0, #-22 /* EINVAL */
-+
-+ /* Call syscall Error */
-+2: sub.4 d0, #0, d0 /* d0 = -d0 */
-+#if defined(__UBICOM32_FDPIC__)
-+ call a3, __syscall_error
-+#else
-+ moveai a3, #%hi(__syscall_error)
-+ calli a3, %lo(__syscall_error)(a3)
-+#endif
-+ /* Child Thread Start */
-+3:
-+#if defined(__UBICOM32_FDPIC__)
-+ /* a5 actually contains a function descriptor for fdpic */
-+ move.4 a0, 4(a5) /* set GOT for this function */
-+ move.4 a5, 0(a5) /* get address of entry point */
-+#endif
-+ move.4 d0, (sp)4++ /* pop 'arg' to stack */
-+ calli a5, 0(a5)
-+ movei d8, #__NR_exit
-+ moveai a3, #%hi(0x40400000)
-+ calli a3, 0x10(a3)
-+
-+ .size clone, . - clone
-+ .global __GI_clone
-+ .hidden __GI_clone
-+ .set __GI_clone,clone
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/crt1.S
-@@ -0,0 +1,179 @@
-+/* Startup code compliant to the ELF m68k ABI.
-+ Copyright (C) 1996, 1997, 1998, 2001, 2002 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.
-+
-+ In addition to the permissions in the GNU Lesser General Public
-+ License, the Free Software Foundation gives you unlimited
-+ permission to link the compiled version of this file with other
-+ programs, and to distribute those programs without any restriction
-+ coming from the use of this file. (The GNU Lesser General Public
-+ License restrictions do apply in other respects; for example, they
-+ cover modification of the file, and distribution when not linked
-+ into another program.)
-+
-+ Note that people who make modified versions of this file are not
-+ obligated to grant this special exception for their modified
-+ versions; it is their choice whether to do so. The GNU Lesser
-+ General Public License gives permission to release a modified
-+ version without this exception; this exception also makes it
-+ possible to release a modified version which carries forward this
-+ exception.
-+
-+ 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, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <features.h>
-+
-+/* This is the canonical entry point, usually the first thing in the text
-+ segment. The SVR4/m68k ABI says that when the entry point runs,
-+ most registers' values are unspecified, except for:
-+
-+ %a1 Contains a function pointer to be registered with `atexit'.
-+ This is how the dynamic linker arranges to have DT_FINI
-+ functions called for shared libraries that have been loaded
-+ before this code runs.
-+
-+ %sp The stack contains the arguments and environment:
-+ 0(%sp) argc
-+ 4(%sp) argv[0]
-+ ...
-+ (4*argc)(%sp) NULL
-+ (4*(argc+1))(%sp) envp[0]
-+ ...
-+ NULL
-+
-+ The uclinux conventions are different. %a1 is not defined on entry
-+ and the stack is laid out as follows:
-+
-+ 0(%sp) argc
-+ 4(%sp) argv
-+ 8(%sp) envp
-+*/
-+
-+
-+ .text
-+ .type main,@function
-+ .type _init,%function
-+ .type _fini,%function
-+#ifndef __UCLIBC_CTOR_DTOR__
-+ .weak _init
-+ .weak _fini
-+#endif
-+ .globl _start
-+ .global __uClibc_main;
-+ .type __uClibc_main,@function;
-+ .type _start,@function
-+_start:
-+
-+#if defined(__UBICOM32_FDPIC__) && !defined(L_Scrt1)
-+ /* P0 contains a pointer to the program's load map. */
-+ call a3, .Lcall;
-+.Lcall:
-+ move.4 d0, d1 ; load exec_map_addr
-+ moveai a4, #%hi(.Lcall)
-+ lea.1 d15, %lo(.Lcall)(a4)
-+ sub.4 d15, a3, d15 ; difference between .Lcall and actual address of .Lcall
-+ moveai a3, #%hi(__ROFIXUP_LIST__)
-+ lea.1 d1, %lo(__ROFIXUP_LIST__)(a3)
-+ moveai a3, #%hi(__ROFIXUP_END__)
-+ lea.1 d2, %lo(__ROFIXUP_END__)(a3)
-+ add.4 d1, d1, d15
-+ add.4 d2, d2, d15
-+ call a5, __self_reloc ; returns GOT in d0
-+ move.4 a0, d0 ; set GOT
-+#endif
-+
-+/*
-+ all this is setup to make the following call.
-+
-+ void __uClibc_main(
-+ d0 - int (*main)(int, char **, char **),
-+ d1 - int argc, (d1)
-+ d2 - char **argv,
-+ d3 - void (*app_init)(void),
-+ d4 - void (*app_fini)(void),
-+ d5 - void (*rtld_fini)(void),
-+ d6 - void *stack_end
-+ );
-+ */
-+
-+ /*
-+ * Load pointer to main into d0
-+ */
-+#ifdef __UBICOM32_FDPIC__
-+ movei d0, #%got_funcdesc_lo(main)
-+ move.4 d0, (a0, d0)
-+#else
-+ moveai a3, #%hi(main)
-+ lea.1 d0, %lo(main)(a3)
-+#endif
-+
-+ /*
-+ * Grab the environment stuff from stack and set up d1, d2 with it.
-+ */
-+ move.4 d1, (sp)
-+#ifdef __UBICOM32_FDPIC__
-+ /* For FDPIC the calling convention is different than flat */
-+ lea.1 d2, 4(sp)
-+#else
-+ move.4 d2, 4(sp)
-+#endif
-+
-+#ifdef __UCLIBC_CTOR_DTOR__
-+ /*
-+ * Load pointer to _init into d3
-+ */
-+#ifdef __UBICOM32_FDPIC__
-+ movei d3, #%got_funcdesc_lo(_init)
-+ move.4 d3, (a0, d3)
-+#else
-+ moveai a3, #%hi(_init)
-+ lea.1 d3, %lo(_init)(a3)
-+#endif
-+
-+ /*
-+ * Load pointer to _fini into d4
-+ */
-+#ifdef __UBICOM32_FDPIC__
-+ movei d4, #%got_funcdesc_lo(_fini)
-+ move.4 d4, (a0, d4)
-+#else
-+ moveai a3, #%hi(_fini)
-+ lea.1 d4, %lo(_fini)(a3)
-+#endif
-+
-+#else /* !__UCLIBC_CTOR_DTOR__ */
-+ move.4 d3, #0 ; _init
-+ move.4 d4, #0 ; _fini
-+#endif
-+
-+#ifdef __UBICOM32_FDPIC__
-+ move.4 d5, a1 ; ldso _fini funcdesc (see dl-startup.h)
-+#else
-+ movei d5, #0 ; rtld_fini (not used)
-+#endif
-+
-+ move.4 d6, sp ; Stack End.
-+
-+ /* Call the user's main function, and exit with its value. But
-+ let the libc call main. */
-+#ifdef __UBICOM32_FDPIC__
-+ call a5, __uClibc_main
-+#else
-+ moveai a5, #%hi(__uClibc_main)
-+ calli a5, %lo(__uClibc_main)(a5)
-+#endif
-+
-+ bkpt #-1 ; Crash if somehow `exit' does return.
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/crti.S
-@@ -0,0 +1,54 @@
-+/* Specialized code needed to support construction and destruction of
-+ file-scope objects in C++ and Java code, and to support exception handling.
-+ Copyright (C) 1999 Free Software Foundation, Inc.
-+ Contributed by Charles-Antoine Gauthier (charles.gauthier@iit.nrc.ca).
-+
-+This file is part of GCC.
-+
-+GCC is free software; you can redistribute it and/or modify
-+it under the terms of the GNU General Public License as published by
-+the Free Software Foundation; either version 2, or (at your option)
-+any later version.
-+
-+GCC is distributed in the hope that it will be useful,
-+but WITHOUT ANY WARRANTY; without even the implied warranty of
-+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+GNU General Public License for more details.
-+
-+You should have received a copy of the GNU General Public License
-+along with GCC; see the file COPYING. If not, write to
-+the Free Software Foundation, 59 Temple Place - Suite 330,
-+Boston, MA 02111-1307, USA. */
-+
-+/* As a special exception, if you link this library with files
-+ compiled with GCC to produce an executable, this does not cause
-+ the resulting executable to be covered by the GNU General Public License.
-+ This exception does not however invalidate any other reasons why
-+ the executable file might be covered by the GNU General Public License. */
-+
-+/*
-+ * This file just supplies function prologues for the .init and .fini
-+ * sections. It is linked in before crtbegin.o.
-+ */
-+ .file "crti.o"
-+ .ident "GNU C crti.o"
-+
-+ .section .init
-+ .align 2
-+ .globl _init
-+ .type _init, @function
-+_init:
-+ move.4 -4(sp)++, a5
-+#ifdef __UBICOM32_FDPIC__
-+ move.4 -4(sp)++, a0
-+#endif
-+
-+ .section .fini
-+ .align 2
-+ .globl _fini
-+ .type _fini, @function
-+_fini:
-+ move.4 -4(sp)++, a5
-+#ifdef __UBICOM32_FDPIC__
-+ move.4 -4(sp)++, a0
-+#endif
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/crtn.S
-@@ -0,0 +1,47 @@
-+/* Specialized code needed to support construction and destruction of
-+ file-scope objects in C++ and Java code, and to support exception handling.
-+ Copyright (C) 1999 Free Software Foundation, Inc.
-+ Contributed by Charles-Antoine Gauthier (charles.gauthier@iit.nrc.ca).
-+
-+This file is part of GCC.
-+
-+GCC is free software; you can redistribute it and/or modify
-+it under the terms of the GNU General Public License as published by
-+the Free Software Foundation; either version 2, or (at your option)
-+any later version.
-+
-+GCC is distributed in the hope that it will be useful,
-+but WITHOUT ANY WARRANTY; without even the implied warranty of
-+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+GNU General Public License for more details.
-+
-+You should have received a copy of the GNU General Public License
-+along with GCC; see the file COPYING. If not, write to
-+the Free Software Foundation, 59 Temple Place - Suite 330,
-+Boston, MA 02111-1307, USA. */
-+
-+/* As a special exception, if you link this library with files
-+ compiled with GCC to produce an executable, this does not cause
-+ the resulting executable to be covered by the GNU General Public License.
-+ This exception does not however invalidate any other reasons why
-+ the executable file might be covered by the GNU General Public License. */
-+
-+/*
-+ * This file supplies function epilogues for the .init and .fini sections.
-+ * It is linked in after all other files.
-+ */
-+
-+ .file "crtn.o"
-+ .ident "GNU C crtn.o"
-+
-+ .section .init
-+#ifdef __UBICOM32_FDPIC__
-+ move.4 a0, (sp)4++
-+#endif
-+ ret (sp)4++
-+
-+ .section .fini
-+#ifdef __UBICOM32_FDPIC__
-+ move.4 a0, (sp)4++
-+#endif
-+ ret (sp)4++
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/crtreloc.c
-@@ -0,0 +1,145 @@
-+/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-+ written by Alexandre Oliva <aoliva@redhat.com>
-+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.
-+
-+In addition to the permissions in the GNU Lesser General Public
-+License, the Free Software Foundation gives you unlimited
-+permission to link the compiled version of this file with other
-+programs, and to distribute those programs without any restriction
-+coming from the use of this file. (The GNU Lesser General Public
-+License restrictions do apply in other respects; for example, they
-+cover modification of the file, and distribution when not linked
-+into another program.)
-+
-+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
-+Library 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; see the file COPYING.LIB. If
-+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-+Cambridge, MA 02139, USA. */
-+
-+#ifdef __UBICOM32_FDPIC__
-+
-+#include <sys/types.h>
-+#include <link.h>
-+
-+/* This file is to be compiled into crt object files, to enable
-+ executables to easily self-relocate. */
-+
-+union word {
-+ char c[4];
-+ void *v;
-+};
-+
-+/* Compute the runtime address of pointer in the range [p,e), and then
-+ map the pointer pointed by it. */
-+static __always_inline void ***
-+reloc_range_indirect (void ***p, void ***e,
-+ const struct elf32_fdpic_loadmap *map)
-+{
-+ while (p < e)
-+ {
-+ if (*p != (void **)-1)
-+ {
-+ void *ptr = __reloc_pointer (*p, map);
-+ if (ptr != (void *)-1)
-+ {
-+ void *pt;
-+ if ((long)ptr & 3)
-+ {
-+ unsigned char *c = ptr;
-+ int i;
-+ unsigned long v = 0;
-+ for (i = 0; i < 4; i++)
-+ v |= c[i] << 8 * i;
-+ pt = (void *)v;
-+ }
-+ else
-+ pt = *(void**)ptr;
-+ pt = __reloc_pointer (pt, map);
-+ if ((long)ptr & 3)
-+ {
-+ unsigned char *c = ptr;
-+ int i;
-+ unsigned long v = (unsigned long)pt;
-+ for (i = 0; i < 4; i++, v >>= 8)
-+ c[i] = v;
-+ }
-+ else
-+ *(void**)ptr = pt;
-+ }
-+ }
-+ p++;
-+ }
-+ return p;
-+}
-+
-+/* Call __reloc_range_indirect for the given range except for the last
-+ entry, whose contents are only relocated. It's expected to hold
-+ the GOT value. */
-+void* attribute_hidden
-+__self_reloc (const struct elf32_fdpic_loadmap *map,
-+ void ***p, void ***e)
-+{
-+ p = reloc_range_indirect (p, e-1, map);
-+
-+ if (p >= e)
-+ return (void*)-1;
-+
-+ return __reloc_pointer (*p, map);
-+}
-+
-+#if 0
-+/* These are other functions that might be useful, but that we don't
-+ need. */
-+
-+/* Remap pointers in [p,e). */
-+static __always_inline void**
-+reloc_range (void **p, void **e,
-+ const struct elf32_fdpic_loadmap *map)
-+{
-+ while (p < e)
-+ {
-+ *p = __reloc_pointer (*p, map);
-+ p++;
-+ }
-+ return p;
-+}
-+
-+/* Remap p, adjust e by the same offset, then map the pointers in the
-+ range determined by them. */
-+void attribute_hidden
-+__reloc_range (const struct elf32_fdpic_loadmap *map,
-+ void **p, void **e)
-+{
-+ void **old = p;
-+
-+ p = __reloc_pointer (p, map);
-+ e += p - old;
-+ reloc_range (p, e, map);
-+}
-+
-+/* Remap p, adjust e by the same offset, then map pointers referenced
-+ by the (unadjusted) pointers in the range. Return the relocated
-+ value of the last pointer in the range. */
-+void* attribute_hidden
-+__reloc_range_indirect (const struct elf32_fdpic_loadmap *map,
-+ void ***p, void ***e)
-+{
-+ void ***old = p;
-+
-+ p = __reloc_pointer (p, map);
-+ e += p - old;
-+ return reloc_range_indirect (p, e, map);
-+}
-+#endif
-+
-+#endif /* __UBICOM32_FDPIC__ */
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/setjmp.S
-@@ -0,0 +1,72 @@
-+/* Setjmp for Ubicom32 */
-+ .text
-+ .global _setjmp
-+ .type _setjmp,@function
-+_setjmp:
-+ movea a3, d0 ; A3 now holds the jmp buf that was passed in.
-+ move.4 (a3)4++, d10
-+ move.4 (a3)4++, d11
-+ move.4 (a3)4++, d12
-+ move.4 (a3)4++, d13
-+ move.4 (a3)4++, a1
-+ move.4 (a3)4++, a2
-+ move.4 (a3)4++, a5
-+ move.4 (a3)4++, a6
-+ move.4 (a3)4++, a7
-+ move.4 d0, #0
-+
-+ calli a5, 0(a5)
-+ .size _setjmp, . - _setjmp
-+
-+/*
-+ * __sigsetjmp for Ubicom32
-+ * d0 holds sigjmp_buf and d1 holds the savemask. We will save the frame and then just call __sigjmp_save to do the mask save.
-+ */
-+ .global __sigsetjmp
-+ .type __sigsetjmp,@function
-+__sigsetjmp:
-+ movea a3, d0 ; A3 now holds the jmp buf that was passed in.
-+ move.4 (a3)4++, d10
-+ move.4 (a3)4++, d11
-+ move.4 (a3)4++, d12
-+ move.4 (a3)4++, d13
-+ move.4 (a3)4++, a1
-+ move.4 (a3)4++, a2
-+ move.4 (a3)4++, a5
-+ move.4 (a3)4++, a6
-+ move.4 (a3)4++, a7
-+
-+ ;; The frame has been saved. Call _sigjmp_save to get sigmask saved. a5 still has the return address and it will go back to that.
-+#if defined(__UBICOM32_FDPIC__)
-+ call a3, __sigjmp_save
-+#else
-+ moveai a3, #%hi(__sigjmp_save)
-+ calli a3, %lo(__sigjmp_save)(a3)
-+#endif
-+ .size __sigjmp_save, . - __sigjmp_save
-+
-+ .global __longjmp
-+ .type __longjmp,@function
-+__longjmp:
-+ movea a3, d0 ; A3 now holds the jmp buf that was passed in.
-+ move.4 d10, (a3)4++
-+ move.4 d11, (a3)4++
-+ move.4 d12, (a3)4++
-+ move.4 d13, (a3)4++
-+ move.4 a1 , (a3)4++
-+ move.4 a2 , (a3)4++
-+ move.4 a5 , (a3)4++
-+ move.4 a6 , (a3)4++
-+ move.4 a7 , (a3)4++
-+
-+ sub.4 #0, #0, d1 ; Test if d1 is zero. If it is we have to return 1 other wise return content of d1
-+ jmpeq.t 2f
-+ move.4 d0, d1 ; d1 is non zero load it into d0
-+ jmpt.t 3f
-+
-+2: move.4 d0, #1
-+3: calli a5, 0(a5)
-+ .size __longjmp, . - __longjmp
-+ .global __GI___longjmp
-+ .hidden __GI___longjmp
-+ .set __GI___longjmp,__longjmp
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/sys/procfs.h
-@@ -0,0 +1,122 @@
-+/* Copyright (C) 1996, 1997, 1999, 2000 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, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#ifndef _SYS_PROCFS_H
-+#define _SYS_PROCFS_H 1
-+
-+/* This is somehow modelled after the file of the same name on SysVr4
-+ systems. It provides a definition of the core file format for ELF
-+ used on Linux. */
-+
-+#include <features.h>
-+#include <signal.h>
-+#include <sys/time.h>
-+#include <sys/types.h>
-+#include <sys/ucontext.h>
-+#include <bits/wordsize.h>
-+
-+__BEGIN_DECLS
-+
-+#define ELF_NGREG 38
-+
-+typedef struct
-+ {
-+ union
-+ {
-+ unsigned long pr_regs[32];
-+ double pr_dregs[16];
-+ } pr_fr;
-+ unsigned long __unused;
-+ unsigned long pr_fsr;
-+ unsigned char pr_qcnt;
-+ unsigned char pr_q_entrysize;
-+ unsigned char pr_en;
-+ unsigned int pr_q[64];
-+ } elf_fpregset_t;
-+
-+typedef unsigned long elf_greg_t;
-+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
-+
-+struct elf_siginfo
-+ {
-+ int si_signo; /* Signal number. */
-+ int si_code; /* Extra code. */
-+ int si_errno; /* Errno. */
-+ };
-+
-+/* Definitions to generate Intel SVR4-like core files. These mostly
-+ have the same names as the SVR4 types with "elf_" tacked on the
-+ front to prevent clashes with linux definitions, and the typedef
-+ forms have been avoided. This is mostly like the SVR4 structure,
-+ but more Linuxy, with things that Linux does not support and which
-+ gdb doesn't really use excluded. Fields present but not used are
-+ marked with "XXX". */
-+struct elf_prstatus
-+ {
-+ struct elf_siginfo pr_info; /* Info associated with signal. */
-+ short int pr_cursig; /* Current signal. */
-+ unsigned long int pr_sigpend; /* Set of pending signals. */
-+ unsigned long int pr_sighold; /* Set of held signals. */
-+ __pid_t pr_pid;
-+ __pid_t pr_ppid;
-+ __pid_t pr_pgrp;
-+ __pid_t pr_sid;
-+ struct timeval pr_utime; /* User time. */
-+ struct timeval pr_stime; /* System time. */
-+ struct timeval pr_cutime; /* Cumulative user time. */
-+ struct timeval pr_cstime; /* Cumulative system time. */
-+ elf_gregset_t pr_reg; /* GP registers. */
-+ int pr_fpvalid; /* True if math copro being used. */
-+ };
-+
-+
-+#define ELF_PRARGSZ (80) /* Number of chars for args */
-+
-+struct elf_prpsinfo
-+ {
-+ char pr_state; /* Numeric process state. */
-+ char pr_sname; /* Char for pr_state. */
-+ char pr_zomb; /* Zombie. */
-+ char pr_nice; /* Nice val. */
-+ unsigned long int pr_flag; /* Flags. */
-+ unsigned short int pr_uid;
-+ unsigned short int pr_gid;
-+ int pr_pid, pr_ppid, pr_pgrp, pr_sid;
-+ /* Lots missing */
-+ char pr_fname[16]; /* Filename of executable. */
-+ char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
-+ };
-+
-+/* Addresses. */
-+typedef void *psaddr_t;
-+
-+/* Register sets. Linux has different names. */
-+typedef elf_gregset_t prgregset_t;
-+typedef elf_fpregset_t prfpregset_t;
-+
-+/* We don't have any differences between processes and threads,
-+ therefore have only one PID type. */
-+typedef __pid_t lwpid_t;
-+
-+
-+typedef struct elf_prstatus prstatus_t;
-+typedef struct elf_prpsinfo prpsinfo_t;
-+
-+__END_DECLS
-+
-+#endif /* sys/procfs.h */
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/sys/ucontext.h
-@@ -0,0 +1,104 @@
-+/* Copyright (C) 1998, 1999 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, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#ifndef _SYS_UCONTEXT_H
-+#define _SYS_UCONTEXT_H 1
-+
-+#include <features.h>
-+#include <signal.h>
-+/*
-+ * Location of the users' stored registers relative to R0.
-+ * Usage is as an index into a gregset_t array or as u.u_ar0[XX].
-+ */
-+#define REG_PSR (0)
-+#define REG_PC (1)
-+#define REG_SPARE (2)
-+#define REG_WVALID (3)
-+#define REG_G1 (4)
-+#define REG_G2 (5)
-+#define REG_G3 (6)
-+#define REG_G4 (7)
-+#define REG_G5 (8)
-+#define REG_G6 (9)
-+#define REG_G7 (10)
-+#define REG_O0 (11)
-+#define REG_O1 (12)
-+#define REG_O2 (13)
-+#define REG_O3 (14)
-+#define REG_O4 (15)
-+#define REG_O5 (16)
-+#define REG_O6 (17)
-+#define REG_O7 (18)
-+#define REG_GLOBALS (19)
-+
-+/*
-+ * A gregset_t is defined as an array type for compatibility with the reference
-+ * source. This is important due to differences in the way the C language
-+ * treats arrays and structures as parameters.
-+ *
-+ * Note that NGREG is really (sizeof (struct regs) / sizeof (greg_t)),
-+ * but that the ABI defines it absolutely to be 21 (resp. 19).
-+ */
-+
-+#define NGREG 20
-+typedef int greg_t;
-+
-+typedef greg_t gregset_t[NGREG];
-+
-+/*
-+ * The following structures define how a register window can appear on the
-+ * stack. This structure is available (when required) through the `gwins'
-+ * field of an mcontext (nested within ucontext). NIOS_MAXWINDOW is the
-+ * maximum number of outstanding register windows defined in the NIOS
-+ * architecture (*not* implementation).
-+ */
-+#define NIOS_MAXREGWINDOW 31 /* max windows in NIOS arch. */
-+struct rwindow
-+ {
-+ greg_t rw_local[8]; /* locals */
-+ greg_t rw_in[8]; /* ins */
-+ };
-+
-+#define rw_fp rw_in[6] /* frame pointer */
-+#define rw_rtn rw_in[7] /* return address */
-+
-+typedef struct gwindows
-+ {
-+ int wbcnt;
-+ int *spbuf[NIOS_MAXREGWINDOW];
-+ struct rwindow wbuf[NIOS_MAXREGWINDOW];
-+ } gwindows_t;
-+
-+typedef struct
-+ {
-+ gregset_t gregs; /* general register set */
-+ gwindows_t *gwins; /* POSSIBLE pointer to register windows */
-+ } mcontext_t;
-+
-+
-+/* Userlevel context. */
-+typedef struct ucontext
-+ {
-+ unsigned long uc_flags;
-+ struct ucontext *uc_link;
-+ __sigset_t uc_sigmask;
-+ stack_t uc_stack;
-+ mcontext_t uc_mcontext;
-+ } ucontext_t;
-+
-+#endif /* sys/ucontext.h */
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/syscall.c
-@@ -0,0 +1,32 @@
-+/* vi: set sw=4 ts=4: */
-+/* syscall for ubicom32/uClibc
-+ *
-+ * Copyright (C) 2008 by Ubicom Inc.
-+ * Copyright (C) 2002 by Erik Andersen <andersen@uclibc.org>
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU Library General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or (at your
-+ * option) any later version.
-+ *
-+ * This program 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 Library General Public License
-+ * for more details.
-+ *
-+ * You should have received a copy of the GNU Library General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#include <features.h>
-+#include <errno.h>
-+#include <sys/types.h>
-+#include <sys/syscall.h>
-+
-+extern long syscall(long sysnum, long a, long b, long c, long d, long e, long f);
-+long syscall(long sysnum, long a, long b, long c, long d, long e, long f)
-+{
-+ int __NR_syscall_number = sysnum;
-+ return (long) INLINE_SYSCALL(syscall_number, 6, a, b, c, d, e, f);
-+}
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/vfork.S
-@@ -0,0 +1,35 @@
-+#include <sys/syscall.h>
-+
-+ .text
-+ .type vfork,@function
-+ .global vfork
-+vfork:
-+ move.4 -4(sp)++, a5 ; Save return address on the stack.
-+ movei d8, #__NR_vfork
-+ moveai a3, #%hi(0x40400000)
-+ calli a5, 0x10(a3)
-+
-+ /*
-+ * You get here only if the syscall bombed. If things had worked out the
-+ * parent and child would have both returned to the instruction after
-+ * the vfork call.
-+ */
-+ move.4 a5, (sp)4++ ; Pop the return address off the stack.
-+ movei d1, #-125
-+ sub.4 #0, d0, d1
-+ jmplt.t 1f
-+
-+ ;; We have an error.
-+ sub.4 d0, #0, d0 ; d0 = -res. Call __set_errno with that.
-+#if defined(__UBICOM32_FDPIC__)
-+ call a3, __syscall_error
-+#else
-+ moveai a3, #%hi(__syscall_error)
-+ calli a3, %lo(__syscall_error)(a3) ; __syscall_error will return -1 and not come back here.
-+#endif
-+1:
-+ calli a5, 0(a5)
-+ .size vfork, . - vfork
-+ .global __GI_vfork
-+ .hidden __GI_vfork
-+ .set __GI_vfork,vfork
---- a/libpthread/linuxthreads.old/pthread.c
-+++ b/libpthread/linuxthreads.old/pthread.c
-@@ -393,6 +393,10 @@ void __pthread_initialize_minimal(void)
- #endif
-
- __libc_multiple_threads_ptr = __libc_pthread_init (ptr_pthread_functions);
-+#ifndef __ARCH_USE_MMU__
-+ __pthread_initial_thread_tos =
-+ (char *)(((long)CURRENT_STACK_FRAME + getpagesize()) & ~(getpagesize() - 1));
-+#endif /* __ARCH_USE_MMU__ */
- }
-
-
-@@ -461,8 +465,11 @@ static void pthread_initialize(void)
- * __pthread_initial_thread_bos at address 0. These bounds are refined as we
- * malloc other stack frames such that they don't overlap. -StS
- */
-- __pthread_initial_thread_tos =
-- (char *)(((long)CURRENT_STACK_FRAME + getpagesize()) & ~(getpagesize() - 1));
-+ if (__pthread_initial_thread_tos == NULL) {
-+ __pthread_initial_thread_tos =
-+ (char *)(((long)CURRENT_STACK_FRAME + getpagesize()) & ~(getpagesize() - 1));
-+ }
-+
- __pthread_initial_thread_bos = (char *) 1; /* set it non-zero so we know we have been here */
- PDEBUG("initial thread stack bounds: bos=%p, tos=%p\n",
- __pthread_initial_thread_bos, __pthread_initial_thread_tos);
---- /dev/null
-+++ b/libpthread/linuxthreads.old/sysdeps/ubicom32/pt-machine.h
-@@ -0,0 +1,68 @@
-+/* Machine-dependent pthreads configuration and inline functions.
-+
-+ Copyright (C) 1996, 1997, 1998, 2000, 2002, 2003, 2004
-+ Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Ralf Baechle <ralf@gnu.org>.
-+ Based on the Alpha version by Richard Henderson <rth@tamu.edu>.
-+
-+ 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; see the file COPYING.LIB. If
-+ not, write to the Free Software Foundation, Inc.,
-+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-+
-+#ifndef _PT_MACHINE_H
-+#define _PT_MACHINE_H 1
-+
-+#include <features.h>
-+
-+/*
-+ * XXX try to make this inline
-+ */
-+extern long int testandset (int *spinlock);
-+
-+#ifndef PT_EI
-+#define PT_EI
-+#else
-+/* Spinlock implementation; required. */
-+
-+/*
-+ * testandset() is the basis for the pthread spin lock.
-+ *
-+ * This implementation only requires that we 'set' the state of *spinlock. As
-+ * bset is allows us to atomically 'testandset' a single bit define our 'set' is
-+ * such that we will set bit 0 (ignoring all other bits, which should also be
-+ * zero).
-+ * Return value of 1 implies that the bit was already set and is still
-+ * set.
-+ * Return value of 0 implies that the bit was not previously set but it
-+ * now is.
-+ */
-+long int
-+testandset (int *spinlock)
-+{
-+ int ret;
-+ __asm__ volatile (
-+ " move.4 %0, #0 \n\t" /* Assume that the bit is not currently set */
-+ " bset %1, %1, #0 \n\t" /* Attempt to 'set' bit 0 */
-+ " jmpeq.t 1f \n\t"
-+ " move.4 %0, #1 \n\t" /* Bit was already set, so return 1 */
-+ " 1: \n\t"
-+ : "=r"(ret), "+U4"(*spinlock)
-+ :
-+ : "memory", "cc"
-+ );
-+ return ret;
-+}
-+#endif
-+#endif /* pt-machine.h */
---- /dev/null
-+++ b/libpthread/linuxthreads.old/sysdeps/ubicom32/tls.h
-@@ -0,0 +1,26 @@
-+/* Definitions for thread-local data handling. linuxthreads/MIPS version.
-+ Copyright (C) 2005 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, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#ifndef _TLS_H
-+#define _TLS_H
-+#ifdef HAVE_TLS_SUPPORT
-+#warning no tls support
-+#undef USE_TLS
-+#endif
-+#endif /* tls.h */
diff --git a/toolchain/uClibc/patches-0.9.30.1/900-backport_fix_possible_null_ptr_dereference_in_getaddrinfo.patch b/toolchain/uClibc/patches-0.9.30.1/900-backport_fix_possible_null_ptr_dereference_in_getaddrinfo.patch
deleted file mode 100644
index 62563ceb98..0000000000
--- a/toolchain/uClibc/patches-0.9.30.1/900-backport_fix_possible_null_ptr_dereference_in_getaddrinfo.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/libc/inet/getaddrinfo.c
-+++ b/libc/inet/getaddrinfo.c
-@@ -187,6 +187,8 @@
- }
-
- for (runp = ifa; runp != NULL; runp = runp->ifa_next) {
-+ if (runp->ifa_addr == NULL)
-+ continue;
- #if defined __UCLIBC_HAS_IPV4__
- if (runp->ifa_addr->sa_family == PF_INET)
- seen |= SEEN_IPV4;
diff --git a/toolchain/uClibc/patches-0.9.30.1/901-hi_lo_system_calls.patch b/toolchain/uClibc/patches-0.9.30.1/901-hi_lo_system_calls.patch
deleted file mode 100644
index 6c78130e3f..0000000000
--- a/toolchain/uClibc/patches-0.9.30.1/901-hi_lo_system_calls.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-The kernel does not save these registers across system calls. GCC 4.4
-has gotten more agressive about using them for temporary variables, so
-this shows up as intermittent crashes if you use a recent compiler.
-
-Signed-off-by: Daniel Jacobowitz <dan@codesourcery.com>
-
-diff --git a/libc/sysdeps/linux/mips/bits/syscalls.h b/libc/sysdeps/linux/mips/bits/syscalls.h
-index 3639913..28b0f91 100644
---- a/libc/sysdeps/linux/mips/bits/syscalls.h
-+++ b/libc/sysdeps/linux/mips/bits/syscalls.h
-@@ -261,7 +261,7 @@
- })
-
- #define __SYSCALL_CLOBBERS "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \
-- "$14", "$15", "$24", "$25", "memory"
-+ "$14", "$15", "$24", "$25", "hi", "lo", "memory"
-
- #else /* N32 || N64 */
-
-@@ -318,7 +318,7 @@
- })
-
- #define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \
-- "$14", "$15", "$24", "$25", "memory"
-+ "$14", "$15", "$24", "$25", "hi", "lo", "memory"
-
- #endif
-
-
---
diff --git a/toolchain/uClibc/patches-0.9.30.1/902-Fix-use-after-free-bug-in-__dns_lookup.patch b/toolchain/uClibc/patches-0.9.30.1/902-Fix-use-after-free-bug-in-__dns_lookup.patch
deleted file mode 100644
index 3a6f43d340..0000000000
--- a/toolchain/uClibc/patches-0.9.30.1/902-Fix-use-after-free-bug-in-__dns_lookup.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From c602079e5b7ba998d1dd6cae4a305af80e6cba52 Mon Sep 17 00:00:00 2001
-From: Gabor Juhos <juhosg@openwrt.org>
-Date: Tue, 23 Mar 2010 08:35:27 +0100
-Subject: [PATCH] Fix use-after-free bug in __dns_lookup.
-
-If the type of the first answer does not match with the requested type,
-then the dotted name will be freed. If there are no further answers in
-the DNS reply, this pointer will be used later on in the same function.
-Additionally it is passed to the caller, and may cause strange behaviour.
-
-For example, the following busybox commands are triggering a segmentation
-fault with uClibc 0.9.30.x
-
- - nslookup ipv6.google.com
- - ping ipv6.google.com
- - wget http//ipv6.google.com/
-
-Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
-
----
-
-See https://dev.openwrt.org/ticket/6886 for a testcase
----
- libc/inet/resolv.c | 4 +---
- 1 files changed, 1 insertions(+), 3 deletions(-)
-
-diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
-index 0a6fd7a..e76f0aa 100644
---- a/libc/inet/resolv.c
-+++ b/libc/inet/resolv.c
-@@ -1501,10 +1501,8 @@ int attribute_hidden __dns_lookup(const char *name,
- memcpy(a, &ma, sizeof(ma));
- if (a->atype != T_SIG && (NULL == a->buf || (type != T_A && type != T_AAAA)))
- break;
-- if (a->atype != type) {
-- free(a->dotted);
-+ if (a->atype != type)
- continue;
-- }
- a->add_count = h.ancount - j - 1;
- if ((a->rdlength + sizeof(struct in_addr*)) * a->add_count > a->buflen)
- break;
---
-1.5.3.2
-
diff --git a/toolchain/uClibc/patches-0.9.31/000-upstream-attribute_optimize_fix.patch b/toolchain/uClibc/patches-0.9.31/000-upstream-attribute_optimize_fix.patch
deleted file mode 100644
index 841b5b7d6f..0000000000
--- a/toolchain/uClibc/patches-0.9.31/000-upstream-attribute_optimize_fix.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From a115ee502fca8b1eb8ce327d764562d3ae669954 Mon Sep 17 00:00:00 2001
-From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-Date: Mon, 12 Apr 2010 13:09:25 +0000
-Subject: attribute_optimize: fix typo with args
-
-curious how 308f5c6e5fd56ea3d1a5512e34388aad788f1180 ever worked.. :P
-
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
----
-diff --git a/include/libc-symbols.h b/include/libc-symbols.h
-index 2729d30..4615a6a 100644
---- a/include/libc-symbols.h
-+++ b/include/libc-symbols.h
-@@ -86,9 +86,9 @@
- #endif
-
- #if defined __GNUC__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
--# define attribute_optimize(lvl) __attribute__ ((optimize(x)))
-+# define attribute_optimize(x) __attribute__ ((optimize(x)))
- #else
--# define attribute_optimize(lvl)
-+# define attribute_optimize(x)
- #endif
-
- #define attribute_unused __attribute__ ((unused))
diff --git a/toolchain/uClibc/patches-0.9.31/000-upstream-calloc_return_zeroed_memory.patch b/toolchain/uClibc/patches-0.9.31/000-upstream-calloc_return_zeroed_memory.patch
deleted file mode 100644
index b0715058da..0000000000
--- a/toolchain/uClibc/patches-0.9.31/000-upstream-calloc_return_zeroed_memory.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From afd7606ca42a2586b8823c7bd1a4a7cfd2476e3b Mon Sep 17 00:00:00 2001
-From: Steven J. Magnani <steve@digidescorp.com>
-Date: Wed, 09 Jun 2010 14:02:21 +0000
-Subject: malloc-simple: Make calloc() return zeroed memory
-
-The 0.9.31 release included a change to malloc-simple to request
-uninitialized memory from noMMU kernels. Unfortunately, the corresponding
-calloc() code assumed that memory returned by malloc() was already zeroed,
-which leads to all kinds of nastiness.
-
-Signed-off-by: Steven J. Magnani <steve@digidescorp.com>
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
----
-diff --git a/libc/stdlib/malloc-simple/alloc.c b/libc/stdlib/malloc-simple/alloc.c
-index 51da14a..914c89d 100644
---- a/libc/stdlib/malloc-simple/alloc.c
-+++ b/libc/stdlib/malloc-simple/alloc.c
-@@ -60,11 +60,10 @@ void * calloc(size_t nmemb, size_t lsize)
- __set_errno(ENOMEM);
- return NULL;
- }
-- result=malloc(size);
--#if 0
-- /* Standard unix mmap using /dev/zero clears memory so calloc
-- * doesn't need to actually zero anything....
-- */
-+ result = malloc(size);
-+
-+#ifndef __ARCH_USE_MMU__
-+ /* mmap'd with MAP_UNINITIALIZE, we have to blank memory ourselves */
- if (result != NULL) {
- memset(result, 0, size);
- }
diff --git a/toolchain/uClibc/patches-0.9.31/000-upstream-ctime_fix.patch b/toolchain/uClibc/patches-0.9.31/000-upstream-ctime_fix.patch
deleted file mode 100644
index 668662c347..0000000000
--- a/toolchain/uClibc/patches-0.9.31/000-upstream-ctime_fix.patch
+++ /dev/null
@@ -1,86 +0,0 @@
-From f6651fa449e1d4bbbb466b091f34e6752f6506f9 Mon Sep 17 00:00:00 2001
-From: David A Ramos <daramos@gustav.stanford.edu>
-Date: Tue, 27 Jul 2010 11:10:15 +0000
-Subject: Fix ctime() standard compliance bug
-
-fixes issue2209:
-ctime() was updated in 0.9.31 to call localtime_r() instead of
-localtime() to
-avoid using a static buffer. Unfortunately, this change replaces the
-static
-buffer (which is zeroed out on initialization) with an uninitialized
-local
-buffer.
-
-In the common case, this has no effect. However, with a sufficiently
-large
-time_t value, the value returned differs from that returned by
-asctime(localtime(t)), and thus violates the ANSI/ISO standard.
-
-An example input is (on a 64-bit machine):
-time_t t = 0x7ffffffffff6c600;
-
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
----
-diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c
-index dfa8c0d..0d12bf3 100644
---- a/libc/misc/time/time.c
-+++ b/libc/misc/time/time.c
-@@ -479,6 +479,7 @@ char *ctime(const time_t *t)
- * localtime's static buffer:
- */
- struct tm xtm;
-+ memset(&xtm, 0, sizeof(xtm));
-
- return asctime(localtime_r(t, &xtm));
- }
-diff --git a/test/time/tst-ctime.c b/test/time/tst-ctime.c
-new file mode 100644
-index 0000000..91d827a
---- a/dev/null
-+++ b/test/time/tst-ctime.c
-@@ -0,0 +1,44 @@
-+/* vi: set sw=4 ts=4: */
-+/* testcase for ctime(3) with large time
-+ * Copyright (C) 2010 David A Ramos <daramos@gustav.stanford.edu>
-+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-+ */
-+
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <time.h>
-+
-+#define MAX_POSITIVE(type) (~0 & ~((type) 1 << (sizeof(type)*8 - 1)))
-+
-+int do_test(int argc, char **argv) {
-+ char *correct = 0, *s;
-+ int status;
-+
-+ /* need a very high positive number (e.g., max - 1024) */
-+ time_t test = MAX_POSITIVE(time_t) - 1024;
-+
-+ s = asctime(localtime(&test));
-+
-+ if (s) {
-+ // copy static buffer to heap
-+ correct = malloc(strlen(s)+1);
-+ strcpy(correct, s);
-+ }
-+
-+ s = ctime(&test);
-+
-+ printf("ANSI:\t%suClibc:\t%s", correct, s);
-+
-+ if (s != correct && strcmp(correct, s))
-+ status = EXIT_FAILURE;
-+ else
-+ status = EXIT_SUCCESS;
-+
-+ if (correct)
-+ free(correct);
-+
-+ return status;
-+}
-+
-+#include <test-skeleton.c>
diff --git a/toolchain/uClibc/patches-0.9.31/000-upstream-enum_fix.patch b/toolchain/uClibc/patches-0.9.31/000-upstream-enum_fix.patch
deleted file mode 100644
index bac1a0d39e..0000000000
--- a/toolchain/uClibc/patches-0.9.31/000-upstream-enum_fix.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-From ac86be72f8b01ac3792737f4b67283541cf2c15b Mon Sep 17 00:00:00 2001
-From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-Date: Tue, 27 Jul 2010 15:05:59 +0000
-Subject: remove trailing comma in enum
-
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
----
-diff --git a/libc/sysdeps/linux/common/bits/confname.h b/libc/sysdeps/linux/common/bits/confname.h
-index ec4b72a..97ddd47 100644
---- a/libc/sysdeps/linux/common/bits/confname.h
-+++ b/libc/sysdeps/linux/common/bits/confname.h
-@@ -527,7 +527,7 @@ enum
-
- _SC_THREAD_ROBUST_PRIO_INHERIT,
- #define _SC_THREAD_ROBUST_PRIO_INHERIT _SC_THREAD_ROBUST_PRIO_INHERIT
-- _SC_THREAD_ROBUST_PRIO_PROTECT,
-+ _SC_THREAD_ROBUST_PRIO_PROTECT
- #define _SC_THREAD_ROBUST_PRIO_PROTECT _SC_THREAD_ROBUST_PRIO_PROTECT
- };
-
diff --git a/toolchain/uClibc/patches-0.9.31/000-upstream-fix_usage_of_uninitialized_DNS_parameters.patch b/toolchain/uClibc/patches-0.9.31/000-upstream-fix_usage_of_uninitialized_DNS_parameters.patch
deleted file mode 100644
index c33614afd7..0000000000
--- a/toolchain/uClibc/patches-0.9.31/000-upstream-fix_usage_of_uninitialized_DNS_parameters.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From c602079e5b7ba998d1dd6cae4a305af80e6cba52 Mon Sep 17 00:00:00 2001
-From: Gabor Juhos <juhosg@openwrt.org>
-Date: Tue, 23 Mar 2010 08:35:27 +0100
-Subject: [PATCH] Fix use-after-free bug in __dns_lookup.
-
-If the type of the first answer does not match with the requested type,
-then the dotted name will be freed. If there are no further answers in
-the DNS reply, this pointer will be used later on in the same function.
-Additionally it is passed to the caller, and may cause strange behaviour.
-
-For example, the following busybox commands are triggering a segmentation
-fault with uClibc 0.9.30.x
-
- - nslookup ipv6.google.com
- - ping ipv6.google.com
- - wget http//ipv6.google.com/
-
-Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
-
----
-
-See https://dev.openwrt.org/ticket/6886 for a testcase
----
- libc/inet/resolv.c | 4 +---
- 1 files changed, 1 insertions(+), 3 deletions(-)
-
---- a/libc/inet/resolv.c
-+++ b/libc/inet/resolv.c
-@@ -1517,10 +1517,8 @@ int attribute_hidden __dns_lookup(const
- memcpy(a, &ma, sizeof(ma));
- if (a->atype != T_SIG && (NULL == a->buf || (type != T_A && type != T_AAAA)))
- break;
-- if (a->atype != type) {
-- free(a->dotted);
-+ if (a->atype != type)
- continue;
-- }
- a->add_count = h.ancount - j - 1;
- if ((a->rdlength + sizeof(struct in_addr*)) * a->add_count > a->buflen)
- break;
diff --git a/toolchain/uClibc/patches-0.9.31/000-upstream_initialize_stdio_locking.patch b/toolchain/uClibc/patches-0.9.31/000-upstream_initialize_stdio_locking.patch
deleted file mode 100644
index 6a32e5d7c0..0000000000
--- a/toolchain/uClibc/patches-0.9.31/000-upstream_initialize_stdio_locking.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From d4ede2b0a4727c1f5236dd9308f09cbf7a39761a Mon Sep 17 00:00:00 2001
-From: Timo Teräs <timo.teras@iki.fi>
-Date: Tue, 13 Apr 2010 06:38:59 +0000
-Subject: linuxthreads.new: initialize stdio locking
-
-uClibc requires the threading library to enable locking for
-stdio, or the locking is not done at all.
-
-Signed-off-by: Timo Teräs <timo.teras@iki.fi>
-Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
----
-diff --git a/libpthread/linuxthreads/pthread.c b/libpthread/linuxthreads/pthread.c
-index 6ae9a10..614cad1 100644
---- a/libpthread/linuxthreads/pthread.c
-+++ b/libpthread/linuxthreads/pthread.c
-@@ -613,6 +613,17 @@ static void pthread_initialize(void)
- #ifdef USE_TLS
- GL(dl_init_static_tls) = &__pthread_init_static_tls;
- #endif
-+
-+ /* uClibc-specific stdio initialization for threads. */
-+ {
-+ FILE *fp;
-+ _stdio_user_locking = 0; /* 2 if threading not initialized */
-+ for (fp = _stdio_openlist; fp != NULL; fp = fp->__nextopen) {
-+ if (fp->__user_locking != 1) {
-+ fp->__user_locking = 0;
-+ }
-+ }
-+ }
- }
-
- void __pthread_initialize(void)
diff --git a/toolchain/uClibc/patches-0.9.31/110-compat_macros.patch b/toolchain/uClibc/patches-0.9.31/110-compat_macros.patch
deleted file mode 100644
index 61dfe55eb6..0000000000
--- a/toolchain/uClibc/patches-0.9.31/110-compat_macros.patch
+++ /dev/null
@@ -1,51 +0,0 @@
---- a/include/string.h
-+++ b/include/string.h
-@@ -357,18 +357,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.31/120-adjtimex.patch b/toolchain/uClibc/patches-0.9.31/120-adjtimex.patch
deleted file mode 100644
index dcf9c9b5aa..0000000000
--- a/toolchain/uClibc/patches-0.9.31/120-adjtimex.patch
+++ /dev/null
@@ -1,14 +0,0 @@
---- 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.31/130-ldso-fix-__dl_parse_dynamic_info-segfault.patch b/toolchain/uClibc/patches-0.9.31/130-ldso-fix-__dl_parse_dynamic_info-segfault.patch
deleted file mode 100644
index f853d2ed80..0000000000
--- a/toolchain/uClibc/patches-0.9.31/130-ldso-fix-__dl_parse_dynamic_info-segfault.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-[PATCH] ld.so: ldd crashes when __LDSO_SEARCH_INTERP_PATH__ is not #defined
-Since b65c7b2c79debcb9017e31913e01eeaa280106fb, the implicit search path
-can be disabled by not #defining __LDSO_SEARCH_INTERP_PATH__. This
-causes _dl_ldsopath to never be set, so it remains NULL. _dl_ldsopath is
-still used when __LDSO_LDD_SUPPORT__ is #defined, to strip the path off
-of the beginning of the absolute path to the ld.so interpreter in use
-for printing. The _dl_strlen will crash with a NULL argument.
-
-Rather than relying on _dl_ldsopath, this change causes ldd to compute
-the interpreter's basename directly.
-
-glibc ld.so seems to print the full path to the interpreter without
-any computed basename or =>. I personally prefer glibc's behavior, but
-to preserve backwards compatibility with uClibc ld.so, the existing
-format with the computed basename, =>, and full path is used here. This
-enables simpler (and unchanged) text processing in a pipeline.
-
-Signed-off-by: Mark Mentovai <mark at moxienet.com>
----
-ldso/ldso/ldso.c | 12 +++++++++---
-1 files changed, 9 insertions(+), 3 deletions(-)
-
---- a/ldso/ldso/ldso.c
-+++ b/ldso/ldso/ldso.c
-@@ -923,9 +923,15 @@ void _dl_get_ready_to_run(struct elf_res
- #ifdef __LDSO_LDD_SUPPORT__
- /* End of the line for ldd.... */
- if (trace_loaded_objects) {
-- _dl_dprintf(1, "\t%s => %s (%x)\n",
-- rpnt->dyn->libname + _dl_strlen(_dl_ldsopath) + 1,
-- rpnt->dyn->libname, DL_LOADADDR_BASE(rpnt->dyn->loadaddr));
-+ /* glibc ld.so/ldd would just do
-+ * _dl_dprintf(1, "\t%s (%x)\n", rpnt->dyn->libname,
-+ * DL_LOADADDR_BASE(rpnt->dyn->loadaddr));
-+ * but uClibc has always used the => format. */
-+ char *ptmp = _dl_strrchr(rpnt->dyn->libname, '/');
-+ if (ptmp != rpnt->dyn->libname)
-+ ++ptmp;
-+ _dl_dprintf(1, "\t%s => %s (%x)\n", ptmp, rpnt->dyn->libname,
-+ DL_LOADADDR_BASE(rpnt->dyn->loadaddr));
- _dl_exit(0);
- }
- #endif
diff --git a/toolchain/uClibc/patches-0.9.31/140-math_decl.patch b/toolchain/uClibc/patches-0.9.31/140-math_decl.patch
deleted file mode 100644
index 63e37346f5..0000000000
--- a/toolchain/uClibc/patches-0.9.31/140-math_decl.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/libc/sysdeps/linux/common/bits/mathcalls.h
-+++ b/libc/sysdeps/linux/common/bits/mathcalls.h
-@@ -237,8 +237,7 @@ __END_NAMESPACE_C99
-
-
- /* Return nonzero if VALUE is not a number. */
--/* DELETE? __MATHDECL_PRIV adds another "__": so this is "____isnan"???! */
--/*__MATHDECL_PRIV (int,__isnan,, (_Mdouble_ __value), (__const__))*/
-+__MATHDECL_PRIV (int,isnan,, (_Mdouble_ __value), (__const__));
-
- #if defined __USE_MISC || defined __USE_XOPEN
- /* Return nonzero if VALUE is not a number. */
diff --git a/toolchain/uClibc/patches-0.9.31/170-math_finite.patch b/toolchain/uClibc/patches-0.9.31/170-math_finite.patch
deleted file mode 100644
index 13fa25ac60..0000000000
--- a/toolchain/uClibc/patches-0.9.31/170-math_finite.patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- a/include/math.h
-+++ b/include/math.h
-@@ -198,7 +198,7 @@ libm_hidden_proto(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:
-@@ -318,6 +318,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.31/410-llvm_workaround.patch b/toolchain/uClibc/patches-0.9.31/410-llvm_workaround.patch
deleted file mode 100644
index 1878093de1..0000000000
--- a/toolchain/uClibc/patches-0.9.31/410-llvm_workaround.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/libc/stdio/_stdio.c
-+++ b/libc/stdio/_stdio.c
-@@ -119,7 +119,7 @@ static FILE _stdio_streams[] = {
- __FLAG_NBF|__FLAG_WRITEONLY, \
- 2, \
- NULL, \
-- NULL, \
-+ 0, \
- 0 )
- };
-
diff --git a/toolchain/uClibc/patches-0.9.31/450-powerpc_copysignl.patch b/toolchain/uClibc/patches-0.9.31/450-powerpc_copysignl.patch
deleted file mode 100644
index ad8d6824bb..0000000000
--- a/toolchain/uClibc/patches-0.9.31/450-powerpc_copysignl.patch
+++ /dev/null
@@ -1,103 +0,0 @@
---- 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.31/600-ubicom32-uClibc.patch b/toolchain/uClibc/patches-0.9.31/600-ubicom32-uClibc.patch
deleted file mode 100644
index 50bed1a474..0000000000
--- a/toolchain/uClibc/patches-0.9.31/600-ubicom32-uClibc.patch
+++ /dev/null
@@ -1,4340 +0,0 @@
---- a/Rules.mak
-+++ b/Rules.mak
-@@ -477,6 +477,17 @@ ifeq ($(TARGET_ARCH),microblaze)
- SYMBOL_PREFIX=_
- endif
-
-+ifeq ($(TARGET_ARCH),ubicom32)
-+ OPTIMIZATION+=-fstrict-aliasing
-+ CPU_CFLAGS-$(CONFIG_UBICOM32_V3)+=-march=ubicom32v3
-+ CPU_CFLAGS-$(CONFIG_UBICOM32_V4)+=-march=ubicom32v4
-+ifeq ($(UCLIBC_FORMAT_FDPIC_ELF),y)
-+ CPU_CFLAGS-y:=-mfdpic
-+ CPU_LDFLAGS-y += -Wl,-melf32ubicom32fdpic
-+endif
-+
-+endif
-+
- ifeq ($(TARGET_ARCH),v850)
- SYMBOL_PREFIX=_
- endif
---- a/extra/Configs/Config.in
-+++ b/extra/Configs/Config.in
-@@ -102,6 +102,9 @@ config TARGET_sh64
- config TARGET_sparc
- bool "sparc"
-
-+config TARGET_ubicom32
-+ bool "ubicom32"
-+
- config TARGET_v850
- bool "v850 (BROKEN)"
-
-@@ -203,6 +206,10 @@ if TARGET_sparc
- source "extra/Configs/Config.sparc"
- endif
-
-+if TARGET_ubicom32
-+source "extra/Configs/Config.ubicom32"
-+endif
-+
- if TARGET_v850
- source "extra/Configs/Config.v850"
- endif
---- a/extra/Configs/Config.in.arch
-+++ b/extra/Configs/Config.in.arch
-@@ -149,7 +149,7 @@ config UCLIBC_HAS_SOFT_FLOAT
- config DO_C99_MATH
- bool "Enable full C99 math library support"
- depends on UCLIBC_HAS_FLOATS
-- default n
-+ default y
- help
- If you want the uClibc math library to contain the full set C99
- math library features, then answer Y. If you leave this set to
---- /dev/null
-+++ b/extra/Configs/Config.ubicom32
-@@ -0,0 +1,44 @@
-+#
-+# For a description of the syntax of this configuration file,
-+# see extra/config/Kconfig-language.txt
-+#
-+
-+config TARGET_ARCH
-+ string
-+ default "ubicom32"
-+
-+config FORCE_OPTIONS_FOR_ARCH
-+ bool
-+ default y
-+ select ARCH_BIG_ENDIAN
-+ select ARCH_HAS_NO_MMU
-+
-+choice
-+ prompt "Target Processor Architecture"
-+ default CONFIG_UC_UBICOM32_V3
-+ help
-+ This selects the instruction set architecture of your Ubicom32 CPU. This
-+ information is used for optimizing purposes. To build a library that
-+ will run on any Ubicom32 CPU, you can specify "v3" here.
-+ If you pick anything other than "v3," there is no
-+ guarantee that uClibc will even run on anything other than the
-+ selected processor type.
-+
-+ You should probably select the Ubicom32 ISA that best matches the
-+ CPU you will be using on your device. uClibc will be tuned
-+ for that architecture.
-+
-+ If you don't know what to do, choose "v3"
-+
-+config CONFIG_UC_UBICOM32_V3
-+ bool "ISA v3"
-+
-+config CONFIG_UC_UBICOM32_V4
-+ bool "ISA v4"
-+endchoice
-+
-+config ARCH_CFLAGS
-+ string
-+
-+config CROSS
-+ string
---- a/include/elf.h
-+++ b/include/elf.h
-@@ -337,6 +337,8 @@ typedef struct
-
- #define EM_XSTORMY16 0xad45
-
-+#define EM_UBICOM32 0xde3d /* Ubicom32; no ABI */
-+
- /* FRV magic number - no EABI available??. */
- #define EM_CYGNUS_FRV 0x5441
-
-@@ -3063,6 +3065,55 @@ typedef Elf32_Addr Elf32_Conflict;
- /* Keep this the last entry. */
- #define R_XTENSA_NUM 50
-
-+/* Ubicom32 ELF relocation types */
-+#define R_UBICOM32_NONE 0
-+#define R_UBICOM32_16 1
-+#define R_UBICOM32_32 2
-+#define R_UBICOM32_LO16 3
-+#define R_UBICOM32_HI16 4
-+#define R_UBICOM32_21_PCREL 5
-+#define R_UBICOM32_24_PCREL 6
-+#define R_UBICOM32_HI24 7
-+#define R_UBICOM32_LO7_S 8
-+#define R_UBICOM32_LO7_2_S 9
-+#define R_UBICOM32_LO7_4_S 10
-+#define R_UBICOM32_LO7_D 11
-+#define R_UBICOM32_LO7_2_D 12
-+#define R_UBICOM32_LO7_4_D 13
-+#define R_UBICOM32_32_HARVARD 14
-+#define R_UBICOM32_LO7_CALLI 15
-+#define R_UBICOM32_LO16_CALLI 16
-+#define R_UBICOM32_GOT_HI24 17
-+#define R_UBICOM32_GOT_LO7_S 18
-+#define R_UBICOM32_GOT_LO7_2_S 19
-+#define R_UBICOM32_GOT_LO7_4_S 20
-+#define R_UBICOM32_GOT_LO7_D 21
-+#define R_UBICOM32_GOT_LO7_2_D 22
-+#define R_UBICOM32_GOT_LO7_4_D 23
-+#define R_UBICOM32_FUNCDESC_GOT_HI24 24
-+#define R_UBICOM32_FUNCDESC_GOT_LO7_S 25
-+#define R_UBICOM32_FUNCDESC_GOT_LO7_2_S 26
-+#define R_UBICOM32_FUNCDESC_GOT_LO7_4_S 27
-+#define R_UBICOM32_FUNCDESC_GOT_LO7_D 28
-+#define R_UBICOM32_FUNCDESC_GOT_LO7_2_D 29
-+#define R_UBICOM32_FUNCDESC_GOT_LO7_4_D 30
-+#define R_UBICOM32_GOT_LO7_CALLI 31
-+#define R_UBICOM32_FUNCDESC_GOT_LO7_CALLI 32
-+#define R_UBICOM32_FUNCDESC_VALUE 33
-+#define R_UBICOM32_FUNCDESC 34
-+#define R_UBICOM32_GOTOFFSET_LO 35
-+#define R_UBICOM32_GOTOFFSET_HI 36
-+#define R_UBICOM32_FUNCDESC_GOTOFFSET_LO 37
-+#define R_UBICOM32_FUNCDESC_GOTOFFSET_HI 38
-+#define R_UBICOM32_GNU_VTINHERIT 200
-+#define R_UBICOM32_GNU_VTENTRY 201
-+
-+/* Ubicom32 Flags. */
-+#define EF_UBICOM32_V3 0x00000001 /* -fmarch=ubicom32v3 */
-+#define EF_UBICOM32_V4 0x00000002 /* -fmarch=ubicom32v4 */
-+#define EF_UBICOM32_PIC 0x80000000 /* -fpic */
-+#define EF_UBICOM32_FDPIC 0x40000000 /* -mfdpic */
-+
- #ifdef __cplusplus
- }
- #endif
---- a/include/features.h
-+++ b/include/features.h
-@@ -445,4 +445,10 @@ uClibc was built without large file supp
- # include <libc-internal.h>
- #endif
-
-+#ifndef libc_hidden_proto
-+#define libc_hidden_proto(name, attrs...)
-+#endif
-+#ifndef libm_hidden_proto
-+#define libm_hidden_proto(name, attrs...)
-+#endif
- #endif /* features.h */
---- a/ldso/ldso/dl-startup.c
-+++ b/ldso/ldso/dl-startup.c
-@@ -164,10 +164,13 @@ DL_START(unsigned long args)
- aux_dat += 2;
- }
-
-+#if !defined __FDPIC__
- /* locate the ELF header. We need this done as soon as possible
- * (esp since SEND_STDERR() needs this on some platforms... */
- if (!auxvt[AT_BASE].a_un.a_val)
- auxvt[AT_BASE].a_un.a_val = elf_machine_load_address();
-+#endif
-+
- DL_INIT_LOADADDR_BOOT(load_addr, auxvt[AT_BASE].a_un.a_val);
- header = (ElfW(Ehdr) *) auxvt[AT_BASE].a_un.a_val;
-
---- a/ldso/ldso/ldso.c
-+++ b/ldso/ldso/ldso.c
-@@ -325,10 +325,12 @@ void _dl_get_ready_to_run(struct elf_res
- _dl_progname = argv[0];
- }
-
-+#if 0 // blackfin does this, we do to avoid die during reloc
- if (_start == (void *) auxvt[AT_ENTRY].a_un.a_val) {
- _dl_dprintf(_dl_debug_file, "Standalone execution is not supported yet\n");
- _dl_exit(1);
- }
-+#endif
-
- /* Start to build the tables of the modules that are required for
- * this beast to run. We start with the basic executable, and then
---- /dev/null
-+++ b/ldso/ldso/ubicom32/dl-debug.h
-@@ -0,0 +1,72 @@
-+/* vi: set sw=4 ts=4: */
-+/* Ubicom32 ELF shared library loader suppport
-+ *
-+ * Copyright (c) 2009 Ubicom Inc.
-+ * Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald,
-+ * David Engel, Hongjiu Lu and Mitch D'Souza
-+ * Copyright (C) 2001-2004 Erik Andersen
-+ *
-+ * All rights reserved.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ * 1. Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions and the following disclaimer.
-+ * 2. The name of the above contributors may not be
-+ * used to endorse or promote products derived from this software
-+ * without specific prior written permission.
-+ *
-+ * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
-+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-+ * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE
-+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-+ * SUCH DAMAGE.
-+ */
-+
-+static const char *_dl_reltypes_tab[] =
-+{
-+ "R_UBICOM32_NONE", /* 0 */
-+ "R_UBICOM32_16",
-+ "R_UBICOM32_32",
-+ "R_UBICOM32_LO16",
-+ "R_UBICOM32_HI16",
-+ "R_UBICOM32_21_PCREL", /* 5 */
-+ "R_UBICOM32_24_PCREL",
-+ "R_UBICOM32_HI24",
-+ "R_UBICOM32_LO7_S",
-+ "R_UBICOM32_LO7_2_S",
-+ "R_UBICOM32_LO7_4_S", /* 10 */
-+ "R_UBICOM32_LO7_D",
-+ "R_UBICOM32_LO7_2_D",
-+ "R_UBICOM32_LO7_4_D",
-+ "R_UBICOM32_32_HARVARD",
-+ "R_UBICOM32_LO7_CALLI", /* 15 */
-+ "R_UBICOM32_LO16_CALLI",
-+ "R_UBICOM32_GOT_HI24",
-+ "R_UBICOM32_GOT_LO7_S",
-+ "R_UBICOM32_GOT_LO7_2_S"
-+ "R_UBICOM32_GOT_LO7_4_S", /* 20 */
-+ "R_UBICOM32_GOT_LO7_D",
-+ "R_UBICOM32_GOT_LO7_2_D",
-+ "R_UBICOM32_GOT_LO7_4_D",
-+ "R_UBICOM32_FUNCDESC_GOT_HI24 24",
-+ "R_UBICOM32_FUNCDESC_GOT_LO7_S", /* 25 */
-+ "R_UBICOM32_FUNCDESC_GOT_LO7_2_S",
-+ "R_UBICOM32_FUNCDESC_GOT_LO7_4_S",
-+ "R_UBICOM32_FUNCDESC_GOT_LO7_D",
-+ "R_UBICOM32_FUNCDESC_GOT_LO7_2_D",
-+ "R_UBICOM32_FUNCDESC_GOT_LO7_4_D", /* 30 */
-+ "R_UBICOM32_GOT_LO7_CALLI",
-+ "R_UBICOM32_FUNCDESC_VALUE",
-+ "R_UBICOM32_FUNCDESC",
-+#if 1
-+ [200] "R_UBICOM32_GNU_VTINHERIT" , "R_UBICOM32_GNU_VTENTRY"
-+#endif
-+};
---- /dev/null
-+++ b/ldso/ldso/ubicom32/dl-inlines.h
-@@ -0,0 +1,582 @@
-+ /* Copyright (C) 2003, 2004 Red Hat, Inc.
-+ Contributed by Alexandre Oliva <aoliva@redhat.com>
-+
-+This file is part of uClibc.
-+
-+uClibc 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.
-+
-+uClibc 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
-+Library General Public License for more details.
-+
-+You should have received a copy of the GNU Lesser General Public
-+License along with uClibc; see the file COPYING.LIB. If not, write to
-+the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
-+USA. */
-+
-+//#include <bfin_sram.h>
-+#define SRAM_TEST(x) 0
-+#ifndef _dl_assert
-+# define _dl_assert(expr)
-+#endif
-+
-+/* Initialize a DL_LOADADDR_TYPE given a got pointer and a complete
-+ load map. */
-+static __always_inline void
-+__dl_init_loadaddr_map (struct elf32_fdpic_loadaddr *loadaddr, Elf32_Addr dl_boot_got_pointer,
-+ struct elf32_fdpic_loadmap *map)
-+{
-+ if (map->version != 0)
-+ {
-+ SEND_EARLY_STDERR ("Invalid loadmap version number\n");
-+ _dl_exit(-1);
-+ }
-+ if (map->nsegs == 0)
-+ {
-+ SEND_EARLY_STDERR ("Invalid segment count in loadmap\n");
-+ _dl_exit(-1);
-+ }
-+ loadaddr->got_value = (void*)dl_boot_got_pointer;
-+ loadaddr->map = map;
-+}
-+
-+/* Figure out how many LOAD segments there are in the given headers,
-+ and allocate a block for the load map big enough for them.
-+ got_value will be properly initialized later on, with INIT_GOT. */
-+static __always_inline int
-+__dl_init_loadaddr (struct elf32_fdpic_loadaddr *loadaddr, Elf32_Phdr *ppnt,
-+ int pcnt)
-+{
-+ int count = 0, i;
-+ size_t size;
-+
-+ for (i = 0; i < pcnt; i++)
-+ if (ppnt[i].p_type == PT_LOAD)
-+ count++;
-+
-+ loadaddr->got_value = 0;
-+
-+ size = sizeof (struct elf32_fdpic_loadmap)
-+ + sizeof (struct elf32_fdpic_loadseg) * count;
-+ loadaddr->map = _dl_malloc (size);
-+ if (! loadaddr->map)
-+ _dl_exit (-1);
-+
-+ loadaddr->map->version = 0;
-+ loadaddr->map->nsegs = 0;
-+
-+ return count;
-+}
-+
-+#if defined (__SUPPORT_LD_DEBUG__)
-+extern char *_dl_debug;
-+extern int _dl_debug_file;
-+#endif
-+
-+/* Incrementally initialize a load map. */
-+static __always_inline void
-+__dl_init_loadaddr_hdr (struct elf32_fdpic_loadaddr loadaddr, void *addr,
-+ Elf32_Phdr *phdr, int maxsegs)
-+{
-+ struct elf32_fdpic_loadseg *segdata;
-+
-+ if (loadaddr.map->nsegs == maxsegs)
-+ _dl_exit (-1);
-+
-+ segdata = &loadaddr.map->segs[loadaddr.map->nsegs++];
-+ segdata->addr = (Elf32_Addr) addr;
-+ segdata->p_vaddr = phdr->p_vaddr;
-+ segdata->p_memsz = phdr->p_memsz;
-+
-+#if defined (__SUPPORT_LD_DEBUG__)
-+ {
-+ if (_dl_debug)
-+ _dl_dprintf(_dl_debug_file, "%i: mapped %x at %x, size %x\n",
-+ loadaddr.map->nsegs-1,
-+ segdata->p_vaddr, segdata->addr, segdata->p_memsz);
-+ }
-+#endif
-+}
-+
-+static __always_inline void __dl_loadaddr_unmap
-+(struct elf32_fdpic_loadaddr loadaddr, struct funcdesc_ht *funcdesc_ht);
-+
-+/* Figure out whether the given address is in one of the mapped
-+ segments. */
-+static __always_inline int
-+__dl_addr_in_loadaddr (void *p, struct elf32_fdpic_loadaddr loadaddr)
-+{
-+ struct elf32_fdpic_loadmap *map = loadaddr.map;
-+ int c;
-+
-+ for (c = 0; c < map->nsegs; c++)
-+ if ((void*)map->segs[c].addr <= p
-+ && (char*)p < (char*)map->segs[c].addr + map->segs[c].p_memsz)
-+ return 1;
-+
-+ return 0;
-+}
-+
-+static __always_inline void * _dl_funcdesc_for (void *entry_point, void *got_value);
-+
-+/* The hashcode handling code below is heavily inspired in libiberty's
-+ hashtab code, but with most adaptation points and support for
-+ deleting elements removed.
-+
-+ Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
-+ Contributed by Vladimir Makarov (vmakarov@cygnus.com). */
-+
-+static __always_inline unsigned long
-+higher_prime_number (unsigned long n)
-+{
-+ /* These are primes that are near, but slightly smaller than, a
-+ power of two. */
-+ static const unsigned long primes[] = {
-+ (unsigned long) 7,
-+ (unsigned long) 13,
-+ (unsigned long) 31,
-+ (unsigned long) 61,
-+ (unsigned long) 127,
-+ (unsigned long) 251,
-+ (unsigned long) 509,
-+ (unsigned long) 1021,
-+ (unsigned long) 2039,
-+ (unsigned long) 4093,
-+ (unsigned long) 8191,
-+ (unsigned long) 16381,
-+ (unsigned long) 32749,
-+ (unsigned long) 65521,
-+ (unsigned long) 131071,
-+ (unsigned long) 262139,
-+ (unsigned long) 524287,
-+ (unsigned long) 1048573,
-+ (unsigned long) 2097143,
-+ (unsigned long) 4194301,
-+ (unsigned long) 8388593,
-+ (unsigned long) 16777213,
-+ (unsigned long) 33554393,
-+ (unsigned long) 67108859,
-+ (unsigned long) 134217689,
-+ (unsigned long) 268435399,
-+ (unsigned long) 536870909,
-+ (unsigned long) 1073741789,
-+ (unsigned long) 2147483647,
-+ /* 4294967291L */
-+ ((unsigned long) 2147483647) + ((unsigned long) 2147483644),
-+ };
-+
-+ const unsigned long *low = &primes[0];
-+ const unsigned long *high = &primes[sizeof(primes) / sizeof(primes[0])];
-+
-+ while (low != high)
-+ {
-+ const unsigned long *mid = low + (high - low) / 2;
-+ if (n > *mid)
-+ low = mid + 1;
-+ else
-+ high = mid;
-+ }
-+
-+#if 0
-+ /* If we've run out of primes, abort. */
-+ if (n > *low)
-+ {
-+ fprintf (stderr, "Cannot find prime bigger than %lu\n", n);
-+ abort ();
-+ }
-+#endif
-+
-+ return *low;
-+}
-+
-+struct funcdesc_ht
-+{
-+ /* Table itself. */
-+ struct funcdesc_value **entries;
-+
-+ /* Current size (in entries) of the hash table */
-+ size_t size;
-+
-+ /* Current number of elements. */
-+ size_t n_elements;
-+};
-+
-+static __always_inline int
-+hash_pointer (const void *p)
-+{
-+ return (int) ((long)p >> 3);
-+}
-+
-+static __always_inline struct funcdesc_ht *
-+htab_create (void)
-+{
-+ struct funcdesc_ht *ht = _dl_malloc (sizeof (struct funcdesc_ht));
-+
-+ if (! ht)
-+ return NULL;
-+ ht->size = 3;
-+ ht->entries = _dl_malloc (sizeof (struct funcdesc_ht_value *) * ht->size);
-+ if (! ht->entries)
-+ return NULL;
-+
-+ ht->n_elements = 0;
-+
-+ _dl_memset (ht->entries, 0, sizeof (struct funcdesc_ht_value *) * ht->size);
-+
-+ return ht;
-+}
-+
-+/* This is only called from _dl_loadaddr_unmap, so it's safe to call
-+ _dl_free(). See the discussion below. */
-+static __always_inline void
-+htab_delete (struct funcdesc_ht *htab)
-+{
-+ int i;
-+
-+ for (i = htab->size - 1; i >= 0; i--)
-+ if (htab->entries[i])
-+ _dl_free (htab->entries[i]);
-+
-+ _dl_free (htab->entries);
-+ _dl_free (htab);
-+}
-+
-+/* Similar to htab_find_slot, but without several unwanted side effects:
-+ - Does not call htab->eq_f when it finds an existing entry.
-+ - Does not change the count of elements/searches/collisions in the
-+ hash table.
-+ This function also assumes there are no deleted entries in the table.
-+ HASH is the hash value for the element to be inserted. */
-+
-+static __always_inline struct funcdesc_value **
-+find_empty_slot_for_expand (struct funcdesc_ht *htab, int hash)
-+{
-+ size_t size = htab->size;
-+ unsigned int index = hash % size;
-+ struct funcdesc_value **slot = htab->entries + index;
-+ int hash2;
-+
-+ if (! *slot)
-+ return slot;
-+
-+ hash2 = 1 + hash % (size - 2);
-+ for (;;)
-+ {
-+ index += hash2;
-+ if (index >= size)
-+ index -= size;
-+
-+ slot = htab->entries + index;
-+ if (! *slot)
-+ return slot;
-+ }
-+}
-+
-+/* The following function changes size of memory allocated for the
-+ entries and repeatedly inserts the table elements. The occupancy
-+ of the table after the call will be about 50%. Naturally the hash
-+ table must already exist. Remember also that the place of the
-+ table entries is changed. If memory allocation failures are allowed,
-+ this function will return zero, indicating that the table could not be
-+ expanded. If all goes well, it will return a non-zero value. */
-+
-+static __always_inline int
-+htab_expand (struct funcdesc_ht *htab)
-+{
-+ struct funcdesc_value **oentries;
-+ struct funcdesc_value **olimit;
-+ struct funcdesc_value **p;
-+ struct funcdesc_value **nentries;
-+ size_t nsize;
-+
-+ oentries = htab->entries;
-+ olimit = oentries + htab->size;
-+
-+ /* Resize only when table after removal of unused elements is either
-+ too full or too empty. */
-+ if (htab->n_elements * 2 > htab->size)
-+ nsize = higher_prime_number (htab->n_elements * 2);
-+ else
-+ nsize = htab->size;
-+
-+ nentries = _dl_malloc (sizeof (struct funcdesc_value *) * nsize);
-+ _dl_memset (nentries, 0, sizeof (struct funcdesc_value *) * nsize);
-+ if (nentries == NULL)
-+ return 0;
-+ htab->entries = nentries;
-+ htab->size = nsize;
-+
-+ p = oentries;
-+ do
-+ {
-+ if (*p)
-+ *find_empty_slot_for_expand (htab, hash_pointer ((*p)->entry_point))
-+ = *p;
-+
-+ p++;
-+ }
-+ while (p < olimit);
-+
-+#if 0 /* We can't tell whether this was allocated by the _dl_malloc()
-+ built into ld.so or malloc() in the main executable or libc,
-+ and calling free() for something that wasn't malloc()ed could
-+ do Very Bad Things (TM). Take the conservative approach
-+ here, potentially wasting as much memory as actually used by
-+ the hash table, even if multiple growths occur. That's not
-+ so bad as to require some overengineered solution that would
-+ enable us to keep track of how it was allocated. */
-+ _dl_free (oentries);
-+#endif
-+ return 1;
-+}
-+
-+/* This function searches for a hash table slot containing an entry
-+ equal to the given element. To delete an entry, call this with
-+ INSERT = 0, then call htab_clear_slot on the slot returned (possibly
-+ after doing some checks). To insert an entry, call this with
-+ INSERT = 1, then write the value you want into the returned slot.
-+ When inserting an entry, NULL may be returned if memory allocation
-+ fails. */
-+
-+static __always_inline struct funcdesc_value **
-+htab_find_slot (struct funcdesc_ht *htab, void *ptr, int insert)
-+{
-+ unsigned int index;
-+ int hash, hash2;
-+ size_t size;
-+ struct funcdesc_value **entry;
-+
-+ if (htab->size * 3 <= htab->n_elements * 4
-+ && htab_expand (htab) == 0)
-+ return NULL;
-+
-+ hash = hash_pointer (ptr);
-+
-+ size = htab->size;
-+ index = hash % size;
-+
-+ entry = &htab->entries[index];
-+ if (!*entry)
-+ goto empty_entry;
-+ else if ((*entry)->entry_point == ptr)
-+ return entry;
-+
-+ hash2 = 1 + hash % (size - 2);
-+ for (;;)
-+ {
-+ index += hash2;
-+ if (index >= size)
-+ index -= size;
-+
-+ entry = &htab->entries[index];
-+ if (!*entry)
-+ goto empty_entry;
-+ else if ((*entry)->entry_point == ptr)
-+ return entry;
-+ }
-+
-+ empty_entry:
-+ if (!insert)
-+ return NULL;
-+
-+ htab->n_elements++;
-+ return entry;
-+}
-+
-+void *
-+_dl_funcdesc_for (void *entry_point, void *got_value)
-+{
-+ struct elf_resolve *tpnt = ((void**)got_value)[2];
-+ struct funcdesc_ht *ht = tpnt->funcdesc_ht;
-+ struct funcdesc_value **entry;
-+
-+ _dl_assert (got_value == tpnt->loadaddr.got_value);
-+
-+ if (! ht)
-+ {
-+ ht = htab_create ();
-+ if (! ht)
-+ return (void*)-1;
-+ tpnt->funcdesc_ht = ht;
-+ }
-+
-+ entry = htab_find_slot (ht, entry_point, 1);
-+ if (*entry)
-+ {
-+ _dl_assert ((*entry)->entry_point == entry_point);
-+ return _dl_stabilize_funcdesc (*entry);
-+ }
-+
-+ *entry = _dl_malloc (sizeof (struct funcdesc_value));
-+ (*entry)->entry_point = entry_point;
-+ (*entry)->got_value = got_value;
-+
-+ return _dl_stabilize_funcdesc (*entry);
-+}
-+
-+static __always_inline void const *
-+_dl_lookup_address (void const *address)
-+{
-+ struct elf_resolve *rpnt;
-+ struct funcdesc_value const *fd;
-+
-+ /* Make sure we don't make assumptions about its alignment. */
-+ __asm__ ("" : "+r" (address));
-+
-+ if ((Elf32_Addr)address & 7)
-+ /* It's not a function descriptor. */
-+ return address;
-+
-+ fd = (struct funcdesc_value const *)address;
-+
-+ for (rpnt = _dl_loaded_modules; rpnt; rpnt = rpnt->next)
-+ {
-+ if (! rpnt->funcdesc_ht)
-+ continue;
-+
-+ if (fd->got_value != rpnt->loadaddr.got_value)
-+ continue;
-+
-+ address = htab_find_slot (rpnt->funcdesc_ht, (void*)fd->entry_point, 0);
-+
-+ if (address && *(struct funcdesc_value *const*)address == fd)
-+ {
-+ address = (*(struct funcdesc_value *const*)address)->entry_point;
-+ break;
-+ }
-+ else
-+ address = fd;
-+ }
-+
-+ return address;
-+}
-+
-+void
-+__dl_loadaddr_unmap (struct elf32_fdpic_loadaddr loadaddr,
-+ struct funcdesc_ht *funcdesc_ht)
-+{
-+ int i;
-+
-+ for (i = 0; i < loadaddr.map->nsegs; i++)
-+ {
-+ struct elf32_fdpic_loadseg *segdata;
-+ ssize_t offs;
-+ segdata = loadaddr.map->segs + i;
-+
-+#if 0 /* SRAM */
-+ /* FIXME:
-+ A more cleaner way is to add type for struct elf32_fdpic_loadseg,
-+ and release the memory according to the type.
-+ Currently, we hardcode the memory address of L1 SRAM. */
-+ if ((segdata->addr & 0xff800000) == 0xff800000)
-+ {
-+ _dl_sram_free ((void *)segdata->addr);
-+ continue;
-+ }
-+#endif
-+ offs = (segdata->p_vaddr & ADDR_ALIGN);
-+ _dl_munmap ((void*)segdata->addr - offs,
-+ segdata->p_memsz + offs);
-+ }
-+ /* _dl_unmap is only called for dlopen()ed libraries, for which
-+ calling free() is safe, or before we've completed the initial
-+ relocation, in which case calling free() is probably pointless,
-+ but still safe. */
-+ _dl_free (loadaddr.map);
-+ if (funcdesc_ht)
-+ htab_delete (funcdesc_ht);
-+}
-+
-+#if 0 /* XXX TODO will look at enabling this if we decide to add support for OCM
-+ * code/data */
-+// OLD BLACKFIN CODE
-+static __always_inline int
-+__dl_is_special_segment (Elf32_Ehdr *epnt,
-+ Elf32_Phdr *ppnt)
-+{
-+ if (ppnt->p_type != PT_LOAD)
-+ return 0;
-+
-+ if ((epnt->e_flags & EF_BFIN_CODE_IN_L1)
-+ && !(ppnt->p_flags & PF_W)
-+ && (ppnt->p_flags & PF_X))
-+ return 1;
-+
-+ if ((epnt->e_flags & EF_BFIN_DATA_IN_L1)
-+ && (ppnt->p_flags & PF_W)
-+ && !(ppnt->p_flags & PF_X))
-+ return 1;
-+
-+ /* 0xff700000, 0xff800000, 0xff900000 and 0xffa00000 are also used in
-+ GNU ld and linux kernel. They need to be keep synchronized. */
-+ if (ppnt->p_vaddr == 0xff700000
-+ || ppnt->p_vaddr == 0xff800000
-+ || ppnt->p_vaddr == 0xff900000
-+ || ppnt->p_vaddr == 0xffa00000)
-+ return 1;
-+
-+ return 0;
-+}
-+
-+static __always_inline char *
-+__dl_map_segment (Elf32_Ehdr *epnt,
-+ Elf32_Phdr *ppnt,
-+ int infile,
-+ int flags)
-+{
-+ char *status, *tryaddr, *l1addr;
-+ size_t size;
-+
-+
-+ if (((epnt->e_flags & EF_BFIN_CODE_IN_L1) || ppnt->p_vaddr == 0xffa00000)
-+ && !(ppnt->p_flags & PF_W)
-+ && (ppnt->p_flags & PF_X)) {
-+ status = (char *) _dl_mmap
-+ (tryaddr = 0,
-+ size = (ppnt->p_vaddr & ADDR_ALIGN) + ppnt->p_filesz,
-+ LXFLAGS(ppnt->p_flags),
-+ flags | MAP_EXECUTABLE | MAP_DENYWRITE,
-+ infile, ppnt->p_offset & OFFS_ALIGN);
-+ if (_dl_mmap_check_error(status)
-+ || (tryaddr && tryaddr != status))
-+ return NULL;
-+ l1addr = (char *) _dl_sram_alloc (ppnt->p_filesz, L1_INST_SRAM);
-+ if (l1addr != NULL)
-+ _dl_dma_memcpy (l1addr, status + (ppnt->p_vaddr & ADDR_ALIGN), ppnt->p_filesz);
-+ _dl_munmap (status, size);
-+ if (l1addr == NULL)
-+ _dl_dprintf(2, "%s:%i: L1 allocation failed\n", _dl_progname, __LINE__);
-+ return l1addr;
-+ }
-+
-+ if (((epnt->e_flags & EF_BFIN_DATA_IN_L1)
-+ || ppnt->p_vaddr == 0xff700000
-+ || ppnt->p_vaddr == 0xff800000
-+ || ppnt->p_vaddr == 0xff900000)
-+ && (ppnt->p_flags & PF_W)
-+ && !(ppnt->p_flags & PF_X)) {
-+ if (ppnt->p_vaddr == 0xff800000)
-+ l1addr = (char *) _dl_sram_alloc (ppnt->p_memsz, L1_DATA_A_SRAM);
-+ else if (ppnt->p_vaddr == 0xff900000)
-+ l1addr = (char *) _dl_sram_alloc (ppnt->p_memsz, L1_DATA_B_SRAM);
-+ else
-+ l1addr = (char *) _dl_sram_alloc (ppnt->p_memsz, L1_DATA_SRAM);
-+ if (l1addr == NULL) {
-+ _dl_dprintf(2, "%s:%i: L1 allocation failed\n", _dl_progname, __LINE__);
-+ } else {
-+ if (_DL_PREAD (infile, l1addr, ppnt->p_filesz, ppnt->p_offset) != ppnt->p_filesz) {
-+ _dl_sram_free (l1addr);
-+ return NULL;
-+ }
-+ if (ppnt->p_filesz < ppnt->p_memsz)
-+ _dl_memset (l1addr + ppnt->p_filesz, 0, ppnt->p_memsz - ppnt->p_filesz);
-+ }
-+ return l1addr;
-+ }
-+ return 0;
-+}
-+#endif
---- /dev/null
-+++ b/ldso/ldso/ubicom32/dl-startup.h
-@@ -0,0 +1,232 @@
-+/*
-+ Copyright (C) 2009 Ubicom, Inc.
-+ Copyright (C) 2003 Red Hat, Inc.
-+ Contributed by Alexandre Oliva <aoliva@redhat.com>
-+
-+This file is part of uClibc.
-+
-+uClibc 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.
-+
-+uClibc 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
-+Library General Public License for more details.
-+
-+You should have received a copy of the GNU Lesser General Public
-+License along with uClibc; see the file COPYING.LIB. If not, write to
-+the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
-+USA. */
-+
-+/* Any assembly language/system dependent hacks needed to setup
-+ * boot1.c so it will work as expected and cope with whatever platform
-+ * specific wierdness is needed for this architecture.
-+
-+ * We override the default _dl_boot function, and replace it with a
-+ * bit of asm. Then call the real _dl_boot function, which is now
-+ * named _dl_boot2. */
-+
-+/* At program start-up, p0 contains a pointer to a
-+ elf32_fdpic_loadmap that describes how the executable was loaded
-+ into memory. p1 contains a pointer to the interpreter (our!)
-+ loadmap, if there is an interpreter, or 0 if we're being run as an
-+ executable. p2 holds a pointer to the interpreter's dynamic
-+ section, if there is an interpreter, or to the executable's dynamic
-+ section, otherwise. If the executable is not dynamic, gr18 is 0.
-+
-+ We rely on the fact that the linker adds a pointer to the
-+ _GLOBAL_OFFSET_TABLE_ as the last ROFIXUP entry, and that
-+ __self_reloc returns the relocated pointer to us, so that we can
-+ use this value to initialize the PIC register. */
-+
-+
-+/*
-+ * _dl_boot is the entry point for ldso.
-+ *
-+ * The kernel leaves the main apps args on the stack (positive offsets), and
-+ * communicates the load maps as follows
-+ *
-+ * - d1 is set to the exec_map_addr (struct elf32_fdpic_loadmap *), which is the
-+ * current state of the mapped application.
-+ *
-+ * - d2 is set to interp_map_addr (struct elf32_fdpic_loadmap *), which is use
-+ * by ldso to relocate itself.
-+ *
-+ * - d3 is dynamic_addr which as far as I can tell is the stack pointer.
-+ *
-+ * - a1 is set to zero and will later be initialised to ldso _dl_fini funcdesc
-+ */
-+
-+__asm__(
-+ " .text \n\t"
-+ " .global _start \n\t"
-+ " .type _start,@function \n\t"
-+ "_start:\n\t"
-+ /*
-+ * Jump to .Lcall storing the location .Lcall in a5
-+ */
-+ " call a5, .Lcall \n\t"
-+ ".Lcall: \n\t"
-+ /*
-+ * Reserve and Push inputs to stack.
-+ * 32 byte stack layout as follows
-+ * offset 0 exec_map_addr
-+ * 4 interp_map_addr
-+ * 8 dynamic_addr
-+ * 12 not used
-+ * 16 dl_main_funcdesc structure for _dl_boot
-+ * (12 bytes sizeof funcdesc_value)
-+ * 28 reserved
-+ * 32 start of &original stack
-+ */
-+ " pdec sp, 32(sp); reserve stack space \n\t"
-+ " move.4 0(sp), d1 ; exec_map_addr \n\t"
-+ " move.4 4(sp), d2 ; interp_map_addr \n\t"
-+ " move.4 8(sp), d3; dynamic_addr \n\t"
-+
-+ /*
-+ * Load linker version of .Lcall in to d0
-+ */
-+ " moveai a3, #%hi(.Lcall) \n\t"
-+ " lea.1 d0, %lo(.Lcall)(a3) \n\t"
-+
-+ /*
-+ * Determine the offset from loaded .Lcall and put it in d0.
-+ */
-+ " sub.4 d0, a5, d0 \n\t"
-+
-+ /*
-+ * Load linker version of __ROFIXUP_LIST__ and __ROFIXUP_END__ in to d1
-+ * and d2.
-+ */
-+ " moveai a3, #%hi(__ROFIXUP_LIST__) \n\t"
-+ " lea.1 d1, %lo(__ROFIXUP_LIST__)(a3) \n\t"
-+ " moveai a3, #%hi(__ROFIXUP_END__) \n\t"
-+ " lea.1 d2, %lo(__ROFIXUP_END__)(a3) \n\t"
-+ /*
-+ * Use offset determined above to find the loaded versions.
-+ */
-+ " add.4 d1, d1, d0 \n\t"
-+ " add.4 d2, d2, d0 \n\t"
-+
-+ /*
-+ * Load interp_map_addr into d0, if interp_map_addr is null use
-+ * exec_map_addr.
-+ */
-+ " move.4 d0, 4(sp) ; load interp_map_addr \n\t"
-+ " cmpi d0, #0 \n\t"
-+ " jmpne.f 1f \n\t"
-+ " move.4 d0, 0(sp) ; load exec_map_addr \n\t"
-+
-+ /*
-+ * call __self_reloc(map, void ***p, void ***e)
-+ * it returns the the GOT in d0.
-+ */
-+ "1: call a5, __self_reloc ; returns a0 in d0 \n\t"
-+ " move.4 a0, d0 ; set GOT \n\t"
-+ " move.4 a2, d0 ; save GOT \n\t"
-+
-+ /*
-+ * now setup to call
-+ * _dl_start (Elf32_Addr dl_boot_got_pointer, (d0)
-+ * struct elf32_fdpic_loadmap *dl_boot_progmap, (d1)
-+ * struct elf32_fdpic_loadmap *dl_boot_ldsomap, (d2)
-+ * Elf32_Dyn *dl_boot_ldso_dyn_pointer, (d3)
-+ * struct funcdesc_value *dl_main_funcdesc, (d4)
-+ * unsigned long args (d5)
-+ *
-+ * NOTE: for dl_main_funcdesc we reserved space on the stack for this
-+ * structure.
-+ */
-+ " move.4 d1, 0(sp) ; d1 = exec_map_addr \n\t"
-+ " move.4 d2, 4(sp) ; d2 = interp_map_addr \n\t"
-+ " move.4 d3, 8(sp) ; d3 = dynamic_addr \n\t"
-+ " lea.1 d4, 16(sp) ; d4 = &dl_main_funcdesc \n\t"
-+ " lea.1 d5, 32(sp) ; d5 = original stack ptr (args)\n\t"
-+ " call a5, _dl_start \n\t"
-+
-+ /*
-+ * Setup to call the main entry point, starting with passing our FINI
-+ * ptr() to the user in a1 (remember we saved the got in a2)
-+ */
-+ " movei d15, #%got_funcdesc_lo(_dl_fini) \n\t"
-+ " move.4 a1, (a2, d15) \n\t"
-+
-+ /*
-+ * restore the load map from the kernel.
-+ */
-+ " move.4 d1, 0(sp) ; restore exec_map_addr \n\t"
-+ " move.4 d2, 4(sp) ; restore interp_map_addr \n\t"
-+ " move.4 d3, 8(sp) ; restore dynamic_addr \n\t"
-+
-+ /*
-+ * _dl_start returned the main apps entry point in dl_main_funcdesc,
-+ * load that information now.
-+ */
-+ " move.4 a5, 16(sp) ; a5 = dl_main_funcdesc.entry_point \n\t"
-+ " move.4 a0, 20(sp) ; a0 = dl_main_funcdesc.got_value \n\t"
-+ " lea.1 sp, 32(sp); restore original stack ptr (args) \n\t"
-+ " calli a5, 0(a5) \n\t"
-+ " bkpt -1; should never get here \n\t"
-+ " .size _start, . - _start \n\t"
-+);
-+
-+#undef DL_START
-+#define DL_START(X) \
-+static void __attribute__ ((used)) \
-+_dl_start (Elf32_Addr dl_boot_got_pointer, \
-+ struct elf32_fdpic_loadmap *dl_boot_progmap, \
-+ struct elf32_fdpic_loadmap *dl_boot_ldsomap, \
-+ Elf32_Dyn *dl_boot_ldso_dyn_pointer, \
-+ struct funcdesc_value *dl_main_funcdesc, \
-+ X)
-+
-+struct elf32_fdpic_loadmap;
-+
-+/*
-+ * Get a pointer to the argv array. On many platforms this can be just
-+ * the address if the first argument, on other platforms we need to
-+ * do something a little more subtle here.
-+ */
-+#define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long*) ARGS) + 1)
-+
-+/*
-+ * Here is a macro to perform a relocation. This is only used when
-+ * bootstrapping the dynamic loader. RELP is the relocation that we
-+ * are performing, REL is the pointer to the address we are relocating.
-+ * SYMBOL is the symbol involved in the relocation, and LOAD is the
-+ * load address.
-+ */
-+#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \
-+ switch(ELF32_R_TYPE((RELP)->r_info)){ \
-+ case R_UBICOM32_32: \
-+ *(REL) += (SYMBOL); \
-+ break; \
-+ case R_UBICOM32_FUNCDESC_VALUE: \
-+ { \
-+ struct funcdesc_value fv = { \
-+ (void*)((SYMBOL) + *(REL)), \
-+ (LOAD).got_value \
-+ }; \
-+ *(struct funcdesc_value volatile *)(REL) = fv; \
-+ break; \
-+ } \
-+ default: \
-+ _dl_exit(1); \
-+ }
-+
-+/*
-+ * Transfer control to the user's application, once the dynamic loader
-+ * is done. We return the address of the function's entry point to
-+ * _dl_boot, see boot1_arch.h.
-+ */
-+#define START() do { \
-+ struct elf_resolve *exec_mod = _dl_loaded_modules; \
-+ dl_main_funcdesc->entry_point = _dl_elf_main; \
-+ while (exec_mod->libtype != elf_executable) \
-+ exec_mod = exec_mod->next; \
-+ dl_main_funcdesc->got_value = exec_mod->loadaddr.got_value; \
-+ return; \
-+} while (0)
---- /dev/null
-+++ b/ldso/ldso/ubicom32/dl-syscalls.h
-@@ -0,0 +1,206 @@
-+/* Copyright (C) 2003, 2004 Red Hat, Inc.
-+ Contributed by Alexandre Oliva <aoliva@redhat.com>
-+
-+This file is part of uClibc.
-+
-+uClibc 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.
-+
-+uClibc 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
-+Library General Public License for more details.
-+
-+You should have received a copy of the GNU Lesser General Public
-+License along with uClibc; see the file COPYING.LIB. If not, write to
-+the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
-+USA. */
-+
-+/* We can't use the real errno in ldso, since it has not yet
-+ * been dynamicly linked in yet. */
-+#include "sys/syscall.h"
-+extern int _dl_errno;
-+#undef __set_errno
-+#define __set_errno(X) {(_dl_errno) = (X);}
-+#include <sys/mman.h>
-+
-+/* The code below is extracted from libc/sysdeps/linux/frv/_mmap.c */
-+
-+#if defined(DYNAMIC_LOADER_IN_SIMULATOR) && DYNAMIC_LOADER_IN_SIMULATOR
-+#define __NR___syscall_mmap2 __NR_mmap2
-+static __inline__ _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr,
-+ size_t, len, int, prot, int, flags, int, fd, off_t, offset);
-+
-+/* Make sure we don't get another definition of _dl_mmap from the
-+ machine-independent code. */
-+#undef __NR_mmap
-+#undef __NR_mmap2
-+
-+/* This is always 12, even on architectures where PAGE_SHIFT != 12. */
-+# ifndef MMAP2_PAGE_SHIFT
-+# define MMAP2_PAGE_SHIFT 12
-+# endif
-+
-+#include <bits/uClibc_page.h> /* for PAGE_SIZE */
-+static __always_inline void *_dl_memset(void*,int,size_t);
-+static __always_inline ssize_t _dl_pread(int fd, void *buf, size_t count, off_t offset);
-+
-+static __ptr_t
-+_dl_mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset)
-+{
-+ size_t plen = (len + PAGE_SIZE - 1) & -PAGE_SIZE;
-+
-+/* This is a hack to enable the dynamic loader to run within a
-+ simulator that doesn't support mmap, with a number of very ugly
-+ tricks. Also, it's not as useful as it sounds, since only dynamic
-+ executables without DT_NEEDED dependencies can be run. AFAIK, they
-+ can only be created with -pie. This trick suffices to enable the
-+ dynamic loader to obtain a blank page that it maps early in the
-+ bootstrap. */
-+ if ((flags & MAP_FIXED) == 0)
-+ {
-+ void *_dl_mmap_base = 0;
-+ __ptr_t *ret = 0;
-+
-+ if (! _dl_mmap_base)
-+ {
-+ void *stack;
-+ __asm__ ("mov sp, %0" : "=r" (stack));
-+ _dl_mmap_base = (void *)(((long)stack + 2 * PAGE_SIZE) & -PAGE_SIZE);
-+ retry:
-+ if (((void **)_dl_mmap_base)[0] == _dl_mmap_base
-+ && ((void **)_dl_mmap_base)[1023] == _dl_mmap_base
-+ && (((void **)_dl_mmap_base)[177]
-+ == ((void **)_dl_mmap_base)[771]))
-+ {
-+ while (((void**)_dl_mmap_base)[177])
-+ {
-+ _dl_mmap_base = ((void**)_dl_mmap_base)[177];
-+ if (!(((void **)_dl_mmap_base)[0] == _dl_mmap_base
-+ && ((void **)_dl_mmap_base)[1023] == _dl_mmap_base
-+ && (((void **)_dl_mmap_base)[177]
-+ == ((void**)_dl_mmap_base)[771])))
-+ ((void(*)())0)();
-+ }
-+ }
-+ else
-+ {
-+ int i;
-+ for (i = 0; i < (int)PAGE_SIZE; i++)
-+ if (*(char*)(_dl_mmap_base + i))
-+ break;
-+ if (i != PAGE_SIZE)
-+ {
-+ _dl_mmap_base = (void*)((long)_dl_mmap_base + PAGE_SIZE);
-+ goto retry;
-+ }
-+ ((void**)_dl_mmap_base)[-1] =
-+ ((void**)_dl_mmap_base)[0] =
-+ ((void**)_dl_mmap_base)[1023] =
-+ _dl_mmap_base;
-+ }
-+ }
-+
-+ if (_dl_mmap_base)
-+ {
-+ if (!(((void **)_dl_mmap_base)[0] == _dl_mmap_base
-+ && ((void **)_dl_mmap_base)[1023] == _dl_mmap_base
-+ && (((void **)_dl_mmap_base)[177]
-+ == ((void**)_dl_mmap_base)[771])))
-+ ((void(*)())0)();
-+ ret = (__ptr_t)((char*)_dl_mmap_base + PAGE_SIZE);
-+ _dl_mmap_base =
-+ ((void**)_dl_mmap_base)[177] =
-+ ((void**)_dl_mmap_base)[771] =
-+ (char*)_dl_mmap_base + plen + PAGE_SIZE;
-+ ((void**)_dl_mmap_base)[0] =
-+ ((void**)_dl_mmap_base)[1023] =
-+ _dl_mmap_base;
-+ }
-+
-+ if ((flags & MAP_ANONYMOUS) != 0)
-+ {
-+ _dl_memset (ret, 0, plen);
-+ return ret;
-+ }
-+
-+ flags |= MAP_FIXED;
-+ addr = ret;
-+ }
-+ if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)) {
-+#if 0
-+ __set_errno (EINVAL);
-+#endif
-+ return MAP_FAILED;
-+ }
-+ if ((flags & MAP_FIXED) != 0)
-+ {
-+ if (_dl_pread(fd, addr, len, offset) != (ssize_t)len)
-+ return (void*)MAP_FAILED;
-+ if (plen != len)
-+ _dl_memset (addr + len, 0, plen - len);
-+ return addr;
-+ }
-+ return(__syscall_mmap2(addr, len, prot, flags, fd, (off_t) (offset >> MMAP2_PAGE_SHIFT)));
-+}
-+#endif
-+
-+#ifdef __NR_pread64
-+#ifdef DYNAMIC_LOADER_IN_SIMULATOR
-+#include <unistd.h>
-+
-+#define __NR___syscall_lseek __NR_lseek
-+static __always_inline unsigned long _dl_read(int fd, const void *buf, unsigned long count);
-+
-+static __always_inline _syscall3(__off_t, __syscall_lseek, int, fd, __off_t, offset,
-+ int, whence);
-+static __always_inline ssize_t
-+_dl_pread(int fd, void *buf, size_t count, off_t offset)
-+{
-+ __off_t orig = __syscall_lseek (fd, 0, SEEK_CUR);
-+ ssize_t ret;
-+
-+ if (orig == -1)
-+ return -1;
-+
-+ if (__syscall_lseek (fd, offset, SEEK_SET) != offset)
-+ return -1;
-+
-+ ret = _dl_read (fd, buf, count);
-+
-+ if (__syscall_lseek (fd, orig, SEEK_SET) != orig)
-+ ((void(*)())0)();
-+
-+ return ret;
-+}
-+#else
-+#define __NR___syscall_pread __NR_pread64
-+static __always_inline _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf,
-+ size_t, count, off_t, offset_hi, off_t, offset_lo);
-+
-+static __always_inline ssize_t
-+_dl_pread(int fd, void *buf, size_t count, off_t offset)
-+{
-+ return(__syscall_pread(fd,buf,count,__LONG_LONG_PAIR (offset >> 31, offset)));
-+}
-+#endif
-+#endif
-+
-+#ifdef __NR_sram_alloc
-+#define __NR__dl_sram_alloc __NR_sram_alloc
-+static __always_inline _syscall2(__ptr_t, _dl_sram_alloc,
-+ size_t, len, unsigned long, flags);
-+#endif
-+
-+#ifdef __NR_sram_free
-+#define __NR__dl_sram_free __NR_sram_free
-+static __always_inline _syscall1(int, _dl_sram_free, __ptr_t, addr);
-+#endif
-+
-+#ifdef __NR_dma_memcpy
-+#define __NR__dl_dma_memcpy __NR_dma_memcpy
-+static __always_inline _syscall3(__ptr_t, _dl_dma_memcpy,
-+ __ptr_t, dest, __ptr_t, src, size_t, len);
-+#endif
---- /dev/null
-+++ b/ldso/ldso/ubicom32/dl-sysdep.h
-@@ -0,0 +1,243 @@
-+ /* Copyright (C) 2003, 2004 Red Hat, Inc.
-+ Contributed by Alexandre Oliva <aoliva@redhat.com>
-+ Based on ../i386/dl-sysdep.h
-+
-+This file is part of uClibc.
-+
-+uClibc 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.
-+
-+uClibc 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
-+Library General Public License for more details.
-+
-+You should have received a copy of the GNU Lesser General Public
-+License along with uClibc; see the file COPYING.LIB. If not, write to
-+the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
-+USA. */
-+
-+/*
-+ * Various assembly language/system dependent hacks that are required
-+ * so that we can minimize the amount of platform specific code.
-+ */
-+
-+/*
-+ * Define this if the system uses RELOCA.
-+ */
-+#undef ELF_USES_RELOCA
-+
-+/* JMPREL relocs are inside the DT_RELA table. */
-+#define ELF_MACHINE_PLTREL_OVERLAP
-+
-+#define DL_NO_COPY_RELOCS
-+
-+#define HAVE_DL_INLINES_H
-+
-+/*
-+ * Initialization sequence for a GOT. Copy the resolver function
-+ * descriptor and the pointer to the elf_resolve/link_map data
-+ * structure. Initialize the got_value in the module while at that.
-+ */
-+#define INIT_GOT(GOT_BASE,MODULE) \
-+{ \
-+ (MODULE)->loadaddr.got_value = (GOT_BASE); \
-+ GOT_BASE[0] = ((unsigned long *)&_dl_linux_resolve)[0]; \
-+ GOT_BASE[1] = ((unsigned long *)&_dl_linux_resolve)[1]; \
-+ GOT_BASE[2] = (unsigned long) MODULE; \
-+}
-+
-+/* Here we define the magic numbers that this dynamic loader should accept */
-+#define MAGIC1 EM_UBICOM32
-+#undef MAGIC2
-+
-+/* Used for error messages */
-+#define ELF_TARGET "UBICOM32"
-+
-+struct elf_resolve;
-+
-+struct funcdesc_value
-+{
-+ void *entry_point;
-+ void *got_value;
-+/*int relocation; not sure if this required, but it does exist */
-+};
-+
-+extern int _dl_linux_resolve(void) __attribute__((__visibility__("hidden")));
-+extern struct funcdesc_value volatile *__attribute__((__visibility__("hidden")))
-+ _dl_linux_resolver (struct elf_resolve *tpnt, int reloc_entry);
-+
-+/* 4KiB page alignment. Should perhaps be made dynamic using
-+ getpagesize(), based on AT_PAGESZ from auxvt? */
-+#define PAGE_ALIGN 0xfffff000
-+#define ADDR_ALIGN 0xfff
-+#define OFFS_ALIGN 0x7ffff000
-+
-+struct funcdesc_ht;
-+
-+/*
-+ * This asm does a quick relcation of string S (which is stored in the text
-+ * section as thats all we can use
-+ */
-+#undef SEND_EARLY_STDERR
-+#define SEND_EARLY_STDERR(S) \
-+do { \
-+ static const char __attribute__((section(".text"))) __s[] = (S); \
-+ const char *__p, *__scratch; \
-+ __asm__ ( \
-+ " call a3, 1f; \n\t" \
-+ "1: movei %0, #%%got_lo(1b) \n\t" \
-+ " move.4 %0, (%3, %0) \n\t" \
-+ " sub.4 %1, a3, %0; \n\t" \
-+ " add.4 %1, %1, %2; \n\t" \
-+ : "=&d" (__scratch), "=&d" (__p) \
-+ : "d" (__s), "a" (dl_boot_got_pointer) \
-+ : "a3", "a4", "d15"); \
-+ SEND_STDERR (__p); \
-+ { int __t; \
-+ for (__t = 0; __t < 0x100000; __t++) __asm__ __volatile__ (""); } \
-+} while (0)
-+
-+#define DL_LOADADDR_TYPE struct elf32_fdpic_loadaddr
-+
-+#define DL_RELOC_ADDR(LOADADDR, ADDR) \
-+ ((ElfW(Addr))__reloc_pointer ((void*)(ADDR), (LOADADDR).map))
-+
-+#define DL_ADDR_TO_FUNC_PTR(ADDR, LOADADDR) \
-+ ((void(*)(void)) _dl_funcdesc_for ((void*)(ADDR), (LOADADDR).got_value))
-+
-+#define _dl_stabilize_funcdesc(val) \
-+ ({ __asm__ ("" : "+m" (*(val))); (val); })
-+
-+#define DL_CALL_FUNC_AT_ADDR(ADDR, LOADADDR, SIGNATURE, ...) \
-+ ({ struct funcdesc_value fd = { (void*)(ADDR), (LOADADDR).got_value }; \
-+ void (*pf)(void) = (void*) _dl_stabilize_funcdesc (&fd); \
-+ (* SIGNATURE pf)(__VA_ARGS__); })
-+
-+#define DL_INIT_LOADADDR_BOOT(LOADADDR, BASEADDR) \
-+ (__dl_init_loadaddr_map (&(LOADADDR), dl_boot_got_pointer, \
-+ dl_boot_ldsomap ?: dl_boot_progmap))
-+
-+#define DL_INIT_LOADADDR_PROG(LOADADDR, BASEADDR) \
-+ (__dl_init_loadaddr_map (&(LOADADDR), 0, dl_boot_progmap))
-+
-+#define DL_INIT_LOADADDR_EXTRA_DECLS \
-+ int dl_init_loadaddr_load_count;
-+#define DL_INIT_LOADADDR(LOADADDR, BASEADDR, PHDR, PHDRCNT) \
-+ (dl_init_loadaddr_load_count = \
-+ __dl_init_loadaddr (&(LOADADDR), (PHDR), (PHDRCNT)))
-+#define DL_INIT_LOADADDR_HDR(LOADADDR, ADDR, PHDR) \
-+ (__dl_init_loadaddr_hdr ((LOADADDR), (ADDR), (PHDR), \
-+ dl_init_loadaddr_load_count))
-+#define DL_LOADADDR_UNMAP(LOADADDR, LEN) \
-+ (__dl_loadaddr_unmap ((LOADADDR), (NULL)))
-+#define DL_LIB_UNMAP(LIB, LEN) \
-+ (__dl_loadaddr_unmap ((LIB)->loadaddr, (LIB)->funcdesc_ht))
-+#define DL_LOADADDR_BASE(LOADADDR) \
-+ ((LOADADDR).got_value)
-+
-+/* This is called from dladdr(), such that we map a function
-+ descriptor's address to the function's entry point before trying to
-+ find in which library it's defined. */
-+#define DL_LOOKUP_ADDRESS(ADDRESS) (_dl_lookup_address (ADDRESS))
-+
-+#define DL_ADDR_IN_LOADADDR(ADDR, TPNT, TFROM) \
-+ (! (TFROM) && __dl_addr_in_loadaddr ((void*)(ADDR), (TPNT)->loadaddr))
-+
-+/*
-+ * Compute the GOT address. On several platforms, we use assembly
-+ * here. on FR-V FDPIC, there's no way to compute the GOT address,
-+ * since the offset between text and data is not fixed, so we arrange
-+ * for the assembly _dl_boot to pass this value as an argument to
-+ * _dl_boot. */
-+#define DL_BOOT_COMPUTE_GOT(got) ((got) = dl_boot_got_pointer)
-+
-+#define DL_BOOT_COMPUTE_DYN(dpnt, got, load_addr) \
-+ ((dpnt) = dl_boot_ldso_dyn_pointer)
-+
-+/* We only support loading FDPIC independently-relocatable shared
-+ libraries. It probably wouldn't be too hard to support loading
-+ shared libraries that require relocation by the same amount, but we
-+ don't know that they exist or would be useful, and the dynamic
-+ loader code could leak the whole-library map unless we keeping a
-+ bit more state for DL_LOADADDR_UNMAP and DL_LIB_UNMAP, so let's
-+ keep things simple for now. */
-+#define DL_CHECK_LIB_TYPE(epnt, piclib, _dl_progname, libname) \
-+do \
-+{ \
-+ if (((epnt)->e_flags & EF_UBICOM32_FDPIC) && ! ((epnt)->e_flags & EF_UBICOM32_PIC)) \
-+ (piclib) = 2; \
-+ else \
-+ { \
-+ _dl_internal_error_number = LD_ERROR_NOTDYN; \
-+ _dl_dprintf(2, "%s: '%s' is not an FDPIC shared library" \
-+ "\n", (_dl_progname), (libname)); \
-+ _dl_close(infile); \
-+ return NULL; \
-+ } \
-+\
-+} \
-+while (0)
-+
-+/* We want want to apply all relocations in the interpreter during
-+ bootstrap. Because of this, we have to skip the interpreter
-+ relocations in _dl_parse_relocation_information(), see
-+ elfinterp.c. */
-+#define DL_SKIP_BOOTSTRAP_RELOC(SYMTAB, INDEX, STRTAB) 0
-+
-+#ifdef __NR_pread64
-+#define _DL_PREAD(FD, BUF, SIZE, OFFSET) \
-+ (_dl_pread((FD), (BUF), (SIZE), (OFFSET)))
-+#endif
-+
-+/* We want to return to dlsym() a function descriptor if the symbol
-+ turns out to be a function. */
-+#define DL_FIND_HASH_VALUE(TPNT, TYPE_CLASS, SYM) \
-+ (((TYPE_CLASS) & ELF_RTYPE_CLASS_DLSYM) \
-+ && ELF32_ST_TYPE((SYM)->st_info) == STT_FUNC \
-+ ? _dl_funcdesc_for ((void *)DL_RELOC_ADDR ((TPNT)->loadaddr, (SYM)->st_value), \
-+ (TPNT)->loadaddr.got_value) \
-+ : DL_RELOC_ADDR ((TPNT)->loadaddr, (SYM)->st_value))
-+
-+#if 0 /* XXX TODO will look at enabling this if we decide to add support for OCM
-+ * code/data */
-+
-+#define DL_IS_SPECIAL_SEGMENT(EPNT, PPNT) \
-+ __dl_is_special_segment(EPNT, PPNT)
-+#define DL_MAP_SEGMENT(EPNT, PPNT, INFILE, FLAGS) \
-+ __dl_map_segment (EPNT, PPNT, INFILE, FLAGS)
-+
-+#endif
-+
-+
-+#define DL_GET_READY_TO_RUN_EXTRA_PARMS \
-+ , struct elf32_fdpic_loadmap *dl_boot_progmap, Elf32_Addr dl_boot_got_pointer
-+#define DL_GET_READY_TO_RUN_EXTRA_ARGS \
-+ , dl_boot_progmap, dl_boot_got_pointer
-+
-+
-+#ifdef __USE_GNU
-+# include <link.h>
-+#else
-+# define __USE_GNU
-+# include <link.h>
-+# undef __USE_GNU
-+#endif
-+
-+#include <elf.h>
-+static __inline__ void
-+elf_machine_relative (DL_LOADADDR_TYPE load_off, const Elf32_Addr rel_addr,
-+ Elf32_Word relative_count)
-+{
-+#if 0
-+ Elf32_Rel * rpnt = (void *) rel_addr;
-+ --rpnt;
-+ do {
-+ Elf32_Addr *const reloc_addr = (void *) (load_off + (++rpnt)->r_offset);
-+
-+ *reloc_addr = DL_RELOC_ADDR (load_off, *reloc_addr);
-+ } while (--relative_count);
-+#endif
-+}
---- /dev/null
-+++ b/ldso/ldso/ubicom32/elfinterp.c
-@@ -0,0 +1,366 @@
-+/* Blackfin ELF shared library loader suppport
-+ Copyright (C) 2003, 2004 Red Hat, Inc.
-+ Contributed by Alexandre Oliva <aoliva@redhat.com>
-+ Lots of code copied from ../i386/elfinterp.c, so:
-+ Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald,
-+ David Engel, Hongjiu Lu and Mitch D'Souza
-+ Copyright (C) 2001-2002, Erik Andersen
-+ All rights reserved.
-+
-+This file is part of uClibc.
-+
-+uClibc 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.
-+
-+uClibc 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
-+Library General Public License for more details.
-+
-+You should have received a copy of the GNU Lesser General Public
-+License along with uClibc; see the file COPYING.LIB. If not, write to
-+the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
-+USA. */
-+
-+#include <sys/cdefs.h> /* __attribute_used__ */
-+
-+/* Program to load an ELF binary on a linux system, and run it.
-+ References to symbols in sharable libraries can be resolved by either
-+ an ELF sharable library or a linux style of shared library. */
-+
-+/* Disclaimer: I have never seen any AT&T source code for SVr4, nor have
-+ I ever taken any courses on internals. This program was developed using
-+ information available through the book "UNIX SYSTEM V RELEASE 4,
-+ Programmers guide: Ansi C and Programming Support Tools", which did
-+ a more than adequate job of explaining everything required to get this
-+ working. */
-+extern int _dl_ubicom32_resolve_pending(void) __attribute__((__visibility__("hidden")));
-+
-+struct funcdesc_value volatile *__attribute__((__visibility__("hidden")))
-+_dl_linux_resolver (struct elf_resolve *tpnt, int reloc_entry)
-+{
-+ int reloc_type;
-+ ELF_RELOC *this_reloc;
-+ char *strtab;
-+ ElfW(Sym) *symtab;
-+ int symtab_index;
-+ char *rel_addr;
-+ struct elf_resolve *new_tpnt;
-+ char *new_addr;
-+ struct funcdesc_value funcval;
-+ struct funcdesc_value volatile *got_entry;
-+ char *symname;
-+
-+ rel_addr = (char *)tpnt->dynamic_info[DT_JMPREL];
-+
-+ this_reloc = (ELF_RELOC *)(intptr_t)(rel_addr + reloc_entry);
-+ reloc_type = ELF_R_TYPE(this_reloc->r_info);
-+ symtab_index = ELF_R_SYM(this_reloc->r_info);
-+
-+ symtab = (Elf32_Sym *) tpnt->dynamic_info[DT_SYMTAB];
-+ strtab = (char *) tpnt->dynamic_info[DT_STRTAB];
-+ symname= strtab + symtab[symtab_index].st_name;
-+
-+ if (reloc_type != R_UBICOM32_FUNCDESC_VALUE) {
-+ _dl_dprintf(2, "%s: Incorrect relocation type in jump relocations\n",
-+ _dl_progname);
-+ _dl_exit(1);
-+ }
-+
-+ /* Address of GOT entry fix up */
-+ got_entry = (struct funcdesc_value *) DL_RELOC_ADDR(tpnt->loadaddr, this_reloc->r_offset);
-+
-+ /* Get the address to be used to fill in the GOT entry. */
-+ new_addr = _dl_lookup_hash(symname, tpnt->symbol_scope, NULL, 0, &new_tpnt);
-+ if (!new_addr) {
-+ new_addr = _dl_lookup_hash(symname, NULL, NULL, 0, &new_tpnt);
-+ if (!new_addr) {
-+ _dl_dprintf(2, "%s: can't resolve symbol '%s'\n",
-+ _dl_progname, symname);
-+ _dl_exit(1);
-+ }
-+ }
-+
-+ funcval.entry_point = new_addr;
-+ funcval.got_value = new_tpnt->loadaddr.got_value;
-+
-+#if defined (__SUPPORT_LD_DEBUG__)
-+ if (_dl_debug_bindings) {
-+ _dl_dprintf(_dl_debug_file, "\nresolve function: %s", symname);
-+ if (_dl_debug_detail)
-+ _dl_dprintf(_dl_debug_file,
-+ "\n\tpatched (%x,%x) ==> (%x,%x) @ %x\n",
-+ got_entry->entry_point, got_entry->got_value,
-+ funcval.entry_point, funcval.got_value,
-+ got_entry);
-+ }
-+ if (1 || !_dl_debug_nofixups) {
-+ got_entry->entry_point = ((unsigned long *)&_dl_ubicom32_resolve_pending)[0];
-+ got_entry->got_value = funcval.got_value;
-+ got_entry->entry_point = funcval.entry_point;
-+ }
-+#else
-+ /*
-+ * initially set the entry point to resolve pending before starting
-+ * the update. This has the effect of putting all other requests in a
-+ * holding pattern until the resolution is completed.
-+ */
-+ got_entry->entry_point = ((unsigned long *)&_dl_ubicom32_resolve_pending)[0];
-+ got_entry->got_value = funcval.got_value;
-+ got_entry->entry_point = funcval.entry_point;
-+#endif
-+
-+ return got_entry;
-+}
-+
-+static int
-+_dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
-+ unsigned long rel_addr, unsigned long rel_size,
-+ int (*reloc_fnc) (struct elf_resolve *tpnt, struct dyn_elf *scope,
-+ ELF_RELOC *rpnt, ElfW(Sym) *symtab, char *strtab))
-+{
-+ unsigned int i;
-+ char *strtab;
-+ ElfW(Sym) *symtab;
-+ ELF_RELOC *rpnt;
-+ int symtab_index;
-+
-+ /* Now parse the relocation information */
-+ rpnt = (ELF_RELOC *) rel_addr;
-+ rel_size = rel_size / sizeof(ELF_RELOC);
-+
-+ symtab = (ElfW(Sym) *) tpnt->dynamic_info[DT_SYMTAB];
-+ strtab = (char *) tpnt->dynamic_info[DT_STRTAB];
-+
-+ for (i = 0; i < rel_size; i++, rpnt++) {
-+ int res;
-+
-+ symtab_index = ELF_R_SYM(rpnt->r_info);
-+ debug_sym(symtab,strtab,symtab_index);
-+ debug_reloc(symtab,strtab,rpnt);
-+
-+ res = reloc_fnc (tpnt, scope, rpnt, symtab, strtab);
-+
-+ if (res==0) continue;
-+
-+ _dl_dprintf(2, "\n%s: ",_dl_progname);
-+
-+ if (symtab_index)
-+ _dl_dprintf(2, "symbol '%s': ", strtab + symtab[symtab_index].st_name);
-+
-+ if (res <0) {
-+ int reloc_type = ELF_R_TYPE(rpnt->r_info);
-+#if defined (__SUPPORT_LD_DEBUG__)
-+ _dl_dprintf(2, "can't handle reloc type %s\n ", _dl_reltypes(reloc_type));
-+#else
-+ _dl_dprintf(2, "can't handle reloc type %x\n", reloc_type);
-+#endif
-+ _dl_exit(-res);
-+ } else if (res >0) {
-+ _dl_dprintf(2, "can't resolve symbol\n");
-+ return res;
-+ }
-+ }
-+ return 0;
-+}
-+
-+static int
-+_dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
-+ ELF_RELOC *rpnt, ElfW(Sym) *symtab, char *strtab)
-+{
-+ int reloc_type;
-+ int symtab_index;
-+ char *symname;
-+ unsigned long reloc_value = 0, *reloc_addr;
-+ struct { unsigned long v; } __attribute__((__packed__))
-+ *reloc_addr_packed;
-+ unsigned long symbol_addr;
-+ struct elf_resolve *symbol_tpnt;
-+ struct funcdesc_value funcval;
-+#if defined (__SUPPORT_LD_DEBUG__)
-+ unsigned long old_val;
-+#endif
-+
-+ reloc_addr = (unsigned long *) DL_RELOC_ADDR(tpnt->loadaddr, rpnt->r_offset);
-+ __asm__ ("" : "=r" (reloc_addr_packed) : "0" (reloc_addr));
-+ reloc_type = ELF_R_TYPE(rpnt->r_info);
-+ symtab_index = ELF_R_SYM(rpnt->r_info);
-+ symbol_addr = 0;
-+ symname = strtab + symtab[symtab_index].st_name;
-+
-+ if (ELF_ST_BIND (symtab[symtab_index].st_info) == STB_LOCAL) {
-+ symbol_addr = (unsigned long) DL_RELOC_ADDR(tpnt->loadaddr, symtab[symtab_index].st_value);
-+ symbol_tpnt = tpnt;
-+ } else {
-+
-+ symbol_addr = (unsigned long)
-+ _dl_lookup_hash(symname, scope, NULL, 0, &symbol_tpnt);
-+
-+ /*
-+ * We want to allow undefined references to weak symbols - this might
-+ * have been intentional. We should not be linking local symbols
-+ * here, so all bases should be covered.
-+ */
-+
-+ if (!symbol_addr && ELF_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK) {
-+ _dl_dprintf (2, "%s: can't resolve symbol '%s'\n",
-+ _dl_progname, strtab + symtab[symtab_index].st_name);
-+ _dl_exit (1);
-+ }
-+ }
-+
-+#if defined (__SUPPORT_LD_DEBUG__)
-+ if (_dl_debug_reloc && _dl_debug_detail)
-+ {
-+ if ((long)reloc_addr_packed & 3)
-+ old_val = reloc_addr_packed->v;
-+ else
-+ old_val = *reloc_addr;
-+ }
-+ else
-+ old_val = 0;
-+#endif
-+ switch (reloc_type) {
-+ case R_UBICOM32_NONE:
-+ break;
-+ case R_UBICOM32_32:
-+ if ((long)reloc_addr_packed & 3)
-+ reloc_value = reloc_addr_packed->v += symbol_addr;
-+ else
-+ reloc_value = *reloc_addr += symbol_addr;
-+ break;
-+ case R_UBICOM32_FUNCDESC_VALUE:
-+ funcval.entry_point = (void*)symbol_addr;
-+ /* The addend of FUNCDESC_VALUE
-+ relocations referencing global
-+ symbols must be ignored, because it
-+ may hold the address of a lazy PLT
-+ entry. */
-+ if (ELF_ST_BIND(symtab[symtab_index].st_info) == STB_LOCAL)
-+ funcval.entry_point += *reloc_addr;
-+ reloc_value = (unsigned long)funcval.entry_point;
-+ if (symbol_addr)
-+ funcval.got_value
-+ = symbol_tpnt->loadaddr.got_value;
-+ else
-+ funcval.got_value = 0;
-+
-+/// XXX this is my best guess as to what I should be doing, but I'm
-+/// putting a break-point here so I can inspect the first time this is
-+/// used.
-+ __asm__ (
-+ " move.4 4(%0), 4(%1) \n\t"
-+ " move.4 0(%0), 0(%1) \n\t" /* Must to entry_point last */
-+ :
-+ : "a" (reloc_addr), "a" (&funcval)
-+ : "memory" );
-+ break;
-+ case R_UBICOM32_FUNCDESC:
-+ if ((long)reloc_addr_packed & 3)
-+ reloc_value = reloc_addr_packed->v;
-+ else
-+ reloc_value = *reloc_addr;
-+ if (symbol_addr)
-+ reloc_value = (unsigned long)_dl_funcdesc_for
-+ ((char *)symbol_addr + reloc_value,
-+ symbol_tpnt->loadaddr.got_value);
-+ else
-+ reloc_value = 0;
-+ if ((long)reloc_addr_packed & 3)
-+ reloc_addr_packed->v = reloc_value;
-+ else
-+ *reloc_addr = reloc_value;
-+ break;
-+ default:
-+ return -1;
-+ }
-+#if defined (__SUPPORT_LD_DEBUG__)
-+ if (_dl_debug_reloc && _dl_debug_detail) {
-+ _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x", old_val, reloc_value, reloc_addr);
-+ switch (reloc_type) {
-+ case R_UBICOM32_FUNCDESC_VALUE:
-+ _dl_dprintf(_dl_debug_file, " got %x", ((struct funcdesc_value *)reloc_value)->got_value);
-+ break;
-+ case R_UBICOM32_FUNCDESC:
-+ if (! reloc_value)
-+ break;
-+ _dl_dprintf(_dl_debug_file, " funcdesc (%x,%x)",
-+ ((struct funcdesc_value *)reloc_value)->entry_point,
-+ ((struct funcdesc_value *)reloc_value)->got_value);
-+ break;
-+ }
-+ }
-+#endif
-+
-+ return 0;
-+}
-+
-+static int
-+_dl_do_lazy_reloc (struct elf_resolve *tpnt,
-+ struct dyn_elf *scope __attribute__((unused)),
-+ ELF_RELOC *rpnt, ElfW(Sym) *symtab __attribute__((unused)),
-+ char *strtab __attribute__((unused)))
-+{
-+ int reloc_type;
-+ struct funcdesc_value volatile *reloc_addr;
-+ struct funcdesc_value funcval;
-+#if defined (__SUPPORT_LD_DEBUG__)
-+ unsigned long old_val;
-+#endif
-+
-+ reloc_addr = (struct funcdesc_value *) DL_RELOC_ADDR(tpnt->loadaddr, rpnt->r_offset);
-+ reloc_type = ELF_R_TYPE(rpnt->r_info);
-+
-+#if defined (__SUPPORT_LD_DEBUG__)
-+ old_val = (unsigned long)reloc_addr->entry_point;
-+#endif
-+ switch (reloc_type) {
-+ case R_UBICOM32_NONE:
-+ break;
-+ case R_UBICOM32_FUNCDESC_VALUE:
-+ funcval = *reloc_addr;
-+ funcval.entry_point = (void*)DL_RELOC_ADDR(tpnt->loadaddr, funcval.entry_point);
-+ funcval.got_value = tpnt->loadaddr.got_value;
-+ *reloc_addr = funcval;
-+ break;
-+ default:
-+ return -1;
-+ }
-+#if defined (__SUPPORT_LD_DEBUG__)
-+ if (_dl_debug_reloc && _dl_debug_detail)
-+ _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x", old_val, reloc_addr->entry_point, reloc_addr);
-+#endif
-+ return 0;
-+
-+}
-+
-+void
-+_dl_parse_lazy_relocation_information
-+(struct dyn_elf *rpnt, unsigned long rel_addr, unsigned long rel_size)
-+{
-+ _dl_parse(rpnt->dyn, NULL, rel_addr, rel_size, _dl_do_lazy_reloc);
-+}
-+
-+int
-+_dl_parse_relocation_information
-+(struct dyn_elf *rpnt, unsigned long rel_addr, unsigned long rel_size)
-+{
-+ return _dl_parse(rpnt->dyn, rpnt->dyn->symbol_scope, rel_addr, rel_size, _dl_do_reloc);
-+}
-+
-+#if 0
-+/* We don't have copy relocs. */
-+int
-+_dl_parse_copy_information
-+(struct dyn_elf *rpnt __attribute__((unused)),
-+ unsigned long rel_addr __attribute__((unused)),
-+ unsigned long rel_size __attribute__((unused)))
-+{
-+ return 0;
-+}
-+#endif
-+#ifndef IS_IN_libdl
-+# include "../../libc/sysdeps/linux/ubicom32/crtreloc.c"
-+#endif
---- /dev/null
-+++ b/ldso/ldso/ubicom32/resolve.S
-@@ -0,0 +1,161 @@
-+ /* Copyright (C) 2003 Red Hat, Inc.
-+ Contributed by Alexandre Oliva <aoliva@redhat.com>
-+
-+ Copyright (C) 2009 Ubicom Inc.
-+ Ported to Ubicom32 by Ubicom Inc.
-+
-+This file is part of uClibc.
-+
-+uClibc 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.
-+
-+uClibc 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
-+Library General Public License for more details.
-+
-+You should have received a copy of the GNU Lesser General Public
-+License along with uClibc; see the file COPYING.LIB. If not, write to
-+the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
-+USA. */
-+
-+
-+/*
-+ * The function below is tail-called by resolver stubs when a lazily-bound *
-+ * function is called. It must preserve all registers that could * be used to
-+ * pass arguments to the actual function.
-+ *
-+ * On entry to the function d0-d13 contain parameters to the actual function of
-+ * interest
-+ *
-+ * a5 contains the return address
-+ * a0 is pointing to the GOT table for the original function
-+ * (a0) _dl_linux_resolve
-+ * 4(a0) GOT for _dl_linux_resolve
-+ * 8(a0) is pointer to "structure elf_resolve" of the module where the call
-+ * originated from
-+ *
-+ * a3 is pointing to the function descriptor in the GOT table, and 8(a3) the
-+ * resolver lookup information.
-+ *
-+ * _dl_linux_resolve calls _dl_linux_resolver passing it pointer to
-+ * struct elf_resolve and the relocation entry.
-+ *
-+ * _dl_linux_resolver() figures out where the jump symbol is _really_ supposed
-+ * to have jumped to and returns that to us. Once we have that, we prepare to
-+ * tail-call the actual function, clean up after ourselves, restoring the
-+ * original arguments, then jump to the fixed up address.
-+ */
-+
-+#if 0
-+ /*
-+ * Here is what the linker will use for the PLT.
-+ */
-+sample_PLT_functionX: /* (at entry a0 contains GOT for this library) */
-+ movei d15, # -%lo(got_funcdescX) ; load offset for GOT
-+ lea.4 a3, (a0, d15) ; a4 is now the function descriptor
-+ move.4 a4, 0(a3) ; get entry_point
-+ move.4 a0, 4(a3) ; set new GOT
-+
-+ /*
-+ * jump to resovled function OR PLT_trampoline Nat had some code here
-+ * that uses the stack instead of a3 to reduces hazards.
-+ */
-+ calli a4, 0(a4)
-+
-+
-+sample_PLT_trampoline:
-+ /*
-+ * find the old got by undoing what was done above. An alternative
-+ * could have been to ‘save’ the old got in say d14 but that would add 1
-+ * instruction to every PLT and there is only 1 PLT trampoline per library.
-+ */
-+ ret (a0) ; jump to _dl_linux_resolve
-+#endif
-+
-+ .text
-+ .p2align 4
-+
-+ .hidden _dl_linux_resolve
-+ .global _dl_linux_resolve
-+ .type _dl_linux_resolve,@function
-+_dl_linux_resolve:
-+ /* Preserve arguments and return address */
-+ move.4 -4(sp)++, d0
-+ move.4 -4(sp)++, d1
-+ move.4 -4(sp)++, d2
-+ move.4 -4(sp)++, d3
-+ move.4 -4(sp)++, d4
-+ move.4 -4(sp)++, d5
-+ move.4 -4(sp)++, d6
-+ move.4 -4(sp)++, d7
-+ move.4 -4(sp)++, d8
-+ move.4 -4(sp)++, d9
-+ move.4 -4(sp)++, d10
-+ move.4 -4(sp)++, d11
-+ move.4 -4(sp)++, d12
-+ move.4 -4(sp)++, d13
-+ move.4 -4(sp)++, a5
-+
-+ /* Prepare to call _dl_linux_resolver. */
-+ move.4 d0, 8(a0) ; reference to elf_resolve
-+ /* Not aligned for space reasons. */
-+ move.4 d1, mac_hi ; reference to GOT table entry which
-+ ; contains the relocation information.
-+
-+ move.4 a0, 4(a0) ; switch to GOT for _dl_linux_resolve
-+ call a5, _dl_linux_resolver;
-+
-+ /* Move aside return value that contains the FUNCDESC_VALUE. */
-+ ;P3 = R0;
-+ move.4 a3, d0;
-+
-+ /* Restore arguments. */
-+ move.4 a5, (sp)4++
-+ move.4 d13, (sp)4++
-+ move.4 d12, (sp)4++
-+ move.4 d11, (sp)4++
-+ move.4 d10, (sp)4++
-+ move.4 d9, (sp)4++
-+ move.4 d8, (sp)4++
-+ move.4 d7, (sp)4++
-+ move.4 d6, (sp)4++
-+ move.4 d5, (sp)4++
-+ move.4 d4, (sp)4++
-+ move.4 d3, (sp)4++
-+ move.4 d2, (sp)4++
-+ move.4 d1, (sp)4++
-+ move.4 d0, (sp)4++
-+
-+ /* Now jump to the actual function. */
-+ /* a3 contains func_desc resolution */
-+ move.4 a4, 0(a3) ; address of function X
-+ move.4 a0, 4(a3) ; switch to GOT for function X
-+ calli a4, 0(a4) ; call through a4, a5 remains
-+
-+ .size _dl_linux_resolve, . - _dl_linux_resolve
-+
-+ .hidden _dl_ubicom32_resolve_pending
-+ .global _dl_ubicom32_resolve_pending
-+ .type _dl_ubicom32_resolve_pending,@function
-+
-+_dl_ubicom32_resolve_pending:
-+ /*
-+ * A special function that is used to ensure thread saftly when the fd
-+ * for a particular resolution is being updated.
-+ *
-+ * At entry, a3 must point to the FD. While the FD is being updated the
-+ * entry_point will continue to point to _dl_ubicom32_resolve_pending so
-+ * we will effectively spin until the resolver update is complete.
-+ */
-+
-+ move.4 a4, 0(a3) ; get entry_point
-+ move.4 a0, 4(a3) ; set new GOT
-+
-+ /*
-+ * jump to resovled function or back to _dl_ubicom32_resolve_pending.
-+ */
-+ calli a4, 0(a4)
-+ .size _dl_ubicom32_resolve_pending, . - _dl_ubicom32_resolve_pending
---- a/libc/misc/Makefile.in
-+++ b/libc/misc/Makefile.in
-@@ -12,7 +12,9 @@ include $(top_srcdir)libc/misc/assert/Ma
- include $(top_srcdir)libc/misc/ctype/Makefile.in
- include $(top_srcdir)libc/misc/dirent/Makefile.in
- include $(top_srcdir)libc/misc/error/Makefile.in
-+ifneq ($(ARCH_HAS_NO_LDSO),y)
- include $(top_srcdir)libc/misc/elf/Makefile.in
-+endif
- include $(top_srcdir)libc/misc/file/Makefile.in
- include $(top_srcdir)libc/misc/fnmatch/Makefile.in
- include $(top_srcdir)libc/misc/ftw/Makefile.in
---- a/libc/misc/elf/dl-iterate-phdr.c
-+++ b/libc/misc/elf/dl-iterate-phdr.c
-@@ -14,7 +14,7 @@
-
- #include <link.h>
- #include <ldso.h>
--
-+#include <memory.h>
- /* we want this in libc but nowhere else */
- #ifdef __USE_GNU
-
---- a/libc/stdlib/malloc/malloc.c
-+++ b/libc/stdlib/malloc/malloc.c
-@@ -23,7 +23,7 @@
-
- /* The malloc heap. We provide a bit of initial static space so that
- programs can do a little mallocing without mmaping in more space. */
--HEAP_DECLARE_STATIC_FREE_AREA (initial_fa, 256);
-+HEAP_DECLARE_STATIC_FREE_AREA (initial_fa, 32768);
- struct heap_free_area *__malloc_heap = HEAP_INIT_WITH_FA (initial_fa);
- #ifdef HEAP_USE_LOCKING
- malloc_mutex_t __malloc_heap_lock = PTHREAD_MUTEX_INITIALIZER;
---- /dev/null
-+++ b/libc/string/ubicom32/Makefile
-@@ -0,0 +1,13 @@
-+# Makefile for uClibc
-+#
-+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
-+#
-+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-+#
-+
-+top_srcdir:=../../../
-+top_builddir:=../../../
-+all: objs
-+include $(top_builddir)Rules.mak
-+include ../Makefile.in
-+include $(top_srcdir)Makerules
---- /dev/null
-+++ b/libc/string/ubicom32/memcpy.c
-@@ -0,0 +1,152 @@
-+/* Copy memory to memory until the specified number of bytes
-+ has been copied. Overlap is NOT handled correctly.
-+ Copyright (C) 1991, 1997, 2003 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Torbjorn Granlund (tege@sics.se).
-+
-+ 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, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <string.h>
-+
-+typedef unsigned long addr_t;
-+
-+libc_hidden_proto(memcpy)
-+
-+void *memcpy (void *dest, const void *src, size_t n)
-+{
-+ void *dest_ret = dest;
-+ void *aligned_start;
-+
-+ if (likely((((addr_t)dest ^ (addr_t)src) & 3) == 0) && likely(n > 6)) {
-+ size_t m;
-+ n -= (4 - (addr_t)dest) & 0x03;
-+ m = n >> 2;
-+ __asm__ volatile (
-+ " call %4, 99f \n\t" // load %4 with address of 99
-+ "99: movei d15, #%%lo(1f-99b) \n\t" // load d15 with offset to 1 from 99
-+ " add.4 %4, %4, d15 \n\t" // add difference
-+
-+ " sub.4 d15, #0, %2 \n\t" // set up for jump table
-+ " and.4 d15, #(32-1), d15 \n\t" // d15 = (-m) & (32 - 1)
-+ " lea.4 %4, (%4,d15) \n\t"
-+
-+ " bfextu d15, %0, #2 \n\t" // d15 = (dest & 3)
-+ " jmpne.w.f 100f \n\t"
-+ " calli %4, 0(%4) \n\t" // 4-byte alignment
-+
-+ "100: cmpi d15, #2 \n\t"
-+ " jmpne.s.f 101f \n\t"
-+ " move.2 (%0)2++, (%1)2++ \n\t"
-+ " calli %4, 0(%4) \n\t" // 2-byte alignment
-+
-+ "101: move.1 (%0)1++, (%1)1++ \n\t"
-+ " jmpgt.s.f 102f \n\t" // 3-byte alignment
-+ " move.2 (%0)2++, (%1)2++ \n\t" // 1-byte alignment
-+ "102: calli %4, 0(%4) \n\t"
-+
-+ "200: cmpi %3, #2 \n\t"
-+ " jmplt.s.f 201f \n\t"
-+ " move.2 (%0)2++, (%1)2++ \n\t"
-+ " jmpeq.s.t 2f \n\t"
-+ "201: move.1 (%0)1++, (%1)1++ \n\t"
-+ " jmpt.w.t 2f \n\t"
-+
-+ "1: .rept 25 \n\t"
-+ " movea (%0)4++, (%1)4++ \n\t"
-+ " .endr \n\t"
-+ " .rept 7 \n\t"
-+ " move.4 (%0)4++, (%1)4++ \n\t"
-+ " .endr \n\t"
-+ " add.4 %2, #-32, %2 \n\t"
-+ " jmpgt.w.f 1b \n\t"
-+
-+ " and.4 %3, #3, %3 \n\t" // check n
-+ " jmpne.w.f 200b \n\t"
-+ "2: \n\t"
-+ : "+a"(dest), "+a"(src), "+d"(m), "+d"(n), "=a"(aligned_start)
-+ :
-+ : "d15", "memory", "cc"
-+ );
-+
-+ return dest_ret;
-+ }
-+
-+ if (likely((((addr_t)dest ^ (addr_t)src) & 1) == 0) && likely(n > 2)) {
-+ size_t m;
-+ n -= (addr_t)dest & 0x01;
-+ m = n >> 1;
-+ __asm__ volatile (
-+ " call %4, 99f \n\t" // load %4 with address of 99
-+ "99: movei d15, #%%lo(1f-99b) \n\t" // load d15 with offset to 1 from 99
-+ " add.4 %4, %4, d15 \n\t" // add difference
-+
-+ " sub.4 d15, #0, %2 \n\t" // set up for jump table
-+ " and.4 d15, #(32-1), d15 \n\t" // d15 = (-m) & (32 - 1)
-+ " lea.4 %4, (%4,d15) \n\t"
-+
-+ " btst %0, #0 \n\t" // check bit 0
-+ " jmpne.w.f 100f \n\t"
-+ " calli %4, 0(%4) \n\t" // 4-byte alignment
-+
-+ "100: move.1 (%0)1++, (%1)1++ \n\t"
-+ " calli %4, 0(%4) \n\t"
-+
-+ "200: move.1 (%0)1++, (%1)1++ \n\t"
-+ " jmpt.w.t 2f \n\t"
-+
-+ "1: .rept 32 \n\t"
-+ " move.2 (%0)2++, (%1)2++ \n\t"
-+ " .endr \n\t"
-+ " add.4 %2, #-32, %2 \n\t"
-+ " jmpgt.w.f 1b \n\t"
-+
-+ " and.4 %3, #1, %3 \n\t" // check n
-+ " jmpne.w.f 200b \n\t"
-+ "2: \n\t"
-+
-+ : "+a"(dest), "+a"(src), "+d"(m), "+d"(n), "=a"(aligned_start)
-+ :
-+ : "d15", "memory", "cc"
-+ );
-+ return dest_ret;
-+ }
-+
-+ __asm__ volatile (
-+ " call %3, 99f \n\t" // load %3 with address of 99
-+ "99: movei d15, #%%lo(1f-99b) \n\t" // load d15 with offset to 1 from 99
-+ " add.4 %3, %3, d15 \n\t" // add difference
-+
-+ " sub.4 d15, #0, %2 \n\t"
-+ " jmpeq.w.f 2f \n\t"
-+ " and.4 d15, #(16-1), d15 \n\t" // d15 = (-n) & (16 - 1)
-+ " lea.4 %3, (%3,d15) \n\t"
-+ " calli %3, 0(%3) \n\t"
-+
-+ "1: .rept 16 \n\t"
-+ " move.1 (%0)1++, (%1)1++ \n\t"
-+ " .endr \n\t"
-+ " add.4 %2, #-16, %2 \n\t"
-+ " jmpgt.w.f 1b \n\t"
-+ "2: \n\t"
-+
-+ : "+a"(dest), "+a"(src), "+d"(n), "=a"(aligned_start)
-+ :
-+ : "d15", "memory", "cc"
-+ );
-+
-+ return dest_ret;
-+}
-+libc_hidden_def(memcpy)
---- /dev/null
-+++ b/libc/string/ubicom32/memset.c
-@@ -0,0 +1,107 @@
-+/* Copyright (C) 1991, 1997, 2003 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, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <string.h>
-+
-+typedef unsigned long addr_t;
-+
-+libc_hidden_proto(memset)
-+void *memset (void *s, int c, size_t n)
-+{
-+ void *s_ret = s;
-+ void *aligned_start;
-+ if (likely(n > 6)) {
-+ size_t m;
-+ n -= (4 - (addr_t)s) & 0x03;
-+ m = n >> 2;
-+ __asm__ volatile (
-+ " call %4, 99f \n\t" // load %4 with address of 99
-+ "99: movei d15, #%%lo(1f-99b) \n\t" // load d15 with offset to 1 from 99
-+ " add.4 %4, %4, d15 \n\t" // add difference
-+
-+ " sub.4 d15, #0, %2 \n\t" // set up for jump table
-+ " and.4 d15, #(32-1), d15 \n\t" // d15 = (-m) & (32 - 1)
-+ " shmrg.1 %1, %1, %1 \n\t"
-+ " shmrg.2 %1, %1, %1 \n\t" // %1 = (c<<24)|(c<<16)|(c<<8)|c
-+ " lea.4 %4, (%4,d15) \n\t"
-+
-+ " bfextu d15, %0, #2 \n\t" // d15 = (s & 3)
-+ " jmpne.w.f 100f \n\t"
-+ " calli %4, 0(%4) \n\t" // 4-byte alignment
-+
-+ "100: cmpi d15, #2 \n\t"
-+ " jmpne.s.f 101f \n\t"
-+ " move.2 (%0)2++, %1 \n\t"
-+ " calli %4, 0(%4) \n\t" // 2-byte alignment
-+
-+ "101: move.1 (%0)1++, %1 \n\t"
-+ " jmpgt.s.f 102f \n\t" // 3-byte alignment
-+ " move.2 (%0)2++, %1 \n\t" // 1-byte alignment
-+ "102: calli %4, 0(%4) \n\t"
-+
-+ "200: cmpi %3, #2 \n\t"
-+ " jmplt.s.f 201f \n\t"
-+ " move.2 (%0)2++, %1 \n\t"
-+ " jmpeq.s.t 2f \n\t"
-+ "201: move.1 (%0)1++, %1 \n\t"
-+ " jmpt.w.t 2f \n\t"
-+
-+ "1: .rept 25 \n\t"
-+ " movea (%0)4++, %1 \n\t"
-+ " .endr \n\t"
-+ " .rept 7 \n\t"
-+ " move.4 (%0)4++, %1 \n\t"
-+ " .endr \n\t"
-+ " add.4 %2, #-32, %2 \n\t"
-+ " jmpgt.w.f 1b \n\t"
-+
-+ " and.4 %3, #3, %3 \n\t" // test bit 1 of n
-+ " jmpne.w.f 200b \n\t"
-+ "2: \n\t"
-+ : "+a"(s), "+d"(c), "+d"(m), "+d"(n), "=a"(aligned_start)
-+ :
-+ : "d15", "memory", "cc"
-+ );
-+
-+ return s_ret;
-+ }
-+
-+ __asm__ volatile (
-+ " call %3, 99f \n\t" // load %3 with address of 99
-+ "99: movei d15, #%%lo(1f-99b) \n\t" // load d15 with offset to 1 from 99
-+ " add.4 %3, %3, d15 \n\t" // add difference
-+
-+ " sub.4 d15, #0, %2 \n\t"
-+ " jmpeq.w.f 2f \n\t"
-+ " and.4 d15, #(8-1), d15 \n\t" // d15 = (-%2) & (16 - 1)
-+ " lea.4 %3, (%3,d15) \n\t"
-+ " calli %3, 0(%3) \n\t"
-+
-+ "1: .rept 8 \n\t"
-+ " move.1 (%0)1++, %1 \n\t"
-+ " .endr \n\t"
-+ "2: \n\t"
-+
-+ : "+a"(s), "+d"(c), "+d"(n), "=a"(aligned_start)
-+ :
-+ : "d15", "memory", "cc"
-+ );
-+
-+ return s_ret;
-+}
-+libc_hidden_def(memset)
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/Makefile
-@@ -0,0 +1,13 @@
-+# Makefile for uClibc
-+#
-+# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
-+#
-+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-+#
-+
-+top_srcdir=../../../../
-+top_builddir=../../../../
-+all: objs
-+include $(top_builddir)Rules.mak
-+include Makefile.arch
-+include $(top_srcdir)Makerules
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/Makefile.arch
-@@ -0,0 +1,28 @@
-+# Makefile for uClibc
-+#
-+# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
-+#
-+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-+#
-+
-+#CSRC := \
-+# brk.c \
-+# crtbegin.c \
-+# crtend.c
-+#
-+#SSRC := \
-+# __longjmp.S \
-+# bsd-_setjmp.S \
-+# bsd-setjmp.S \
-+# setjmp.S \
-+# clone.S \
-+# vfork.S
-+
-+CSRC := \
-+ syscall.c __syscall_error.c
-+
-+SSRC := \
-+ clone.S setjmp.S vfork.S
-+
-+ARCH_CFLAGS := $(CPU_CFLAGS-y)
-+include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/__syscall_error.c
-@@ -0,0 +1,11 @@
-+#include <errno.h>
-+#include <features.h>
-+
-+/* This routine is jumped to by some of the syscall handlers, to stash
-+ * an error number into errno. */
-+int __syscall_error(int err_no) attribute_hidden;
-+int __syscall_error(int err_no)
-+{
-+ __set_errno(err_no);
-+ return -1;
-+}
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/bits/elf-fdpic.h
-@@ -0,0 +1,115 @@
-+/* Copyright 2003, 2004 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.
-+
-+In addition to the permissions in the GNU Lesser General Public
-+License, the Free Software Foundation gives you unlimited
-+permission to link the compiled version of this file with other
-+programs, and to distribute those programs without any restriction
-+coming from the use of this file. (The GNU Lesser General Public
-+License restrictions do apply in other respects; for example, they
-+cover modification of the file, and distribution when not linked
-+into another program.)
-+
-+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
-+Library 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; see the file COPYING.LIB. If
-+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-+Cambridge, MA 02139, USA. */
-+
-+#ifndef _BITS_ELF_FDPIC_H
-+#define _BITS_ELF_FDPIC_H
-+
-+/* These data structures are described in the FDPIC ABI extension.
-+ The kernel passes a process a memory map, such that for every LOAD
-+ segment there is an elf32_fdpic_loadseg entry. A pointer to an
-+ elf32_fdpic_loadmap is passed in d8 at start-up, and a pointer to
-+ an additional such map is passed in d9 for the interpreter, when
-+ there is one. */
-+
-+#include <elf.h>
-+
-+/* This data structure represents a PT_LOAD segment. */
-+struct elf32_fdpic_loadseg
-+{
-+ /* Core address to which the segment is mapped. */
-+ Elf32_Addr addr;
-+ /* VMA recorded in the program header. */
-+ Elf32_Addr p_vaddr;
-+ /* Size of this segment in memory. */
-+ Elf32_Word p_memsz;
-+};
-+
-+struct elf32_fdpic_loadmap {
-+ /* Protocol version number, must be zero. */
-+ Elf32_Half version;
-+ /* Number of segments in this map. */
-+ Elf32_Half nsegs;
-+ /* The actual memory map. */
-+ struct elf32_fdpic_loadseg segs[/*nsegs*/];
-+};
-+
-+struct elf32_fdpic_loadaddr {
-+ struct elf32_fdpic_loadmap *map;
-+ void *got_value;
-+};
-+
-+/* Map a pointer's VMA to its corresponding address according to the
-+ load map. */
-+static __always_inline void *
-+__reloc_pointer (void *p,
-+ const struct elf32_fdpic_loadmap *map)
-+{
-+ int c;
-+
-+#if 0
-+ if (map->version != 0)
-+ /* Crash. */
-+ ((void(*)())0)();
-+#endif
-+
-+ /* No special provision is made for NULL. We don't want NULL
-+ addresses to go through relocation, so they shouldn't be in
-+ .rofixup sections, and, if they're present in dynamic
-+ relocations, they shall be mapped to the NULL address without
-+ undergoing relocations. */
-+
-+ for (c = 0;
-+ /* Take advantage of the fact that the loadmap is ordered by
-+ virtual addresses. In general there will only be 2 entries,
-+ so it's not profitable to do a binary search. */
-+ c < map->nsegs && p >= (void*)map->segs[c].p_vaddr;
-+ c++)
-+ {
-+ /* This should be computed as part of the pointer comparison
-+ above, but we want to use the carry in the comparison, so we
-+ can't convert it to an integer type beforehand. */
-+ unsigned long offset = p - (void*)map->segs[c].p_vaddr;
-+ /* We only check for one-past-the-end for the last segment,
-+ assumed to be the data segment, because other cases are
-+ ambiguous in the absence of padding between segments, and
-+ rofixup already serves as padding between text and data.
-+ Unfortunately, unless we special-case the last segment, we
-+ fail to relocate the _end symbol. */
-+ if (offset < map->segs[c].p_memsz
-+ || (offset == map->segs[c].p_memsz && c + 1 == map->nsegs))
-+ return (char*)map->segs[c].addr + offset;
-+ }
-+
-+ /* We might want to crash instead. */
-+ return (void*)-1;
-+}
-+
-+# define __RELOC_POINTER(ptr, loadaddr) \
-+ (__reloc_pointer ((void*)(ptr), \
-+ (loadaddr).map))
-+
-+#endif /* _BITS_ELF_FDPIC_H */
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/bits/endian.h
-@@ -0,0 +1,7 @@
-+/* Ubicom32 is big-endian. */
-+
-+#ifndef _ENDIAN_H
-+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
-+#endif
-+
-+#define __BYTE_ORDER __BIG_ENDIAN
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/bits/fcntl.h
-@@ -0,0 +1,226 @@
-+/* O_*, F_*, FD_* bit values for Linux.
-+ Copyright (C) 2000 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, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#ifndef _FCNTL_H
-+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
-+#endif
-+
-+
-+#include <sys/types.h>
-+#ifdef __USE_GNU
-+# include <bits/uio.h>
-+#endif
-+
-+/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
-+ located on an ext2 file system */
-+#define O_ACCMODE 0003
-+#define O_RDONLY 00
-+#define O_WRONLY 01
-+#define O_RDWR 02
-+#define O_CREAT 0100 /* not fcntl */
-+#define O_EXCL 0200 /* not fcntl */
-+#define O_NOCTTY 0400 /* not fcntl */
-+#define O_TRUNC 01000 /* not fcntl */
-+#define O_APPEND 02000
-+#define O_NONBLOCK 04000
-+#define O_NDELAY O_NONBLOCK
-+#define O_SYNC 010000
-+#define O_FSYNC O_SYNC
-+#define O_ASYNC 020000
-+
-+#ifdef __USE_GNU
-+# define O_DIRECTORY 040000 /* Must be a directory. */
-+# define O_NOFOLLOW 0100000 /* Do not follow links. */
-+# define O_DIRECT 0200000 /* Direct disk access. */
-+# define O_NOATIME 01000000 /* Do not set atime. */
-+# define O_CLOEXEC 02000000 /* set close_on_exec */
-+# define O_STREAMING 04000000 /* streaming access */
-+#endif
-+
-+/* For now Linux has synchronisity options for data and read operations.
-+ We define the symbols here but let them do the same as O_SYNC since
-+ this is a superset. */
-+#if defined __USE_POSIX199309 || defined __USE_UNIX98
-+# define O_DSYNC O_SYNC /* Synchronize data. */
-+# define O_RSYNC O_SYNC /* Synchronize read operations. */
-+#endif
-+
-+#ifdef __USE_LARGEFILE64
-+# define O_LARGEFILE 0400000
-+#endif
-+
-+/* Values for the second argument to `fcntl'. */
-+#define F_DUPFD 0 /* Duplicate file descriptor. */
-+#define F_GETFD 1 /* Get file descriptor flags. */
-+#define F_SETFD 2 /* Set file descriptor flags. */
-+#define F_GETFL 3 /* Get file status flags. */
-+#define F_SETFL 4 /* Set file status flags. */
-+#ifndef __USE_FILE_OFFSET64
-+# define F_GETLK 5 /* Get record locking info. */
-+# define F_SETLK 6 /* Set record locking info (non-blocking). */
-+# define F_SETLKW 7 /* Set record locking info (blocking). */
-+#else
-+# define F_GETLK F_GETLK64 /* Get record locking info. */
-+# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/
-+# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */
-+#endif
-+#define F_GETLK64 12 /* Get record locking info. */
-+#define F_SETLK64 13 /* Set record locking info (non-blocking). */
-+#define F_SETLKW64 14 /* Set record locking info (blocking). */
-+
-+#if defined __USE_BSD || defined __USE_XOPEN2K
-+# define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */
-+# define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */
-+#endif
-+
-+#ifdef __USE_GNU
-+# define F_SETSIG 10 /* Set number of signal to be sent. */
-+# define F_GETSIG 11 /* Get number of signal to be sent. */
-+#endif
-+
-+#ifdef __USE_GNU
-+# define F_SETLEASE 1024 /* Set a lease. */
-+# define F_GETLEASE 1025 /* Enquire what lease is active. */
-+# define F_NOTIFY 1026 /* Request notfications on a directory. */
-+#endif
-+
-+/* For F_[GET|SET]FL. */
-+#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
-+
-+/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
-+#define F_RDLCK 0 /* Read lock. */
-+#define F_WRLCK 1 /* Write lock. */
-+#define F_UNLCK 2 /* Remove lock. */
-+
-+/* For old implementation of bsd flock(). */
-+#define F_EXLCK 4 /* or 3 */
-+#define F_SHLCK 8 /* or 4 */
-+
-+#ifdef __USE_BSD
-+/* Operations for bsd flock(), also used by the kernel implementation. */
-+# define LOCK_SH 1 /* shared lock */
-+# define LOCK_EX 2 /* exclusive lock */
-+# define LOCK_NB 4 /* or'd with one of the above to prevent
-+ blocking */
-+# define LOCK_UN 8 /* remove lock */
-+#endif
-+
-+#ifdef __USE_GNU
-+# define LOCK_MAND 32 /* This is a mandatory flock: */
-+# define LOCK_READ 64 /* ... which allows concurrent read operations. */
-+# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */
-+# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */
-+#endif
-+
-+#ifdef __USE_GNU
-+/* Types of directory notifications that may be requested with F_NOTIFY. */
-+# define DN_ACCESS 0x00000001 /* File accessed. */
-+# define DN_MODIFY 0x00000002 /* File modified. */
-+# define DN_CREATE 0x00000004 /* File created. */
-+# define DN_DELETE 0x00000008 /* File removed. */
-+# define DN_RENAME 0x00000010 /* File renamed. */
-+# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
-+# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
-+#endif
-+
-+struct flock
-+ {
-+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
-+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
-+#ifndef __USE_FILE_OFFSET64
-+ __off_t l_start; /* Offset where the lock begins. */
-+ __off_t l_len; /* Size of the locked area; zero means until EOF. */
-+#else
-+ __off64_t l_start; /* Offset where the lock begins. */
-+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
-+#endif
-+ __pid_t l_pid; /* Process holding the lock. */
-+ };
-+
-+#ifdef __USE_LARGEFILE64
-+struct flock64
-+ {
-+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
-+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
-+ __off64_t l_start; /* Offset where the lock begins. */
-+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
-+ __pid_t l_pid; /* Process holding the lock. */
-+ };
-+#endif
-+
-+/* Define some more compatibility macros to be backward compatible with
-+ BSD systems which did not managed to hide these kernel macros. */
-+#ifdef __USE_BSD
-+# define FAPPEND O_APPEND
-+# define FFSYNC O_FSYNC
-+# define FASYNC O_ASYNC
-+# define FNONBLOCK O_NONBLOCK
-+# define FNDELAY O_NDELAY
-+#endif /* Use BSD. */
-+
-+/* Advise to `posix_fadvise'. */
-+#ifdef __USE_XOPEN2K
-+# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
-+# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
-+# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
-+# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
-+# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
-+# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
-+#endif
-+
-+#ifdef __USE_GNU
-+# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
-+ in the range before performing the
-+ write. */
-+# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those
-+ dirty pages in the range which are
-+ not presently under writeback. */
-+# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
-+ the range after performing the
-+ write. */
-+#endif
-+
-+__BEGIN_DECLS
-+
-+#ifdef __USE_GNU
-+
-+/* Provide kernel hint to read ahead. */
-+extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
-+ __THROW;
-+
-+/* Selective file content synch'ing. */
-+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
-+ unsigned int __flags);
-+
-+/* Splice address range into a pipe. */
-+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
-+ size_t __count, unsigned int __flags);
-+
-+/* Splice two files together. */
-+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
-+ __off64_t *__offout, size_t __len,
-+ unsigned int __flags);
-+
-+/* In-kernel implementation of tee for pipe buffers. */
-+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
-+ unsigned int __flags);
-+
-+#endif
-+
-+__END_DECLS
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/bits/kernel_stat.h
-@@ -0,0 +1,55 @@
-+#ifndef _BITS_STAT_STRUCT_H
-+#define _BITS_STAT_STRUCT_H
-+
-+#ifndef _LIBC
-+#error bits/kernel_stat.h is for internal uClibc use only!
-+#endif
-+
-+/* This file provides whatever this particular arch's kernel thinks
-+ * struct kernel_stat should look like... It turns out each arch has a
-+ * different opinion on the subject... */
-+
-+struct kernel_stat {
-+ unsigned short st_dev;
-+ unsigned short __pad1;
-+ unsigned long st_ino;
-+ unsigned short st_mode;
-+ unsigned short st_nlink;
-+ unsigned short st_uid;
-+ unsigned short st_gid;
-+ unsigned short st_rdev;
-+ unsigned short __pad2;
-+ unsigned long st_size;
-+ unsigned long st_blksize;
-+ unsigned long st_blocks;
-+ struct timespec st_atim;
-+ struct timespec st_mtim;
-+ struct timespec st_ctim;
-+ unsigned long __unused4;
-+ unsigned long __unused5;
-+};
-+
-+struct kernel_stat64 {
-+ unsigned char __pad0[6];
-+ unsigned short st_dev;
-+ unsigned char __pad1[4];
-+#define _HAVE_STAT64___ST_INO
-+ unsigned long __st_ino;
-+ unsigned int st_mode;
-+ unsigned int st_nlink;
-+ unsigned long st_uid;
-+ unsigned long st_gid;
-+ unsigned char __pad2[6];
-+ unsigned short st_rdev;
-+ unsigned char __pad3[4];
-+ long long st_size;
-+ unsigned long st_blksize;
-+ unsigned long st_blocks; /* Number 512-byte blocks allocated. */
-+ unsigned long __pad4; /* future possible st_blocks high bits */
-+ struct timespec st_atim;
-+ struct timespec st_mtim;
-+ struct timespec st_ctim;
-+ unsigned long long st_ino;
-+};
-+
-+#endif /* _BITS_STAT_STRUCT_H */
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/bits/kernel_types.h
-@@ -0,0 +1,44 @@
-+/* Note that we use the exact same include guard #define names
-+ * as asm/posix_types.h. This will avoid gratuitous conflicts
-+ * with the posix_types.h kernel header, and will ensure that
-+ * our private content, and not the kernel header, will win.
-+ * -Erik
-+ */
-+#ifndef __ARCH_UBICOM32_POSIX_TYPES_H
-+#define __ARCH_UBICOM32_POSIX_TYPES_H
-+
-+typedef unsigned long __kernel_dev_t;
-+typedef unsigned long __kernel_ino_t;
-+typedef unsigned short __kernel_mode_t;
-+typedef unsigned short __kernel_nlink_t;
-+typedef long __kernel_off_t;
-+typedef int __kernel_pid_t;
-+typedef unsigned short __kernel_ipc_pid_t;
-+typedef unsigned short __kernel_uid_t;
-+typedef unsigned short __kernel_gid_t;
-+typedef unsigned int __kernel_size_t;
-+typedef int __kernel_ssize_t;
-+typedef int __kernel_ptrdiff_t;
-+typedef long __kernel_time_t;
-+typedef long __kernel_suseconds_t;
-+typedef long __kernel_clock_t;
-+typedef int __kernel_daddr_t;
-+typedef char * __kernel_caddr_t;
-+typedef unsigned short __kernel_uid16_t;
-+typedef unsigned short __kernel_gid16_t;
-+typedef unsigned int __kernel_uid32_t;
-+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 long __kernel_loff_t;
-+
-+typedef struct {
-+#ifdef __USE_ALL
-+ int val[2];
-+#else
-+ int __val[2];
-+#endif
-+} __kernel_fsid_t;
-+
-+#endif /* __ARCH_UBICOM32_POSIX_TYPES_H */
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/bits/mman.h
-@@ -0,0 +1,103 @@
-+/* Definitions for POSIX memory map interface. Linux/m68k version.
-+ Copyright (C) 1997, 2000, 2003, 2005 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, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#ifndef _SYS_MMAN_H
-+# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
-+#endif
-+
-+/* The following definitions basically come from the kernel headers.
-+ But the kernel header is not namespace clean. */
-+
-+
-+/* Protections are chosen from these bits, OR'd together. The
-+ implementation does not necessarily support PROT_EXEC or PROT_WRITE
-+ without PROT_READ. The only guarantees are that no writing will be
-+ allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
-+
-+#define PROT_READ 0x1 /* Page can be read. */
-+#define PROT_WRITE 0x2 /* Page can be written. */
-+#define PROT_EXEC 0x4 /* Page can be executed. */
-+#define PROT_NONE 0x0 /* Page can not be accessed. */
-+#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of
-+ growsdown vma (mprotect only). */
-+#define PROT_GROWSUP 0x02000000 /* Extend change to start of
-+ growsup vma (mprotect only). */
-+
-+/* Sharing types (must choose one and only one of these). */
-+#define MAP_SHARED 0x01 /* Share changes. */
-+#define MAP_PRIVATE 0x02 /* Changes are private. */
-+#ifdef __USE_MISC
-+# define MAP_TYPE 0x0f /* Mask for type of mapping. */
-+#endif
-+
-+/* Other flags. */
-+#define MAP_FIXED 0x10 /* Interpret addr exactly. */
-+#ifdef __USE_MISC
-+# define MAP_FILE 0
-+# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
-+# define MAP_ANON MAP_ANONYMOUS
-+#endif
-+
-+/* These are Linux-specific. */
-+#ifdef __USE_MISC
-+# define MAP_GROWSDOWN 0x0000100 /* Stack-like segment. */
-+# define MAP_DENYWRITE 0x0000800 /* ETXTBSY */
-+# define MAP_EXECUTABLE 0x0001000 /* Mark it as an executable. */
-+# define MAP_LOCKED 0x0002000 /* Lock the mapping. */
-+# define MAP_NORESERVE 0x0004000 /* Don't check for reservations. */
-+# define MAP_POPULATE 0x0008000 /* Populate (prefault) pagetables. */
-+# define MAP_NONBLOCK 0x0010000 /* Do not block on IO. */
-+# define MAP_UNINITIALIZE 0x4000000 /* For anonymous mmap, memory could be uninitialized. */
-+#endif
-+
-+/* Flags to `msync'. */
-+#define MS_ASYNC 1 /* Sync memory asynchronously. */
-+#define MS_SYNC 4 /* Synchronous memory sync. */
-+#define MS_INVALIDATE 2 /* Invalidate the caches. */
-+
-+/* Flags for `mlockall'. */
-+#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
-+#define MCL_FUTURE 2 /* Lock all additions to address
-+ space. */
-+
-+/* Flags for `mremap'. */
-+#ifdef __USE_GNU
-+# define MREMAP_MAYMOVE 1
-+# define MREMAP_FIXED 2
-+#endif
-+
-+/* Advice to `madvise'. */
-+#ifdef __USE_BSD
-+# define MADV_NORMAL 0 /* No further special treatment. */
-+# define MADV_RANDOM 1 /* Expect random page references. */
-+# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
-+# define MADV_WILLNEED 3 /* Will need these pages. */
-+# define MADV_DONTNEED 4 /* Don't need these pages. */
-+# define MADV_DONTFORK 10 /* Do not inherit across fork. */
-+# define MADV_DOFORK 11 /* Do inherit across fork. */
-+#endif
-+
-+/* The POSIX people had to invent similar names for the same things. */
-+#ifdef __USE_XOPEN2K
-+# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
-+# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
-+# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
-+# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
-+# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
-+#endif
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/bits/setjmp.h
-@@ -0,0 +1,52 @@
-+/* Define the machine-dependent type `jmp_buf'. Ubicom32 version.
-+ Copyright (C) 1992,93,95,97,2000 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, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#ifndef _BITS_SETJMP_H
-+#define _BITS_SETJMP_H 1
-+
-+#if !defined _SETJMP_H && !defined _PTHREAD_H
-+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
-+#endif
-+
-+#ifndef _ASM
-+/*
-+ * This is the structure where we are going to save D10-D13, A0, A1, A2, A5, A6 and SP(A7).
-+ * A5 is the return address. Call to setjmp will save these. Call to longjmp will return
-+ * Control to the address in A5.
-+ */
-+typedef struct setjmp_save_struct {
-+ unsigned long d10; /* D10 */
-+ unsigned long d11; /* D11 */
-+ unsigned long d12; /* D12 */
-+ unsigned long d13; /* D13 */
-+ unsigned long a1; /* A1 */
-+ unsigned long a2; /* A2 */
-+ unsigned long a5; /* A5 return address. */
-+ unsigned long a6; /* A6 */
-+ unsigned long sp; /* A7 stack pointer. */
-+} __jmp_buf[1];
-+
-+#endif
-+
-+/* Test if longjmp to JMPBUF would unwind the frame
-+ containing a local variable at ADDRESS. */
-+#define _JMPBUF_UNWINDS(jmpbuf, address) \
-+ ((void *) (address) < (void*)(jmpbuf)->sp)
-+
-+#endif /* bits/setjmp.h */
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/bits/stackinfo.h
-@@ -0,0 +1,28 @@
-+/* Copyright (C) 1999 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, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+/* This file contains a bit of information about the stack allocation
-+ of the processor. */
-+
-+#ifndef _STACKINFO_H
-+#define _STACKINFO_H 1
-+
-+/* On Ubicom32 the stack grows down. */
-+#define _STACK_GROWS_DOWN 1
-+
-+#endif /* stackinfo.h */
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/bits/syscalls.h
-@@ -0,0 +1,81 @@
-+#ifndef _BITS_SYSCALLS_H
-+#define _BITS_SYSCALLS_H
-+#ifndef _SYSCALL_H
-+# error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead."
-+#endif
-+
-+/* m68k headers does stupid stuff with __NR_iopl / __NR_vm86:
-+ * #define __NR_iopl not supported
-+ * #define __NR_vm86 not supported
-+ */
-+#undef __NR_iopl
-+#undef __NR_vm86
-+
-+#ifndef __ASSEMBLER__
-+
-+#include <errno.h>
-+
-+/* Linux takes system call arguments in registers:
-+
-+ syscall number %d8
-+ arg 1 %d0
-+ arg 2 %d1
-+ arg 3 %d2
-+ arg 4 %d3
-+ arg 5 %d4
-+ arg 6 %d5
-+*/
-+
-+#define __loadargs_0(name, dummy) \
-+ d8 = (long int)name
-+
-+#define __loadargs_1(name, __arg1) \
-+ __loadargs_0(name, 0); \
-+ d0_retval = (long int) __arg1
-+
-+#define __loadargs_2(name, __arg1, __arg2) \
-+ __loadargs_1(name, __arg1); \
-+ d1 = (long int) __arg2
-+
-+#define __loadargs_3(name, __arg1, __arg2, __arg3) \
-+ __loadargs_2(name, __arg1, __arg2); \
-+ d2 = (long int) __arg3
-+
-+#define __loadargs_4(name, __arg1, __arg2, __arg3, __arg4) \
-+ __loadargs_3(name, __arg1, __arg2, __arg3); \
-+ d3 = (long int)__arg4
-+
-+#define __loadargs_5(name, __arg1, __arg2, __arg3, __arg4, __arg5) \
-+ __loadargs_4(name, __arg1, __arg2, __arg3, __arg4); \
-+ d4 = (long int)__arg5
-+
-+#define __loadargs_6(name, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6) \
-+ __loadargs_5(name, __arg1, __arg2, __arg3, __arg4, __arg5); \
-+ d5 = (long int)__arg6
-+
-+#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
-+({ \
-+ register long int d0_retval __asm__ ("d0"); \
-+ register long int d1 __asm__ ("d1"); \
-+ register long int d2 __asm__ ("d2"); \
-+ register long int d3 __asm__ ("d3"); \
-+ register long int d4 __asm__ ("d4"); \
-+ register long int d5 __asm__ ("d5"); \
-+ register long int d8 __asm__ ("d8"); \
-+ __loadargs_##nr (name, args); \
-+ __asm__ __volatile__ ( \
-+ " moveai a5, #%%hi(0x40400000)\n\t" \
-+ " calli a5, 16(a5)\n\t" \
-+ : "+r" (d0_retval), "+r" (d1), "+r" (d2), "+r" (d3), \
-+ "+r" (d4), "+r" (d5), "+r" (d8) : \
-+ : "cc", "memory", \
-+ "acc0_lo", "acc0_hi", "acc1_lo", "acc1_hi", \
-+ "source3", \
-+ "a0", "a3", "a4", "a5", \
-+ "d6", "d7", "d9", "d14", "d15" \
-+ ); \
-+ d0_retval; \
-+})
-+
-+#endif /* __ASSEMBLER__ */
-+#endif /* _BITS_SYSCALLS_H */
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/bits/uClibc_arch_features.h
-@@ -0,0 +1,45 @@
-+/*
-+ * Track misc arch-specific features that aren't config options
-+ */
-+
-+#ifndef _BITS_UCLIBC_ARCH_FEATURES_H
-+#define _BITS_UCLIBC_ARCH_FEATURES_H
-+
-+/* instruction used when calling abort() to kill yourself */
-+/*#define __UCLIBC_ABORT_INSTRUCTION__ "asm instruction"*/
-+#undef __UCLIBC_ABORT_INSTRUCTION__
-+
-+/* can your target use syscall6() for mmap ? */
-+#undef __UCLIBC_MMAP_HAS_6_ARGS__
-+
-+/* does your target use syscall4() for truncate64 ? (32bit arches only) */
-+#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__
-+
-+/* does your target have a broken create_module() ? */
-+#undef __UCLIBC_BROKEN_CREATE_MODULE__
-+
-+/* does your target have to worry about older [gs]etrlimit() ? */
-+#undef __UCLIBC_HANDLE_OLDER_RLIMIT__
-+
-+/* does your target prefix all symbols with an _ ? */
-+#define __UCLIBC_NO_UNDERSCORES__
-+
-+/* does your target have an asm .set ? */
-+#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
-+
-+/* define if target doesn't like .global */
-+#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__
-+
-+/* define if target supports .weak */
-+#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__
-+
-+/* define if target supports .weakext */
-+#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__
-+
-+/* needed probably only for ppc64 */
-+#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__
-+
-+/* define if target supports IEEE signed zero floats */
-+#define __UCLIBC_HAVE_SIGNED_ZERO__
-+
-+#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/bits/wordsize.h
-@@ -0,0 +1,19 @@
-+/* Copyright (C) 1999 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, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#define __WORDSIZE 32
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/clone.S
-@@ -0,0 +1,71 @@
-+#include <sys/syscall.h>
-+
-+ .global __syscall_error
-+
-+/* int _clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
-+ .text
-+ .type clone,@function
-+ .global clone
-+clone:
-+ /* Sanity check arguments. */
-+ sub.4 #0, #0, d0 /* Test if fn is zero. */
-+ jmpeq.f 1f /* arg bad */
-+ sub.4 #0, #0, d1 /* Test if child_stack is zero. */
-+ jmpeq.f 1f /* arg bad */
-+
-+ /* Set up child_stack frame.. arg and fn */
-+ move.4 a3, d1
-+ move.4 -4(a3)++, d3 /* push 'arg' to child stack */
-+ move.4 -4(a3)++, d0 /* push fn to child stack, this will become a5
-+ * on new child */
-+ move.4 d1, a3
-+ move.4 -4(sp)++, a5 /* push a5 to our stack */
-+
-+ /*
-+ * The syscall clone is clone(int flags, void *child_stack) so we set
-+ * that up now
-+ */
-+ move.4 d0, d2 /* Move flags to d0 */
-+
-+ /* Do Clone syscall */
-+ movei d8, #__NR_clone
-+ moveai a5, #%hi(0x40400000)
-+ calli a5, 0x10(a5)
-+ move.4 a5, (sp)4++ /* pop a5 from stack */
-+
-+ /* Clone Complete */
-+ cmpi d0, #0 /* Test if d0 is less than zero. If it is we
-+ * return the error */
-+ jmplt.f 2f /* If return is less than we had an error */
-+ jmpeq.f 3f /* If return is 0 we are in the clone, jump to
-+ * thread start */
-+ ret a5 /* d0 is pid */
-+
-+ /* Invalid Value */
-+1: movei d0, #-22 /* EINVAL */
-+
-+ /* Call syscall Error */
-+2: sub.4 d0, #0, d0 /* d0 = -d0 */
-+#if defined(__UBICOM32_FDPIC__)
-+ call a3, __syscall_error
-+#else
-+ moveai a3, #%hi(__syscall_error)
-+ calli a3, %lo(__syscall_error)(a3)
-+#endif
-+ /* Child Thread Start */
-+3:
-+#if defined(__UBICOM32_FDPIC__)
-+ /* a5 actually contains a function descriptor for fdpic */
-+ move.4 a0, 4(a5) /* set GOT for this function */
-+ move.4 a5, 0(a5) /* get address of entry point */
-+#endif
-+ move.4 d0, (sp)4++ /* pop 'arg' to stack */
-+ calli a5, 0(a5)
-+ movei d8, #__NR_exit
-+ moveai a3, #%hi(0x40400000)
-+ calli a3, 0x10(a3)
-+
-+ .size clone, . - clone
-+ .global __GI_clone
-+ .hidden __GI_clone
-+ .set __GI_clone,clone
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/crt1.S
-@@ -0,0 +1,179 @@
-+/* Startup code compliant to the ELF m68k ABI.
-+ Copyright (C) 1996, 1997, 1998, 2001, 2002 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.
-+
-+ In addition to the permissions in the GNU Lesser General Public
-+ License, the Free Software Foundation gives you unlimited
-+ permission to link the compiled version of this file with other
-+ programs, and to distribute those programs without any restriction
-+ coming from the use of this file. (The GNU Lesser General Public
-+ License restrictions do apply in other respects; for example, they
-+ cover modification of the file, and distribution when not linked
-+ into another program.)
-+
-+ Note that people who make modified versions of this file are not
-+ obligated to grant this special exception for their modified
-+ versions; it is their choice whether to do so. The GNU Lesser
-+ General Public License gives permission to release a modified
-+ version without this exception; this exception also makes it
-+ possible to release a modified version which carries forward this
-+ exception.
-+
-+ 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, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <features.h>
-+
-+/* This is the canonical entry point, usually the first thing in the text
-+ segment. The SVR4/m68k ABI says that when the entry point runs,
-+ most registers' values are unspecified, except for:
-+
-+ %a1 Contains a function pointer to be registered with `atexit'.
-+ This is how the dynamic linker arranges to have DT_FINI
-+ functions called for shared libraries that have been loaded
-+ before this code runs.
-+
-+ %sp The stack contains the arguments and environment:
-+ 0(%sp) argc
-+ 4(%sp) argv[0]
-+ ...
-+ (4*argc)(%sp) NULL
-+ (4*(argc+1))(%sp) envp[0]
-+ ...
-+ NULL
-+
-+ The uclinux conventions are different. %a1 is not defined on entry
-+ and the stack is laid out as follows:
-+
-+ 0(%sp) argc
-+ 4(%sp) argv
-+ 8(%sp) envp
-+*/
-+
-+
-+ .text
-+ .type main,@function
-+ .type _init,%function
-+ .type _fini,%function
-+#ifndef __UCLIBC_CTOR_DTOR__
-+ .weak _init
-+ .weak _fini
-+#endif
-+ .globl _start
-+ .global __uClibc_main;
-+ .type __uClibc_main,@function;
-+ .type _start,@function
-+_start:
-+
-+#if defined(__UBICOM32_FDPIC__) && !defined(L_Scrt1)
-+ /* P0 contains a pointer to the program's load map. */
-+ call a3, .Lcall;
-+.Lcall:
-+ move.4 d0, d1 ; load exec_map_addr
-+ moveai a4, #%hi(.Lcall)
-+ lea.1 d15, %lo(.Lcall)(a4)
-+ sub.4 d15, a3, d15 ; difference between .Lcall and actual address of .Lcall
-+ moveai a3, #%hi(__ROFIXUP_LIST__)
-+ lea.1 d1, %lo(__ROFIXUP_LIST__)(a3)
-+ moveai a3, #%hi(__ROFIXUP_END__)
-+ lea.1 d2, %lo(__ROFIXUP_END__)(a3)
-+ add.4 d1, d1, d15
-+ add.4 d2, d2, d15
-+ call a5, __self_reloc ; returns GOT in d0
-+ move.4 a0, d0 ; set GOT
-+#endif
-+
-+/*
-+ all this is setup to make the following call.
-+
-+ void __uClibc_main(
-+ d0 - int (*main)(int, char **, char **),
-+ d1 - int argc, (d1)
-+ d2 - char **argv,
-+ d3 - void (*app_init)(void),
-+ d4 - void (*app_fini)(void),
-+ d5 - void (*rtld_fini)(void),
-+ d6 - void *stack_end
-+ );
-+ */
-+
-+ /*
-+ * Load pointer to main into d0
-+ */
-+#ifdef __UBICOM32_FDPIC__
-+ movei d0, #%got_funcdesc_lo(main)
-+ move.4 d0, (a0, d0)
-+#else
-+ moveai a3, #%hi(main)
-+ lea.1 d0, %lo(main)(a3)
-+#endif
-+
-+ /*
-+ * Grab the environment stuff from stack and set up d1, d2 with it.
-+ */
-+ move.4 d1, (sp)
-+#ifdef __UBICOM32_FDPIC__
-+ /* For FDPIC the calling convention is different than flat */
-+ lea.1 d2, 4(sp)
-+#else
-+ move.4 d2, 4(sp)
-+#endif
-+
-+#ifdef __UCLIBC_CTOR_DTOR__
-+ /*
-+ * Load pointer to _init into d3
-+ */
-+#ifdef __UBICOM32_FDPIC__
-+ movei d3, #%got_funcdesc_lo(_init)
-+ move.4 d3, (a0, d3)
-+#else
-+ moveai a3, #%hi(_init)
-+ lea.1 d3, %lo(_init)(a3)
-+#endif
-+
-+ /*
-+ * Load pointer to _fini into d4
-+ */
-+#ifdef __UBICOM32_FDPIC__
-+ movei d4, #%got_funcdesc_lo(_fini)
-+ move.4 d4, (a0, d4)
-+#else
-+ moveai a3, #%hi(_fini)
-+ lea.1 d4, %lo(_fini)(a3)
-+#endif
-+
-+#else /* !__UCLIBC_CTOR_DTOR__ */
-+ move.4 d3, #0 ; _init
-+ move.4 d4, #0 ; _fini
-+#endif
-+
-+#ifdef __UBICOM32_FDPIC__
-+ move.4 d5, a1 ; ldso _fini funcdesc (see dl-startup.h)
-+#else
-+ movei d5, #0 ; rtld_fini (not used)
-+#endif
-+
-+ move.4 d6, sp ; Stack End.
-+
-+ /* Call the user's main function, and exit with its value. But
-+ let the libc call main. */
-+#ifdef __UBICOM32_FDPIC__
-+ call a5, __uClibc_main
-+#else
-+ moveai a5, #%hi(__uClibc_main)
-+ calli a5, %lo(__uClibc_main)(a5)
-+#endif
-+
-+ bkpt #-1 ; Crash if somehow `exit' does return.
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/crti.S
-@@ -0,0 +1,54 @@
-+/* Specialized code needed to support construction and destruction of
-+ file-scope objects in C++ and Java code, and to support exception handling.
-+ Copyright (C) 1999 Free Software Foundation, Inc.
-+ Contributed by Charles-Antoine Gauthier (charles.gauthier@iit.nrc.ca).
-+
-+This file is part of GCC.
-+
-+GCC is free software; you can redistribute it and/or modify
-+it under the terms of the GNU General Public License as published by
-+the Free Software Foundation; either version 2, or (at your option)
-+any later version.
-+
-+GCC is distributed in the hope that it will be useful,
-+but WITHOUT ANY WARRANTY; without even the implied warranty of
-+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+GNU General Public License for more details.
-+
-+You should have received a copy of the GNU General Public License
-+along with GCC; see the file COPYING. If not, write to
-+the Free Software Foundation, 59 Temple Place - Suite 330,
-+Boston, MA 02111-1307, USA. */
-+
-+/* As a special exception, if you link this library with files
-+ compiled with GCC to produce an executable, this does not cause
-+ the resulting executable to be covered by the GNU General Public License.
-+ This exception does not however invalidate any other reasons why
-+ the executable file might be covered by the GNU General Public License. */
-+
-+/*
-+ * This file just supplies function prologues for the .init and .fini
-+ * sections. It is linked in before crtbegin.o.
-+ */
-+ .file "crti.o"
-+ .ident "GNU C crti.o"
-+
-+ .section .init
-+ .align 2
-+ .globl _init
-+ .type _init, @function
-+_init:
-+ move.4 -4(sp)++, a5
-+#ifdef __UBICOM32_FDPIC__
-+ move.4 -4(sp)++, a0
-+#endif
-+
-+ .section .fini
-+ .align 2
-+ .globl _fini
-+ .type _fini, @function
-+_fini:
-+ move.4 -4(sp)++, a5
-+#ifdef __UBICOM32_FDPIC__
-+ move.4 -4(sp)++, a0
-+#endif
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/crtn.S
-@@ -0,0 +1,47 @@
-+/* Specialized code needed to support construction and destruction of
-+ file-scope objects in C++ and Java code, and to support exception handling.
-+ Copyright (C) 1999 Free Software Foundation, Inc.
-+ Contributed by Charles-Antoine Gauthier (charles.gauthier@iit.nrc.ca).
-+
-+This file is part of GCC.
-+
-+GCC is free software; you can redistribute it and/or modify
-+it under the terms of the GNU General Public License as published by
-+the Free Software Foundation; either version 2, or (at your option)
-+any later version.
-+
-+GCC is distributed in the hope that it will be useful,
-+but WITHOUT ANY WARRANTY; without even the implied warranty of
-+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+GNU General Public License for more details.
-+
-+You should have received a copy of the GNU General Public License
-+along with GCC; see the file COPYING. If not, write to
-+the Free Software Foundation, 59 Temple Place - Suite 330,
-+Boston, MA 02111-1307, USA. */
-+
-+/* As a special exception, if you link this library with files
-+ compiled with GCC to produce an executable, this does not cause
-+ the resulting executable to be covered by the GNU General Public License.
-+ This exception does not however invalidate any other reasons why
-+ the executable file might be covered by the GNU General Public License. */
-+
-+/*
-+ * This file supplies function epilogues for the .init and .fini sections.
-+ * It is linked in after all other files.
-+ */
-+
-+ .file "crtn.o"
-+ .ident "GNU C crtn.o"
-+
-+ .section .init
-+#ifdef __UBICOM32_FDPIC__
-+ move.4 a0, (sp)4++
-+#endif
-+ ret (sp)4++
-+
-+ .section .fini
-+#ifdef __UBICOM32_FDPIC__
-+ move.4 a0, (sp)4++
-+#endif
-+ ret (sp)4++
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/crtreloc.c
-@@ -0,0 +1,145 @@
-+/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-+ written by Alexandre Oliva <aoliva@redhat.com>
-+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.
-+
-+In addition to the permissions in the GNU Lesser General Public
-+License, the Free Software Foundation gives you unlimited
-+permission to link the compiled version of this file with other
-+programs, and to distribute those programs without any restriction
-+coming from the use of this file. (The GNU Lesser General Public
-+License restrictions do apply in other respects; for example, they
-+cover modification of the file, and distribution when not linked
-+into another program.)
-+
-+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
-+Library 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; see the file COPYING.LIB. If
-+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-+Cambridge, MA 02139, USA. */
-+
-+#ifdef __UBICOM32_FDPIC__
-+
-+#include <sys/types.h>
-+#include <link.h>
-+
-+/* This file is to be compiled into crt object files, to enable
-+ executables to easily self-relocate. */
-+
-+union word {
-+ char c[4];
-+ void *v;
-+};
-+
-+/* Compute the runtime address of pointer in the range [p,e), and then
-+ map the pointer pointed by it. */
-+static __always_inline void ***
-+reloc_range_indirect (void ***p, void ***e,
-+ const struct elf32_fdpic_loadmap *map)
-+{
-+ while (p < e)
-+ {
-+ if (*p != (void **)-1)
-+ {
-+ void *ptr = __reloc_pointer (*p, map);
-+ if (ptr != (void *)-1)
-+ {
-+ void *pt;
-+ if ((long)ptr & 3)
-+ {
-+ unsigned char *c = ptr;
-+ int i;
-+ unsigned long v = 0;
-+ for (i = 0; i < 4; i++)
-+ v |= c[i] << 8 * i;
-+ pt = (void *)v;
-+ }
-+ else
-+ pt = *(void**)ptr;
-+ pt = __reloc_pointer (pt, map);
-+ if ((long)ptr & 3)
-+ {
-+ unsigned char *c = ptr;
-+ int i;
-+ unsigned long v = (unsigned long)pt;
-+ for (i = 0; i < 4; i++, v >>= 8)
-+ c[i] = v;
-+ }
-+ else
-+ *(void**)ptr = pt;
-+ }
-+ }
-+ p++;
-+ }
-+ return p;
-+}
-+
-+/* Call __reloc_range_indirect for the given range except for the last
-+ entry, whose contents are only relocated. It's expected to hold
-+ the GOT value. */
-+void* attribute_hidden
-+__self_reloc (const struct elf32_fdpic_loadmap *map,
-+ void ***p, void ***e)
-+{
-+ p = reloc_range_indirect (p, e-1, map);
-+
-+ if (p >= e)
-+ return (void*)-1;
-+
-+ return __reloc_pointer (*p, map);
-+}
-+
-+#if 0
-+/* These are other functions that might be useful, but that we don't
-+ need. */
-+
-+/* Remap pointers in [p,e). */
-+static __always_inline void**
-+reloc_range (void **p, void **e,
-+ const struct elf32_fdpic_loadmap *map)
-+{
-+ while (p < e)
-+ {
-+ *p = __reloc_pointer (*p, map);
-+ p++;
-+ }
-+ return p;
-+}
-+
-+/* Remap p, adjust e by the same offset, then map the pointers in the
-+ range determined by them. */
-+void attribute_hidden
-+__reloc_range (const struct elf32_fdpic_loadmap *map,
-+ void **p, void **e)
-+{
-+ void **old = p;
-+
-+ p = __reloc_pointer (p, map);
-+ e += p - old;
-+ reloc_range (p, e, map);
-+}
-+
-+/* Remap p, adjust e by the same offset, then map pointers referenced
-+ by the (unadjusted) pointers in the range. Return the relocated
-+ value of the last pointer in the range. */
-+void* attribute_hidden
-+__reloc_range_indirect (const struct elf32_fdpic_loadmap *map,
-+ void ***p, void ***e)
-+{
-+ void ***old = p;
-+
-+ p = __reloc_pointer (p, map);
-+ e += p - old;
-+ return reloc_range_indirect (p, e, map);
-+}
-+#endif
-+
-+#endif /* __UBICOM32_FDPIC__ */
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/setjmp.S
-@@ -0,0 +1,72 @@
-+/* Setjmp for Ubicom32 */
-+ .text
-+ .global _setjmp
-+ .type _setjmp,@function
-+_setjmp:
-+ movea a3, d0 ; A3 now holds the jmp buf that was passed in.
-+ move.4 (a3)4++, d10
-+ move.4 (a3)4++, d11
-+ move.4 (a3)4++, d12
-+ move.4 (a3)4++, d13
-+ move.4 (a3)4++, a1
-+ move.4 (a3)4++, a2
-+ move.4 (a3)4++, a5
-+ move.4 (a3)4++, a6
-+ move.4 (a3)4++, a7
-+ move.4 d0, #0
-+
-+ calli a5, 0(a5)
-+ .size _setjmp, . - _setjmp
-+
-+/*
-+ * __sigsetjmp for Ubicom32
-+ * d0 holds sigjmp_buf and d1 holds the savemask. We will save the frame and then just call __sigjmp_save to do the mask save.
-+ */
-+ .global __sigsetjmp
-+ .type __sigsetjmp,@function
-+__sigsetjmp:
-+ movea a3, d0 ; A3 now holds the jmp buf that was passed in.
-+ move.4 (a3)4++, d10
-+ move.4 (a3)4++, d11
-+ move.4 (a3)4++, d12
-+ move.4 (a3)4++, d13
-+ move.4 (a3)4++, a1
-+ move.4 (a3)4++, a2
-+ move.4 (a3)4++, a5
-+ move.4 (a3)4++, a6
-+ move.4 (a3)4++, a7
-+
-+ ;; The frame has been saved. Call _sigjmp_save to get sigmask saved. a5 still has the return address and it will go back to that.
-+#if defined(__UBICOM32_FDPIC__)
-+ call a3, __sigjmp_save
-+#else
-+ moveai a3, #%hi(__sigjmp_save)
-+ calli a3, %lo(__sigjmp_save)(a3)
-+#endif
-+ .size __sigjmp_save, . - __sigjmp_save
-+
-+ .global __longjmp
-+ .type __longjmp,@function
-+__longjmp:
-+ movea a3, d0 ; A3 now holds the jmp buf that was passed in.
-+ move.4 d10, (a3)4++
-+ move.4 d11, (a3)4++
-+ move.4 d12, (a3)4++
-+ move.4 d13, (a3)4++
-+ move.4 a1 , (a3)4++
-+ move.4 a2 , (a3)4++
-+ move.4 a5 , (a3)4++
-+ move.4 a6 , (a3)4++
-+ move.4 a7 , (a3)4++
-+
-+ sub.4 #0, #0, d1 ; Test if d1 is zero. If it is we have to return 1 other wise return content of d1
-+ jmpeq.t 2f
-+ move.4 d0, d1 ; d1 is non zero load it into d0
-+ jmpt.t 3f
-+
-+2: move.4 d0, #1
-+3: calli a5, 0(a5)
-+ .size __longjmp, . - __longjmp
-+ .global __GI___longjmp
-+ .hidden __GI___longjmp
-+ .set __GI___longjmp,__longjmp
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/sys/procfs.h
-@@ -0,0 +1,122 @@
-+/* Copyright (C) 1996, 1997, 1999, 2000 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, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#ifndef _SYS_PROCFS_H
-+#define _SYS_PROCFS_H 1
-+
-+/* This is somehow modelled after the file of the same name on SysVr4
-+ systems. It provides a definition of the core file format for ELF
-+ used on Linux. */
-+
-+#include <features.h>
-+#include <signal.h>
-+#include <sys/time.h>
-+#include <sys/types.h>
-+#include <sys/ucontext.h>
-+#include <bits/wordsize.h>
-+
-+__BEGIN_DECLS
-+
-+#define ELF_NGREG 38
-+
-+typedef struct
-+ {
-+ union
-+ {
-+ unsigned long pr_regs[32];
-+ double pr_dregs[16];
-+ } pr_fr;
-+ unsigned long __unused;
-+ unsigned long pr_fsr;
-+ unsigned char pr_qcnt;
-+ unsigned char pr_q_entrysize;
-+ unsigned char pr_en;
-+ unsigned int pr_q[64];
-+ } elf_fpregset_t;
-+
-+typedef unsigned long elf_greg_t;
-+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
-+
-+struct elf_siginfo
-+ {
-+ int si_signo; /* Signal number. */
-+ int si_code; /* Extra code. */
-+ int si_errno; /* Errno. */
-+ };
-+
-+/* Definitions to generate Intel SVR4-like core files. These mostly
-+ have the same names as the SVR4 types with "elf_" tacked on the
-+ front to prevent clashes with linux definitions, and the typedef
-+ forms have been avoided. This is mostly like the SVR4 structure,
-+ but more Linuxy, with things that Linux does not support and which
-+ gdb doesn't really use excluded. Fields present but not used are
-+ marked with "XXX". */
-+struct elf_prstatus
-+ {
-+ struct elf_siginfo pr_info; /* Info associated with signal. */
-+ short int pr_cursig; /* Current signal. */
-+ unsigned long int pr_sigpend; /* Set of pending signals. */
-+ unsigned long int pr_sighold; /* Set of held signals. */
-+ __pid_t pr_pid;
-+ __pid_t pr_ppid;
-+ __pid_t pr_pgrp;
-+ __pid_t pr_sid;
-+ struct timeval pr_utime; /* User time. */
-+ struct timeval pr_stime; /* System time. */
-+ struct timeval pr_cutime; /* Cumulative user time. */
-+ struct timeval pr_cstime; /* Cumulative system time. */
-+ elf_gregset_t pr_reg; /* GP registers. */
-+ int pr_fpvalid; /* True if math copro being used. */
-+ };
-+
-+
-+#define ELF_PRARGSZ (80) /* Number of chars for args */
-+
-+struct elf_prpsinfo
-+ {
-+ char pr_state; /* Numeric process state. */
-+ char pr_sname; /* Char for pr_state. */
-+ char pr_zomb; /* Zombie. */
-+ char pr_nice; /* Nice val. */
-+ unsigned long int pr_flag; /* Flags. */
-+ unsigned short int pr_uid;
-+ unsigned short int pr_gid;
-+ int pr_pid, pr_ppid, pr_pgrp, pr_sid;
-+ /* Lots missing */
-+ char pr_fname[16]; /* Filename of executable. */
-+ char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
-+ };
-+
-+/* Addresses. */
-+typedef void *psaddr_t;
-+
-+/* Register sets. Linux has different names. */
-+typedef elf_gregset_t prgregset_t;
-+typedef elf_fpregset_t prfpregset_t;
-+
-+/* We don't have any differences between processes and threads,
-+ therefore have only one PID type. */
-+typedef __pid_t lwpid_t;
-+
-+
-+typedef struct elf_prstatus prstatus_t;
-+typedef struct elf_prpsinfo prpsinfo_t;
-+
-+__END_DECLS
-+
-+#endif /* sys/procfs.h */
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/sys/ucontext.h
-@@ -0,0 +1,104 @@
-+/* Copyright (C) 1998, 1999 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, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#ifndef _SYS_UCONTEXT_H
-+#define _SYS_UCONTEXT_H 1
-+
-+#include <features.h>
-+#include <signal.h>
-+/*
-+ * Location of the users' stored registers relative to R0.
-+ * Usage is as an index into a gregset_t array or as u.u_ar0[XX].
-+ */
-+#define REG_PSR (0)
-+#define REG_PC (1)
-+#define REG_SPARE (2)
-+#define REG_WVALID (3)
-+#define REG_G1 (4)
-+#define REG_G2 (5)
-+#define REG_G3 (6)
-+#define REG_G4 (7)
-+#define REG_G5 (8)
-+#define REG_G6 (9)
-+#define REG_G7 (10)
-+#define REG_O0 (11)
-+#define REG_O1 (12)
-+#define REG_O2 (13)
-+#define REG_O3 (14)
-+#define REG_O4 (15)
-+#define REG_O5 (16)
-+#define REG_O6 (17)
-+#define REG_O7 (18)
-+#define REG_GLOBALS (19)
-+
-+/*
-+ * A gregset_t is defined as an array type for compatibility with the reference
-+ * source. This is important due to differences in the way the C language
-+ * treats arrays and structures as parameters.
-+ *
-+ * Note that NGREG is really (sizeof (struct regs) / sizeof (greg_t)),
-+ * but that the ABI defines it absolutely to be 21 (resp. 19).
-+ */
-+
-+#define NGREG 20
-+typedef int greg_t;
-+
-+typedef greg_t gregset_t[NGREG];
-+
-+/*
-+ * The following structures define how a register window can appear on the
-+ * stack. This structure is available (when required) through the `gwins'
-+ * field of an mcontext (nested within ucontext). NIOS_MAXWINDOW is the
-+ * maximum number of outstanding register windows defined in the NIOS
-+ * architecture (*not* implementation).
-+ */
-+#define NIOS_MAXREGWINDOW 31 /* max windows in NIOS arch. */
-+struct rwindow
-+ {
-+ greg_t rw_local[8]; /* locals */
-+ greg_t rw_in[8]; /* ins */
-+ };
-+
-+#define rw_fp rw_in[6] /* frame pointer */
-+#define rw_rtn rw_in[7] /* return address */
-+
-+typedef struct gwindows
-+ {
-+ int wbcnt;
-+ int *spbuf[NIOS_MAXREGWINDOW];
-+ struct rwindow wbuf[NIOS_MAXREGWINDOW];
-+ } gwindows_t;
-+
-+typedef struct
-+ {
-+ gregset_t gregs; /* general register set */
-+ gwindows_t *gwins; /* POSSIBLE pointer to register windows */
-+ } mcontext_t;
-+
-+
-+/* Userlevel context. */
-+typedef struct ucontext
-+ {
-+ unsigned long uc_flags;
-+ struct ucontext *uc_link;
-+ __sigset_t uc_sigmask;
-+ stack_t uc_stack;
-+ mcontext_t uc_mcontext;
-+ } ucontext_t;
-+
-+#endif /* sys/ucontext.h */
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/syscall.c
-@@ -0,0 +1,32 @@
-+/* vi: set sw=4 ts=4: */
-+/* syscall for ubicom32/uClibc
-+ *
-+ * Copyright (C) 2008 by Ubicom Inc.
-+ * Copyright (C) 2002 by Erik Andersen <andersen@uclibc.org>
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU Library General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or (at your
-+ * option) any later version.
-+ *
-+ * This program 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 Library General Public License
-+ * for more details.
-+ *
-+ * You should have received a copy of the GNU Library General Public License
-+ * along with this program; if not, write to the Free Software Foundation,
-+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#include <features.h>
-+#include <errno.h>
-+#include <sys/types.h>
-+#include <sys/syscall.h>
-+
-+extern long syscall(long sysnum, long a, long b, long c, long d, long e, long f);
-+long syscall(long sysnum, long a, long b, long c, long d, long e, long f)
-+{
-+ int __NR_syscall_number = sysnum;
-+ return (long) INLINE_SYSCALL(syscall_number, 6, a, b, c, d, e, f);
-+}
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/vfork.S
-@@ -0,0 +1,35 @@
-+#include <sys/syscall.h>
-+
-+ .text
-+ .type vfork,@function
-+ .global vfork
-+vfork:
-+ move.4 -4(sp)++, a5 ; Save return address on the stack.
-+ movei d8, #__NR_vfork
-+ moveai a3, #%hi(0x40400000)
-+ calli a5, 0x10(a3)
-+
-+ /*
-+ * You get here only if the syscall bombed. If things had worked out the
-+ * parent and child would have both returned to the instruction after
-+ * the vfork call.
-+ */
-+ move.4 a5, (sp)4++ ; Pop the return address off the stack.
-+ movei d1, #-125
-+ sub.4 #0, d0, d1
-+ jmplt.t 1f
-+
-+ ;; We have an error.
-+ sub.4 d0, #0, d0 ; d0 = -res. Call __set_errno with that.
-+#if defined(__UBICOM32_FDPIC__)
-+ call a3, __syscall_error
-+#else
-+ moveai a3, #%hi(__syscall_error)
-+ calli a3, %lo(__syscall_error)(a3) ; __syscall_error will return -1 and not come back here.
-+#endif
-+1:
-+ calli a5, 0(a5)
-+ .size vfork, . - vfork
-+ .global __GI_vfork
-+ .hidden __GI_vfork
-+ .set __GI_vfork,vfork
---- a/libpthread/linuxthreads.old/pthread.c
-+++ b/libpthread/linuxthreads.old/pthread.c
-@@ -393,6 +393,10 @@ void __pthread_initialize_minimal(void)
- #endif
-
- __libc_multiple_threads_ptr = __libc_pthread_init (ptr_pthread_functions);
-+#ifndef __ARCH_USE_MMU__
-+ __pthread_initial_thread_tos =
-+ (char *)(((long)CURRENT_STACK_FRAME + getpagesize()) & ~(getpagesize() - 1));
-+#endif /* __ARCH_USE_MMU__ */
- }
-
-
-@@ -461,8 +465,11 @@ static void pthread_initialize(void)
- * __pthread_initial_thread_bos at address 0. These bounds are refined as we
- * malloc other stack frames such that they don't overlap. -StS
- */
-- __pthread_initial_thread_tos =
-- (char *)(((long)CURRENT_STACK_FRAME + getpagesize()) & ~(getpagesize() - 1));
-+ if (__pthread_initial_thread_tos == NULL) {
-+ __pthread_initial_thread_tos =
-+ (char *)(((long)CURRENT_STACK_FRAME + getpagesize()) & ~(getpagesize() - 1));
-+ }
-+
- __pthread_initial_thread_bos = (char *) 1; /* set it non-zero so we know we have been here */
- PDEBUG("initial thread stack bounds: bos=%p, tos=%p\n",
- __pthread_initial_thread_bos, __pthread_initial_thread_tos);
---- /dev/null
-+++ b/libpthread/linuxthreads.old/sysdeps/ubicom32/pt-machine.h
-@@ -0,0 +1,68 @@
-+/* Machine-dependent pthreads configuration and inline functions.
-+
-+ Copyright (C) 1996, 1997, 1998, 2000, 2002, 2003, 2004
-+ Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Ralf Baechle <ralf@gnu.org>.
-+ Based on the Alpha version by Richard Henderson <rth@tamu.edu>.
-+
-+ 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; see the file COPYING.LIB. If
-+ not, write to the Free Software Foundation, Inc.,
-+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-+
-+#ifndef _PT_MACHINE_H
-+#define _PT_MACHINE_H 1
-+
-+#include <features.h>
-+
-+/*
-+ * XXX try to make this inline
-+ */
-+extern long int testandset (int *spinlock);
-+
-+#ifndef PT_EI
-+#define PT_EI
-+#else
-+/* Spinlock implementation; required. */
-+
-+/*
-+ * testandset() is the basis for the pthread spin lock.
-+ *
-+ * This implementation only requires that we 'set' the state of *spinlock. As
-+ * bset is allows us to atomically 'testandset' a single bit define our 'set' is
-+ * such that we will set bit 0 (ignoring all other bits, which should also be
-+ * zero).
-+ * Return value of 1 implies that the bit was already set and is still
-+ * set.
-+ * Return value of 0 implies that the bit was not previously set but it
-+ * now is.
-+ */
-+long int
-+testandset (int *spinlock)
-+{
-+ int ret;
-+ __asm__ volatile (
-+ " move.4 %0, #0 \n\t" /* Assume that the bit is not currently set */
-+ " bset %1, %1, #0 \n\t" /* Attempt to 'set' bit 0 */
-+ " jmpeq.t 1f \n\t"
-+ " move.4 %0, #1 \n\t" /* Bit was already set, so return 1 */
-+ " 1: \n\t"
-+ : "=r"(ret), "+U4"(*spinlock)
-+ :
-+ : "memory", "cc"
-+ );
-+ return ret;
-+}
-+#endif
-+#endif /* pt-machine.h */
---- /dev/null
-+++ b/libpthread/linuxthreads.old/sysdeps/ubicom32/tls.h
-@@ -0,0 +1,26 @@
-+/* Definitions for thread-local data handling. linuxthreads/MIPS version.
-+ Copyright (C) 2005 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, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#ifndef _TLS_H
-+#define _TLS_H
-+#ifdef HAVE_TLS_SUPPORT
-+#warning no tls support
-+#undef USE_TLS
-+#endif
-+#endif /* tls.h */
---- /dev/null
-+++ b/libc/sysdeps/linux/ubicom32/sys/user.h
-@@ -0,0 +1,40 @@
-+/* Copyright (C) 1998 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, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#ifndef _SYS_USER_H
-+#define _SYS_USER_H 1
-+
-+#include <features.h>
-+
-+#include <asm/ptrace.h>
-+
-+struct user {
-+ struct pt_regs regs; /* entire machine state */
-+ size_t u_tsize; /* text size (pages) */
-+ size_t u_dsize; /* data size (pages) */
-+ size_t u_ssize; /* stack size (pages) */
-+ unsigned long start_code; /* text starting address */
-+ unsigned long start_data; /* data starting address */
-+ unsigned long start_stack; /* stack starting address */
-+ long int signal; /* signal causing core dump */
-+ struct regs * u_ar0; /* help gdb find registers */
-+ unsigned long magic; /* identifies a core file */
-+ char u_comm[32]; /* user command name */
-+};
-+
-+#endif /* _SYS_USER_H */
diff --git a/toolchain/uClibc/patches-0.9.31/901-MIPS-restore-INLINE_SYSCALL-macro.patch b/toolchain/uClibc/patches-0.9.31/901-MIPS-restore-INLINE_SYSCALL-macro.patch
deleted file mode 100644
index 4ba09424b9..0000000000
--- a/toolchain/uClibc/patches-0.9.31/901-MIPS-restore-INLINE_SYSCALL-macro.patch
+++ /dev/null
@@ -1,110 +0,0 @@
-From 911bf867eb82e28799e81578c50d82ee166cebb5 Mon Sep 17 00:00:00 2001
-From: Gabor Juhos <juhosg@openwrt.org>
-Date: Tue, 6 Apr 2010 17:25:56 +0200
-Subject: [PATCH] MIPS: restore INLINE_SYSCALL macro
-
-The MIPS specific INLINE_SYSCALL macro has been renamed to
-INLINE_SYSCALL_NCS with:
-
- 763bbf9e9a27426c9be8322dca5ddf2cb4dbc464
-
- syscall: unify part 2: NCS variety
-
- Declare common NCS (non-constant syscall) variants and convert the
- existing ports over to this.
-
-This change breaks system calls. The code generated with using of the
-new macro does not obey the restartable syscall convention used by the
-linux kernel. When it tries to restart the syscall the errno value is
-not being replaced by the syscall number.
-
-This causes weird behaviour of the 'ping' command in busybox for
-example:
-
-root@OpenWrt:/# ping 192.168.1.254
-PING 192.168.1.254 (192.168.1.254): 56 data bytes
-64 bytes from 192.168.1.254: seq=0 ttl=128 time=6.292 ms
-ping: recvfrom: Function not implemented
-64 bytes from 192.168.1.254: seq=1 ttl=128 time=0.719 ms
-ping: recvfrom: Function not implemented
-64 bytes from 192.168.1.254: seq=2 ttl=128 time=0.489 ms
-ping: recvfrom: Function not implemented
-64 bytes from 192.168.1.254: seq=3 ttl=128 time=0.486 ms
-ping: recvfrom: Function not implemented
-64 bytes from 192.168.1.254: seq=4 ttl=128 time=0.487 ms
-ping: recvfrom: Function not implemented
-64 bytes from 192.168.1.254: seq=5 ttl=128 time=0.939 ms
-ping: recvfrom: Function not implemented
-64 bytes from 192.168.1.254: seq=6 ttl=128 time=0.971 ms
-ping: recvfrom: Function not implemented
-64 bytes from 192.168.1.254: seq=7 ttl=128 time=0.488 ms
-ping: recvfrom: Funct^C
---- 192.168.1.254 ping statistics ---
-9 packets transmitted, 9 packets received, 0% packet loss
-round-trip min/avg/max = 0.486/1.307/6.292 ms
-root@OpenWrt:/#
-
-Here is the relevant assembler code parts of the 'recvfrom' function:
-
-with the current INLINE_SYSCALL_NCS:
-00000000 <__GI_recvfrom>:
- ...
- 2c: 24021050 li v0,4176
- 30: 8fd1003c lw s1,60(s8)
- 34: 8fd00038 lw s0,56(s8)
- 38: 27bdffe0 addiu sp,sp,-32
- 3c: afb00010 sw s0,16(sp)
- 40: afb10014 sw s1,20(sp) <-- wrong
- 44: 0000000c syscall
- 48: 27bd0020 addiu sp,sp,32
- ...
-
-with the old INLINE_SYSCALL:
-00000000 <__libc_recvfrom>:
- ...
- 28: 8fd0003c lw s0,60(s8)
- 2c: 8fc20038 lw v0,56(s8)
- 30: 27bdffe0 addiu sp,sp,-32
- 34: afa20010 sw v0,16(sp)
- 38: afb00014 sw s0,20(sp)
- 3c: 24021050 li v0,4176 <-- good
- 40: 0000000c syscall
- 44: 27bd0020 addiu sp,sp,32
- ...
-
-Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
-Cc: Mike Frysinger <vapier@gentoo.org>
----
-Notes:
-
-The ideal solution would to fix the 'internal_syscall' macros to generate
-correct code for the NCS case as well. However the INLINE_SYSCALL macro
-generates smaller code if the syscall number is constant, so it is
-useful in such cases.
-
-Additionally, the current INLINE_SYSCALL_NCS in the 'mips/bits/syscall.h'
-is a duplicate of the one in the 'common/bits/syscalls-common.h' so it
-should be removed anyway.
----
- libc/sysdeps/linux/mips/bits/syscalls.h | 4 ++--
- 1 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/libc/sysdeps/linux/mips/bits/syscalls.h b/libc/sysdeps/linux/mips/bits/syscalls.h
-index 28b0f91..944d038 100644
---- a/libc/sysdeps/linux/mips/bits/syscalls.h
-+++ b/libc/sysdeps/linux/mips/bits/syscalls.h
-@@ -19,9 +19,9 @@
-
- /* Define a macro which expands into the inline wrapper code for a system
- call. */
--#define INLINE_SYSCALL_NCS(name, nr, args...) \
-+#define INLINE_SYSCALL(name, nr, args...) \
- ({ INTERNAL_SYSCALL_DECL(err); \
-- long result_var = INTERNAL_SYSCALL_NCS (name, err, nr, args); \
-+ 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)); \
---
-1.5.3.2
-
diff --git a/toolchain/uClibc/patches-0.9.31/903-fcntl64_fix.patch b/toolchain/uClibc/patches-0.9.31/903-fcntl64_fix.patch
deleted file mode 100644
index 8bb01a6260..0000000000
--- a/toolchain/uClibc/patches-0.9.31/903-fcntl64_fix.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-64 bit targets often don't have a separate fcntl64() system call, because they don't need one.
-
-Signed-off-by: Rob Landley <rob at landley.net>
-
---- uClibc/include/fcntl.h 2010-04-02 10:34:27.000000000 -0500
-+++ uClibc.bak/include/fcntl.h 2010-05-16 04:54:10.000000000 -0500
-@@ -73,7 +73,7 @@
-
- This function is a cancellation point and therefore not marked with
- __THROW. */
--#ifndef __USE_FILE_OFFSET64
-+#if !defined(__USE_FILE_OFFSET64) || defined(__LP64__)
- extern int fcntl (int __fd, int __cmd, ...);
- libc_hidden_proto(fcntl)
- #else
-@@ -83,7 +83,7 @@
- # define fcntl fcntl64
- # endif
- #endif
--#ifdef __USE_LARGEFILE64
-+#if defined(__USE_LARGEFILE64) && !defined(__LP64__)
- extern int fcntl64 (int __fd, int __cmd, ...);
- libc_hidden_proto(fcntl64)
- #endif
-
---
diff --git a/toolchain/uClibc/patches-0.9.31/904-pthread_errno_fix.patch b/toolchain/uClibc/patches-0.9.31/904-pthread_errno_fix.patch
deleted file mode 100644
index 543750c813..0000000000
--- a/toolchain/uClibc/patches-0.9.31/904-pthread_errno_fix.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/libpthread/linuxthreads.old/errno.c
-+++ b/libpthread/linuxthreads.old/errno.c
-@@ -22,6 +22,7 @@
- #include "internals.h"
- #include <stdio.h>
-
-+libpthread_hidden_proto(__errno_location)
- int *
- __errno_location (void)
- {
-@@ -29,6 +30,7 @@ __errno_location (void)
- return THREAD_GETMEM (self, p_errnop);
- }
-
-+libpthread_hidden_proto(__h_errno_location)
- int *
- __h_errno_location (void)
- {