Date:2010-08-10 12:19:22 (3 years 11 months ago)
Author:Mirko Vogt
Commit:ff7b2bf558d4ea6ca836da0e12d6be282c5fcaa4
Message:merge over changes from OpenWrt trunk:

toolchain/uClibc
to have (preliminary) nptl support in uClibc
Files: toolchain/uClibc/Config.in (1 diff)
toolchain/uClibc/Config.version (1 diff)
toolchain/uClibc/Makefile (3 diffs)
toolchain/uClibc/config-0.9.30.1/arm.cns3xxx (1 diff)
toolchain/uClibc/config-0.9.30.2/arm.cns3xxx (1 diff)
toolchain/uClibc/config-0.9.30.3/arm.cns3xxx (1 diff)
toolchain/uClibc/config-0.9.31/arm (1 diff)
toolchain/uClibc/config-0.9.31/arm.cns3xxx (1 diff)
toolchain/uClibc/config-0.9.31/arm.gemini (1 diff)
toolchain/uClibc/config-0.9.31/armeb (1 diff)
toolchain/uClibc/config-0.9.31/avr32 (1 diff)
toolchain/uClibc/config-0.9.31/common (1 diff)
toolchain/uClibc/config-0.9.31/cris (1 diff)
toolchain/uClibc/config-0.9.31/debug (1 diff)
toolchain/uClibc/config-0.9.31/i386 (1 diff)
toolchain/uClibc/config-0.9.31/i686 (1 diff)
toolchain/uClibc/config-0.9.31/m68k (1 diff)
toolchain/uClibc/config-0.9.31/mips (1 diff)
toolchain/uClibc/config-0.9.31/mips64 (1 diff)
toolchain/uClibc/config-0.9.31/mips64el (1 diff)
toolchain/uClibc/config-0.9.31/mipsel (1 diff)
toolchain/uClibc/config-0.9.31/mipsel.brcm-2.4 (1 diff)
toolchain/uClibc/config-0.9.31/mipsel.cobalt (1 diff)
toolchain/uClibc/config-0.9.31/powerpc (1 diff)
toolchain/uClibc/config-0.9.31/ubicom32 (1 diff)
toolchain/uClibc/config-0.9.31/x86_64 (1 diff)
toolchain/uClibc/config-0.9.32/arm (1 diff)
toolchain/uClibc/config-0.9.32/arm.cns3xxx (1 diff)
toolchain/uClibc/config-0.9.32/arm.gemini (1 diff)
toolchain/uClibc/config-0.9.32/armeb (1 diff)
toolchain/uClibc/config-0.9.32/avr32 (1 diff)
toolchain/uClibc/config-0.9.32/common (1 diff)
toolchain/uClibc/config-0.9.32/cris (1 diff)
toolchain/uClibc/config-0.9.32/debug (1 diff)
toolchain/uClibc/config-0.9.32/i386 (1 diff)
toolchain/uClibc/config-0.9.32/i686 (1 diff)
toolchain/uClibc/config-0.9.32/m68k (1 diff)
toolchain/uClibc/config-0.9.32/mips (1 diff)
toolchain/uClibc/config-0.9.32/mips64 (1 diff)
toolchain/uClibc/config-0.9.32/mips64el (1 diff)
toolchain/uClibc/config-0.9.32/mipsel (1 diff)
toolchain/uClibc/config-0.9.32/mipsel.brcm-2.4 (1 diff)
toolchain/uClibc/config-0.9.32/mipsel.cobalt (1 diff)
toolchain/uClibc/config-0.9.32/powerpc (1 diff)
toolchain/uClibc/config-0.9.32/ubicom32 (1 diff)
toolchain/uClibc/config-0.9.32/x86_64 (1 diff)
toolchain/uClibc/patches-0.9.31/110-compat_macros.patch (1 diff)
toolchain/uClibc/patches-0.9.31/120-adjtimex.patch (1 diff)
toolchain/uClibc/patches-0.9.31/140-math_decl.patch (1 diff)
toolchain/uClibc/patches-0.9.31/170-math_finite.patch (1 diff)
toolchain/uClibc/patches-0.9.31/410-llvm_workaround.patch (1 diff)
toolchain/uClibc/patches-0.9.31/450-powerpc_copysignl.patch (1 diff)
toolchain/uClibc/patches-0.9.31/600-ubicom32-uClibc.patch (1 diff)
toolchain/uClibc/patches-0.9.31/901-MIPS-restore-INLINE_SYSCALL-macro.patch (1 diff)
toolchain/uClibc/patches-0.9.31/902-Fix-use-after-free-bug-in-__dns_lookup.patch (1 diff)
toolchain/uClibc/patches-0.9.31/903-fcntl64_fix.patch (1 diff)
toolchain/uClibc/patches-0.9.32/100-do_not_select_extra-warnings.patch (1 diff)
toolchain/uClibc/patches-0.9.32/110-compat_macros.patch (1 diff)
toolchain/uClibc/patches-0.9.32/120-adjtimex.patch (1 diff)
toolchain/uClibc/patches-0.9.32/140-math_decl.patch (1 diff)
toolchain/uClibc/patches-0.9.32/170-math_finite.patch (1 diff)
toolchain/uClibc/patches-0.9.32/410-llvm_workaround.patch (1 diff)
toolchain/uClibc/patches-0.9.32/450-powerpc_copysignl.patch (1 diff)
toolchain/uClibc/patches-0.9.32/600-ubicom32-uClibc.patch (1 diff)

Change Details

toolchain/uClibc/Config.in
1616    config UCLIBC_VERSION_0_9_30_3
1717        bool "uClibc 0.9.30.3"
1818
19    config UCLIBC_VERSION_NPTL
20        bool "uClibc NPTL branch"
21        depends BROKEN
19    config UCLIBC_VERSION_0_9_31
20        bool "uClibc 0.9.31"
21
22    config UCLIBC_VERSION_0_9_32
23        bool "uClibc 0.9.32 (with nptl support)"
2224
2325endchoice
2426
toolchain/uClibc/Config.version
44    default "0.9.30.1" if UCLIBC_VERSION_0_9_30_1
55    default "0.9.30.2" if UCLIBC_VERSION_0_9_30_2
66    default "0.9.30.3" if UCLIBC_VERSION_0_9_30_3
7    default "0.9.30+nptl" if UCLIBC_VERSION_NPTL
7    default "0.9.31" if UCLIBC_VERSION_0_9_31
8    default "0.9.32" if UCLIBC_VERSION_0_9_32
89    default "0.9.30.1"
toolchain/uClibc/Makefile
1
2
13#
2# Copyright (C) 2006-2009 OpenWrt.org
4# Copyright (C) 2006-2010 OpenWrt.org
35#
46# This is free software, licensed under the GNU General Public License v2.
57# See /LICENSE for more information.
...... 
911
1012PKG_NAME:=uClibc
1113PKG_VERSION:=$(call qstrip,$(CONFIG_UCLIBC_VERSION))
12ifeq ($(CONFIG_UCLIBC_VERSION_NPTL),y)
14ifeq ($(CONFIG_UCLIBC_VERSION_0_9_32),y)
1315  PKG_SOURCE_URL:=git://git.busybox.net/uClibc
1416  PKG_SOURCE_PROTO:=git
15  PKG_SOURCE_VERSION:=ef18cfe8ebab25f5ef92e81956f50e2dc57df602
17  PKG_SOURCE_VERSION:=ef487a35f428da6240003dca23b9d29908e2285e
1618  PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
1719  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
18  LIBC_SO_VERSION:=0.9.30-git
20  LIBC_SO_VERSION:=$(PKG_VERSION)-git
1921else
2022  PKG_SOURCE_URL:=http://www.uclibc.org/downloads
2123  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
...... 
2729PKG_MD5SUM_0.9.30.1 = 1a4b84e5536ad8170563ffa88c34679c
2830PKG_MD5SUM_0.9.30.2 = e759ec855500082ac3e671dd6cacfdb0
2931PKG_MD5SUM_0.9.30.3 = 73a4bf4a0fa508b01a7a3143574e3d21
32PKG_MD5SUM_0.9.31 = 52fb8a494758630c8d3ddd7f1e0daafd
3033PKG_MD5SUM=$(PKG_MD5SUM_$(PKG_VERSION))
3134
3235HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)-$(PKG_VERSION)
toolchain/uClibc/config-0.9.30.1/arm.cns3xxx
1ARCH_ANY_ENDIAN=y
2ARCH_LITTLE_ENDIAN=y
3ARCH_WANTS_LITTLE_ENDIAN=y
4# CONFIG_ARM10T is not set
5# CONFIG_ARM1136JF_S is not set
6CONFIG_ARM1176JZF_S=y
7# CONFIG_ARM1176JZ_S is not set
8# CONFIG_ARM610 is not set
9# CONFIG_ARM710 is not set
10# CONFIG_ARM720T is not set
11# CONFIG_ARM7TDMI is not set
12# CONFIG_ARM920T is not set
13# CONFIG_ARM922T is not set
14# CONFIG_ARM926T is not set
15# CONFIG_ARM_CORTEX_M1 is not set
16# CONFIG_ARM_CORTEX_M3 is not set
17# CONFIG_ARM_EABI is not set
18# CONFIG_ARM_IWMMXT is not set
19CONFIG_ARM_OABI=y
20# CONFIG_ARM_SA110 is not set
21# CONFIG_ARM_SA1100 is not set
22# CONFIG_ARM_XSCALE is not set
23# CONFIG_GENERIC_ARM is not set
24TARGET_ARCH="arm"
25TARGET_arm=y
toolchain/uClibc/config-0.9.30.2/arm.cns3xxx
1ARCH_ANY_ENDIAN=y
2ARCH_LITTLE_ENDIAN=y
3ARCH_WANTS_LITTLE_ENDIAN=y
4# CONFIG_ARM10T is not set
5# CONFIG_ARM1136JF_S is not set
6CONFIG_ARM1176JZF_S=y
7# CONFIG_ARM1176JZ_S is not set
8# CONFIG_ARM610 is not set
9# CONFIG_ARM710 is not set
10# CONFIG_ARM720T is not set
11# CONFIG_ARM7TDMI is not set
12# CONFIG_ARM920T is not set
13# CONFIG_ARM922T is not set
14# CONFIG_ARM926T is not set
15# CONFIG_ARM_CORTEX_M1 is not set
16# CONFIG_ARM_CORTEX_M3 is not set
17# CONFIG_ARM_EABI is not set
18# CONFIG_ARM_IWMMXT is not set
19CONFIG_ARM_OABI=y
20# CONFIG_ARM_SA110 is not set
21# CONFIG_ARM_SA1100 is not set
22# CONFIG_ARM_XSCALE is not set
23# CONFIG_GENERIC_ARM is not set
24TARGET_ARCH="arm"
25TARGET_arm=y
toolchain/uClibc/config-0.9.30.3/arm.cns3xxx
1ARCH_ANY_ENDIAN=y
2ARCH_LITTLE_ENDIAN=y
3ARCH_WANTS_LITTLE_ENDIAN=y
4# CONFIG_ARM10T is not set
5# CONFIG_ARM1136JF_S is not set
6CONFIG_ARM1176JZF_S=y
7# CONFIG_ARM1176JZ_S is not set
8# CONFIG_ARM610 is not set
9# CONFIG_ARM710 is not set
10# CONFIG_ARM720T is not set
11# CONFIG_ARM7TDMI is not set
12# CONFIG_ARM920T is not set
13# CONFIG_ARM922T is not set
14# CONFIG_ARM926T is not set
15# CONFIG_ARM_CORTEX_M1 is not set
16# CONFIG_ARM_CORTEX_M3 is not set
17# CONFIG_ARM_EABI is not set
18# CONFIG_ARM_IWMMXT is not set
19CONFIG_ARM_OABI=y
20# CONFIG_ARM_SA110 is not set
21# CONFIG_ARM_SA1100 is not set
22# CONFIG_ARM_XSCALE is not set
23# CONFIG_GENERIC_ARM is not set
24TARGET_ARCH="arm"
25TARGET_arm=y
toolchain/uClibc/config-0.9.31/arm
1ARCH_ANY_ENDIAN=y
2ARCH_LITTLE_ENDIAN=y
3ARCH_WANTS_LITTLE_ENDIAN=y
4# CONFIG_ARM10T is not set
5# CONFIG_ARM1136JF_S is not set
6# CONFIG_ARM1176JZF_S is not set
7# CONFIG_ARM1176JZ_S is not set
8# CONFIG_ARM610 is not set
9# CONFIG_ARM710 is not set
10# CONFIG_ARM720T is not set
11# CONFIG_ARM7TDMI is not set
12# CONFIG_ARM920T is not set
13# CONFIG_ARM922T is not set
14# CONFIG_ARM926T is not set
15# CONFIG_ARM_CORTEX_M1 is not set
16# CONFIG_ARM_CORTEX_M3 is not set
17# CONFIG_ARM_EABI is not set
18# CONFIG_ARM_IWMMXT is not set
19CONFIG_ARM_OABI=y
20# CONFIG_ARM_SA110 is not set
21# CONFIG_ARM_SA1100 is not set
22CONFIG_ARM_XSCALE=y
23# CONFIG_GENERIC_ARM is not set
24TARGET_ARCH="arm"
25TARGET_arm=y
toolchain/uClibc/config-0.9.31/arm.cns3xxx
1ARCH_ANY_ENDIAN=y
2ARCH_LITTLE_ENDIAN=y
3ARCH_WANTS_LITTLE_ENDIAN=y
4# CONFIG_ARM10T is not set
5# CONFIG_ARM1136JF_S is not set
6CONFIG_ARM1176JZF_S=y
7# CONFIG_ARM1176JZ_S is not set
8# CONFIG_ARM610 is not set
9# CONFIG_ARM710 is not set
10# CONFIG_ARM720T is not set
11# CONFIG_ARM7TDMI is not set
12# CONFIG_ARM920T is not set
13# CONFIG_ARM922T is not set
14# CONFIG_ARM926T is not set
15# CONFIG_ARM_CORTEX_M1 is not set
16# CONFIG_ARM_CORTEX_M3 is not set
17# CONFIG_ARM_EABI is not set
18# CONFIG_ARM_IWMMXT is not set
19CONFIG_ARM_OABI=y
20# CONFIG_ARM_SA110 is not set
21# CONFIG_ARM_SA1100 is not set
22# CONFIG_ARM_XSCALE is not set
23# CONFIG_GENERIC_ARM is not set
24TARGET_ARCH="arm"
25TARGET_arm=y
toolchain/uClibc/config-0.9.31/arm.gemini
1ARCH_ANY_ENDIAN=y
2ARCH_LITTLE_ENDIAN=y
3ARCH_WANTS_LITTLE_ENDIAN=y
4# CONFIG_ARM10T is not set
5# CONFIG_ARM1136JF_S is not set
6# CONFIG_ARM1176JZF_S is not set
7# CONFIG_ARM1176JZ_S is not set
8# CONFIG_ARM610 is not set
9# CONFIG_ARM710 is not set
10# CONFIG_ARM720T is not set
11# CONFIG_ARM7TDMI is not set
12CONFIG_ARM920T=y
13# CONFIG_ARM922T is not set
14# CONFIG_ARM926T is not set
15# CONFIG_ARM_CORTEX_M1 is not set
16# CONFIG_ARM_CORTEX_M3 is not set
17# CONFIG_ARM_EABI is not set
18# CONFIG_ARM_IWMMXT is not set
19CONFIG_ARM_OABI=y
20# CONFIG_ARM_SA110 is not set
21# CONFIG_ARM_SA1100 is not set
22# CONFIG_ARM_XSCALE is not set
23# CONFIG_GENERIC_ARM is not set
24TARGET_ARCH="arm"
25TARGET_arm=y
26# USE_BX is not set
toolchain/uClibc/config-0.9.31/armeb
1ARCH_ANY_ENDIAN=y
2ARCH_BIG_ENDIAN=y
3ARCH_WANTS_BIG_ENDIAN=y
4# CONFIG_ARM10T is not set
5# CONFIG_ARM1136JF_S is not set
6# CONFIG_ARM1176JZF_S is not set
7# CONFIG_ARM1176JZ_S is not set
8# CONFIG_ARM610 is not set
9# CONFIG_ARM710 is not set
10# CONFIG_ARM720T is not set
11# CONFIG_ARM7TDMI is not set
12# CONFIG_ARM920T is not set
13# CONFIG_ARM922T is not set
14# CONFIG_ARM926T is not set
15# CONFIG_ARM_CORTEX_M1 is not set
16# CONFIG_ARM_CORTEX_M3 is not set
17# CONFIG_ARM_EABI is not set
18# CONFIG_ARM_IWMMXT is not set
19CONFIG_ARM_OABI=y
20# CONFIG_ARM_SA110 is not set
21# CONFIG_ARM_SA1100 is not set
22CONFIG_ARM_XSCALE=y
23# CONFIG_GENERIC_ARM is not set
24TARGET_ARCH="arm"
25TARGET_arm=y
toolchain/uClibc/config-0.9.31/avr32
1ARCH_BIG_ENDIAN=y
2CONFIG_AVR32_AP7=y
3FORCE_SHAREABLE_TEXT_SEGMENTS=y
4LINKRELAX=y
5TARGET_ARCH="avr32"
6TARGET_avr32=y
7UCLIBC_HAS_FPU=y
8# UCLIBC_HAS_SCANF_GLIBC_A_FLAG is not set
9# UCLIBC_HAS_STRING_ARCH_OPT is not set
10UNIX98PTY_ONLY=y
toolchain/uClibc/config-0.9.31/common
1# ARCH_ANY_ENDIAN is not set
2ARCH_HAS_MMU=y
3# ARCH_HAS_NO_LDSO is not set
4# ARCH_HAS_NO_SHARED is not set
5# ARCH_LITTLE_ENDIAN is not set
6ARCH_USE_MMU=y
7# ARCH_WANTS_BIG_ENDIAN is not set
8# ARCH_WANTS_LITTLE_ENDIAN is not set
9ASSUME_DEVPTS=y
10COMPAT_ATEXIT=y
11CROSS_COMPILER_PREFIX=""
12DEVEL_PREFIX="/usr/"
13# DOASSERTS is not set
14# DODEBUG is not set
15# DODEBUG_PT is not set
16# DOMULTI is not set
17DOPIC=y
18DOSTRIP=y
19DO_C99_MATH=y
20# DO_XSI_MATH is not set
21# EXTRA_WARNINGS is not set
22FORCE_OPTIONS_FOR_ARCH=y
23# FORCE_SHAREABLE_TEXT_SEGMENTS is not set
24# HARDWIRED_ABSPATH is not set
25# HAS_NO_THREADS is not set
26HAVE_DOT_CONFIG=y
27# HAVE_NO_PIC is not set
28# HAVE_NO_SSP is not set
29HAVE_SHARED=y
30KERNEL_HEADERS="."
31LDSO_BASE_FILENAME="ld.so"
32LDSO_CACHE_SUPPORT=y
33# LDSO_GNU_HASH_SUPPORT is not set
34LDSO_LDD_SUPPORT=y
35# LDSO_PRELOAD_FILE_SUPPORT is not set
36LDSO_RUNPATH=y
37# LDSO_SEARCH_INTERP_PATH is not set
38# LINUXTHREADS_NEW is not set
39LINUXTHREADS_OLD=y
40# MALLOC is not set
41MALLOC_GLIBC_COMPAT=y
42# MALLOC_SIMPLE is not set
43MALLOC_STANDARD=y
44MULTILIB_DIR="lib"
45# PTHREADS_DEBUG_SUPPORT is not set
46RUNTIME_PREFIX="/"
47# SUPPORT_LD_DEBUG is not set
48# SUPPORT_LD_DEBUG_EARLY is not set
49TARGET_SUBARCH=""
50# TARGET_alpha is not set
51# TARGET_arm is not set
52# TARGET_avr32 is not set
53# TARGET_bfin is not set
54# TARGET_cris is not set
55# TARGET_e1 is not set
56# TARGET_frv is not set
57# TARGET_h8300 is not set
58# TARGET_hppa is not set
59# TARGET_i386 is not set
60# TARGET_i960 is not set
61# TARGET_ia64 is not set
62# TARGET_m68k is not set
63# TARGET_microblaze is not set
64# TARGET_mips is not set
65# TARGET_nios is not set
66# TARGET_nios2 is not set
67# TARGET_powerpc is not set
68# TARGET_sh is not set
69# TARGET_sh64 is not set
70# TARGET_sparc is not set
71# TARGET_ubicom32 is not set
72# TARGET_v850 is not set
73# TARGET_vax is not set
74# TARGET_x86_64 is not set
75# TARGET_xtensa is not set
76UCLIBC_BSD_SPECIFIC=y
77UCLIBC_BUILD_NOEXECSTACK=y
78# UCLIBC_BUILD_NOW is not set
79# UCLIBC_BUILD_PIE is not set
80UCLIBC_BUILD_RELRO=y
81UCLIBC_CTOR_DTOR=y
82UCLIBC_DYNAMIC_ATEXIT=y
83UCLIBC_EXTRA_CFLAGS=""
84UCLIBC_GRP_BUFFER_SIZE=256
85# UCLIBC_HAS_ADVANCED_REALTIME is not set
86# UCLIBC_HAS_ARC4RANDOM is not set
87UCLIBC_HAS_BSD_ERR=y
88UCLIBC_HAS_BSD_RES_CLOSE=y
89# UCLIBC_HAS_COMPAT_RES_STATE is not set
90UCLIBC_HAS_CRYPT=y
91UCLIBC_HAS_CRYPT_IMPL=y
92UCLIBC_HAS_CTYPE_CHECKED=y
93# UCLIBC_HAS_CTYPE_ENFORCED is not set
94UCLIBC_HAS_CTYPE_SIGNED=y
95UCLIBC_HAS_CTYPE_TABLES=y
96# UCLIBC_HAS_CTYPE_UNSAFE is not set
97UCLIBC_HAS_EPOLL=y
98UCLIBC_HAS_ERRNO_MESSAGES=y
99# UCLIBC_HAS_EXTRA_COMPAT_RES_STATE is not set
100# UCLIBC_HAS_FENV is not set
101UCLIBC_HAS_FLOATS=y
102UCLIBC_HAS_FNMATCH=y
103UCLIBC_HAS_FNMATCH_OLD=y
104UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y
105# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set
106# UCLIBC_HAS_FPU is not set
107UCLIBC_HAS_FTW=y
108UCLIBC_HAS_FULL_RPC=y
109UCLIBC_HAS_GETPT=y
110UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y
111UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
112UCLIBC_HAS_GLOB=y
113UCLIBC_HAS_GNU_ERROR=y
114UCLIBC_HAS_GNU_GETOPT=y
115UCLIBC_HAS_GNU_GETSUBOPT=y
116UCLIBC_HAS_GNU_GLOB=y
117UCLIBC_HAS_HEXADECIMAL_FLOATS=y
118UCLIBC_HAS_IPV4=y
119UCLIBC_HAS_IPV6=y
120UCLIBC_HAS_LFS=y
121UCLIBC_HAS_LIBNSL_STUB=y
122UCLIBC_HAS_LIBRESOLV_STUB=y
123UCLIBC_HAS_LIBUTIL=y
124# UCLIBC_HAS_LOCALE is not set
125UCLIBC_HAS_NETWORK_SUPPORT=y
126UCLIBC_HAS_NFTW=y
127# UCLIBC_HAS_OBSOLETE_BSD_SIGNAL is not set
128# UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL is not set
129UCLIBC_HAS_PRINTF_M_SPEC=y
130# UCLIBC_HAS_PROFILING is not set
131UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
132UCLIBC_HAS_PTY=y
133UCLIBC_HAS_REALTIME=y
134# UCLIBC_HAS_REENTRANT_RPC is not set
135UCLIBC_HAS_REGEX=y
136UCLIBC_HAS_REGEX_OLD=y
137UCLIBC_HAS_RPC=y
138UCLIBC_HAS_SCANF_GLIBC_A_FLAG=y
139UCLIBC_HAS_SHADOW=y
140UCLIBC_HAS_SIGNUM_MESSAGES=y
141UCLIBC_HAS_SOCKET=y
142UCLIBC_HAS_SOFT_FLOAT=y
143# UCLIBC_HAS_SSP is not set
144UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y
145# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set
146# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set
147# UCLIBC_HAS_STDIO_BUFSIZ_256 is not set
148UCLIBC_HAS_STDIO_BUFSIZ_4096=y
149# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set
150# UCLIBC_HAS_STDIO_BUFSIZ_8192 is not set
151# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set
152# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set
153# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set
154UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y
155UCLIBC_HAS_STDIO_GETC_MACRO=y
156UCLIBC_HAS_STDIO_PUTC_MACRO=y
157# UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT is not set
158UCLIBC_HAS_STRING_ARCH_OPT=y
159UCLIBC_HAS_STRING_GENERIC_OPT=y
160# UCLIBC_HAS_STUBS is not set
161UCLIBC_HAS_SYSLOG=y
162# UCLIBC_HAS_SYS_ERRLIST is not set
163# UCLIBC_HAS_SYS_SIGLIST is not set
164UCLIBC_HAS_THREADS=y
165UCLIBC_HAS_TM_EXTENSIONS=y
166UCLIBC_HAS_TZ_CACHING=y
167UCLIBC_HAS_TZ_FILE=y
168UCLIBC_HAS_TZ_FILE_READ_MANY=y
169UCLIBC_HAS_WCHAR=y
170UCLIBC_HAS_WORDEXP=y
171# UCLIBC_HAS_XATTR is not set
172UCLIBC_HAS___PROGNAME=y
173# UCLIBC_LINUX_MODULE_24 is not set
174UCLIBC_LINUX_SPECIFIC=y
175# UCLIBC_MALLOC_DEBUGGING is not set
176# UCLIBC_MJN3_ONLY is not set
177# UCLIBC_NTP_LEGACY is not set
178UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
179UCLIBC_PWD_BUFFER_SIZE=256
180# UCLIBC_STATIC_LDCONFIG is not set
181UCLIBC_SUPPORT_AI_ADDRCONFIG=y
182UCLIBC_SUSV3_LEGACY=y
183UCLIBC_SUSV3_LEGACY_MACROS=y
184UCLIBC_SUSV4_LEGACY=y
185# UCLIBC_SV4_DEPRECATED is not set
186UCLIBC_TZ_FILE_PATH="/etc/TZ"
187UCLIBC_USE_NETLINK=y
188# UNIX98PTY_ONLY is not set
189USE_BX=y
190WARNINGS="-Wall"
toolchain/uClibc/config-0.9.31/cris
1ARCH_LITTLE_ENDIAN=y
2CONFIG_CRIS=y
3# CONFIG_CRISV32 is not set
4TARGET_ARCH="cris"
5TARGET_cris=y
6UCLIBC_HAS_FPU=y
toolchain/uClibc/config-0.9.31/debug
1DODEBUG=y
2DODEBUG_PT=y
3PTHREADS_DEBUG_SUPPORT=y
4SUPPORT_LD_DEBUG=y
5SUPPORT_LD_DEBUG_EARLY=y
6UCLIBC_MALLOC_DEBUGGING=y
toolchain/uClibc/config-0.9.31/i386
1ARCH_LITTLE_ENDIAN=y
2# CONFIG_386 is not set
3CONFIG_486=y
4# CONFIG_586 is not set
5# CONFIG_586MMX is not set
6# CONFIG_686 is not set
7# CONFIG_CRUSOE is not set
8# CONFIG_CYRIXIII is not set
9# CONFIG_ELAN is not set
10# CONFIG_GENERIC_386 is not set
11# CONFIG_K6 is not set
12# CONFIG_K7 is not set
13# CONFIG_NEHEMIAH is not set
14# CONFIG_PENTIUM4 is not set
15# CONFIG_PENTIUMII is not set
16# CONFIG_PENTIUMIII is not set
17# CONFIG_WINCHIP2 is not set
18# CONFIG_WINCHIPC6 is not set
19TARGET_ARCH="i386"
20TARGET_i386=y
21UCLIBC_HAS_FPU=y
22UCLIBC_HAS_LONG_DOUBLE_MATH=y
toolchain/uClibc/config-0.9.31/i686
1ARCH_LITTLE_ENDIAN=y
2# CONFIG_386 is not set
3# CONFIG_486 is not set
4# CONFIG_586 is not set
5# CONFIG_586MMX is not set
6CONFIG_686=y
7# CONFIG_CRUSOE is not set
8# CONFIG_CYRIXIII is not set
9# CONFIG_ELAN is not set
10# CONFIG_GENERIC_386 is not set
11# CONFIG_K6 is not set
12# CONFIG_K7 is not set
13# CONFIG_NEHEMIAH is not set
14# CONFIG_PENTIUM4 is not set
15# CONFIG_PENTIUMII is not set
16# CONFIG_PENTIUMIII is not set
17# CONFIG_WINCHIP2 is not set
18# CONFIG_WINCHIPC6 is not set
19TARGET_ARCH="i386"
20TARGET_i386=y
21UCLIBC_HAS_FPU=y
22UCLIBC_HAS_LONG_DOUBLE_MATH=y
toolchain/uClibc/config-0.9.31/m68k
1ARCH_BIG_ENDIAN=y
2TARGET_ARCH="m68k"
3TARGET_SUBARCH=""
4TARGET_m68k=y
5UCLIBC_HAS_LONG_DOUBLE_MATH=y
toolchain/uClibc/config-0.9.31/mips
1ARCH_ANY_ENDIAN=y
2ARCH_BIG_ENDIAN=y
3ARCH_CFLAGS="-mno-split-addresses"
4ARCH_WANTS_BIG_ENDIAN=y
5# CONFIG_MIPS_ISA_1 is not set
6# CONFIG_MIPS_ISA_2 is not set
7# CONFIG_MIPS_ISA_3 is not set
8# CONFIG_MIPS_ISA_4 is not set
9CONFIG_MIPS_ISA_MIPS32=y
10# CONFIG_MIPS_ISA_MIPS32R2 is not set
11# CONFIG_MIPS_ISA_MIPS64 is not set
12# CONFIG_MIPS_N32_ABI is not set
13# CONFIG_MIPS_N64_ABI is not set
14CONFIG_MIPS_O32_ABI=y
15TARGET_ARCH="mips"
16TARGET_mips=y
17UCLIBC_HAS_FPU=y
toolchain/uClibc/config-0.9.31/mips64
1ARCH_ANY_ENDIAN=y
2ARCH_BIG_ENDIAN=y
3ARCH_CFLAGS="-mno-split-addresses"
4ARCH_WANTS_BIG_ENDIAN=y
5# CONFIG_MIPS_ISA_1 is not set
6# CONFIG_MIPS_ISA_2 is not set
7# CONFIG_MIPS_ISA_3 is not set
8# CONFIG_MIPS_ISA_4 is not set
9# CONFIG_MIPS_ISA_MIPS32 is not set
10# CONFIG_MIPS_ISA_MIPS32R2 is not set
11CONFIG_MIPS_ISA_MIPS64=y
12# CONFIG_MIPS_N32_ABI is not set
13CONFIG_MIPS_N64_ABI=y
14# CONFIG_MIPS_O32_ABI is not set
15TARGET_ARCH="mips"
16TARGET_mips=y
17UCLIBC_HAS_FPU=y
toolchain/uClibc/config-0.9.31/mips64el
1ARCH_ANY_ENDIAN=y
2ARCH_CFLAGS="-mno-split-addresses"
3ARCH_LITTLE_ENDIAN=y
4ARCH_WANTS_LITTLE_ENDIAN=y
5# CONFIG_MIPS_ISA_1 is not set
6# CONFIG_MIPS_ISA_2 is not set
7# CONFIG_MIPS_ISA_3 is not set
8# CONFIG_MIPS_ISA_4 is not set
9# CONFIG_MIPS_ISA_MIPS32 is not set
10# CONFIG_MIPS_ISA_MIPS32R2 is not set
11CONFIG_MIPS_ISA_MIPS64=y
12# CONFIG_MIPS_N32_ABI is not set
13CONFIG_MIPS_N64_ABI=y
14# CONFIG_MIPS_O32_ABI is not set
15TARGET_ARCH="mips"
16TARGET_mips=y
17UCLIBC_HAS_FPU=y
toolchain/uClibc/config-0.9.31/mipsel
1ARCH_ANY_ENDIAN=y
2ARCH_CFLAGS="-mno-split-addresses"
3ARCH_LITTLE_ENDIAN=y
4ARCH_WANTS_LITTLE_ENDIAN=y
5# CONFIG_MIPS_ISA_1 is not set
6# CONFIG_MIPS_ISA_2 is not set
7# CONFIG_MIPS_ISA_3 is not set
8# CONFIG_MIPS_ISA_4 is not set
9CONFIG_MIPS_ISA_MIPS32=y
10# CONFIG_MIPS_ISA_MIPS32R2 is not set
11# CONFIG_MIPS_ISA_MIPS64 is not set
12# CONFIG_MIPS_N32_ABI is not set
13# CONFIG_MIPS_N64_ABI is not set
14CONFIG_MIPS_O32_ABI=y
15TARGET_ARCH="mips"
16TARGET_mips=y
17UCLIBC_HAS_FPU=y
toolchain/uClibc/config-0.9.31/mipsel.brcm-2.4
1ARCH_ANY_ENDIAN=y
2ARCH_CFLAGS="-mno-split-addresses"
3ARCH_LITTLE_ENDIAN=y
4ARCH_WANTS_LITTLE_ENDIAN=y
5# CONFIG_MIPS_ISA_1 is not set
6# CONFIG_MIPS_ISA_2 is not set
7# CONFIG_MIPS_ISA_3 is not set
8# CONFIG_MIPS_ISA_4 is not set
9CONFIG_MIPS_ISA_MIPS32=y
10# CONFIG_MIPS_ISA_MIPS32R2 is not set
11# CONFIG_MIPS_ISA_MIPS64 is not set
12# CONFIG_MIPS_N32_ABI is not set
13# CONFIG_MIPS_N64_ABI is not set
14CONFIG_MIPS_O32_ABI=y
15TARGET_ARCH="mips"
16TARGET_mips=y
17UCLIBC_HAS_FPU=y
18UCLIBC_LINUX_MODULE_24=y
toolchain/uClibc/config-0.9.31/mipsel.cobalt
1ARCH_ANY_ENDIAN=y
2ARCH_CFLAGS="-mno-split-addresses"
3ARCH_LITTLE_ENDIAN=y
4ARCH_WANTS_LITTLE_ENDIAN=y
5# CONFIG_MIPS_ISA_1 is not set
6# CONFIG_MIPS_ISA_2 is not set
7CONFIG_MIPS_ISA_3=y
8# CONFIG_MIPS_ISA_4 is not set
9# CONFIG_MIPS_ISA_MIPS32 is not set
10# CONFIG_MIPS_ISA_MIPS32R2 is not set
11# CONFIG_MIPS_ISA_MIPS64 is not set
12# CONFIG_MIPS_N32_ABI is not set
13# CONFIG_MIPS_N64_ABI is not set
14CONFIG_MIPS_O32_ABI=y
15TARGET_ARCH="mips"
16TARGET_mips=y
17UCLIBC_HAS_FPU=y
toolchain/uClibc/config-0.9.31/powerpc
1ARCH_BIG_ENDIAN=y
2CONFIG_CLASSIC=y
3# CONFIG_E500 is not set
4TARGET_ARCH="powerpc"
5TARGET_SUBARCH="classic"
6TARGET_powerpc=y
7UCLIBC_HAS_LONG_DOUBLE_MATH=y
toolchain/uClibc/config-0.9.31/ubicom32
1ARCH_BIG_ENDIAN=y
2ARCH_HAS_NO_MMU=y
3COMPAT_ATEXIT=y
4# CONFIG_UC_UBICOM32_V3 is not set
5CONFIG_UC_UBICOM32_V4=y
6# DOSTRIP is not set
7EXCLUDE_BRK=y
8FORCE_SHAREABLE_TEXT_SEGMENTS=y
9LDSO_PRELOAD_FILE_SUPPORT=y
10MALLOC=y
11# MALLOC_STANDARD is not set
12PTHREADS_DEBUG_SUPPORT=y
13SUPPORT_LD_DEBUG=y
14TARGET_ARCH="ubicom32"
15TARGET_ubicom32=y
16# UCLIBC_FORMAT_ELF is not set
17UCLIBC_FORMAT_FDPIC_ELF=y
18# UCLIBC_FORMAT_FLAT is not set
19# UCLIBC_FORMAT_FLAT_SEP_DATA is not set
20# UCLIBC_FORMAT_SHARED_FLAT is not set
21UCLIBC_HAS_ADVANCED_REALTIME=y
22UCLIBC_HAS_FOPEN_LARGEFILE_MODE=y
23UCLIBC_HAS_FPU=y
24# UCLIBC_HAS_GETPT is not set
25UCLIBC_HAS_OBSOLETE_BSD_SIGNAL=y
26UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL=y
27UCLIBC_HAS_PROFILING=y
28UCLIBC_HAS_REENTRANT_RPC=y
29UCLIBC_HAS_STUBS=y
30UCLIBC_HAS_XATTR=y
31UCLIBC_NTP_LEGACY=y
32UCLIBC_STATIC_LDCONFIG=y
33UCLIBC_SV4_DEPRECATED=y
34UCLIBC_UCLINUX_BROKEN_MUNMAP=y
35UNIX98PTY_ONLY=y
toolchain/uClibc/config-0.9.31/x86_64
1ARCH_LITTLE_ENDIAN=y
2# LINUXTHREADS_NEW is not set
3TARGET_ARCH="x86_64"
4TARGET_x86_64=y
5UCLIBC_BSD_SPECIFIC=y
6UCLIBC_HAS_FPU=y
7UCLIBC_HAS_LONG_DOUBLE_MATH=y
toolchain/uClibc/config-0.9.32/arm
1ARCH_ANY_ENDIAN=y
2ARCH_LITTLE_ENDIAN=y
3ARCH_WANTS_LITTLE_ENDIAN=y
4# CONFIG_ARM10T is not set
5# CONFIG_ARM1136JF_S is not set
6# CONFIG_ARM1176JZF_S is not set
7# CONFIG_ARM1176JZ_S is not set
8# CONFIG_ARM610 is not set
9# CONFIG_ARM710 is not set
10# CONFIG_ARM720T is not set
11# CONFIG_ARM7TDMI is not set
12# CONFIG_ARM920T is not set
13# CONFIG_ARM922T is not set
14# CONFIG_ARM926T is not set
15# CONFIG_ARM_CORTEX_M1 is not set
16# CONFIG_ARM_CORTEX_M3 is not set
17# CONFIG_ARM_EABI is not set
18# CONFIG_ARM_IWMMXT is not set
19CONFIG_ARM_OABI=y
20# CONFIG_ARM_SA110 is not set
21# CONFIG_ARM_SA1100 is not set
22CONFIG_ARM_XSCALE=y
23# CONFIG_GENERIC_ARM is not set
24TARGET_ARCH="arm"
25TARGET_arm=y
toolchain/uClibc/config-0.9.32/arm.cns3xxx
1ARCH_ANY_ENDIAN=y
2ARCH_LITTLE_ENDIAN=y
3ARCH_WANTS_LITTLE_ENDIAN=y
4# CONFIG_ARM10T is not set
5# CONFIG_ARM1136JF_S is not set
6CONFIG_ARM1176JZF_S=y
7# CONFIG_ARM1176JZ_S is not set
8# CONFIG_ARM610 is not set
9# CONFIG_ARM710 is not set
10# CONFIG_ARM720T is not set
11# CONFIG_ARM7TDMI is not set
12# CONFIG_ARM920T is not set
13# CONFIG_ARM922T is not set
14# CONFIG_ARM926T is not set
15# CONFIG_ARM_CORTEX_M1 is not set
16# CONFIG_ARM_CORTEX_M3 is not set
17# CONFIG_ARM_EABI is not set
18# CONFIG_ARM_IWMMXT is not set
19CONFIG_ARM_OABI=y
20# CONFIG_ARM_SA110 is not set
21# CONFIG_ARM_SA1100 is not set
22# CONFIG_ARM_XSCALE is not set
23# CONFIG_GENERIC_ARM is not set
24TARGET_ARCH="arm"
25TARGET_arm=y
toolchain/uClibc/config-0.9.32/arm.gemini
1ARCH_ANY_ENDIAN=y
2ARCH_LITTLE_ENDIAN=y
3ARCH_WANTS_LITTLE_ENDIAN=y
4# CONFIG_ARM10T is not set
5# CONFIG_ARM1136JF_S is not set
6# CONFIG_ARM1176JZF_S is not set
7# CONFIG_ARM1176JZ_S is not set
8# CONFIG_ARM610 is not set
9# CONFIG_ARM710 is not set
10# CONFIG_ARM720T is not set
11# CONFIG_ARM7TDMI is not set
12CONFIG_ARM920T=y
13# CONFIG_ARM922T is not set
14# CONFIG_ARM926T is not set
15# CONFIG_ARM_CORTEX_M1 is not set
16# CONFIG_ARM_CORTEX_M3 is not set
17# CONFIG_ARM_EABI is not set
18# CONFIG_ARM_IWMMXT is not set
19CONFIG_ARM_OABI=y
20# CONFIG_ARM_SA110 is not set
21# CONFIG_ARM_SA1100 is not set
22# CONFIG_ARM_XSCALE is not set
23# CONFIG_GENERIC_ARM is not set
24TARGET_ARCH="arm"
25TARGET_arm=y
26# USE_BX is not set
toolchain/uClibc/config-0.9.32/armeb
1ARCH_ANY_ENDIAN=y
2ARCH_BIG_ENDIAN=y
3ARCH_WANTS_BIG_ENDIAN=y
4# CONFIG_ARM10T is not set
5# CONFIG_ARM1136JF_S is not set
6# CONFIG_ARM1176JZF_S is not set
7# CONFIG_ARM1176JZ_S is not set
8# CONFIG_ARM610 is not set
9# CONFIG_ARM710 is not set
10# CONFIG_ARM720T is not set
11# CONFIG_ARM7TDMI is not set
12# CONFIG_ARM920T is not set
13# CONFIG_ARM922T is not set
14# CONFIG_ARM926T is not set
15# CONFIG_ARM_CORTEX_M1 is not set
16# CONFIG_ARM_CORTEX_M3 is not set
17# CONFIG_ARM_EABI is not set
18# CONFIG_ARM_IWMMXT is not set
19CONFIG_ARM_OABI=y
20# CONFIG_ARM_SA110 is not set
21# CONFIG_ARM_SA1100 is not set
22CONFIG_ARM_XSCALE=y
23# CONFIG_GENERIC_ARM is not set
24TARGET_ARCH="arm"
25TARGET_arm=y
toolchain/uClibc/config-0.9.32/avr32
1ARCH_BIG_ENDIAN=y
2CONFIG_AVR32_AP7=y
3FORCE_SHAREABLE_TEXT_SEGMENTS=y
4LINKRELAX=y
5TARGET_ARCH="avr32"
6TARGET_avr32=y
7UCLIBC_HAS_FPU=y
8# UCLIBC_HAS_SCANF_GLIBC_A_FLAG is not set
9# UCLIBC_HAS_STRING_ARCH_OPT is not set
10UNIX98PTY_ONLY=y
toolchain/uClibc/config-0.9.32/common
1# ARCH_ANY_ENDIAN is not set
2ARCH_HAS_MMU=y
3# ARCH_HAS_NO_LDSO is not set
4# ARCH_HAS_NO_SHARED is not set
5# ARCH_LITTLE_ENDIAN is not set
6ARCH_USE_MMU=y
7# ARCH_WANTS_BIG_ENDIAN is not set
8# ARCH_WANTS_LITTLE_ENDIAN is not set
9ASSUME_DEVPTS=y
10COMPAT_ATEXIT=y
11CROSS_COMPILER_PREFIX=""
12DEVEL_PREFIX="/usr/"
13# DOASSERTS is not set
14# DODEBUG is not set
15# DODEBUG_PT is not set
16# DOMULTI is not set
17DOPIC=y
18DOSTRIP=y
19DO_C99_MATH=y
20# DO_XSI_MATH is not set
21# EXTRA_WARNINGS is not set
22FORCE_OPTIONS_FOR_ARCH=y
23# FORCE_SHAREABLE_TEXT_SEGMENTS is not set
24# HARDWIRED_ABSPATH is not set
25# HAS_NO_THREADS is not set
26HAVE_DOT_CONFIG=y
27# HAVE_NO_PIC is not set
28# HAVE_NO_SSP is not set
29HAVE_SHARED=y
30KERNEL_HEADERS="."
31LDSO_BASE_FILENAME="ld.so"
32LDSO_CACHE_SUPPORT=y
33# LDSO_GNU_HASH_SUPPORT is not set
34LDSO_LDD_SUPPORT=y
35# LDSO_PRELOAD_FILE_SUPPORT is not set
36# LDSO_PRELOAD_ENV_SUPPORT is not set
37LDSO_RUNPATH=y
38# LDSO_SEARCH_INTERP_PATH is not set
39# LINUXTHREADS_NEW is not set
40# LINUXTHREADS_OLD is not set
41UCLIBC_HAS_THREADS_NATIVE=y
42# MALLOC is not set
43MALLOC_GLIBC_COMPAT=y
44# MALLOC_SIMPLE is not set
45MALLOC_STANDARD=y
46MULTILIB_DIR="lib"
47# PTHREADS_DEBUG_SUPPORT is not set
48RUNTIME_PREFIX="/"
49# SUPPORT_LD_DEBUG is not set
50# SUPPORT_LD_DEBUG_EARLY is not set
51TARGET_SUBARCH=""
52# TARGET_alpha is not set
53# TARGET_arm is not set
54# TARGET_avr32 is not set
55# TARGET_bfin is not set
56# TARGET_cris is not set
57# TARGET_e1 is not set
58# TARGET_frv is not set
59# TARGET_h8300 is not set
60# TARGET_hppa is not set
61# TARGET_i386 is not set
62# TARGET_i960 is not set
63# TARGET_ia64 is not set
64# TARGET_m68k is not set
65# TARGET_microblaze is not set
66# TARGET_mips is not set
67# TARGET_nios is not set
68# TARGET_nios2 is not set
69# TARGET_powerpc is not set
70# TARGET_sh is not set
71# TARGET_sh64 is not set
72# TARGET_sparc is not set
73# TARGET_ubicom32 is not set
74# TARGET_v850 is not set
75# TARGET_vax is not set
76# TARGET_x86_64 is not set
77# TARGET_xtensa is not set
78UCLIBC_BSD_SPECIFIC=y
79UCLIBC_BUILD_NOEXECSTACK=y
80# UCLIBC_BUILD_NOW is not set
81# UCLIBC_BUILD_PIE is not set
82UCLIBC_BUILD_RELRO=y
83UCLIBC_CTOR_DTOR=y
84UCLIBC_DYNAMIC_ATEXIT=y
85UCLIBC_EXTRA_CFLAGS=""
86UCLIBC_GRP_BUFFER_SIZE=256
87UCLIBC_HAS_ADVANCED_REALTIME=y
88# UCLIBC_HAS_ARC4RANDOM is not set
89UCLIBC_HAS_BSD_ERR=y
90UCLIBC_HAS_BSD_RES_CLOSE=y
91# UCLIBC_HAS_COMPAT_RES_STATE is not set
92UCLIBC_HAS_CRYPT=y
93UCLIBC_HAS_CRYPT_IMPL=y
94UCLIBC_HAS_CTYPE_CHECKED=y
95# UCLIBC_HAS_CTYPE_ENFORCED is not set
96UCLIBC_HAS_CTYPE_SIGNED=y
97UCLIBC_HAS_CTYPE_TABLES=y
98# UCLIBC_HAS_CTYPE_UNSAFE is not set
99UCLIBC_HAS_EPOLL=y
100UCLIBC_HAS_ERRNO_MESSAGES=y
101# UCLIBC_HAS_EXTRA_COMPAT_RES_STATE is not set
102# UCLIBC_HAS_FENV is not set
103UCLIBC_HAS_FLOATS=y
104UCLIBC_HAS_FNMATCH=y
105UCLIBC_HAS_FNMATCH_OLD=y
106UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y
107# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set
108# UCLIBC_HAS_FPU is not set
109UCLIBC_HAS_FTW=y
110UCLIBC_HAS_FULL_RPC=y
111UCLIBC_HAS_GETPT=y
112UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y
113UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
114UCLIBC_HAS_GLOB=y
115UCLIBC_HAS_GNU_ERROR=y
116UCLIBC_HAS_GNU_GETOPT=y
117UCLIBC_HAS_GNU_GETSUBOPT=y
118UCLIBC_HAS_GNU_GLOB=y
119UCLIBC_HAS_HEXADECIMAL_FLOATS=y
120UCLIBC_HAS_IPV4=y
121UCLIBC_HAS_IPV6=y
122UCLIBC_HAS_LFS=y
123UCLIBC_HAS_LIBNSL_STUB=y
124UCLIBC_HAS_LIBRESOLV_STUB=y
125UCLIBC_HAS_LIBUTIL=y
126# UCLIBC_HAS_LOCALE is not set
127UCLIBC_HAS_NETWORK_SUPPORT=y
128UCLIBC_HAS_NFTW=y
129# UCLIBC_HAS_OBSOLETE_BSD_SIGNAL is not set
130# UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL is not set
131UCLIBC_HAS_PRINTF_M_SPEC=y
132# UCLIBC_HAS_PROFILING is not set
133UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
134UCLIBC_HAS_PTY=y
135UCLIBC_HAS_REALTIME=y
136# UCLIBC_HAS_REENTRANT_RPC is not set
137UCLIBC_HAS_REGEX=y
138UCLIBC_HAS_REGEX_OLD=y
139UCLIBC_HAS_RPC=y
140UCLIBC_HAS_SCANF_GLIBC_A_FLAG=y
141UCLIBC_HAS_SHADOW=y
142UCLIBC_HAS_SIGNUM_MESSAGES=y
143UCLIBC_HAS_SOCKET=y
144UCLIBC_HAS_SOFT_FLOAT=y
145# UCLIBC_HAS_SSP is not set
146UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y
147# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set
148# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set
149# UCLIBC_HAS_STDIO_BUFSIZ_256 is not set
150UCLIBC_HAS_STDIO_BUFSIZ_4096=y
151# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set
152# UCLIBC_HAS_STDIO_BUFSIZ_8192 is not set
153# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set
154# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set
155# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set
156UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y
157UCLIBC_HAS_STDIO_GETC_MACRO=y
158UCLIBC_HAS_STDIO_PUTC_MACRO=y
159# UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT is not set
160UCLIBC_HAS_STRING_ARCH_OPT=y
161UCLIBC_HAS_STRING_GENERIC_OPT=y
162# UCLIBC_HAS_STUBS is not set
163UCLIBC_HAS_SYSLOG=y
164# UCLIBC_HAS_SYS_ERRLIST is not set
165# UCLIBC_HAS_SYS_SIGLIST is not set
166UCLIBC_HAS_THREADS=y
167UCLIBC_HAS_TM_EXTENSIONS=y
168UCLIBC_HAS_TZ_CACHING=y
169UCLIBC_HAS_TZ_FILE=y
170UCLIBC_HAS_TZ_FILE_READ_MANY=y
171UCLIBC_HAS_WCHAR=y
172UCLIBC_HAS_WORDEXP=y
173# UCLIBC_HAS_XATTR is not set
174UCLIBC_HAS___PROGNAME=y
175# UCLIBC_LINUX_MODULE_24 is not set
176UCLIBC_LINUX_SPECIFIC=y
177# UCLIBC_MALLOC_DEBUGGING is not set
178# UCLIBC_MJN3_ONLY is not set
179# UCLIBC_NTP_LEGACY is not set
180UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
181UCLIBC_PWD_BUFFER_SIZE=256
182# UCLIBC_STATIC_LDCONFIG is not set
183UCLIBC_SUPPORT_AI_ADDRCONFIG=y
184UCLIBC_SUSV3_LEGACY=y
185UCLIBC_SUSV3_LEGACY_MACROS=y
186UCLIBC_SUSV4_LEGACY=y
187# UCLIBC_SV4_DEPRECATED is not set
188UCLIBC_TZ_FILE_PATH="/etc/TZ"
189# UCLIBC_FALLBACK_TO_ETC_LOCALTIME is not set
190UCLIBC_USE_NETLINK=y
191# UNIX98PTY_ONLY is not set
192USE_BX=y
193WARNINGS="-Wall"
toolchain/uClibc/config-0.9.32/cris
1ARCH_LITTLE_ENDIAN=y
2CONFIG_CRIS=y
3# CONFIG_CRISV32 is not set
4TARGET_ARCH="cris"
5TARGET_cris=y
6UCLIBC_HAS_FPU=y
toolchain/uClibc/config-0.9.32/debug
1DODEBUG=y
2DODEBUG_PT=y
3PTHREADS_DEBUG_SUPPORT=y
4SUPPORT_LD_DEBUG=y
5SUPPORT_LD_DEBUG_EARLY=y
6UCLIBC_MALLOC_DEBUGGING=y
toolchain/uClibc/config-0.9.32/i386
1ARCH_LITTLE_ENDIAN=y
2# CONFIG_386 is not set
3CONFIG_486=y
4# CONFIG_586 is not set
5# CONFIG_586MMX is not set
6# CONFIG_686 is not set
7# CONFIG_CRUSOE is not set
8# CONFIG_CYRIXIII is not set
9# CONFIG_ELAN is not set
10# CONFIG_GENERIC_386 is not set
11# CONFIG_K6 is not set
12# CONFIG_K7 is not set
13# CONFIG_NEHEMIAH is not set
14# CONFIG_PENTIUM4 is not set
15# CONFIG_PENTIUMII is not set
16# CONFIG_PENTIUMIII is not set
17# CONFIG_WINCHIP2 is not set
18# CONFIG_WINCHIPC6 is not set
19TARGET_ARCH="i386"
20TARGET_i386=y
21UCLIBC_HAS_FPU=y
22UCLIBC_HAS_LONG_DOUBLE_MATH=y
toolchain/uClibc/config-0.9.32/i686
1ARCH_LITTLE_ENDIAN=y
2# CONFIG_386 is not set
3# CONFIG_486 is not set
4# CONFIG_586 is not set
5# CONFIG_586MMX is not set
6CONFIG_686=y
7# CONFIG_CRUSOE is not set
8# CONFIG_CYRIXIII is not set
9# CONFIG_ELAN is not set
10# CONFIG_GENERIC_386 is not set
11# CONFIG_K6 is not set
12# CONFIG_K7 is not set
13# CONFIG_NEHEMIAH is not set
14# CONFIG_PENTIUM4 is not set
15# CONFIG_PENTIUMII is not set
16# CONFIG_PENTIUMIII is not set
17# CONFIG_WINCHIP2 is not set
18# CONFIG_WINCHIPC6 is not set
19TARGET_ARCH="i386"
20TARGET_i386=y
21UCLIBC_HAS_FPU=y
22UCLIBC_HAS_LONG_DOUBLE_MATH=y
toolchain/uClibc/config-0.9.32/m68k
1ARCH_BIG_ENDIAN=y
2TARGET_ARCH="m68k"
3TARGET_SUBARCH=""
4TARGET_m68k=y
5UCLIBC_HAS_LONG_DOUBLE_MATH=y
toolchain/uClibc/config-0.9.32/mips
1ARCH_ANY_ENDIAN=y
2ARCH_BIG_ENDIAN=y
3ARCH_CFLAGS="-mno-split-addresses"
4ARCH_WANTS_BIG_ENDIAN=y
5# CONFIG_MIPS_ISA_1 is not set
6# CONFIG_MIPS_ISA_2 is not set
7# CONFIG_MIPS_ISA_3 is not set
8# CONFIG_MIPS_ISA_4 is not set
9CONFIG_MIPS_ISA_MIPS32=y
10# CONFIG_MIPS_ISA_MIPS32R2 is not set
11# CONFIG_MIPS_ISA_MIPS64 is not set
12# CONFIG_MIPS_N32_ABI is not set
13# CONFIG_MIPS_N64_ABI is not set
14CONFIG_MIPS_O32_ABI=y
15TARGET_ARCH="mips"
16TARGET_mips=y
17UCLIBC_HAS_FPU=y
toolchain/uClibc/config-0.9.32/mips64
1ARCH_ANY_ENDIAN=y
2ARCH_BIG_ENDIAN=y
3ARCH_CFLAGS="-mno-split-addresses"
4ARCH_WANTS_BIG_ENDIAN=y
5# CONFIG_MIPS_ISA_1 is not set
6# CONFIG_MIPS_ISA_2 is not set
7# CONFIG_MIPS_ISA_3 is not set
8# CONFIG_MIPS_ISA_4 is not set
9# CONFIG_MIPS_ISA_MIPS32 is not set
10# CONFIG_MIPS_ISA_MIPS32R2 is not set
11CONFIG_MIPS_ISA_MIPS64=y
12# CONFIG_MIPS_N32_ABI is not set
13CONFIG_MIPS_N64_ABI=y
14# CONFIG_MIPS_O32_ABI is not set
15TARGET_ARCH="mips"
16TARGET_mips=y
17UCLIBC_HAS_FPU=y
toolchain/uClibc/config-0.9.32/mips64el
1ARCH_ANY_ENDIAN=y
2ARCH_CFLAGS="-mno-split-addresses"
3ARCH_LITTLE_ENDIAN=y
4ARCH_WANTS_LITTLE_ENDIAN=y
5# CONFIG_MIPS_ISA_1 is not set
6# CONFIG_MIPS_ISA_2 is not set
7# CONFIG_MIPS_ISA_3 is not set
8# CONFIG_MIPS_ISA_4 is not set
9# CONFIG_MIPS_ISA_MIPS32 is not set
10# CONFIG_MIPS_ISA_MIPS32R2 is not set
11CONFIG_MIPS_ISA_MIPS64=y
12# CONFIG_MIPS_N32_ABI is not set
13CONFIG_MIPS_N64_ABI=y
14# CONFIG_MIPS_O32_ABI is not set
15TARGET_ARCH="mips"
16TARGET_mips=y
17UCLIBC_HAS_FPU=y
toolchain/uClibc/config-0.9.32/mipsel
1ARCH_ANY_ENDIAN=y
2ARCH_CFLAGS="-mno-split-addresses"
3ARCH_LITTLE_ENDIAN=y
4ARCH_WANTS_LITTLE_ENDIAN=y
5# CONFIG_MIPS_ISA_1 is not set
6# CONFIG_MIPS_ISA_2 is not set
7# CONFIG_MIPS_ISA_3 is not set
8# CONFIG_MIPS_ISA_4 is not set
9CONFIG_MIPS_ISA_MIPS32=y
10# CONFIG_MIPS_ISA_MIPS32R2 is not set
11# CONFIG_MIPS_ISA_MIPS64 is not set
12# CONFIG_MIPS_N32_ABI is not set
13# CONFIG_MIPS_N64_ABI is not set
14CONFIG_MIPS_O32_ABI=y
15TARGET_ARCH="mips"
16TARGET_mips=y
17UCLIBC_HAS_FPU=y
toolchain/uClibc/config-0.9.32/mipsel.brcm-2.4
1ARCH_ANY_ENDIAN=y
2ARCH_CFLAGS="-mno-split-addresses"
3ARCH_LITTLE_ENDIAN=y
4ARCH_WANTS_LITTLE_ENDIAN=y
5# CONFIG_MIPS_ISA_1 is not set
6# CONFIG_MIPS_ISA_2 is not set
7# CONFIG_MIPS_ISA_3 is not set
8# CONFIG_MIPS_ISA_4 is not set
9CONFIG_MIPS_ISA_MIPS32=y
10# CONFIG_MIPS_ISA_MIPS32R2 is not set
11# CONFIG_MIPS_ISA_MIPS64 is not set
12# CONFIG_MIPS_N32_ABI is not set
13# CONFIG_MIPS_N64_ABI is not set
14CONFIG_MIPS_O32_ABI=y
15TARGET_ARCH="mips"
16TARGET_mips=y
17UCLIBC_HAS_FPU=y
18UCLIBC_LINUX_MODULE_24=y
toolchain/uClibc/config-0.9.32/mipsel.cobalt
1ARCH_ANY_ENDIAN=y
2ARCH_CFLAGS="-mno-split-addresses"
3ARCH_LITTLE_ENDIAN=y
4ARCH_WANTS_LITTLE_ENDIAN=y
5# CONFIG_MIPS_ISA_1 is not set
6# CONFIG_MIPS_ISA_2 is not set
7CONFIG_MIPS_ISA_3=y
8# CONFIG_MIPS_ISA_4 is not set
9# CONFIG_MIPS_ISA_MIPS32 is not set
10# CONFIG_MIPS_ISA_MIPS32R2 is not set
11# CONFIG_MIPS_ISA_MIPS64 is not set
12# CONFIG_MIPS_N32_ABI is not set
13# CONFIG_MIPS_N64_ABI is not set
14CONFIG_MIPS_O32_ABI=y
15TARGET_ARCH="mips"
16TARGET_mips=y
17UCLIBC_HAS_FPU=y
toolchain/uClibc/config-0.9.32/powerpc
1ARCH_BIG_ENDIAN=y
2CONFIG_CLASSIC=y
3# CONFIG_E500 is not set
4TARGET_ARCH="powerpc"
5TARGET_SUBARCH="classic"
6TARGET_powerpc=y
7UCLIBC_HAS_LONG_DOUBLE_MATH=y
toolchain/uClibc/config-0.9.32/ubicom32
1ARCH_BIG_ENDIAN=y
2ARCH_HAS_NO_MMU=y
3COMPAT_ATEXIT=y
4# CONFIG_UC_UBICOM32_V3 is not set
5CONFIG_UC_UBICOM32_V4=y
6# DOSTRIP is not set
7EXCLUDE_BRK=y
8FORCE_SHAREABLE_TEXT_SEGMENTS=y
9LDSO_PRELOAD_FILE_SUPPORT=y
10MALLOC=y
11# MALLOC_STANDARD is not set
12PTHREADS_DEBUG_SUPPORT=y
13SUPPORT_LD_DEBUG=y
14TARGET_ARCH="ubicom32"
15TARGET_ubicom32=y
16# UCLIBC_FORMAT_ELF is not set
17UCLIBC_FORMAT_FDPIC_ELF=y
18# UCLIBC_FORMAT_FLAT is not set
19# UCLIBC_FORMAT_FLAT_SEP_DATA is not set
20# UCLIBC_FORMAT_SHARED_FLAT is not set
21UCLIBC_HAS_FOPEN_LARGEFILE_MODE=y
22UCLIBC_HAS_FPU=y
23# UCLIBC_HAS_GETPT is not set
24UCLIBC_HAS_OBSOLETE_BSD_SIGNAL=y
25UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL=y
26UCLIBC_HAS_PROFILING=y
27UCLIBC_HAS_REENTRANT_RPC=y
28UCLIBC_HAS_STUBS=y
29UCLIBC_HAS_XATTR=y
30UCLIBC_NTP_LEGACY=y
31UCLIBC_STATIC_LDCONFIG=y
32UCLIBC_SV4_DEPRECATED=y
33UCLIBC_UCLINUX_BROKEN_MUNMAP=y
34UNIX98PTY_ONLY=y
toolchain/uClibc/config-0.9.32/x86_64
1ARCH_LITTLE_ENDIAN=y
2# LINUXTHREADS_NEW is not set
3TARGET_ARCH="x86_64"
4TARGET_x86_64=y
5UCLIBC_BSD_SPECIFIC=y
6UCLIBC_HAS_FPU=y
7UCLIBC_HAS_LONG_DOUBLE_MATH=y
toolchain/uClibc/patches-0.9.31/110-compat_macros.patch
1--- a/include/string.h
2@@ -357,18 +357,40 @@ extern char *index (__const char *__s, i
3 /* Find the last occurrence of C in S (same as strrchr). */
4 extern char *rindex (__const char *__s, int __c)
5      __THROW __attribute_pure__ __nonnull ((1));
6-# else
7-# ifdef __UCLIBC_SUSV3_LEGACY_MACROS__
8+# elif defined(__UCLIBC_SUSV3_LEGACY_MACROS__) && !defined(_STRINGS_H)
9 /* bcopy/bzero/bcmp/index/rindex are marked LEGACY in SuSv3.
10  * They are replaced as proposed by SuSv3. Don't sync this part
11  * with glibc and keep it in sync with strings.h. */
12
13-# define bcopy(src,dest,n) (memmove((dest), (src), (n)), (void) 0)
14-# define bzero(s,n) (memset((s), '\0', (n)), (void) 0)
15-# define bcmp(s1,s2,n) memcmp((s1), (s2), (size_t)(n))
16-# define index(s,c) strchr((s), (c))
17-# define rindex(s,c) strrchr((s), (c))
18-# endif
19+/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
20+static __inline__ void bcopy (__const void *__src, void *__dest, size_t __n)
21+{
22+ memmove(__dest, __src, __n);
23+}
24+
25+/* Set N bytes of S to 0. */
26+static __inline__ void bzero (void *__s, size_t __n)
27+{
28+ memset(__s, 0, __n);
29+}
30+
31+/* Compare N bytes of S1 and S2 (same as memcmp). */
32+static __inline__ int bcmp (__const void *__s1, __const void *__s2, size_t __n)
33+{
34+ return memcmp(__s1, __s2, __n);
35+}
36+
37+/* Find the first occurrence of C in S (same as strchr). */
38+static __inline__ char *index (__const char *__s, int __c)
39+{
40+ return strchr(__s, __c);
41+}
42+
43+/* Find the last occurrence of C in S (same as strrchr). */
44+static __inline__ char *rindex (__const char *__s, int __c)
45+{
46+ return strrchr(__s, __c);
47+}
48 # endif
49
50 /* Return the position of the first bit set in I, or 0 if none are set.
toolchain/uClibc/patches-0.9.31/120-adjtimex.patch
1--- a/include/sys/timex.h
2@@ -116,9 +116,8 @@ struct timex
3
4 __BEGIN_DECLS
5
6-#if 0
7-extern int __adjtimex (struct timex *__ntx) __THROW;
8-#endif
9+#undef __adjtimex
10+#define __adjtimex adjtimex
11 extern int adjtimex (struct timex *__ntx) __THROW;
12 libc_hidden_proto(adjtimex)
13
toolchain/uClibc/patches-0.9.31/140-math_decl.patch
1--- a/libc/sysdeps/linux/common/bits/mathcalls.h
2@@ -237,8 +237,7 @@ __END_NAMESPACE_C99
3
4
5 /* Return nonzero if VALUE is not a number. */
6-/* DELETE? __MATHDECL_PRIV adds another "__": so this is "____isnan"???! */
7-/*__MATHDECL_PRIV (int,__isnan,, (_Mdouble_ __value), (__const__))*/
8+__MATHDECL_PRIV (int,isnan,, (_Mdouble_ __value), (__const__));
9
10 #if defined __USE_MISC || defined __USE_XOPEN
11 /* Return nonzero if VALUE is not a number. */
toolchain/uClibc/patches-0.9.31/170-math_finite.patch
1--- a/include/math.h
2@@ -198,7 +198,7 @@ libm_hidden_proto(signgam)
3
4
5 /* ISO C99 defines some generic macros which work on any data type. */
6-#ifdef __USE_ISOC99
7+#if defined(__USE_ISOC99) || defined(__USE_BSD)
8
9 /* Get the architecture specific values describing the floating-point
10    evaluation. The following symbols will get defined:
11@@ -318,6 +318,11 @@ enum
12
13 #endif /* Use ISO C99. */
14
15+/* BSD compat */
16+#define finite(x) __finite(x)
17+#define finitef(x) __finitef(x)
18+#define finitel(x) __finitel(x)
19+
20 #ifdef __USE_MISC
21 /* Support for various different standard error handling behaviors. */
22 typedef enum
toolchain/uClibc/patches-0.9.31/410-llvm_workaround.patch
1--- a/libc/stdio/_stdio.c
2@@ -119,7 +119,7 @@ static FILE _stdio_streams[] = {
3                              __FLAG_NBF|__FLAG_WRITEONLY, \
4                              2, \
5                              NULL, \
6- NULL, \
7+ 0, \
8                              0 )
9 };
10
toolchain/uClibc/patches-0.9.31/450-powerpc_copysignl.patch
1--- a/libc/sysdeps/linux/powerpc/Makefile.arch
2@@ -5,7 +5,7 @@
3 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
4 #
5
6-CSRC := __syscall_error.c pread_write.c ioctl.c
7+CSRC := __syscall_error.c pread_write.c ioctl.c copysignl.c
8
9 ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y)
10 CSRC += posix_fadvise.c posix_fadvise64.c
11--- /dev/null
12@@ -0,0 +1,89 @@
13+/* s_copysignl.c -- long double version of s_copysign.c.
14+ * Conversion to long double by Ulrich Drepper,
15+ * Cygnus Support, drepper@cygnus.com.
16+ */
17+
18+/*
19+ * ====================================================
20+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
21+ *
22+ * Developed at SunPro, a Sun Microsystems, Inc. business.
23+ * Permission to use, copy, modify, and distribute this
24+ * software is freely granted, provided that this notice
25+ * is preserved.
26+ * ====================================================
27+ */
28+
29+/*
30+ * copysignl(long double x, long double y)
31+ * copysignl(x,y) returns a value with the magnitude of x and
32+ * with the sign bit of y.
33+ */
34+
35+#include <endian.h>
36+#include <stdint.h>
37+
38+#if __FLOAT_WORD_ORDER == BIG_ENDIAN
39+
40+typedef union
41+{
42+ long double value;
43+ struct
44+ {
45+ int sign_exponent:16;
46+ unsigned int empty:16;
47+ uint32_t msw;
48+ uint32_t lsw;
49+ } parts;
50+} ieee_long_double_shape_type;
51+
52+#endif
53+
54+#if __FLOAT_WORD_ORDER == LITTLE_ENDIAN
55+
56+typedef union
57+{
58+ long double value;
59+ struct
60+ {
61+ uint32_t lsw;
62+ uint32_t msw;
63+ int sign_exponent:16;
64+ unsigned int empty:16;
65+ } parts;
66+} ieee_long_double_shape_type;
67+
68+#endif
69+
70+/* Get int from the exponent of a long double. */
71+
72+#define GET_LDOUBLE_EXP(exp,d) \
73+do { \
74+ ieee_long_double_shape_type ge_u; \
75+ ge_u.value = (d); \
76+ (exp) = ge_u.parts.sign_exponent; \
77+} while (0)
78+
79+/* Set exponent of a long double from an int. */
80+
81+#define SET_LDOUBLE_EXP(d,exp) \
82+do { \
83+ ieee_long_double_shape_type se_u; \
84+ se_u.value = (d); \
85+ se_u.parts.sign_exponent = (exp); \
86+ (d) = se_u.value; \
87+} while (0)
88+
89+long double copysignl(long double x, long double y);
90+libc_hidden_proto(copysignl);
91+
92+long double copysignl(long double x, long double y)
93+{
94+ uint32_t es1,es2;
95+ GET_LDOUBLE_EXP(es1,x);
96+ GET_LDOUBLE_EXP(es2,y);
97+ SET_LDOUBLE_EXP(x,(es1&0x7fff)|(es2&0x8000));
98+ return x;
99+}
100+
101+libc_hidden_def(copysignl);
toolchain/uClibc/patches-0.9.31/600-ubicom32-uClibc.patch
1--- a/Rules.mak
2@@ -477,6 +477,17 @@ ifeq ($(TARGET_ARCH),microblaze)
3       SYMBOL_PREFIX=_
4 endif
5
6+ifeq ($(TARGET_ARCH),ubicom32)
7+ OPTIMIZATION+=-fstrict-aliasing
8+ CPU_CFLAGS-$(CONFIG_UBICOM32_V3)+=-march=ubicom32v3
9+ CPU_CFLAGS-$(CONFIG_UBICOM32_V4)+=-march=ubicom32v4
10+ifeq ($(UCLIBC_FORMAT_FDPIC_ELF),y)
11+ CPU_CFLAGS-y:=-mfdpic
12+ CPU_LDFLAGS-y += -Wl,-melf32ubicom32fdpic
13+endif
14+
15+endif
16+
17 ifeq ($(TARGET_ARCH),v850)
18       SYMBOL_PREFIX=_
19 endif
20--- a/extra/Configs/Config.in
21@@ -102,6 +102,9 @@ config TARGET_sh64
22 config TARGET_sparc
23     bool "sparc"
24
25+config TARGET_ubicom32
26+ bool "ubicom32"
27+
28 config TARGET_v850
29     bool "v850 (BROKEN)"
30
31@@ -203,6 +206,10 @@ if TARGET_sparc
32 source "extra/Configs/Config.sparc"
33 endif
34
35+if TARGET_ubicom32
36+source "extra/Configs/Config.ubicom32"
37+endif
38+
39 if TARGET_v850
40 source "extra/Configs/Config.v850"
41 endif
42--- a/extra/Configs/Config.in.arch
43@@ -149,7 +149,7 @@ config UCLIBC_HAS_SOFT_FLOAT
44 config DO_C99_MATH
45     bool "Enable full C99 math library support"
46     depends on UCLIBC_HAS_FLOATS
47- default n
48+ default y
49     help
50       If you want the uClibc math library to contain the full set C99
51       math library features, then answer Y. If you leave this set to
52--- /dev/null
53@@ -0,0 +1,44 @@
54+#
55+# For a description of the syntax of this configuration file,
56+# see extra/config/Kconfig-language.txt
57+#
58+
59+config TARGET_ARCH
60+ string
61+ default "ubicom32"
62+
63+config FORCE_OPTIONS_FOR_ARCH
64+ bool
65+ default y
66+ select ARCH_BIG_ENDIAN
67+ select ARCH_HAS_NO_MMU
68+
69+choice
70+ prompt "Target Processor Architecture"
71+ default CONFIG_UC_UBICOM32_V3
72+ help
73+ This selects the instruction set architecture of your Ubicom32 CPU. This
74+ information is used for optimizing purposes. To build a library that
75+ will run on any Ubicom32 CPU, you can specify "v3" here.
76+ If you pick anything other than "v3," there is no
77+ guarantee that uClibc will even run on anything other than the
78+ selected processor type.
79+
80+ You should probably select the Ubicom32 ISA that best matches the
81+ CPU you will be using on your device. uClibc will be tuned
82+ for that architecture.
83+
84+ If you don't know what to do, choose "v3"
85+
86+config CONFIG_UC_UBICOM32_V3
87+ bool "ISA v3"
88+
89+config CONFIG_UC_UBICOM32_V4
90+ bool "ISA v4"
91+endchoice
92+
93+config ARCH_CFLAGS
94+ string
95+
96+config CROSS
97+ string
98--- a/include/elf.h
99@@ -337,6 +337,8 @@ typedef struct
100
101 #define EM_XSTORMY16 0xad45
102
103+#define EM_UBICOM32 0xde3d /* Ubicom32; no ABI */
104+
105 /* FRV magic number - no EABI available??. */
106 #define EM_CYGNUS_FRV 0x5441
107
108@@ -3063,6 +3065,55 @@ typedef Elf32_Addr Elf32_Conflict;
109 /* Keep this the last entry. */
110 #define R_XTENSA_NUM 50
111
112+/* Ubicom32 ELF relocation types */
113+#define R_UBICOM32_NONE 0
114+#define R_UBICOM32_16 1
115+#define R_UBICOM32_32 2
116+#define R_UBICOM32_LO16 3
117+#define R_UBICOM32_HI16 4
118+#define R_UBICOM32_21_PCREL 5
119+#define R_UBICOM32_24_PCREL 6
120+#define R_UBICOM32_HI24 7
121+#define R_UBICOM32_LO7_S 8
122+#define R_UBICOM32_LO7_2_S 9
123+#define R_UBICOM32_LO7_4_S 10
124+#define R_UBICOM32_LO7_D 11
125+#define R_UBICOM32_LO7_2_D 12
126+#define R_UBICOM32_LO7_4_D 13
127+#define R_UBICOM32_32_HARVARD 14
128+#define R_UBICOM32_LO7_CALLI 15
129+#define R_UBICOM32_LO16_CALLI 16
130+#define R_UBICOM32_GOT_HI24 17
131+#define R_UBICOM32_GOT_LO7_S 18
132+#define R_UBICOM32_GOT_LO7_2_S 19
133+#define R_UBICOM32_GOT_LO7_4_S 20
134+#define R_UBICOM32_GOT_LO7_D 21
135+#define R_UBICOM32_GOT_LO7_2_D 22
136+#define R_UBICOM32_GOT_LO7_4_D 23
137+#define R_UBICOM32_FUNCDESC_GOT_HI24 24
138+#define R_UBICOM32_FUNCDESC_GOT_LO7_S 25
139+#define R_UBICOM32_FUNCDESC_GOT_LO7_2_S 26
140+#define R_UBICOM32_FUNCDESC_GOT_LO7_4_S 27
141+#define R_UBICOM32_FUNCDESC_GOT_LO7_D 28
142+#define R_UBICOM32_FUNCDESC_GOT_LO7_2_D 29
143+#define R_UBICOM32_FUNCDESC_GOT_LO7_4_D 30
144+#define R_UBICOM32_GOT_LO7_CALLI 31
145+#define R_UBICOM32_FUNCDESC_GOT_LO7_CALLI 32
146+#define R_UBICOM32_FUNCDESC_VALUE 33
147+#define R_UBICOM32_FUNCDESC 34
148+#define R_UBICOM32_GOTOFFSET_LO 35
149+#define R_UBICOM32_GOTOFFSET_HI 36
150+#define R_UBICOM32_FUNCDESC_GOTOFFSET_LO 37
151+#define R_UBICOM32_FUNCDESC_GOTOFFSET_HI 38
152+#define R_UBICOM32_GNU_VTINHERIT 200
153+#define R_UBICOM32_GNU_VTENTRY 201
154+
155+/* Ubicom32 Flags. */
156+#define EF_UBICOM32_V3 0x00000001 /* -fmarch=ubicom32v3 */
157+#define EF_UBICOM32_V4 0x00000002 /* -fmarch=ubicom32v4 */
158+#define EF_UBICOM32_PIC 0x80000000 /* -fpic */
159+#define EF_UBICOM32_FDPIC 0x40000000 /* -mfdpic */
160+
161 #ifdef __cplusplus
162 }
163 #endif
164--- a/include/features.h
165@@ -445,4 +445,10 @@ uClibc was built without large file supp
166 # include <libc-internal.h>
167 #endif
168
169+#ifndef libc_hidden_proto
170+#define libc_hidden_proto(name, attrs...)
171+#endif
172+#ifndef libm_hidden_proto
173+#define libm_hidden_proto(name, attrs...)
174+#endif
175 #endif /* features.h */
176--- a/ldso/ldso/dl-startup.c
177@@ -164,10 +164,13 @@ DL_START(unsigned long args)
178         aux_dat += 2;
179     }
180
181+#if !defined __FDPIC__
182     /* locate the ELF header. We need this done as soon as possible
183      * (esp since SEND_STDERR() needs this on some platforms... */
184     if (!auxvt[AT_BASE].a_un.a_val)
185         auxvt[AT_BASE].a_un.a_val = elf_machine_load_address();
186+#endif
187+
188     DL_INIT_LOADADDR_BOOT(load_addr, auxvt[AT_BASE].a_un.a_val);
189     header = (ElfW(Ehdr) *) auxvt[AT_BASE].a_un.a_val;
190
191--- a/ldso/ldso/ldso.c
192@@ -325,10 +325,12 @@ void _dl_get_ready_to_run(struct elf_res
193         _dl_progname = argv[0];
194     }
195
196+#if 0 // blackfin does this, we do to avoid die during reloc
197     if (_start == (void *) auxvt[AT_ENTRY].a_un.a_val) {
198         _dl_dprintf(_dl_debug_file, "Standalone execution is not supported yet\n");
199         _dl_exit(1);
200     }
201+#endif
202
203     /* Start to build the tables of the modules that are required for
204      * this beast to run. We start with the basic executable, and then
205--- /dev/null
206@@ -0,0 +1,72 @@
207+/* vi: set sw=4 ts=4: */
208+/* Ubicom32 ELF shared library loader suppport
209+ *
210+ * Copyright (c) 2009 Ubicom Inc.
211+ * Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald,
212+ * David Engel, Hongjiu Lu and Mitch D'Souza
213+ * Copyright (C) 2001-2004 Erik Andersen
214+ *
215+ * All rights reserved.
216+ *
217+ * Redistribution and use in source and binary forms, with or without
218+ * modification, are permitted provided that the following conditions
219+ * are met:
220+ * 1. Redistributions of source code must retain the above copyright
221+ * notice, this list of conditions and the following disclaimer.
222+ * 2. The name of the above contributors may not be
223+ * used to endorse or promote products derived from this software
224+ * without specific prior written permission.
225+ *
226+ * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
227+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
228+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
229+ * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE
230+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
231+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
232+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
233+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
234+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
235+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
236+ * SUCH DAMAGE.
237+ */
238+
239+static const char *_dl_reltypes_tab[] =
240+{
241+ "R_UBICOM32_NONE", /* 0 */
242+ "R_UBICOM32_16",
243+ "R_UBICOM32_32",
244+ "R_UBICOM32_LO16",
245+ "R_UBICOM32_HI16",
246+ "R_UBICOM32_21_PCREL", /* 5 */
247+ "R_UBICOM32_24_PCREL",
248+ "R_UBICOM32_HI24",
249+ "R_UBICOM32_LO7_S",
250+ "R_UBICOM32_LO7_2_S",
251+ "R_UBICOM32_LO7_4_S", /* 10 */
252+ "R_UBICOM32_LO7_D",
253+ "R_UBICOM32_LO7_2_D",
254+ "R_UBICOM32_LO7_4_D",
255+ "R_UBICOM32_32_HARVARD",
256+ "R_UBICOM32_LO7_CALLI", /* 15 */
257+ "R_UBICOM32_LO16_CALLI",
258+ "R_UBICOM32_GOT_HI24",
259+ "R_UBICOM32_GOT_LO7_S",
260+ "R_UBICOM32_GOT_LO7_2_S"
261+ "R_UBICOM32_GOT_LO7_4_S", /* 20 */
262+ "R_UBICOM32_GOT_LO7_D",
263+ "R_UBICOM32_GOT_LO7_2_D",
264+ "R_UBICOM32_GOT_LO7_4_D",
265+ "R_UBICOM32_FUNCDESC_GOT_HI24 24",
266+ "R_UBICOM32_FUNCDESC_GOT_LO7_S", /* 25 */
267+ "R_UBICOM32_FUNCDESC_GOT_LO7_2_S",
268+ "R_UBICOM32_FUNCDESC_GOT_LO7_4_S",
269+ "R_UBICOM32_FUNCDESC_GOT_LO7_D",
270+ "R_UBICOM32_FUNCDESC_GOT_LO7_2_D",
271+ "R_UBICOM32_FUNCDESC_GOT_LO7_4_D", /* 30 */
272+ "R_UBICOM32_GOT_LO7_CALLI",
273+ "R_UBICOM32_FUNCDESC_VALUE",
274+ "R_UBICOM32_FUNCDESC",
275+#if 1
276+ [200] "R_UBICOM32_GNU_VTINHERIT" , "R_UBICOM32_GNU_VTENTRY"
277+#endif
278+};
279--- /dev/null
280@@ -0,0 +1,582 @@
281+ /* Copyright (C) 2003, 2004 Red Hat, Inc.
282+ Contributed by Alexandre Oliva <aoliva@redhat.com>
283+
284+This file is part of uClibc.
285+
286+uClibc is free software; you can redistribute it and/or modify it
287+under the terms of the GNU Lesser General Public License as
288+published by the Free Software Foundation; either version 2.1 of the
289+License, or (at your option) any later version.
290+
291+uClibc is distributed in the hope that it will be useful, but WITHOUT
292+ANY WARRANTY; without even the implied warranty of
293+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
294+Library General Public License for more details.
295+
296+You should have received a copy of the GNU Lesser General Public
297+License along with uClibc; see the file COPYING.LIB. If not, write to
298+the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
299+USA. */
300+
301+//#include <bfin_sram.h>
302+#define SRAM_TEST(x) 0
303+#ifndef _dl_assert
304+# define _dl_assert(expr)
305+#endif
306+
307+/* Initialize a DL_LOADADDR_TYPE given a got pointer and a complete
308+ load map. */
309+static __always_inline void
310+__dl_init_loadaddr_map (struct elf32_fdpic_loadaddr *loadaddr, Elf32_Addr dl_boot_got_pointer,
311+ struct elf32_fdpic_loadmap *map)
312+{
313+ if (map->version != 0)
314+ {
315+ SEND_EARLY_STDERR ("Invalid loadmap version number\n");
316+ _dl_exit(-1);
317+ }
318+ if (map->nsegs == 0)
319+ {
320+ SEND_EARLY_STDERR ("Invalid segment count in loadmap\n");
321+ _dl_exit(-1);
322+ }
323+ loadaddr->got_value = (void*)dl_boot_got_pointer;
324+ loadaddr->map = map;
325+}
326+
327+/* Figure out how many LOAD segments there are in the given headers,
328+ and allocate a block for the load map big enough for them.
329+ got_value will be properly initialized later on, with INIT_GOT. */
330+static __always_inline int
331+__dl_init_loadaddr (struct elf32_fdpic_loadaddr *loadaddr, Elf32_Phdr *ppnt,
332+ int pcnt)
333+{
334+ int count = 0, i;
335+ size_t size;
336+
337+ for (i = 0; i < pcnt; i++)
338+ if (ppnt[i].p_type == PT_LOAD)
339+ count++;
340+
341+ loadaddr->got_value = 0;
342+
343+ size = sizeof (struct elf32_fdpic_loadmap)
344+ + sizeof (struct elf32_fdpic_loadseg) * count;
345+ loadaddr->map = _dl_malloc (size);
346+ if (! loadaddr->map)
347+ _dl_exit (-1);
348+
349+ loadaddr->map->version = 0;
350+ loadaddr->map->nsegs = 0;
351+
352+ return count;
353+}
354+
355+#if defined (__SUPPORT_LD_DEBUG__)
356+extern char *_dl_debug;
357+extern int _dl_debug_file;
358+#endif
359+
360+/* Incrementally initialize a load map. */
361+static __always_inline void
362+__dl_init_loadaddr_hdr (struct elf32_fdpic_loadaddr loadaddr, void *addr,
363+ Elf32_Phdr *phdr, int maxsegs)
364+{
365+ struct elf32_fdpic_loadseg *segdata;
366+
367+ if (loadaddr.map->nsegs == maxsegs)
368+ _dl_exit (-1);
369+
370+ segdata = &loadaddr.map->segs[loadaddr.map->nsegs++];
371+ segdata->addr = (Elf32_Addr) addr;
372+ segdata->p_vaddr = phdr->p_vaddr;
373+ segdata->p_memsz = phdr->p_memsz;
374+
375+#if defined (__SUPPORT_LD_DEBUG__)
376+ {
377+ if (_dl_debug)
378+ _dl_dprintf(_dl_debug_file, "%i: mapped %x at %x, size %x\n",
379+ loadaddr.map->nsegs-1,
380+ segdata->p_vaddr, segdata->addr, segdata->p_memsz);
381+ }
382+#endif
383+}
384+
385+static __always_inline void __dl_loadaddr_unmap
386+(struct elf32_fdpic_loadaddr loadaddr, struct funcdesc_ht *funcdesc_ht);
387+
388+/* Figure out whether the given address is in one of the mapped
389+ segments. */
390+static __always_inline int
391+__dl_addr_in_loadaddr (void *p, struct elf32_fdpic_loadaddr loadaddr)
392+{
393+ struct elf32_fdpic_loadmap *map = loadaddr.map;
394+ int c;
395+
396+ for (c = 0; c < map->nsegs; c++)
397+ if ((void*)map->segs[c].addr <= p
398+ && (char*)p < (char*)map->segs[c].addr + map->segs[c].p_memsz)
399+ return 1;
400+
401+ return 0;
402+}
403+
404+static __always_inline void * _dl_funcdesc_for (void *entry_point, void *got_value);
405+
406+/* The hashcode handling code below is heavily inspired in libiberty's
407+ hashtab code, but with most adaptation points and support for
408+ deleting elements removed.
409+
410+ Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
411+ Contributed by Vladimir Makarov (vmakarov@cygnus.com). */
412+
413+static __always_inline unsigned long
414+higher_prime_number (unsigned long n)
415+{
416+ /* These are primes that are near, but slightly smaller than, a
417+ power of two. */
418+ static const unsigned long primes[] = {
419+ (unsigned long) 7,
420+ (unsigned long) 13,
421+ (unsigned long) 31,
422+ (unsigned long) 61,
423+ (unsigned long) 127,
424+ (unsigned long) 251,
425+ (unsigned long) 509,
426+ (unsigned long) 1021,
427+ (unsigned long) 2039,
428+ (unsigned long) 4093,
429+ (unsigned long) 8191,
430+ (unsigned long) 16381,
431+ (unsigned long) 32749,
432+ (unsigned long) 65521,
433+ (unsigned long) 131071,
434+ (unsigned long) 262139,
435+ (unsigned long) 524287,
436+ (unsigned long) 1048573,
437+ (unsigned long) 2097143,
438+ (unsigned long) 4194301,
439+ (unsigned long) 8388593,
440+ (unsigned long) 16777213,
441+ (unsigned long) 33554393,
442+ (unsigned long) 67108859,
443+ (unsigned long) 134217689,
444+ (unsigned long) 268435399,
445+ (unsigned long) 536870909,
446+ (unsigned long) 1073741789,
447+ (unsigned long) 2147483647,
448+ /* 4294967291L */
449+ ((unsigned long) 2147483647) + ((unsigned long) 2147483644),
450+ };
451+
452+ const unsigned long *low = &primes[0];
453+ const unsigned long *high = &primes[sizeof(primes) / sizeof(primes[0])];
454+
455+ while (low != high)
456+ {
457+ const unsigned long *mid = low + (high - low) / 2;
458+ if (n > *mid)
459+ low = mid + 1;
460+ else
461+ high = mid;
462+ }
463+
464+#if 0
465+ /* If we've run out of primes, abort. */
466+ if (n > *low)
467+ {
468+ fprintf (stderr, "Cannot find prime bigger than %lu\n", n);
469+ abort ();
470+ }
471+#endif
472+
473+ return *low;
474+}
475+
476+struct funcdesc_ht
477+{
478+ /* Table itself. */
479+ struct funcdesc_value **entries;
480+
481+ /* Current size (in entries) of the hash table */
482+ size_t size;
483+
484+ /* Current number of elements. */
485+ size_t n_elements;
486+};
487+
488+static __always_inline int
489+hash_pointer (const void *p)
490+{
491+ return (int) ((long)p >> 3);
492+}
493+
494+static __always_inline struct funcdesc_ht *
495+htab_create (void)
496+{
497+ struct funcdesc_ht *ht = _dl_malloc (sizeof (struct funcdesc_ht));
498+
499+ if (! ht)
500+ return NULL;
501+ ht->size = 3;
502+ ht->entries = _dl_malloc (sizeof (struct funcdesc_ht_value *) * ht->size);
503+ if (! ht->entries)
504+ return NULL;
505+
506+ ht->n_elements = 0;
507+
508+ _dl_memset (ht->entries, 0, sizeof (struct funcdesc_ht_value *) * ht->size);
509+
510+ return ht;
511+}
512+
513+/* This is only called from _dl_loadaddr_unmap, so it's safe to call
514+ _dl_free(). See the discussion below. */
515+static __always_inline void
516+htab_delete (struct funcdesc_ht *htab)
517+{
518+ int i;
519+
520+ for (i = htab->size - 1; i >= 0; i--)
521+ if (htab->entries[i])
522+ _dl_free (htab->entries[i]);
523+
524+ _dl_free (htab->entries);
525+ _dl_free (htab);
526+}
527+
528+/* Similar to htab_find_slot, but without several unwanted side effects:
529+ - Does not call htab->eq_f when it finds an existing entry.
530+ - Does not change the count of elements/searches/collisions in the
531+ hash table.
532+ This function also assumes there are no deleted entries in the table.
533+ HASH is the hash value for the element to be inserted. */
534+
535+static __always_inline struct funcdesc_value **
536+find_empty_slot_for_expand (struct funcdesc_ht *htab, int hash)
537+{
538+ size_t size = htab->size;
539+ unsigned int index = hash % size;
540+ struct funcdesc_value **slot = htab->entries + index;
541+ int hash2;
542+
543+ if (! *slot)
544+ return slot;
545+
546+ hash2 = 1 + hash % (size - 2);
547+ for (;;)
548+ {
549+ index += hash2;
550+ if (index >= size)
551+ index -= size;
552+
553+ slot = htab->entries + index;
554+ if (! *slot)
555+ return slot;
556+ }
557+}
558+
559+/* The following function changes size of memory allocated for the
560+ entries and repeatedly inserts the table elements. The occupancy
561+ of the table after the call will be about 50%. Naturally the hash
562+ table must already exist. Remember also that the place of the
563+ table entries is changed. If memory allocation failures are allowed,
564+ this function will return zero, indicating that the table could not be
565+ expanded. If all goes well, it will return a non-zero value. */
566+
567+static __always_inline int
568+htab_expand (struct funcdesc_ht *htab)
569+{
570+ struct funcdesc_value **oentries;
571+ struct funcdesc_value **olimit;
572+ struct funcdesc_value **p;
573+ struct funcdesc_value **nentries;
574+ size_t nsize;
575+
576+ oentries = htab->entries;
577+ olimit = oentries + htab->size;
578+
579+ /* Resize only when table after removal of unused elements is either
580+ too full or too empty. */
581+ if (htab->n_elements * 2 > htab->size)
582+ nsize = higher_prime_number (htab->n_elements * 2);
583+ else
584+ nsize = htab->size;
585+
586+ nentries = _dl_malloc (sizeof (struct funcdesc_value *) * nsize);
587+ _dl_memset (nentries, 0, sizeof (struct funcdesc_value *) * nsize);
588+ if (nentries == NULL)
589+ return 0;
590+ htab->entries = nentries;
591+ htab->size = nsize;
592+
593+ p = oentries;
594+ do
595+ {
596+ if (*p)
597+ *find_empty_slot_for_expand (htab, hash_pointer ((*p)->entry_point))
598+ = *p;
599+
600+ p++;
601+ }
602+ while (p < olimit);
603+
604+#if 0 /* We can't tell whether this was allocated by the _dl_malloc()
605+ built into ld.so or malloc() in the main executable or libc,
606+ and calling free() for something that wasn't malloc()ed could
607+ do Very Bad Things (TM). Take the conservative approach
608+ here, potentially wasting as much memory as actually used by
609+ the hash table, even if multiple growths occur. That's not
610+ so bad as to require some overengineered solution that would
611+ enable us to keep track of how it was allocated. */
612+ _dl_free (oentries);
613+#endif
614+ return 1;
615+}
616+
617+/* This function searches for a hash table slot containing an entry
618+ equal to the given element. To delete an entry, call this with
619+ INSERT = 0, then call htab_clear_slot on the slot returned (possibly
620+ after doing some checks). To insert an entry, call this with
621+ INSERT = 1, then write the value you want into the returned slot.
622+ When inserting an entry, NULL may be returned if memory allocation
623+ fails. */
624+
625+static __always_inline struct funcdesc_value **
626+htab_find_slot (struct funcdesc_ht *htab, void *ptr, int insert)
627+{
628+ unsigned int index;
629+ int hash, hash2;
630+ size_t size;
631+ struct funcdesc_value **entry;
632+
633+ if (htab->size * 3 <= htab->n_elements * 4
634+ && htab_expand (htab) == 0)
635+ return NULL;
636+
637+ hash = hash_pointer (ptr);
638+
639+ size = htab->size;
640+ index = hash % size;
641+
642+ entry = &htab->entries[index];
643+ if (!*entry)
644+ goto empty_entry;
645+ else if ((*entry)->entry_point == ptr)
646+ return entry;
647+
648+ hash2 = 1 + hash % (size - 2);
649+ for (;;)
650+ {
651+ index += hash2;
652+ if (index >= size)
653+ index -= size;
654+
655+ entry = &htab->entries[index];
656+ if (!*entry)
657+ goto empty_entry;
658+ else if ((*entry)->entry_point == ptr)
659+ return entry;
660+ }
661+
662+ empty_entry:
663+ if (!insert)
664+ return NULL;
665+
666+ htab->n_elements++;
667+ return entry;
668+}
669+
670+void *
671+_dl_funcdesc_for (void *entry_point, void *got_value)
672+{
673+ struct elf_resolve *tpnt = ((void**)got_value)[2];
674+ struct funcdesc_ht *ht = tpnt->funcdesc_ht;
675+ struct funcdesc_value **entry;
676+
677+ _dl_assert (got_value == tpnt->loadaddr.got_value);
678+
679+ if (! ht)
680+ {
681+ ht = htab_create ();
682+ if (! ht)
683+ return (void*)-1;
684+ tpnt->funcdesc_ht = ht;
685+ }
686+
687+ entry = htab_find_slot (ht, entry_point, 1);
688+ if (*entry)
689+ {
690+ _dl_assert ((*entry)->entry_point == entry_point);
691+ return _dl_stabilize_funcdesc (*entry);
692+ }
693+
694+ *entry = _dl_malloc (sizeof (struct funcdesc_value));
695+ (*entry)->entry_point = entry_point;
696+ (*entry)->got_value = got_value;
697+
698+ return _dl_stabilize_funcdesc (*entry);
699+}
700+
701+static __always_inline void const *
702+_dl_lookup_address (void const *address)
703+{
704+ struct elf_resolve *rpnt;
705+ struct funcdesc_value const *fd;
706+
707+ /* Make sure we don't make assumptions about its alignment. */
708+ __asm__ ("" : "+r" (address));
709+
710+ if ((Elf32_Addr)address & 7)
711+ /* It's not a function descriptor. */
712+ return address;
713+
714+ fd = (struct funcdesc_value const *)address;
715+
716+ for (rpnt = _dl_loaded_modules; rpnt; rpnt = rpnt->next)
717+ {
718+ if (! rpnt->funcdesc_ht)
719+ continue;
720+
721+ if (fd->got_value != rpnt->loadaddr.got_value)
722+ continue;
723+
724+ address = htab_find_slot (rpnt->funcdesc_ht, (void*)fd->entry_point, 0);
725+
726+ if (address && *(struct funcdesc_value *const*)address == fd)
727+ {
728+ address = (*(struct funcdesc_value *const*)address)->entry_point;
729+ break;
730+ }
731+ else
732+ address = fd;
733+ }
734+
735+ return address;
736+}
737+
738+void
739+__dl_loadaddr_unmap (struct elf32_fdpic_loadaddr loadaddr,
740+ struct funcdesc_ht *funcdesc_ht)
741+{
742+ int i;
743+
744+ for (i = 0; i < loadaddr.map->nsegs; i++)
745+ {
746+ struct elf32_fdpic_loadseg *segdata;
747+ ssize_t offs;
748+ segdata = loadaddr.map->segs + i;
749+
750+#if 0 /* SRAM */
751+ /* FIXME:
752+ A more cleaner way is to add type for struct elf32_fdpic_loadseg,
753+ and release the memory according to the type.
754+ Currently, we hardcode the memory address of L1 SRAM. */
755+ if ((segdata->addr & 0xff800000) == 0xff800000)
756+ {
757+ _dl_sram_free ((void *)segdata->addr);
758+ continue;
759+ }
760+#endif
761+ offs = (segdata->p_vaddr & ADDR_ALIGN);
762+ _dl_munmap ((void*)segdata->addr - offs,
763+ segdata->p_memsz + offs);
764+ }
765+ /* _dl_unmap is only called for dlopen()ed libraries, for which
766+ calling free() is safe, or before we've completed the initial
767+ relocation, in which case calling free() is probably pointless,
768+ but still safe. */
769+ _dl_free (loadaddr.map);
770+ if (funcdesc_ht)
771+ htab_delete (funcdesc_ht);
772+}
773+
774+#if 0 /* XXX TODO will look at enabling this if we decide to add support for OCM
775+ * code/data */
776+// OLD BLACKFIN CODE
777+static __always_inline int
778+__dl_is_special_segment (Elf32_Ehdr *epnt,
779+ Elf32_Phdr *ppnt)
780+{
781+ if (ppnt->p_type != PT_LOAD)
782+ return 0;
783+
784+ if ((epnt->e_flags & EF_BFIN_CODE_IN_L1)
785+ && !(ppnt->p_flags & PF_W)
786+ && (ppnt->p_flags & PF_X))
787+ return 1;
788+
789+ if ((epnt->e_flags & EF_BFIN_DATA_IN_L1)
790+ && (ppnt->p_flags & PF_W)
791+ && !(ppnt->p_flags & PF_X))
792+ return 1;
793+
794+ /* 0xff700000, 0xff800000, 0xff900000 and 0xffa00000 are also used in
795+ GNU ld and linux kernel. They need to be keep synchronized. */
796+ if (ppnt->p_vaddr == 0xff700000
797+ || ppnt->p_vaddr == 0xff800000
798+ || ppnt->p_vaddr == 0xff900000
799+ || ppnt->p_vaddr == 0xffa00000)
800+ return 1;
801+
802+ return 0;
803+}
804+
805+static __always_inline char *
806+__dl_map_segment (Elf32_Ehdr *epnt,
807+ Elf32_Phdr *ppnt,
808+ int infile,
809+ int flags)
810+{
811+ char *status, *tryaddr, *l1addr;
812+ size_t size;
813+
814+
815+ if (((epnt->e_flags & EF_BFIN_CODE_IN_L1) || ppnt->p_vaddr == 0xffa00000)
816+ && !(ppnt->p_flags & PF_W)
817+ && (ppnt->p_flags & PF_X)) {
818+ status = (char *) _dl_mmap
819+ (tryaddr = 0,
820+ size = (ppnt->p_vaddr & ADDR_ALIGN) + ppnt->p_filesz,
821+ LXFLAGS(ppnt->p_flags),
822+ flags | MAP_EXECUTABLE | MAP_DENYWRITE,
823+ infile, ppnt->p_offset & OFFS_ALIGN);
824+ if (_dl_mmap_check_error(status)
825+ || (tryaddr && tryaddr != status))
826+ return NULL;
827+ l1addr = (char *) _dl_sram_alloc (ppnt->p_filesz, L1_INST_SRAM);
828+ if (l1addr != NULL)
829+ _dl_dma_memcpy (l1addr, status + (ppnt->p_vaddr & ADDR_ALIGN), ppnt->p_filesz);
830+ _dl_munmap (status, size);
831+ if (l1addr == NULL)
832+ _dl_dprintf(2, "%s:%i: L1 allocation failed\n", _dl_progname, __LINE__);
833+ return l1addr;
834+ }
835+
836+ if (((epnt->e_flags & EF_BFIN_DATA_IN_L1)
837+ || ppnt->p_vaddr == 0xff700000
838+ || ppnt->p_vaddr == 0xff800000
839+ || ppnt->p_vaddr == 0xff900000)
840+ && (ppnt->p_flags & PF_W)
841+ && !(ppnt->p_flags & PF_X)) {
842+ if (ppnt->p_vaddr == 0xff800000)
843+ l1addr = (char *) _dl_sram_alloc (ppnt->p_memsz, L1_DATA_A_SRAM);
844+ else if (ppnt->p_vaddr == 0xff900000)
845+ l1addr = (char *) _dl_sram_alloc (ppnt->p_memsz, L1_DATA_B_SRAM);
846+ else
847+ l1addr = (char *) _dl_sram_alloc (ppnt->p_memsz, L1_DATA_SRAM);
848+ if (l1addr == NULL) {
849+ _dl_dprintf(2, "%s:%i: L1 allocation failed\n", _dl_progname, __LINE__);
850+ } else {
851+ if (_DL_PREAD (infile, l1addr, ppnt->p_filesz, ppnt->p_offset) != ppnt->p_filesz) {
852+ _dl_sram_free (l1addr);
853+ return NULL;
854+ }
855+ if (ppnt->p_filesz < ppnt->p_memsz)
856+ _dl_memset (l1addr + ppnt->p_filesz, 0, ppnt->p_memsz - ppnt->p_filesz);
857+ }
858+ return l1addr;
859+ }
860+ return 0;
861+}
862+#endif
863--- /dev/null
864@@ -0,0 +1,232 @@
865+/*
866+ Copyright (C) 2009 Ubicom, Inc.
867+ Copyright (C) 2003 Red Hat, Inc.
868+ Contributed by Alexandre Oliva <aoliva@redhat.com>
869+
870+This file is part of uClibc.
871+
872+uClibc is free software; you can redistribute it and/or modify it
873+under the terms of the GNU Lesser General Public License as
874+published by the Free Software Foundation; either version 2.1 of the
875+License, or (at your option) any later version.
876+
877+uClibc is distributed in the hope that it will be useful, but WITHOUT
878+ANY WARRANTY; without even the implied warranty of
879+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
880+Library General Public License for more details.
881+
882+You should have received a copy of the GNU Lesser General Public
883+License along with uClibc; see the file COPYING.LIB. If not, write to
884+the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
885+USA. */
886+
887+/* Any assembly language/system dependent hacks needed to setup
888+ * boot1.c so it will work as expected and cope with whatever platform
889+ * specific wierdness is needed for this architecture.
890+
891+ * We override the default _dl_boot function, and replace it with a
892+ * bit of asm. Then call the real _dl_boot function, which is now
893+ * named _dl_boot2. */
894+
895+/* At program start-up, p0 contains a pointer to a
896+ elf32_fdpic_loadmap that describes how the executable was loaded
897+ into memory. p1 contains a pointer to the interpreter (our!)
898+ loadmap, if there is an interpreter, or 0 if we're being run as an
899+ executable. p2 holds a pointer to the interpreter's dynamic
900+ section, if there is an interpreter, or to the executable's dynamic
901+ section, otherwise. If the executable is not dynamic, gr18 is 0.
902+
903+ We rely on the fact that the linker adds a pointer to the
904+ _GLOBAL_OFFSET_TABLE_ as the last ROFIXUP entry, and that
905+ __self_reloc returns the relocated pointer to us, so that we can
906+ use this value to initialize the PIC register. */
907+
908+
909+/*
910+ * _dl_boot is the entry point for ldso.
911+ *
912+ * The kernel leaves the main apps args on the stack (positive offsets), and
913+ * communicates the load maps as follows
914+ *
915+ * - d1 is set to the exec_map_addr (struct elf32_fdpic_loadmap *), which is the
916+ * current state of the mapped application.
917+ *
918+ * - d2 is set to interp_map_addr (struct elf32_fdpic_loadmap *), which is use
919+ * by ldso to relocate itself.
920+ *
921+ * - d3 is dynamic_addr which as far as I can tell is the stack pointer.
922+ *
923+ * - a1 is set to zero and will later be initialised to ldso _dl_fini funcdesc
924+ */
925+
926+__asm__(
927+ " .text \n\t"
928+ " .global _start \n\t"
929+ " .type _start,@function \n\t"
930+ "_start:\n\t"
931+ /*
932+ * Jump to .Lcall storing the location .Lcall in a5
933+ */
934+ " call a5, .Lcall \n\t"
935+ ".Lcall: \n\t"
936+ /*
937+ * Reserve and Push inputs to stack.
938+ * 32 byte stack layout as follows
939+ * offset 0 exec_map_addr
940+ * 4 interp_map_addr
941+ * 8 dynamic_addr
942+ * 12 not used
943+ * 16 dl_main_funcdesc structure for _dl_boot
944+ * (12 bytes sizeof funcdesc_value)
945+ * 28 reserved
946+ * 32 start of &original stack
947+ */
948+ " pdec sp, 32(sp); reserve stack space \n\t"
949+ " move.4 0(sp), d1 ; exec_map_addr \n\t"
950+ " move.4 4(sp), d2 ; interp_map_addr \n\t"
951+ " move.4 8(sp), d3; dynamic_addr \n\t"
952+
953+ /*
954+ * Load linker version of .Lcall in to d0
955+ */
956+ " moveai a3, #%hi(.Lcall) \n\t"
957+ " lea.1 d0, %lo(.Lcall)(a3) \n\t"
958+
959+ /*
960+ * Determine the offset from loaded .Lcall and put it in d0.
961+ */
962+ " sub.4 d0, a5, d0 \n\t"
963+
964+ /*
965+ * Load linker version of __ROFIXUP_LIST__ and __ROFIXUP_END__ in to d1
966+ * and d2.
967+ */
968+ " moveai a3, #%hi(__ROFIXUP_LIST__) \n\t"
969+ " lea.1 d1, %lo(__ROFIXUP_LIST__)(a3) \n\t"
970+ " moveai a3, #%hi(__ROFIXUP_END__) \n\t"
971+ " lea.1 d2, %lo(__ROFIXUP_END__)(a3) \n\t"
972+ /*
973+ * Use offset determined above to find the loaded versions.
974+ */
975+ " add.4 d1, d1, d0 \n\t"
976+ " add.4 d2, d2, d0 \n\t"
977+
978+ /*
979+ * Load interp_map_addr into d0, if interp_map_addr is null use
980+ * exec_map_addr.
981+ */
982+ " move.4 d0, 4(sp) ; load interp_map_addr \n\t"
983+ " cmpi d0, #0 \n\t"
984+ " jmpne.f 1f \n\t"
985+ " move.4 d0, 0(sp) ; load exec_map_addr \n\t"
986+
987+ /*
988+ * call __self_reloc(map, void ***p, void ***e)
989+ * it returns the the GOT in d0.
990+ */
991+ "1: call a5, __self_reloc ; returns a0 in d0 \n\t"
992+ " move.4 a0, d0 ; set GOT \n\t"
993+ " move.4 a2, d0 ; save GOT \n\t"
994+
995+ /*
996+ * now setup to call
997+ * _dl_start (Elf32_Addr dl_boot_got_pointer, (d0)
998+ * struct elf32_fdpic_loadmap *dl_boot_progmap, (d1)
999+ * struct elf32_fdpic_loadmap *dl_boot_ldsomap, (d2)
1000+ * Elf32_Dyn *dl_boot_ldso_dyn_pointer, (d3)
1001+ * struct funcdesc_value *dl_main_funcdesc, (d4)
1002+ * unsigned long args (d5)
1003+ *
1004+ * NOTE: for dl_main_funcdesc we reserved space on the stack for this
1005+ * structure.
1006+ */
1007+ " move.4 d1, 0(sp) ; d1 = exec_map_addr \n\t"
1008+ " move.4 d2, 4(sp) ; d2 = interp_map_addr \n\t"
1009+ " move.4 d3, 8(sp) ; d3 = dynamic_addr \n\t"
1010+ " lea.1 d4, 16(sp) ; d4 = &dl_main_funcdesc \n\t"
1011+ " lea.1 d5, 32(sp) ; d5 = original stack ptr (args)\n\t"
1012+ " call a5, _dl_start \n\t"
1013+
1014+ /*
1015+ * Setup to call the main entry point, starting with passing our FINI
1016+ * ptr() to the user in a1 (remember we saved the got in a2)
1017+ */
1018+ " movei d15, #%got_funcdesc_lo(_dl_fini) \n\t"
1019+ " move.4 a1, (a2, d15) \n\t"
1020+
1021+ /*
1022+ * restore the load map from the kernel.
1023+ */
1024+ " move.4 d1, 0(sp) ; restore exec_map_addr \n\t"
1025+ " move.4 d2, 4(sp) ; restore interp_map_addr \n\t"
1026+ " move.4 d3, 8(sp) ; restore dynamic_addr \n\t"
1027+
1028+ /*
1029+ * _dl_start returned the main apps entry point in dl_main_funcdesc,
1030+ * load that information now.
1031+ */
1032+ " move.4 a5, 16(sp) ; a5 = dl_main_funcdesc.entry_point \n\t"
1033+ " move.4 a0, 20(sp) ; a0 = dl_main_funcdesc.got_value \n\t"
1034+ " lea.1 sp, 32(sp); restore original stack ptr (args) \n\t"
1035+ " calli a5, 0(a5) \n\t"
1036+ " bkpt -1; should never get here \n\t"
1037+ " .size _start, . - _start \n\t"
1038+);
1039+
1040+#undef DL_START
1041+#define DL_START(X) \
1042+static void __attribute__ ((used)) \
1043+_dl_start (Elf32_Addr dl_boot_got_pointer, \
1044+ struct elf32_fdpic_loadmap *dl_boot_progmap, \
1045+ struct elf32_fdpic_loadmap *dl_boot_ldsomap, \
1046+ Elf32_Dyn *dl_boot_ldso_dyn_pointer, \
1047+ struct funcdesc_value *dl_main_funcdesc, \
1048+ X)
1049+
1050+struct elf32_fdpic_loadmap;
1051+
1052+/*
1053+ * Get a pointer to the argv array. On many platforms this can be just
1054+ * the address if the first argument, on other platforms we need to
1055+ * do something a little more subtle here.
1056+ */
1057+#define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long*) ARGS) + 1)
1058+
1059+/*
1060+ * Here is a macro to perform a relocation. This is only used when
1061+ * bootstrapping the dynamic loader. RELP is the relocation that we
1062+ * are performing, REL is the pointer to the address we are relocating.
1063+ * SYMBOL is the symbol involved in the relocation, and LOAD is the
1064+ * load address.
1065+ */
1066+#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \
1067+ switch(ELF32_R_TYPE((RELP)->r_info)){ \
1068+ case R_UBICOM32_32: \
1069+ *(REL) += (SYMBOL); \
1070+ break; \
1071+ case R_UBICOM32_FUNCDESC_VALUE: \
1072+ { \
1073+ struct funcdesc_value fv = { \
1074+ (void*)((SYMBOL) + *(REL)), \
1075+ (LOAD).got_value \
1076+ }; \
1077+ *(struct funcdesc_value volatile *)(REL) = fv; \
1078+ break; \
1079+ } \
1080+ default: \
1081+ _dl_exit(1); \
1082+ }
1083+
1084+/*
1085+ * Transfer control to the user's application, once the dynamic loader
1086+ * is done. We return the address of the function's entry point to
1087+ * _dl_boot, see boot1_arch.h.
1088+ */
1089+#define START() do { \
1090+ struct elf_resolve *exec_mod = _dl_loaded_modules; \
1091+ dl_main_funcdesc->entry_point = _dl_elf_main; \
1092+ while (exec_mod->libtype != elf_executable) \
1093+ exec_mod = exec_mod->next; \
1094+ dl_main_funcdesc->got_value = exec_mod->loadaddr.got_value; \
1095+ return; \
1096+} while (0)
1097--- /dev/null
1098@@ -0,0 +1,206 @@
1099+/* Copyright (C) 2003, 2004 Red Hat, Inc.
1100+ Contributed by Alexandre Oliva <aoliva@redhat.com>
1101+
1102+This file is part of uClibc.
1103+
1104+uClibc is free software; you can redistribute it and/or modify it
1105+under the terms of the GNU Lesser General Public License as
1106+published by the Free Software Foundation; either version 2.1 of the
1107+License, or (at your option) any later version.
1108+
1109+uClibc is distributed in the hope that it will be useful, but WITHOUT
1110+ANY WARRANTY; without even the implied warranty of
1111+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1112+Library General Public License for more details.
1113+
1114+You should have received a copy of the GNU Lesser General Public
1115+License along with uClibc; see the file COPYING.LIB. If not, write to
1116+the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
1117+USA. */
1118+
1119+/* We can't use the real errno in ldso, since it has not yet
1120+ * been dynamicly linked in yet. */
1121+#include "sys/syscall.h"
1122+extern int _dl_errno;
1123+#undef __set_errno
1124+#define __set_errno(X) {(_dl_errno) = (X);}
1125+#include <sys/mman.h>
1126+
1127+/* The code below is extracted from libc/sysdeps/linux/frv/_mmap.c */
1128+
1129+#if defined(DYNAMIC_LOADER_IN_SIMULATOR) && DYNAMIC_LOADER_IN_SIMULATOR
1130+#define __NR___syscall_mmap2 __NR_mmap2
1131+static __inline__ _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr,
1132+ size_t, len, int, prot, int, flags, int, fd, off_t, offset);
1133+
1134+/* Make sure we don't get another definition of _dl_mmap from the
1135+ machine-independent code. */
1136+#undef __NR_mmap
1137+#undef __NR_mmap2
1138+
1139+/* This is always 12, even on architectures where PAGE_SHIFT != 12. */
1140+# ifndef MMAP2_PAGE_SHIFT
1141+# define MMAP2_PAGE_SHIFT 12
1142+# endif
1143+
1144+#include <bits/uClibc_page.h> /* for PAGE_SIZE */
1145+static __always_inline void *_dl_memset(void*,int,size_t);
1146+static __always_inline ssize_t _dl_pread(int fd, void *buf, size_t count, off_t offset);
1147+
1148+static __ptr_t
1149+_dl_mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset)
1150+{
1151+ size_t plen = (len + PAGE_SIZE - 1) & -PAGE_SIZE;
1152+
1153+/* This is a hack to enable the dynamic loader to run within a
1154+ simulator that doesn't support mmap, with a number of very ugly
1155+ tricks. Also, it's not as useful as it sounds, since only dynamic
1156+ executables without DT_NEEDED dependencies can be run. AFAIK, they
1157+ can only be created with -pie. This trick suffices to enable the
1158+ dynamic loader to obtain a blank page that it maps early in the
1159+ bootstrap. */
1160+ if ((flags & MAP_FIXED) == 0)
1161+ {
1162+ void *_dl_mmap_base = 0;
1163+ __ptr_t *ret = 0;
1164+
1165+ if (! _dl_mmap_base)
1166+ {
1167+ void *stack;
1168+ __asm__ ("mov sp, %0" : "=r" (stack));
1169+ _dl_mmap_base = (void *)(((long)stack + 2 * PAGE_SIZE) & -PAGE_SIZE);
1170+ retry:
1171+ if (((void **)_dl_mmap_base)[0] == _dl_mmap_base
1172+ && ((void **)_dl_mmap_base)[1023] == _dl_mmap_base
1173+ && (((void **)_dl_mmap_base)[177]
1174+ == ((void **)_dl_mmap_base)[771]))
1175+ {
1176+ while (((void**)_dl_mmap_base)[177])
1177+ {
1178+ _dl_mmap_base = ((void**)_dl_mmap_base)[177];
1179+ if (!(((void **)_dl_mmap_base)[0] == _dl_mmap_base
1180+ && ((void **)_dl_mmap_base)[1023] == _dl_mmap_base
1181+ && (((void **)_dl_mmap_base)[177]
1182+ == ((void**)_dl_mmap_base)[771])))
1183+ ((void(*)())0)();
1184+ }
1185+ }
1186+ else
1187+ {
1188+ int i;
1189+ for (i = 0; i < (int)PAGE_SIZE; i++)
1190+ if (*(char*)(_dl_mmap_base + i))
1191+ break;
1192+ if (i != PAGE_SIZE)
1193+ {
1194+ _dl_mmap_base = (void*)((long)_dl_mmap_base + PAGE_SIZE);
1195+ goto retry;
1196+ }
1197+ ((void**)_dl_mmap_base)[-1] =
1198+ ((void**)_dl_mmap_base)[0] =
1199+ ((void**)_dl_mmap_base)[1023] =
1200+ _dl_mmap_base;
1201+ }
1202+ }
1203+
1204+ if (_dl_mmap_base)
1205+ {
1206+ if (!(((void **)_dl_mmap_base)[0] == _dl_mmap_base
1207+ && ((void **)_dl_mmap_base)[1023] == _dl_mmap_base
1208+ && (((void **)_dl_mmap_base)[177]
1209+ == ((void**)_dl_mmap_base)[771])))
1210+ ((void(*)())0)();
1211+ ret = (__ptr_t)((char*)_dl_mmap_base + PAGE_SIZE);
1212+ _dl_mmap_base =
1213+ ((void**)_dl_mmap_base)[177] =
1214+ ((void**)_dl_mmap_base)[771] =
1215+ (char*)_dl_mmap_base + plen + PAGE_SIZE;
1216+ ((void**)_dl_mmap_base)[0] =
1217+ ((void**)_dl_mmap_base)[1023] =
1218+ _dl_mmap_base;
1219+ }
1220+
1221+ if ((flags & MAP_ANONYMOUS) != 0)
1222+ {
1223+ _dl_memset (ret, 0, plen);
1224+ return ret;
1225+ }
1226+
1227+ flags |= MAP_FIXED;
1228+ addr = ret;
1229+ }
1230+ if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)) {
1231+#if 0
1232+ __set_errno (EINVAL);
1233+#endif
1234+ return MAP_FAILED;
1235+ }
1236+ if ((flags & MAP_FIXED) != 0)
1237+ {
1238+ if (_dl_pread(fd, addr, len, offset) != (ssize_t)len)
1239+ return (void*)MAP_FAILED;
1240+ if (plen != len)
1241+ _dl_memset (addr + len, 0, plen - len);
1242+ return addr;
1243+ }
1244+ return(__syscall_mmap2(addr, len, prot, flags, fd, (off_t) (offset >> MMAP2_PAGE_SHIFT)));
1245+}
1246+#endif
1247+
1248+#ifdef __NR_pread64
1249+#ifdef DYNAMIC_LOADER_IN_SIMULATOR
1250+#include <unistd.h>
1251+
1252+#define __NR___syscall_lseek __NR_lseek
1253+static __always_inline unsigned long _dl_read(int fd, const void *buf, unsigned long count);
1254+
1255+static __always_inline _syscall3(__off_t, __syscall_lseek, int, fd, __off_t, offset,
1256+ int, whence);
1257+static __always_inline ssize_t
1258+_dl_pread(int fd, void *buf, size_t count, off_t offset)
1259+{
1260+ __off_t orig = __syscall_lseek (fd, 0, SEEK_CUR);
1261+ ssize_t ret;
1262+
1263+ if (orig == -1)
1264+ return -1;
1265+
1266+ if (__syscall_lseek (fd, offset, SEEK_SET) != offset)
1267+ return -1;
1268+
1269+ ret = _dl_read (fd, buf, count);
1270+
1271+ if (__syscall_lseek (fd, orig, SEEK_SET) != orig)
1272+ ((void(*)())0)();
1273+
1274+ return ret;
1275+}
1276+#else
1277+#define __NR___syscall_pread __NR_pread64
1278+static __always_inline _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf,
1279+ size_t, count, off_t, offset_hi, off_t, offset_lo);
1280+
1281+static __always_inline ssize_t
1282+_dl_pread(int fd, void *buf, size_t count, off_t offset)
1283+{
1284+ return(__syscall_pread(fd,buf,count,__LONG_LONG_PAIR (offset >> 31, offset)));
1285+}
1286+#endif
1287+#endif
1288+
1289+#ifdef __NR_sram_alloc
1290+#define __NR__dl_sram_alloc __NR_sram_alloc
1291+static __always_inline _syscall2(__ptr_t, _dl_sram_alloc,
1292+ size_t, len, unsigned long, flags);
1293+#endif
1294+
1295+#ifdef __NR_sram_free
1296+#define __NR__dl_sram_free __NR_sram_free
1297+static __always_inline _syscall1(int, _dl_sram_free, __ptr_t, addr);
1298+#endif
1299+
1300+#ifdef __NR_dma_memcpy
1301+#define __NR__dl_dma_memcpy __NR_dma_memcpy
1302+static __always_inline _syscall3(__ptr_t, _dl_dma_memcpy,
1303+ __ptr_t, dest, __ptr_t, src, size_t, len);
1304+#endif
1305--- /dev/null
1306@@ -0,0 +1,243 @@
1307+ /* Copyright (C) 2003, 2004 Red Hat, Inc.
1308+ Contributed by Alexandre Oliva <aoliva@redhat.com>
1309+ Based on ../i386/dl-sysdep.h
1310+
1311+This file is part of uClibc.
1312+
1313+uClibc is free software; you can redistribute it and/or modify it
1314+under the terms of the GNU Lesser General Public License as
1315+published by the Free Software Foundation; either version 2.1 of the
1316+License, or (at your option) any later version.
1317+
1318+uClibc is distributed in the hope that it will be useful, but WITHOUT
1319+ANY WARRANTY; without even the implied warranty of
1320+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1321+Library General Public License for more details.
1322+
1323+You should have received a copy of the GNU Lesser General Public
1324+License along with uClibc; see the file COPYING.LIB. If not, write to
1325+the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
1326+USA. */
1327+
1328+/*
1329+ * Various assembly language/system dependent hacks that are required
1330+ * so that we can minimize the amount of platform specific code.
1331+ */
1332+
1333+/*
1334+ * Define this if the system uses RELOCA.
1335+ */
1336+#undef ELF_USES_RELOCA
1337+
1338+/* JMPREL relocs are inside the DT_RELA table. */
1339+#define ELF_MACHINE_PLTREL_OVERLAP
1340+
1341+#define DL_NO_COPY_RELOCS
1342+
1343+#define HAVE_DL_INLINES_H
1344+
1345+/*
1346+ * Initialization sequence for a GOT. Copy the resolver function
1347+ * descriptor and the pointer to the elf_resolve/link_map data
1348+ * structure. Initialize the got_value in the module while at that.
1349+ */
1350+#define INIT_GOT(GOT_BASE,MODULE) \
1351+{ \
1352+ (MODULE)->loadaddr.got_value = (GOT_BASE); \
1353+ GOT_BASE[0] = ((unsigned long *)&_dl_linux_resolve)[0]; \
1354+ GOT_BASE[1] = ((unsigned long *)&_dl_linux_resolve)[1]; \
1355+ GOT_BASE[2] = (unsigned long) MODULE; \
1356+}
1357+
1358+/* Here we define the magic numbers that this dynamic loader should accept */
1359+#define MAGIC1 EM_UBICOM32
1360+#undef MAGIC2
1361+
1362+/* Used for error messages */
1363+#define ELF_TARGET "UBICOM32"
1364+
1365+struct elf_resolve;
1366+
1367+struct funcdesc_value
1368+{
1369+ void *entry_point;
1370+ void *got_value;
1371+/*int relocation; not sure if this required, but it does exist */
1372+};
1373+
1374+extern int _dl_linux_resolve(void) __attribute__((__visibility__("hidden")));
1375+extern struct funcdesc_value volatile *__attribute__((__visibility__("hidden")))
1376+ _dl_linux_resolver (struct elf_resolve *tpnt, int reloc_entry);
1377+
1378+/* 4KiB page alignment. Should perhaps be made dynamic using
1379+ getpagesize(), based on AT_PAGESZ from auxvt? */
1380+#define PAGE_ALIGN 0xfffff000
1381+#define ADDR_ALIGN 0xfff
1382+#define OFFS_ALIGN 0x7ffff000
1383+
1384+struct funcdesc_ht;
1385+
1386+/*
1387+ * This asm does a quick relcation of string S (which is stored in the text
1388+ * section as thats all we can use
1389+ */
1390+#undef SEND_EARLY_STDERR
1391+#define SEND_EARLY_STDERR(S) \
1392+do { \
1393+ static const char __attribute__((section(".text"))) __s[] = (S); \
1394+ const char *__p, *__scratch; \
1395+ __asm__ ( \
1396+ " call a3, 1f; \n\t" \
1397+ "1: movei %0, #%%got_lo(1b) \n\t" \
1398+ " move.4 %0, (%3, %0) \n\t" \
1399+ " sub.4 %1, a3, %0; \n\t" \
1400+ " add.4 %1, %1, %2; \n\t" \
1401+ : "=&d" (__scratch), "=&d" (__p) \
1402+ : "d" (__s), "a" (dl_boot_got_pointer) \
1403+ : "a3", "a4", "d15"); \
1404+ SEND_STDERR (__p); \
1405+ { int __t; \
1406+ for (__t = 0; __t < 0x100000; __t++) __asm__ __volatile__ (""); } \
1407+} while (0)
1408+
1409+#define DL_LOADADDR_TYPE struct elf32_fdpic_loadaddr
1410+
1411+#define DL_RELOC_ADDR(LOADADDR, ADDR) \
1412+ ((ElfW(Addr))__reloc_pointer ((void*)(ADDR), (LOADADDR).map))
1413+
1414+#define DL_ADDR_TO_FUNC_PTR(ADDR, LOADADDR) \
1415+ ((void(*)(void)) _dl_funcdesc_for ((void*)(ADDR), (LOADADDR).got_value))
1416+
1417+#define _dl_stabilize_funcdesc(val) \
1418+ ({ __asm__ ("" : "+m" (*(val))); (val); })
1419+
1420+#define DL_CALL_FUNC_AT_ADDR(ADDR, LOADADDR, SIGNATURE, ...) \
1421+ ({ struct funcdesc_value fd = { (void*)(ADDR), (LOADADDR).got_value }; \
1422+ void (*pf)(void) = (void*) _dl_stabilize_funcdesc (&fd); \
1423+ (* SIGNATURE pf)(__VA_ARGS__); })
1424+
1425+#define DL_INIT_LOADADDR_BOOT(LOADADDR, BASEADDR) \
1426+ (__dl_init_loadaddr_map (&(LOADADDR), dl_boot_got_pointer, \
1427+ dl_boot_ldsomap ?: dl_boot_progmap))
1428+
1429+#define DL_INIT_LOADADDR_PROG(LOADADDR, BASEADDR) \
1430+ (__dl_init_loadaddr_map (&(LOADADDR), 0, dl_boot_progmap))
1431+
1432+#define DL_INIT_LOADADDR_EXTRA_DECLS \
1433+ int dl_init_loadaddr_load_count;
1434+#define DL_INIT_LOADADDR(LOADADDR, BASEADDR, PHDR, PHDRCNT) \
1435+ (dl_init_loadaddr_load_count = \
1436+ __dl_init_loadaddr (&(LOADADDR), (PHDR), (PHDRCNT)))
1437+#define DL_INIT_LOADADDR_HDR(LOADADDR, ADDR, PHDR) \
1438+ (__dl_init_loadaddr_hdr ((LOADADDR), (ADDR), (PHDR), \
1439+ dl_init_loadaddr_load_count))
1440+#define DL_LOADADDR_UNMAP(LOADADDR, LEN) \
1441+ (__dl_loadaddr_unmap ((LOADADDR), (NULL)))
1442+#define DL_LIB_UNMAP(LIB, LEN) \
1443+ (__dl_loadaddr_unmap ((LIB)->loadaddr, (LIB)->funcdesc_ht))
1444+#define DL_LOADADDR_BASE(LOADADDR) \
1445+ ((LOADADDR).got_value)
1446+
1447+/* This is called from dladdr(), such that we map a function
1448+ descriptor's address to the function's entry point before trying to
1449+ find in which library it's defined. */
1450+#define DL_LOOKUP_ADDRESS(ADDRESS) (_dl_lookup_address (ADDRESS))
1451+
1452+#define DL_ADDR_IN_LOADADDR(ADDR, TPNT, TFROM) \
1453+ (! (TFROM) && __dl_addr_in_loadaddr ((void*)(ADDR), (TPNT)->loadaddr))
1454+
1455+/*
1456+ * Compute the GOT address. On several platforms, we use assembly
1457+ * here. on FR-V FDPIC, there's no way to compute the GOT address,
1458+ * since the offset between text and data is not fixed, so we arrange
1459+ * for the assembly _dl_boot to pass this value as an argument to
1460+ * _dl_boot. */
1461+#define DL_BOOT_COMPUTE_GOT(got) ((got) = dl_boot_got_pointer)
1462+
1463+#define DL_BOOT_COMPUTE_DYN(dpnt, got, load_addr) \
1464+ ((dpnt) = dl_boot_ldso_dyn_pointer)
1465+
1466+/* We only support loading FDPIC independently-relocatable shared
1467+ libraries. It probably wouldn't be too hard to support loading
1468+ shared libraries that require relocation by the same amount, but we
1469+ don't know that they exist or would be useful, and the dynamic
1470+ loader code could leak the whole-library map unless we keeping a
1471+ bit more state for DL_LOADADDR_UNMAP and DL_LIB_UNMAP, so let's
1472+ keep things simple for now. */
1473+#define DL_CHECK_LIB_TYPE(epnt, piclib, _dl_progname, libname) \
1474+do \
1475+{ \
1476+ if (((epnt)->e_flags & EF_UBICOM32_FDPIC) && ! ((epnt)->e_flags & EF_UBICOM32_PIC)) \
1477+ (piclib) = 2; \
1478+ else \
1479+ { \
1480+ _dl_internal_error_number = LD_ERROR_NOTDYN; \
1481+ _dl_dprintf(2, "%s: '%s' is not an FDPIC shared library" \
1482+ "\n", (_dl_progname), (libname)); \
1483+ _dl_close(infile); \
1484+ return NULL; \
1485+ } \
1486+\
1487+} \
1488+while (0)
1489+
1490+/* We want want to apply all relocations in the interpreter during
1491+ bootstrap. Because of this, we have to skip the interpreter
1492+ relocations in _dl_parse_relocation_information(), see
1493+ elfinterp.c. */
1494+#define DL_SKIP_BOOTSTRAP_RELOC(SYMTAB, INDEX, STRTAB) 0
1495+
1496+#ifdef __NR_pread64
1497+#define _DL_PREAD(FD, BUF, SIZE, OFFSET) \
1498+ (_dl_pread((FD), (BUF), (SIZE), (OFFSET)))
1499+#endif
1500+
1501+/* We want to return to dlsym() a function descriptor if the symbol
1502+ turns out to be a function. */
1503+#define DL_FIND_HASH_VALUE(TPNT, TYPE_CLASS, SYM) \
1504+ (((TYPE_CLASS) & ELF_RTYPE_CLASS_DLSYM) \
1505+ && ELF32_ST_TYPE((SYM)->st_info) == STT_FUNC \
1506+ ? _dl_funcdesc_for ((void *)DL_RELOC_ADDR ((TPNT)->loadaddr, (SYM)->st_value), \
1507+ (TPNT)->loadaddr.got_value) \
1508+ : DL_RELOC_ADDR ((TPNT)->loadaddr, (SYM)->st_value))
1509+
1510+#if 0 /* XXX TODO will look at enabling this if we decide to add support for OCM
1511+ * code/data */
1512+
1513+#define DL_IS_SPECIAL_SEGMENT(EPNT, PPNT) \
1514+ __dl_is_special_segment(EPNT, PPNT)
1515+#define DL_MAP_SEGMENT(EPNT, PPNT, INFILE, FLAGS) \
1516+ __dl_map_segment (EPNT, PPNT, INFILE, FLAGS)
1517+
1518+#endif
1519+
1520+
1521+#define DL_GET_READY_TO_RUN_EXTRA_PARMS \
1522+ , struct elf32_fdpic_loadmap *dl_boot_progmap, Elf32_Addr dl_boot_got_pointer
1523+#define DL_GET_READY_TO_RUN_EXTRA_ARGS \
1524+ , dl_boot_progmap, dl_boot_got_pointer
1525+
1526+
1527+#ifdef __USE_GNU
1528+# include <link.h>
1529+#else
1530+# define __USE_GNU
1531+# include <link.h>
1532+# undef __USE_GNU
1533+#endif
1534+
1535+#include <elf.h>
1536+static __inline__ void
1537+elf_machine_relative (DL_LOADADDR_TYPE load_off, const Elf32_Addr rel_addr,
1538+ Elf32_Word relative_count)
1539+{
1540+#if 0
1541+ Elf32_Rel * rpnt = (void *) rel_addr;
1542+ --rpnt;
1543+ do {
1544+ Elf32_Addr *const reloc_addr = (void *) (load_off + (++rpnt)->r_offset);
1545+
1546+ *reloc_addr = DL_RELOC_ADDR (load_off, *reloc_addr);
1547+ } while (--relative_count);
1548+#endif
1549+}
1550--- /dev/null
1551@@ -0,0 +1,366 @@
1552+/* Blackfin ELF shared library loader suppport
1553+ Copyright (C) 2003, 2004 Red Hat, Inc.
1554+ Contributed by Alexandre Oliva <aoliva@redhat.com>
1555+ Lots of code copied from ../i386/elfinterp.c, so:
1556+ Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald,
1557+ David Engel, Hongjiu Lu and Mitch D'Souza
1558+ Copyright (C) 2001-2002, Erik Andersen
1559+ All rights reserved.
1560+
1561+This file is part of uClibc.
1562+
1563+uClibc is free software; you can redistribute it and/or modify it
1564+under the terms of the GNU Lesser General Public License as
1565+published by the Free Software Foundation; either version 2.1 of the
1566+License, or (at your option) any later version.
1567+
1568+uClibc is distributed in the hope that it will be useful, but WITHOUT
1569+ANY WARRANTY; without even the implied warranty of
1570+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1571+Library General Public License for more details.
1572+
1573+You should have received a copy of the GNU Lesser General Public
1574+License along with uClibc; see the file COPYING.LIB. If not, write to
1575+the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
1576+USA. */
1577+
1578+#include <sys/cdefs.h> /* __attribute_used__ */
1579+
1580+/* Program to load an ELF binary on a linux system, and run it.
1581+ References to symbols in sharable libraries can be resolved by either
1582+ an ELF sharable library or a linux style of shared library. */
1583+
1584+/* Disclaimer: I have never seen any AT&T source code for SVr4, nor have
1585+ I ever taken any courses on internals. This program was developed using
1586+ information available through the book "UNIX SYSTEM V RELEASE 4,
1587+ Programmers guide: Ansi C and Programming Support Tools", which did
1588+ a more than adequate job of explaining everything required to get this
1589+ working. */
1590+extern int _dl_ubicom32_resolve_pending(void) __attribute__((__visibility__("hidden")));
1591+
1592+struct funcdesc_value volatile *__attribute__((__visibility__("hidden")))
1593+_dl_linux_resolver (struct elf_resolve *tpnt, int reloc_entry)
1594+{
1595+ int reloc_type;
1596+ ELF_RELOC *this_reloc;
1597+ char *strtab;
1598+ ElfW(Sym) *symtab;
1599+ int symtab_index;
1600+ char *rel_addr;
1601+ struct elf_resolve *new_tpnt;
1602+ char *new_addr;
1603+ struct funcdesc_value funcval;
1604+ struct funcdesc_value volatile *got_entry;
1605+ char *symname;
1606+
1607+ rel_addr = (char *)tpnt->dynamic_info[DT_JMPREL];
1608+
1609+ this_reloc = (ELF_RELOC *)(intptr_t)(rel_addr + reloc_entry);
1610+ reloc_type = ELF_R_TYPE(this_reloc->r_info);
1611+ symtab_index = ELF_R_SYM(this_reloc->r_info);
1612+
1613+ symtab = (Elf32_Sym *) tpnt->dynamic_info[DT_SYMTAB];
1614+ strtab = (char *) tpnt->dynamic_info[DT_STRTAB];
1615+ symname= strtab + symtab[symtab_index].st_name;
1616+
1617+ if (reloc_type != R_UBICOM32_FUNCDESC_VALUE) {
1618+ _dl_dprintf(2, "%s: Incorrect relocation type in jump relocations\n",
1619+ _dl_progname);
1620+ _dl_exit(1);
1621+ }
1622+
1623+ /* Address of GOT entry fix up */
1624+ got_entry = (struct funcdesc_value *) DL_RELOC_ADDR(tpnt->loadaddr, this_reloc->r_offset);
1625+
1626+ /* Get the address to be used to fill in the GOT entry. */
1627+ new_addr = _dl_lookup_hash(symname, tpnt->symbol_scope, NULL, 0, &new_tpnt);
1628+ if (!new_addr) {
1629+ new_addr = _dl_lookup_hash(symname, NULL, NULL, 0, &new_tpnt);
1630+ if (!new_addr) {
1631+ _dl_dprintf(2, "%s: can't resolve symbol '%s'\n",
1632+ _dl_progname, symname);
1633+ _dl_exit(1);
1634+ }
1635+ }
1636+
1637+ funcval.entry_point = new_addr;
1638+ funcval.got_value = new_tpnt->loadaddr.got_value;
1639+
1640+#if defined (__SUPPORT_LD_DEBUG__)
1641+ if (_dl_debug_bindings) {
1642+ _dl_dprintf(_dl_debug_file, "\nresolve function: %s", symname);
1643+ if (_dl_debug_detail)
1644+ _dl_dprintf(_dl_debug_file,
1645+ "\n\tpatched (%x,%x) ==> (%x,%x) @ %x\n",
1646+ got_entry->entry_point, got_entry->got_value,
1647+ funcval.entry_point, funcval.got_value,
1648+ got_entry);
1649+ }
1650+ if (1 || !_dl_debug_nofixups) {
1651+ got_entry->entry_point = ((unsigned long *)&_dl_ubicom32_resolve_pending)[0];
1652+ got_entry->got_value = funcval.got_value;
1653+ got_entry->entry_point = funcval.entry_point;
1654+ }
1655+#else
1656+ /*
1657+ * initially set the entry point to resolve pending before starting
1658+ * the update. This has the effect of putting all other requests in a
1659+ * holding pattern until the resolution is completed.
1660+ */
1661+ got_entry->entry_point = ((unsigned long *)&_dl_ubicom32_resolve_pending)[0];
1662+ got_entry->got_value = funcval.got_value;
1663+ got_entry->entry_point = funcval.entry_point;
1664+#endif
1665+
1666+ return got_entry;
1667+}
1668+
1669+static int
1670+_dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
1671+ unsigned long rel_addr, unsigned long rel_size,
1672+ int (*reloc_fnc) (struct elf_resolve *tpnt, struct dyn_elf *scope,
1673+ ELF_RELOC *rpnt, ElfW(Sym) *symtab, char *strtab))
1674+{
1675+ unsigned int i;
1676+ char *strtab;
1677+ ElfW(Sym) *symtab;
1678+ ELF_RELOC *rpnt;
1679+ int symtab_index;
1680+
1681+ /* Now parse the relocation information */
1682+ rpnt = (ELF_RELOC *) rel_addr;
1683+ rel_size = rel_size / sizeof(ELF_RELOC);
1684+
1685+ symtab = (ElfW(Sym) *) tpnt->dynamic_info[DT_SYMTAB];
1686+ strtab = (char *) tpnt->dynamic_info[DT_STRTAB];
1687+
1688+ for (i = 0; i < rel_size; i++, rpnt++) {
1689+ int res;
1690+
1691+ symtab_index = ELF_R_SYM(rpnt->r_info);
1692+ debug_sym(symtab,strtab,symtab_index);
1693+ debug_reloc(symtab,strtab,rpnt);
1694+
1695+ res = reloc_fnc (tpnt, scope, rpnt, symtab, strtab);
1696+
1697+ if (res==0) continue;
1698+
1699+ _dl_dprintf(2, "\n%s: ",_dl_progname);
1700+
1701+ if (symtab_index)
1702+ _dl_dprintf(2, "symbol '%s': ", strtab + symtab[symtab_index].st_name);
1703+
1704+ if (res <0) {
1705+ int reloc_type = ELF_R_TYPE(rpnt->r_info);
1706+#if defined (__SUPPORT_LD_DEBUG__)
1707+ _dl_dprintf(2, "can't handle reloc type %s\n ", _dl_reltypes(reloc_type));
1708+#else
1709+ _dl_dprintf(2, "can't handle reloc type %x\n", reloc_type);
1710+#endif
1711+ _dl_exit(-res);
1712+ } else if (res >0) {
1713+ _dl_dprintf(2, "can't resolve symbol\n");
1714+ return res;
1715+ }
1716+ }
1717+ return 0;
1718+}
1719+
1720+static int
1721+_dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
1722+ ELF_RELOC *rpnt, ElfW(Sym) *symtab, char *strtab)
1723+{
1724+ int reloc_type;
1725+ int symtab_index;
1726+ char *symname;
1727+ unsigned long reloc_value = 0, *reloc_addr;
1728+ struct { unsigned long v; } __attribute__((__packed__))
1729+ *reloc_addr_packed;
1730+ unsigned long symbol_addr;
1731+ struct elf_resolve *symbol_tpnt;
1732+ struct funcdesc_value funcval;
1733+#if defined (__SUPPORT_LD_DEBUG__)
1734+ unsigned long old_val;
1735+#endif
1736+
1737+ reloc_addr = (unsigned long *) DL_RELOC_ADDR(tpnt->loadaddr, rpnt->r_offset);
1738+ __asm__ ("" : "=r" (reloc_addr_packed) : "0" (reloc_addr));
1739+ reloc_type = ELF_R_TYPE(rpnt->r_info);
1740+ symtab_index = ELF_R_SYM(rpnt->r_info);
1741+ symbol_addr = 0;
1742+ symname = strtab + symtab[symtab_index].st_name;
1743+
1744+ if (ELF_ST_BIND (symtab[symtab_index].st_info) == STB_LOCAL) {
1745+ symbol_addr = (unsigned long) DL_RELOC_ADDR(tpnt->loadaddr, symtab[symtab_index].st_value);
1746+ symbol_tpnt = tpnt;
1747+ } else {
1748+
1749+ symbol_addr = (unsigned long)
1750+ _dl_lookup_hash(symname, scope, NULL, 0, &symbol_tpnt);
1751+
1752+ /*
1753+ * We want to allow undefined references to weak symbols - this might
1754+ * have been intentional. We should not be linking local symbols
1755+ * here, so all bases should be covered.
1756+ */
1757+
1758+ if (!symbol_addr && ELF_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK) {
1759+ _dl_dprintf (2, "%s: can't resolve symbol '%s'\n",
1760+ _dl_progname, strtab + symtab[symtab_index].st_name);
1761+ _dl_exit (1);
1762+ }
1763+ }
1764+
1765+#if defined (__SUPPORT_LD_DEBUG__)
1766+ if (_dl_debug_reloc && _dl_debug_detail)
1767+ {
1768+ if ((long)reloc_addr_packed & 3)
1769+ old_val = reloc_addr_packed->v;
1770+ else
1771+ old_val = *reloc_addr;
1772+ }
1773+ else
1774+ old_val = 0;
1775+#endif
1776+ switch (reloc_type) {
1777+ case R_UBICOM32_NONE:
1778+ break;
1779+ case R_UBICOM32_32:
1780+ if ((long)reloc_addr_packed & 3)
1781+ reloc_value = reloc_addr_packed->v += symbol_addr;
1782+ else
1783+ reloc_value = *reloc_addr += symbol_addr;
1784+ break;
1785+ case R_UBICOM32_FUNCDESC_VALUE:
1786+ funcval.entry_point = (void*)symbol_addr;
1787+ /* The addend of FUNCDESC_VALUE
1788+ relocations referencing global
1789+ symbols must be ignored, because it
1790+ may hold the address of a lazy PLT
1791+ entry. */
1792+ if (ELF_ST_BIND(symtab[symtab_index].st_info) == STB_LOCAL)
1793+ funcval.entry_point += *reloc_addr;
1794+ reloc_value = (unsigned long)funcval.entry_point;
1795+ if (symbol_addr)
1796+ funcval.got_value
1797+ = symbol_tpnt->loadaddr.got_value;
1798+ else
1799+ funcval.got_value = 0;
1800+
1801+/// XXX this is my best guess as to what I should be doing, but I'm
1802+/// putting a break-point here so I can inspect the first time this is
1803+/// used.
1804+ __asm__ (
1805+ " move.4 4(%0), 4(%1) \n\t"
1806+ " move.4 0(%0), 0(%1) \n\t" /* Must to entry_point last */
1807+ :
1808+ : "a" (reloc_addr), "a" (&funcval)
1809+ : "memory" );
1810+ break;
1811+ case R_UBICOM32_FUNCDESC:
1812+ if ((long)reloc_addr_packed & 3)
1813+ reloc_value = reloc_addr_packed->v;
1814+ else
1815+ reloc_value = *reloc_addr;
1816+ if (symbol_addr)
1817+ reloc_value = (unsigned long)_dl_funcdesc_for
1818+ ((char *)symbol_addr + reloc_value,
1819+ symbol_tpnt->loadaddr.got_value);
1820+ else
1821+ reloc_value = 0;
1822+ if ((long)reloc_addr_packed & 3)
1823+ reloc_addr_packed->v = reloc_value;
1824+ else
1825+ *reloc_addr = reloc_value;
1826+ break;
1827+ default:
1828+ return -1;
1829+ }
1830+#if defined (__SUPPORT_LD_DEBUG__)
1831+ if (_dl_debug_reloc && _dl_debug_detail) {
1832+ _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x", old_val, reloc_value, reloc_addr);
1833+ switch (reloc_type) {
1834+ case R_UBICOM32_FUNCDESC_VALUE:
1835+ _dl_dprintf(_dl_debug_file, " got %x", ((struct funcdesc_value *)reloc_value)->got_value);
1836+ break;
1837+ case R_UBICOM32_FUNCDESC:
1838+ if (! reloc_value)
1839+ break;
1840+ _dl_dprintf(_dl_debug_file, " funcdesc (%x,%x)",
1841+ ((struct funcdesc_value *)reloc_value)->entry_point,
1842+ ((struct funcdesc_value *)reloc_value)->got_value);
1843+ break;
1844+ }
1845+ }
1846+#endif
1847+
1848+ return 0;
1849+}
1850+
1851+static int
1852+_dl_do_lazy_reloc (struct elf_resolve *tpnt,
1853+ struct dyn_elf *scope __attribute__((unused)),
1854+ ELF_RELOC *rpnt, ElfW(Sym) *symtab __attribute__((unused)),
1855+ char *strtab __attribute__((unused)))
1856+{
1857+ int reloc_type;
1858+ struct funcdesc_value volatile *reloc_addr;
1859+ struct funcdesc_value funcval;
1860+#if defined (__SUPPORT_LD_DEBUG__)
1861+ unsigned long old_val;
1862+#endif
1863+
1864+ reloc_addr = (struct funcdesc_value *) DL_RELOC_ADDR(tpnt->loadaddr, rpnt->r_offset);
1865+ reloc_type = ELF_R_TYPE(rpnt->r_info);
1866+
1867+#if defined (__SUPPORT_LD_DEBUG__)
1868+ old_val = (unsigned long)reloc_addr->entry_point;
1869+#endif
1870+ switch (reloc_type) {
1871+ case R_UBICOM32_NONE:
1872+ break;
1873+ case R_UBICOM32_FUNCDESC_VALUE:
1874+ funcval = *reloc_addr;
1875+ funcval.entry_point = (void*)DL_RELOC_ADDR(tpnt->loadaddr, funcval.entry_point);
1876+ funcval.got_value = tpnt->loadaddr.got_value;
1877+ *reloc_addr = funcval;
1878+ break;
1879+ default:
1880+ return -1;
1881+ }
1882+#if defined (__SUPPORT_LD_DEBUG__)
1883+ if (_dl_debug_reloc && _dl_debug_detail)
1884+ _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x", old_val, reloc_addr->entry_point, reloc_addr);
1885+#endif
1886+ return 0;
1887+
1888+}
1889+
1890+void
1891+_dl_parse_lazy_relocation_information
1892+(struct dyn_elf *rpnt, unsigned long rel_addr, unsigned long rel_size)
1893+{
1894+ _dl_parse(rpnt->dyn, NULL, rel_addr, rel_size, _dl_do_lazy_reloc);
1895+}
1896+
1897+int
1898+_dl_parse_relocation_information
1899+(struct dyn_elf *rpnt, unsigned long rel_addr, unsigned long rel_size)
1900+{
1901+ return _dl_parse(rpnt->dyn, rpnt->dyn->symbol_scope, rel_addr, rel_size, _dl_do_reloc);
1902+}
1903+
1904+#if 0
1905+/* We don't have copy relocs. */
1906+int
1907+_dl_parse_copy_information
1908+(struct dyn_elf *rpnt __attribute__((unused)),
1909+ unsigned long rel_addr __attribute__((unused)),
1910+ unsigned long rel_size __attribute__((unused)))
1911+{
1912+ return 0;
1913+}
1914+#endif
1915+#ifndef IS_IN_libdl
1916+# include "../../libc/sysdeps/linux/ubicom32/crtreloc.c"
1917+#endif
1918--- /dev/null
1919@@ -0,0 +1,161 @@
1920+ /* Copyright (C) 2003 Red Hat, Inc.
1921+ Contributed by Alexandre Oliva <aoliva@redhat.com>
1922+
1923+ Copyright (C) 2009 Ubicom Inc.
1924+ Ported to Ubicom32 by Ubicom Inc.
1925+
1926+This file is part of uClibc.
1927+
1928+uClibc is free software; you can redistribute it and/or modify it
1929+under the terms of the GNU Lesser General Public License as
1930+published by the Free Software Foundation; either version 2.1 of the
1931+License, or (at your option) any later version.
1932+
1933+uClibc is distributed in the hope that it will be useful, but WITHOUT
1934+ANY WARRANTY; without even the implied warranty of
1935+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1936+Library General Public License for more details.
1937+
1938+You should have received a copy of the GNU Lesser General Public
1939+License along with uClibc; see the file COPYING.LIB. If not, write to
1940+the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
1941+USA. */
1942+
1943+
1944+/*
1945+ * The function below is tail-called by resolver stubs when a lazily-bound *
1946+ * function is called. It must preserve all registers that could * be used to
1947+ * pass arguments to the actual function.
1948+ *
1949+ * On entry to the function d0-d13 contain parameters to the actual function of
1950+ * interest
1951+ *
1952+ * a5 contains the return address
1953+ * a0 is pointing to the GOT table for the original function
1954+ * (a0) _dl_linux_resolve
1955+ * 4(a0) GOT for _dl_linux_resolve
1956+ * 8(a0) is pointer to "structure elf_resolve" of the module where the call
1957+ * originated from
1958+ *
1959+ * a3 is pointing to the function descriptor in the GOT table, and 8(a3) the
1960+ * resolver lookup information.
1961+ *
1962+ * _dl_linux_resolve calls _dl_linux_resolver passing it pointer to
1963+ * struct elf_resolve and the relocation entry.
1964+ *
1965+ * _dl_linux_resolver() figures out where the jump symbol is _really_ supposed
1966+ * to have jumped to and returns that to us. Once we have that, we prepare to
1967+ * tail-call the actual function, clean up after ourselves, restoring the
1968+ * original arguments, then jump to the fixed up address.
1969+ */
1970+
1971+#if 0
1972+ /*
1973+ * Here is what the linker will use for the PLT.
1974+ */
1975+sample_PLT_functionX: /* (at entry a0 contains GOT for this library) */
1976+ movei d15, # -%lo(got_funcdescX) ; load offset for GOT
1977+ lea.4 a3, (a0, d15) ; a4 is now the function descriptor
1978+ move.4 a4, 0(a3) ; get entry_point
1979+ move.4 a0, 4(a3) ; set new GOT
1980+
1981+ /*
1982+ * jump to resovled function OR PLT_trampoline Nat had some code here
1983+ * that uses the stack instead of a3 to reduces hazards.
1984+ */
1985+ calli a4, 0(a4)
1986+
1987+
1988+sample_PLT_trampoline:
1989+ /*
1990+ * find the old got by undoing what was done above. An alternative
1991+ * could have been to ‘save’ the old got in say d14 but that would add 1
1992+ * instruction to every PLT and there is only 1 PLT trampoline per library.
1993+ */
1994+ ret (a0) ; jump to _dl_linux_resolve
1995+#endif
1996+
1997+ .text
1998+ .p2align 4
1999+
2000+ .hidden _dl_linux_resolve
2001+ .global _dl_linux_resolve
2002+ .type _dl_linux_resolve,@function
2003+_dl_linux_resolve:
2004+ /* Preserve arguments and return address */
2005+ move.4 -4(sp)++, d0
2006+ move.4 -4(sp)++, d1
2007+ move.4 -4(sp)++, d2
2008+ move.4 -4(sp)++, d3
2009+ move.4 -4(sp)++, d4
2010+ move.4 -4(sp)++, d5
2011+ move.4 -4(sp)++, d6
2012+ move.4 -4(sp)++, d7
2013+ move.4 -4(sp)++, d8
2014+ move.4 -4(sp)++, d9
2015+ move.4 -4(sp)++, d10
2016+ move.4 -4(sp)++, d11
2017+ move.4 -4(sp)++, d12
2018+ move.4 -4(sp)++, d13
2019+ move.4 -4(sp)++, a5
2020+
2021+ /* Prepare to call _dl_linux_resolver. */
2022+ move.4 d0, 8(a0) ; reference to elf_resolve
2023+ /* Not aligned for space reasons. */
2024+ move.4 d1, mac_hi ; reference to GOT table entry which
2025+ ; contains the relocation information.
2026+
2027+ move.4 a0, 4(a0) ; switch to GOT for _dl_linux_resolve
2028+ call a5, _dl_linux_resolver;
2029+
2030+ /* Move aside return value that contains the FUNCDESC_VALUE. */
2031+ ;P3 = R0;
2032+ move.4 a3, d0;
2033+
2034+ /* Restore arguments. */
2035+ move.4 a5, (sp)4++
2036+ move.4 d13, (sp)4++
2037+ move.4 d12, (sp)4++
2038+ move.4 d11, (sp)4++
2039+ move.4 d10, (sp)4++
2040+ move.4 d9, (sp)4++
2041+ move.4 d8, (sp)4++
2042+ move.4 d7, (sp)4++
2043+ move.4 d6, (sp)4++
2044+ move.4 d5, (sp)4++
2045+ move.4 d4, (sp)4++
2046+ move.4 d3, (sp)4++
2047+ move.4 d2, (sp)4++
2048+ move.4 d1, (sp)4++
2049+ move.4 d0, (sp)4++
2050+
2051+ /* Now jump to the actual function. */
2052+ /* a3 contains func_desc resolution */
2053+ move.4 a4, 0(a3) ; address of function X
2054+ move.4 a0, 4(a3) ; switch to GOT for function X
2055+ calli a4, 0(a4) ; call through a4, a5 remains
2056+
2057+ .size _dl_linux_resolve, . - _dl_linux_resolve
2058+
2059+ .hidden _dl_ubicom32_resolve_pending
2060+ .global _dl_ubicom32_resolve_pending
2061+ .type _dl_ubicom32_resolve_pending,@function
2062+
2063+_dl_ubicom32_resolve_pending:
2064+ /*
2065+ * A special function that is used to ensure thread saftly when the fd
2066+ * for a particular resolution is being updated.
2067+ *
2068+ * At entry, a3 must point to the FD. While the FD is being updated the
2069+ * entry_point will continue to point to _dl_ubicom32_resolve_pending so
2070+ * we will effectively spin until the resolver update is complete.
2071+ */
2072+
2073+ move.4 a4, 0(a3) ; get entry_point
2074+ move.4 a0, 4(a3) ; set new GOT
2075+
2076+ /*
2077+ * jump to resovled function or back to _dl_ubicom32_resolve_pending.
2078+ */
2079+ calli a4, 0(a4)
2080+ .size _dl_ubicom32_resolve_pending, . - _dl_ubicom32_resolve_pending
2081--- a/libc/misc/Makefile.in
2082@@ -12,7 +12,9 @@ include $(top_srcdir)libc/misc/assert/Ma
2083 include $(top_srcdir)libc/misc/ctype/Makefile.in
2084 include $(top_srcdir)libc/misc/dirent/Makefile.in
2085 include $(top_srcdir)libc/misc/error/Makefile.in
2086+ifneq ($(ARCH_HAS_NO_LDSO),y)
2087 include $(top_srcdir)libc/misc/elf/Makefile.in
2088+endif
2089 include $(top_srcdir)libc/misc/file/Makefile.in
2090 include $(top_srcdir)libc/misc/fnmatch/Makefile.in
2091 include $(top_srcdir)libc/misc/ftw/Makefile.in
2092--- a/libc/misc/elf/dl-iterate-phdr.c
2093@@ -14,7 +14,7 @@
2094
2095 #include <link.h>
2096 #include <ldso.h>
2097-
2098+#include <memory.h>
2099 /* we want this in libc but nowhere else */
2100 #ifdef __USE_GNU
2101
2102--- a/libc/stdlib/malloc/malloc.c
2103@@ -23,7 +23,7 @@
2104
2105 /* The malloc heap. We provide a bit of initial static space so that
2106    programs can do a little mallocing without mmaping in more space. */
2107-HEAP_DECLARE_STATIC_FREE_AREA (initial_fa, 256);
2108+HEAP_DECLARE_STATIC_FREE_AREA (initial_fa, 32768);
2109 struct heap_free_area *__malloc_heap = HEAP_INIT_WITH_FA (initial_fa);
2110 #ifdef HEAP_USE_LOCKING
2111 malloc_mutex_t __malloc_heap_lock = PTHREAD_MUTEX_INITIALIZER;
2112--- /dev/null
2113@@ -0,0 +1,13 @@
2114+# Makefile for uClibc
2115+#
2116+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
2117+#
2118+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
2119+#
2120+
2121+top_srcdir:=../../../
2122+top_builddir:=../../../
2123+all: objs
2124+include $(top_builddir)Rules.mak
2125+include ../Makefile.in
2126+include $(top_srcdir)Makerules
2127--- /dev/null
2128@@ -0,0 +1,152 @@
2129+/* Copy memory to memory until the specified number of bytes
2130+ has been copied. Overlap is NOT handled correctly.
2131+ Copyright (C) 1991, 1997, 2003 Free Software Foundation, Inc.
2132+ This file is part of the GNU C Library.
2133+ Contributed by Torbjorn Granlund (tege@sics.se).
2134+
2135+ The GNU C Library is free software; you can redistribute it and/or
2136+ modify it under the terms of the GNU Lesser General Public
2137+ License as published by the Free Software Foundation; either
2138+ version 2.1 of the License, or (at your option) any later version.
2139+
2140+ The GNU C Library is distributed in the hope that it will be useful,
2141+ but WITHOUT ANY WARRANTY; without even the implied warranty of
2142+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2143+ Lesser General Public License for more details.
2144+
2145+ You should have received a copy of the GNU Lesser General Public
2146+ License along with the GNU C Library; if not, write to the Free
2147+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
2148+ 02111-1307 USA. */
2149+
2150+#include <string.h>
2151+
2152+typedef unsigned long addr_t;
2153+
2154+libc_hidden_proto(memcpy)
2155+
2156+void *memcpy (void *dest, const void *src, size_t n)
2157+{
2158+ void *dest_ret = dest;
2159+ void *aligned_start;
2160+
2161+ if (likely((((addr_t)dest ^ (addr_t)src) & 3) == 0) && likely(n > 6)) {
2162+ size_t m;
2163+ n -= (4 - (addr_t)dest) & 0x03;
2164+ m = n >> 2;
2165+ __asm__ volatile (
2166+ " call %4, 99f \n\t" // load %4 with address of 99
2167+ "99: movei d15, #%%lo(1f-99b) \n\t" // load d15 with offset to 1 from 99
2168+ " add.4 %4, %4, d15 \n\t" // add difference
2169+
2170+ " sub.4 d15, #0, %2 \n\t" // set up for jump table
2171+ " and.4 d15, #(32-1), d15 \n\t" // d15 = (-m) & (32 - 1)
2172+ " lea.4 %4, (%4,d15) \n\t"
2173+
2174+ " bfextu d15, %0, #2 \n\t" // d15 = (dest & 3)
2175+ " jmpne.w.f 100f \n\t"
2176+ " calli %4, 0(%4) \n\t" // 4-byte alignment
2177+
2178+ "100: cmpi d15, #2 \n\t"
2179+ " jmpne.s.f 101f \n\t"
2180+ " move.2 (%0)2++, (%1)2++ \n\t"
2181+ " calli %4, 0(%4) \n\t" // 2-byte alignment
2182+
2183+ "101: move.1 (%0)1++, (%1)1++ \n\t"
2184+ " jmpgt.s.f 102f \n\t" // 3-byte alignment
2185+ " move.2 (%0)2++, (%1)2++ \n\t" // 1-byte alignment
2186+ "102: calli %4, 0(%4) \n\t"
2187+
2188+ "200: cmpi %3, #2 \n\t"
2189+ " jmplt.s.f 201f \n\t"
2190+ " move.2 (%0)2++, (%1)2++ \n\t"
2191+ " jmpeq.s.t 2f \n\t"
2192+ "201: move.1 (%0)1++, (%1)1++ \n\t"
2193+ " jmpt.w.t 2f \n\t"
2194+
2195+ "1: .rept 25 \n\t"
2196+ " movea (%0)4++, (%1)4++ \n\t"
2197+ " .endr \n\t"
2198+ " .rept 7 \n\t"
2199+ " move.4 (%0)4++, (%1)4++ \n\t"
2200+ " .endr \n\t"
2201+ " add.4 %2, #-32, %2 \n\t"
2202+ " jmpgt.w.f 1b \n\t"
2203+
2204+ " and.4 %3, #3, %3 \n\t" // check n
2205+ " jmpne.w.f 200b \n\t"
2206+ "2: \n\t"
2207+ : "+a"(dest), "+a"(src), "+d"(m), "+d"(n), "=a"(aligned_start)
2208+ :
2209+ : "d15", "memory", "cc"
2210+ );
2211+
2212+ return dest_ret;
2213+ }
2214+
2215+ if (likely((((addr_t)dest ^ (addr_t)src) & 1) == 0) && likely(n > 2)) {
2216+ size_t m;
2217+ n -= (addr_t)dest & 0x01;
2218+ m = n >> 1;
2219+ __asm__ volatile (
2220+ " call %4, 99f \n\t" // load %4 with address of 99
2221+ "99: movei d15, #%%lo(1f-99b) \n\t" // load d15 with offset to 1 from 99
2222+ " add.4 %4, %4, d15 \n\t" // add difference
2223+
2224+ " sub.4 d15, #0, %2 \n\t" // set up for jump table
2225+ " and.4 d15, #(32-1), d15 \n\t" // d15 = (-m) & (32 - 1)
2226+ " lea.4 %4, (%4,d15) \n\t"
2227+
2228+ " btst %0, #0 \n\t" // check bit 0
2229+ " jmpne.w.f 100f \n\t"
2230+ " calli %4, 0(%4) \n\t" // 4-byte alignment
2231+
2232+ "100: move.1 (%0)1++, (%1)1++ \n\t"
2233+ " calli %4, 0(%4) \n\t"
2234+
2235+ "200: move.1 (%0)1++, (%1)1++ \n\t"
2236+ " jmpt.w.t 2f \n\t"
2237+
2238+ "1: .rept 32 \n\t"
2239+ " move.2 (%0)2++, (%1)2++ \n\t"
2240+ " .endr \n\t"
2241+ " add.4 %2, #-32, %2 \n\t"
2242+ " jmpgt.w.f 1b \n\t"
2243+
2244+ " and.4 %3, #1, %3 \n\t" // check n
2245+ " jmpne.w.f 200b \n\t"
2246+ "2: \n\t"
2247+
2248+ : "+a"(dest), "+a"(src), "+d"(m), "+d"(n), "=a"(aligned_start)
2249+ :
2250+ : "d15", "memory", "cc"
2251+ );
2252+ return dest_ret;
2253+ }
2254+
2255+ __asm__ volatile (
2256+ " call %3, 99f \n\t" // load %3 with address of 99
2257+ "99: movei d15, #%%lo(1f-99b) \n\t" // load d15 with offset to 1 from 99
2258+ " add.4 %3, %3, d15 \n\t" // add difference
2259+
2260+ " sub.4 d15, #0, %2 \n\t"
2261+ " jmpeq.w.f 2f \n\t"
2262+ " and.4 d15, #(16-1), d15 \n\t" // d15 = (-n) & (16 - 1)
2263+ " lea.4 %3, (%3,d15) \n\t"
2264+ " calli %3, 0(%3) \n\t"
2265+
2266+ "1: .rept 16 \n\t"
2267+ " move.1 (%0)1++, (%1)1++ \n\t"
2268+ " .endr \n\t"
2269+ " add.4 %2, #-16, %2 \n\t"
2270+ " jmpgt.w.f 1b \n\t"
2271+ "2: \n\t"
2272+
2273+ : "+a"(dest), "+a"(src), "+d"(n), "=a"(aligned_start)
2274+ :
2275+ : "d15", "memory", "cc"
2276+ );
2277+
2278+ return dest_ret;
2279+}
2280+libc_hidden_def(memcpy)
2281--- /dev/null
2282@@ -0,0 +1,107 @@
2283+/* Copyright (C) 1991, 1997, 2003 Free Software Foundation, Inc.
2284+ This file is part of the GNU C Library.
2285+
2286+ The GNU C Library is free software; you can redistribute it and/or
2287+ modify it under the terms of the GNU Lesser General Public
2288+ License as published by the Free Software Foundation; either
2289+ version 2.1 of the License, or (at your option) any later version.
2290+
2291+ The GNU C Library is distributed in the hope that it will be useful,
2292+ but WITHOUT ANY WARRANTY; without even the implied warranty of
2293+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2294+ Lesser General Public License for more details.
2295+
2296+ You should have received a copy of the GNU Lesser General Public
2297+ License along with the GNU C Library; if not, write to the Free
2298+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
2299+ 02111-1307 USA. */
2300+
2301+#include <string.h>
2302+
2303+typedef unsigned long addr_t;
2304+
2305+libc_hidden_proto(memset)
2306+void *memset (void *s, int c, size_t n)
2307+{
2308+ void *s_ret = s;
2309+ void *aligned_start;
2310+ if (likely(n > 6)) {
2311+ size_t m;
2312+ n -= (4 - (addr_t)s) & 0x03;
2313+ m = n >> 2;
2314+ __asm__ volatile (
2315+ " call %4, 99f \n\t" // load %4 with address of 99
2316+ "99: movei d15, #%%lo(1f-99b) \n\t" // load d15 with offset to 1 from 99
2317+ " add.4 %4, %4, d15 \n\t" // add difference
2318+
2319+ " sub.4 d15, #0, %2 \n\t" // set up for jump table
2320+ " and.4 d15, #(32-1), d15 \n\t" // d15 = (-m) & (32 - 1)
2321+ " shmrg.1 %1, %1, %1 \n\t"
2322+ " shmrg.2 %1, %1, %1 \n\t" // %1 = (c<<24)|(c<<16)|(c<<8)|c
2323+ " lea.4 %4, (%4,d15) \n\t"
2324+
2325+ " bfextu d15, %0, #2 \n\t" // d15 = (s & 3)
2326+ " jmpne.w.f 100f \n\t"
2327+ " calli %4, 0(%4) \n\t" // 4-byte alignment
2328+
2329+ "100: cmpi d15, #2 \n\t"
2330+ " jmpne.s.f 101f \n\t"
2331+ " move.2 (%0)2++, %1 \n\t"
2332+ " calli %4, 0(%4) \n\t" // 2-byte alignment
2333+
2334+ "101: move.1 (%0)1++, %1 \n\t"
2335+ " jmpgt.s.f 102f \n\t" // 3-byte alignment
2336+ " move.2 (%0)2++, %1 \n\t" // 1-byte alignment
2337+ "102: calli %4, 0(%4) \n\t"
2338+
2339+ "200: cmpi %3, #2 \n\t"
2340+ " jmplt.s.f 201f \n\t"
2341+ " move.2 (%0)2++, %1 \n\t"
2342+ " jmpeq.s.t 2f \n\t"
2343+ "201: move.1 (%0)1++, %1 \n\t"
2344+ " jmpt.w.t 2f \n\t"
2345+
2346+ "1: .rept 25 \n\t"
2347+ " movea (%0)4++, %1 \n\t"
2348+ " .endr \n\t"
2349+ " .rept 7 \n\t"
2350+ " move.4 (%0)4++, %1 \n\t"
2351+ " .endr \n\t"
2352+ " add.4 %2, #-32, %2 \n\t"
2353+ " jmpgt.w.f 1b \n\t"
2354+
2355+ " and.4 %3, #3, %3 \n\t" // test bit 1 of n
2356+ " jmpne.w.f 200b \n\t"
2357+ "2: \n\t"
2358+ : "+a"(s), "+d"(c), "+d"(m), "+d"(n), "=a"(aligned_start)
2359+ :
2360+ : "d15", "memory", "cc"
2361+ );
2362+
2363+ return s_ret;
2364+ }
2365+
2366+ __asm__ volatile (
2367+ " call %3, 99f \n\t" // load %3 with address of 99
2368+ "99: movei d15, #%%lo(1f-99b) \n\t" // load d15 with offset to 1 from 99
2369+ " add.4 %3, %3, d15 \n\t" // add difference
2370+
2371+ " sub.4 d15, #0, %2 \n\t"
2372+ " jmpeq.w.f 2f \n\t"
2373+ " and.4 d15, #(8-1), d15 \n\t" // d15 = (-%2) & (16 - 1)
2374+ " lea.4 %3, (%3,d15) \n\t"
2375+ " calli %3, 0(%3) \n\t"
2376+
2377+ "1: .rept 8 \n\t"
2378+ " move.1 (%0)1++, %1 \n\t"
2379+ " .endr \n\t"
2380+ "2: \n\t"
2381+
2382+ : "+a"(s), "+d"(c), "+d"(n), "=a"(aligned_start)
2383+ :
2384+ : "d15", "memory", "cc"
2385+ );
2386+
2387+ return s_ret;
2388+}
2389+libc_hidden_def(memset)
2390--- /dev/null
2391@@ -0,0 +1,13 @@
2392+# Makefile for uClibc
2393+#
2394+# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
2395+#
2396+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
2397+#
2398+
2399+top_srcdir=../../../../
2400+top_builddir=../../../../
2401+all: objs
2402+include $(top_builddir)Rules.mak
2403+include Makefile.arch
2404+include $(top_srcdir)Makerules
2405--- /dev/null
2406@@ -0,0 +1,28 @@
2407+# Makefile for uClibc
2408+#
2409+# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
2410+#
2411+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
2412+#
2413+
2414+#CSRC := \
2415+# brk.c \
2416+# crtbegin.c \
2417+# crtend.c
2418+#
2419+#SSRC := \
2420+# __longjmp.S \
2421+# bsd-_setjmp.S \
2422+# bsd-setjmp.S \
2423+# setjmp.S \
2424+# clone.S \
2425+# vfork.S
2426+
2427+CSRC := \
2428+ syscall.c __syscall_error.c
2429+
2430+SSRC := \
2431+ clone.S setjmp.S vfork.S
2432+
2433+ARCH_CFLAGS := $(CPU_CFLAGS-y)
2434+include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch
2435--- /dev/null
2436@@ -0,0 +1,11 @@
2437+#include <errno.h>
2438+#include <features.h>
2439+
2440+/* This routine is jumped to by some of the syscall handlers, to stash
2441+ * an error number into errno. */
2442+int __syscall_error(int err_no) attribute_hidden;
2443+int __syscall_error(int err_no)
2444+{
2445+ __set_errno(err_no);
2446+ return -1;
2447+}
2448--- /dev/null
2449@@ -0,0 +1,115 @@
2450+/* Copyright 2003, 2004 Free Software Foundation, Inc.
2451+This file is part of the GNU C Library.
2452+
2453+The GNU C Library is free software; you can redistribute it and/or
2454+modify it under the terms of the GNU Lesser General Public License as
2455+published by the Free Software Foundation; either version 2.1 of the
2456+License, or (at your option) any later version.
2457+
2458+In addition to the permissions in the GNU Lesser General Public
2459+License, the Free Software Foundation gives you unlimited
2460+permission to link the compiled version of this file with other
2461+programs, and to distribute those programs without any restriction
2462+coming from the use of this file. (The GNU Lesser General Public
2463+License restrictions do apply in other respects; for example, they
2464+cover modification of the file, and distribution when not linked
2465+into another program.)
2466+
2467+The GNU C Library is distributed in the hope that it will be useful,
2468+but WITHOUT ANY WARRANTY; without even the implied warranty of
2469+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2470+Library General Public License for more details.
2471+
2472+You should have received a copy of the GNU Lesser General Public
2473+License along with the GNU C Library; see the file COPYING.LIB. If
2474+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
2475+Cambridge, MA 02139, USA. */
2476+
2477+#ifndef _BITS_ELF_FDPIC_H
2478+#define _BITS_ELF_FDPIC_H
2479+
2480+/* These data structures are described in the FDPIC ABI extension.
2481+ The kernel passes a process a memory map, such that for every LOAD
2482+ segment there is an elf32_fdpic_loadseg entry. A pointer to an
2483+ elf32_fdpic_loadmap is passed in d8 at start-up, and a pointer to
2484+ an additional such map is passed in d9 for the interpreter, when
2485+ there is one. */
2486+
2487+#include <elf.h>
2488+
2489+/* This data structure represents a PT_LOAD segment. */
2490+struct elf32_fdpic_loadseg
2491+{
2492+ /* Core address to which the segment is mapped. */
2493+ Elf32_Addr addr;
2494+ /* VMA recorded in the program header. */
2495+ Elf32_Addr p_vaddr;
2496+ /* Size of this segment in memory. */
2497+ Elf32_Word p_memsz;
2498+};
2499+
2500+struct elf32_fdpic_loadmap {
2501+ /* Protocol version number, must be zero. */
2502+ Elf32_Half version;
2503+ /* Number of segments in this map. */
2504+ Elf32_Half nsegs;
2505+ /* The actual memory map. */
2506+ struct elf32_fdpic_loadseg segs[/*nsegs*/];
2507+};
2508+
2509+struct elf32_fdpic_loadaddr {
2510+ struct elf32_fdpic_loadmap *map;
2511+ void *got_value;
2512+};
2513+
2514+/* Map a pointer's VMA to its corresponding address according to the
2515+ load map. */
2516+static __always_inline void *
2517+__reloc_pointer (void *p,
2518+ const struct elf32_fdpic_loadmap *map)
2519+{
2520+ int c;
2521+
2522+#if 0
2523+ if (map->version != 0)
2524+ /* Crash. */
2525+ ((void(*)())0)();
2526+#endif
2527+
2528+ /* No special provision is made for NULL. We don't want NULL
2529+ addresses to go through relocation, so they shouldn't be in
2530+ .rofixup sections, and, if they're present in dynamic
2531+ relocations, they shall be mapped to the NULL address without
2532+ undergoing relocations. */
2533+
2534+ for (c = 0;
2535+ /* Take advantage of the fact that the loadmap is ordered by
2536+ virtual addresses. In general there will only be 2 entries,
2537+ so it's not profitable to do a binary search. */
2538+ c < map->nsegs && p >= (void*)map->segs[c].p_vaddr;
2539+ c++)
2540+ {
2541+ /* This should be computed as part of the pointer comparison
2542+ above, but we want to use the carry in the comparison, so we
2543+ can't convert it to an integer type beforehand. */
2544+ unsigned long offset = p - (void*)map->segs[c].p_vaddr;
2545+ /* We only check for one-past-the-end for the last segment,
2546+ assumed to be the data segment, because other cases are
2547+ ambiguous in the absence of padding between segments, and
2548+ rofixup already serves as padding between text and data.
2549+ Unfortunately, unless we special-case the last segment, we
2550+ fail to relocate the _end symbol. */
2551+ if (offset < map->segs[c].p_memsz
2552+ || (offset == map->segs[c].p_memsz && c + 1 == map->nsegs))
2553+ return (char*)map->segs[c].addr + offset;
2554+ }
2555+
2556+ /* We might want to crash instead. */
2557+ return (void*)-1;
2558+}
2559+
2560+# define __RELOC_POINTER(ptr, loadaddr) \
2561+ (__reloc_pointer ((void*)(ptr), \
2562+ (loadaddr).map))
2563+
2564+#endif /* _BITS_ELF_FDPIC_H */
2565--- /dev/null
2566@@ -0,0 +1,7 @@
2567+/* Ubicom32 is big-endian. */
2568+
2569+#ifndef _ENDIAN_H
2570+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
2571+#endif
2572+
2573+#define __BYTE_ORDER __BIG_ENDIAN
2574--- /dev/null
2575@@ -0,0 +1,226 @@
2576+/* O_*, F_*, FD_* bit values for Linux.
2577+ Copyright (C) 2000 Free Software Foundation, Inc.
2578+ This file is part of the GNU C Library.
2579+
2580+ The GNU C Library is free software; you can redistribute it and/or
2581+ modify it under the terms of the GNU Lesser General Public
2582+ License as published by the Free Software Foundation; either
2583+ version 2.1 of the License, or (at your option) any later version.
2584+
2585+ The GNU C Library is distributed in the hope that it will be useful,
2586+ but WITHOUT ANY WARRANTY; without even the implied warranty of
2587+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2588+ Lesser General Public License for more details.
2589+
2590+ You should have received a copy of the GNU Lesser General Public
2591+ License along with the GNU C Library; if not, write to the Free
2592+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
2593+ 02111-1307 USA. */
2594+
2595+#ifndef _FCNTL_H
2596+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
2597+#endif
2598+
2599+
2600+#include <sys/types.h>
2601+#ifdef __USE_GNU
2602+# include <bits/uio.h>
2603+#endif
2604+
2605+/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
2606+ located on an ext2 file system */
2607+#define O_ACCMODE 0003
2608+#define O_RDONLY 00
2609+#define O_WRONLY 01
2610+#define O_RDWR 02
2611+#define O_CREAT 0100 /* not fcntl */
2612+#define O_EXCL 0200 /* not fcntl */
2613+#define O_NOCTTY 0400 /* not fcntl */
2614+#define O_TRUNC 01000 /* not fcntl */
2615+#define O_APPEND 02000
2616+#define O_NONBLOCK 04000
2617+#define O_NDELAY O_NONBLOCK
2618+#define O_SYNC 010000
2619+#define O_FSYNC O_SYNC
2620+#define O_ASYNC 020000
2621+
2622+#ifdef __USE_GNU
2623+# define O_DIRECTORY 040000 /* Must be a directory. */
2624+# define O_NOFOLLOW 0100000 /* Do not follow links. */
2625+# define O_DIRECT 0200000 /* Direct disk access. */
2626+# define O_NOATIME 01000000 /* Do not set atime. */
2627+# define O_CLOEXEC 02000000 /* set close_on_exec */
2628+# define O_STREAMING 04000000 /* streaming access */
2629+#endif
2630+
2631+/* For now Linux has synchronisity options for data and read operations.
2632+ We define the symbols here but let them do the same as O_SYNC since
2633+ this is a superset. */
2634+#if defined __USE_POSIX199309 || defined __USE_UNIX98
2635+# define O_DSYNC O_SYNC /* Synchronize data. */
2636+# define O_RSYNC O_SYNC /* Synchronize read operations. */
2637+#endif
2638+
2639+#ifdef __USE_LARGEFILE64
2640+# define O_LARGEFILE 0400000
2641+#endif
2642+
2643+/* Values for the second argument to `fcntl'. */
2644+#define F_DUPFD 0 /* Duplicate file descriptor. */
2645+#define F_GETFD 1 /* Get file descriptor flags. */
2646+#define F_SETFD 2 /* Set file descriptor flags. */
2647+#define F_GETFL 3 /* Get file status flags. */
2648+#define F_SETFL 4 /* Set file status flags. */
2649+#ifndef __USE_FILE_OFFSET64
2650+# define F_GETLK 5 /* Get record locking info. */
2651+# define F_SETLK 6 /* Set record locking info (non-blocking). */
2652+# define F_SETLKW 7 /* Set record locking info (blocking). */
2653+#else
2654+# define F_GETLK F_GETLK64 /* Get record locking info. */
2655+# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/
2656+# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */
2657+#endif
2658+#define F_GETLK64 12 /* Get record locking info. */
2659+#define F_SETLK64 13 /* Set record locking info (non-blocking). */
2660+#define F_SETLKW64 14 /* Set record locking info (blocking). */
2661+
2662+#if defined __USE_BSD || defined __USE_XOPEN2K
2663+# define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */
2664+# define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */
2665+#endif
2666+
2667+#ifdef __USE_GNU
2668+# define F_SETSIG 10 /* Set number of signal to be sent. */
2669+# define F_GETSIG 11 /* Get number of signal to be sent. */
2670+#endif
2671+
2672+#ifdef __USE_GNU
2673+# define F_SETLEASE 1024 /* Set a lease. */
2674+# define F_GETLEASE 1025 /* Enquire what lease is active. */
2675+# define F_NOTIFY 1026 /* Request notfications on a directory. */
2676+#endif
2677+
2678+/* For F_[GET|SET]FL. */
2679+#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
2680+
2681+/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
2682+#define F_RDLCK 0 /* Read lock. */
2683+#define F_WRLCK 1 /* Write lock. */
2684+#define F_UNLCK 2 /* Remove lock. */
2685+
2686+/* For old implementation of bsd flock(). */
2687+#define F_EXLCK 4 /* or 3 */
2688+#define F_SHLCK 8 /* or 4 */
2689+
2690+#ifdef __USE_BSD
2691+/* Operations for bsd flock(), also used by the kernel implementation. */
2692+# define LOCK_SH 1 /* shared lock */
2693+# define LOCK_EX 2 /* exclusive lock */
2694+# define LOCK_NB 4 /* or'd with one of the above to prevent
2695+ blocking */
2696+# define LOCK_UN 8 /* remove lock */
2697+#endif
2698+
2699+#ifdef __USE_GNU
2700+# define LOCK_MAND 32 /* This is a mandatory flock: */
2701+# define LOCK_READ 64 /* ... which allows concurrent read operations. */
2702+# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */
2703+# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */
2704+#endif
2705+
2706+#ifdef __USE_GNU
2707+/* Types of directory notifications that may be requested with F_NOTIFY. */
2708+# define DN_ACCESS 0x00000001 /* File accessed. */
2709+# define DN_MODIFY 0x00000002 /* File modified. */
2710+# define DN_CREATE 0x00000004 /* File created. */
2711+# define DN_DELETE 0x00000008 /* File removed. */
2712+# define DN_RENAME 0x00000010 /* File renamed. */
2713+# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
2714+# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
2715+#endif
2716+
2717+struct flock
2718+ {
2719+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
2720+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
2721+#ifndef __USE_FILE_OFFSET64
2722+ __off_t l_start; /* Offset where the lock begins. */
2723+ __off_t l_len; /* Size of the locked area; zero means until EOF. */
2724+#else
2725+ __off64_t l_start; /* Offset where the lock begins. */
2726+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
2727+#endif
2728+ __pid_t l_pid; /* Process holding the lock. */
2729+ };
2730+
2731+#ifdef __USE_LARGEFILE64
2732+struct flock64
2733+ {
2734+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
2735+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
2736+ __off64_t l_start; /* Offset where the lock begins. */
2737+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
2738+ __pid_t l_pid; /* Process holding the lock. */
2739+ };
2740+#endif
2741+
2742+/* Define some more compatibility macros to be backward compatible with
2743+ BSD systems which did not managed to hide these kernel macros. */
2744+#ifdef __USE_BSD
2745+# define FAPPEND O_APPEND
2746+# define FFSYNC O_FSYNC
2747+# define FASYNC O_ASYNC
2748+# define FNONBLOCK O_NONBLOCK
2749+# define FNDELAY O_NDELAY
2750+#endif /* Use BSD. */
2751+
2752+/* Advise to `posix_fadvise'. */
2753+#ifdef __USE_XOPEN2K
2754+# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
2755+# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
2756+# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
2757+# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
2758+# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
2759+# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
2760+#endif
2761+
2762+#ifdef __USE_GNU
2763+# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
2764+ in the range before performing the
2765+ write. */
2766+# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those
2767+ dirty pages in the range which are
2768+ not presently under writeback. */
2769+# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
2770+ the range after performing the
2771+ write. */
2772+#endif
2773+
2774+__BEGIN_DECLS
2775+
2776+#ifdef __USE_GNU
2777+
2778+/* Provide kernel hint to read ahead. */
2779+extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
2780+ __THROW;
2781+
2782+/* Selective file content synch'ing. */
2783+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
2784+ unsigned int __flags);
2785+
2786+/* Splice address range into a pipe. */
2787+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
2788+ size_t __count, unsigned int __flags);
2789+
2790+/* Splice two files together. */
2791+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
2792+ __off64_t *__offout, size_t __len,
2793+ unsigned int __flags);
2794+
2795+/* In-kernel implementation of tee for pipe buffers. */
2796+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
2797+ unsigned int __flags);
2798+
2799+#endif
2800+
2801+__END_DECLS
2802--- /dev/null
2803@@ -0,0 +1,55 @@
2804+#ifndef _BITS_STAT_STRUCT_H
2805+#define _BITS_STAT_STRUCT_H
2806+
2807+#ifndef _LIBC
2808+#error bits/kernel_stat.h is for internal uClibc use only!
2809+#endif
2810+
2811+/* This file provides whatever this particular arch's kernel thinks
2812+ * struct kernel_stat should look like... It turns out each arch has a
2813+ * different opinion on the subject... */
2814+
2815+struct kernel_stat {
2816+ unsigned short st_dev;
2817+ unsigned short __pad1;
2818+ unsigned long st_ino;
2819+ unsigned short st_mode;
2820+ unsigned short st_nlink;
2821+ unsigned short st_uid;
2822+ unsigned short st_gid;
2823+ unsigned short st_rdev;
2824+ unsigned short __pad2;
2825+ unsigned long st_size;
2826+ unsigned long st_blksize;
2827+ unsigned long st_blocks;
2828+ struct timespec st_atim;
2829+ struct timespec st_mtim;
2830+ struct timespec st_ctim;
2831+ unsigned long __unused4;
2832+ unsigned long __unused5;
2833+};
2834+
2835+struct kernel_stat64 {
2836+ unsigned char __pad0[6];
2837+ unsigned short st_dev;
2838+ unsigned char __pad1[4];
2839+#define _HAVE_STAT64___ST_INO
2840+ unsigned long __st_ino;
2841+ unsigned int st_mode;
2842+ unsigned int st_nlink;
2843+ unsigned long st_uid;
2844+ unsigned long st_gid;
2845+ unsigned char __pad2[6];
2846+ unsigned short st_rdev;
2847+ unsigned char __pad3[4];
2848+ long long st_size;
2849+ unsigned long st_blksize;
2850+ unsigned long st_blocks; /* Number 512-byte blocks allocated. */
2851+ unsigned long __pad4; /* future possible st_blocks high bits */
2852+ struct timespec st_atim;
2853+ struct timespec st_mtim;
2854+ struct timespec st_ctim;
2855+ unsigned long long st_ino;
2856+};
2857+
2858+#endif /* _BITS_STAT_STRUCT_H */
2859--- /dev/null
2860@@ -0,0 +1,44 @@
2861+/* Note that we use the exact same include guard #define names
2862+ * as asm/posix_types.h. This will avoid gratuitous conflicts
2863+ * with the posix_types.h kernel header, and will ensure that
2864+ * our private content, and not the kernel header, will win.
2865+ * -Erik
2866+ */
2867+#ifndef __ARCH_UBICOM32_POSIX_TYPES_H
2868+#define __ARCH_UBICOM32_POSIX_TYPES_H
2869+
2870+typedef unsigned long __kernel_dev_t;
2871+typedef unsigned long __kernel_ino_t;
2872+typedef unsigned short __kernel_mode_t;
2873+typedef unsigned short __kernel_nlink_t;
2874+typedef long __kernel_off_t;
2875+typedef int __kernel_pid_t;
2876+typedef unsigned short __kernel_ipc_pid_t;
2877+typedef unsigned short __kernel_uid_t;
2878+typedef unsigned short __kernel_gid_t;
2879+typedef unsigned int __kernel_size_t;
2880+typedef int __kernel_ssize_t;
2881+typedef int __kernel_ptrdiff_t;
2882+typedef long __kernel_time_t;
2883+typedef long __kernel_suseconds_t;
2884+typedef long __kernel_clock_t;
2885+typedef int __kernel_daddr_t;
2886+typedef char * __kernel_caddr_t;
2887+typedef unsigned short __kernel_uid16_t;
2888+typedef unsigned short __kernel_gid16_t;
2889+typedef unsigned int __kernel_uid32_t;
2890+typedef unsigned int __kernel_gid32_t;
2891+typedef unsigned short __kernel_old_uid_t;
2892+typedef unsigned short __kernel_old_gid_t;
2893+typedef unsigned short __kernel_old_dev_t;
2894+typedef long long __kernel_loff_t;
2895+
2896+typedef struct {
2897+#ifdef __USE_ALL
2898+ int val[2];
2899+#else
2900+ int __val[2];
2901+#endif
2902+} __kernel_fsid_t;
2903+
2904+#endif /* __ARCH_UBICOM32_POSIX_TYPES_H */
2905--- /dev/null
2906@@ -0,0 +1,103 @@
2907+/* Definitions for POSIX memory map interface. Linux/m68k version.
2908+ Copyright (C) 1997, 2000, 2003, 2005 Free Software Foundation, Inc.
2909+ This file is part of the GNU C Library.
2910+
2911+ The GNU C Library is free software; you can redistribute it and/or
2912+ modify it under the terms of the GNU Lesser General Public
2913+ License as published by the Free Software Foundation; either
2914+ version 2.1 of the License, or (at your option) any later version.
2915+
2916+ The GNU C Library is distributed in the hope that it will be useful,
2917+ but WITHOUT ANY WARRANTY; without even the implied warranty of
2918+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2919+ Lesser General Public License for more details.
2920+
2921+ You should have received a copy of the GNU Lesser General Public
2922+ License along with the GNU C Library; if not, write to the Free
2923+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
2924+ 02111-1307 USA. */
2925+
2926+#ifndef _SYS_MMAN_H
2927+# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
2928+#endif
2929+
2930+/* The following definitions basically come from the kernel headers.
2931+ But the kernel header is not namespace clean. */
2932+
2933+
2934+/* Protections are chosen from these bits, OR'd together. The
2935+ implementation does not necessarily support PROT_EXEC or PROT_WRITE
2936+ without PROT_READ. The only guarantees are that no writing will be
2937+ allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
2938+
2939+#define PROT_READ 0x1 /* Page can be read. */
2940+#define PROT_WRITE 0x2 /* Page can be written. */
2941+#define PROT_EXEC 0x4 /* Page can be executed. */
2942+#define PROT_NONE 0x0 /* Page can not be accessed. */
2943+#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of
2944+ growsdown vma (mprotect only). */
2945+#define PROT_GROWSUP 0x02000000 /* Extend change to start of
2946+ growsup vma (mprotect only). */
2947+
2948+/* Sharing types (must choose one and only one of these). */
2949+#define MAP_SHARED 0x01 /* Share changes. */
2950+#define MAP_PRIVATE 0x02 /* Changes are private. */
2951+#ifdef __USE_MISC
2952+# define MAP_TYPE 0x0f /* Mask for type of mapping. */
2953+#endif
2954+
2955+/* Other flags. */
2956+#define MAP_FIXED 0x10 /* Interpret addr exactly. */
2957+#ifdef __USE_MISC
2958+# define MAP_FILE 0
2959+# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
2960+# define MAP_ANON MAP_ANONYMOUS
2961+#endif
2962+
2963+/* These are Linux-specific. */
2964+#ifdef __USE_MISC
2965+# define MAP_GROWSDOWN 0x0000100 /* Stack-like segment. */
2966+# define MAP_DENYWRITE 0x0000800 /* ETXTBSY */
2967+# define MAP_EXECUTABLE 0x0001000 /* Mark it as an executable. */
2968+# define MAP_LOCKED 0x0002000 /* Lock the mapping. */
2969+# define MAP_NORESERVE 0x0004000 /* Don't check for reservations. */
2970+# define MAP_POPULATE 0x0008000 /* Populate (prefault) pagetables. */
2971+# define MAP_NONBLOCK 0x0010000 /* Do not block on IO. */
2972+# define MAP_UNINITIALIZE 0x4000000 /* For anonymous mmap, memory could be uninitialized. */
2973+#endif
2974+
2975+/* Flags to `msync'. */
2976+#define MS_ASYNC 1 /* Sync memory asynchronously. */
2977+#define MS_SYNC 4 /* Synchronous memory sync. */
2978+#define MS_INVALIDATE 2 /* Invalidate the caches. */
2979+
2980+/* Flags for `mlockall'. */
2981+#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
2982+#define MCL_FUTURE 2 /* Lock all additions to address
2983+ space. */
2984+
2985+/* Flags for `mremap'. */
2986+#ifdef __USE_GNU
2987+# define MREMAP_MAYMOVE 1
2988+# define MREMAP_FIXED 2
2989+#endif
2990+
2991+/* Advice to `madvise'. */
2992+#ifdef __USE_BSD
2993+# define MADV_NORMAL 0 /* No further special treatment. */
2994+# define MADV_RANDOM 1 /* Expect random page references. */
2995+# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
2996+# define MADV_WILLNEED 3 /* Will need these pages. */
2997+# define MADV_DONTNEED 4 /* Don't need these pages. */
2998+# define MADV_DONTFORK 10 /* Do not inherit across fork. */
2999+# define MADV_DOFORK 11 /* Do inherit across fork. */
3000+#endif
3001+
3002+/* The POSIX people had to invent similar names for the same things. */
3003+#ifdef __USE_XOPEN2K
3004+# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
3005+# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
3006+# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
3007+# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
3008+# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
3009+#endif
3010--- /dev/null
3011@@ -0,0 +1,52 @@
3012+/* Define the machine-dependent type `jmp_buf'. Ubicom32 version.
3013+ Copyright (C) 1992,93,95,97,2000 Free Software Foundation, Inc.
3014+ This file is part of the GNU C Library.
3015+
3016+ The GNU C Library is free software; you can redistribute it and/or
3017+ modify it under the terms of the GNU Lesser General Public
3018+ License as published by the Free Software Foundation; either
3019+ version 2.1 of the License, or (at your option) any later version.
3020+
3021+ The GNU C Library is distributed in the hope that it will be useful,
3022+ but WITHOUT ANY WARRANTY; without even the implied warranty of
3023+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3024+ Lesser General Public License for more details.
3025+
3026+ You should have received a copy of the GNU Lesser General Public
3027+ License along with the GNU C Library; if not, write to the Free
3028+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3029+ 02111-1307 USA. */
3030+
3031+#ifndef _BITS_SETJMP_H
3032+#define _BITS_SETJMP_H 1
3033+
3034+#if !defined _SETJMP_H && !defined _PTHREAD_H
3035+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
3036+#endif
3037+
3038+#ifndef _ASM
3039+/*
3040+ * This is the structure where we are going to save D10-D13, A0, A1, A2, A5, A6 and SP(A7).
3041+ * A5 is the return address. Call to setjmp will save these. Call to longjmp will return
3042+ * Control to the address in A5.
3043+ */
3044+typedef struct setjmp_save_struct {
3045+ unsigned long d10; /* D10 */
3046+ unsigned long d11; /* D11 */
3047+ unsigned long d12; /* D12 */
3048+ unsigned long d13; /* D13 */
3049+ unsigned long a1; /* A1 */
3050+ unsigned long a2; /* A2 */
3051+ unsigned long a5; /* A5 return address. */
3052+ unsigned long a6; /* A6 */
3053+ unsigned long sp; /* A7 stack pointer. */
3054+} __jmp_buf[1];
3055+
3056+#endif
3057+
3058+/* Test if longjmp to JMPBUF would unwind the frame
3059+ containing a local variable at ADDRESS. */
3060+#define _JMPBUF_UNWINDS(jmpbuf, address) \
3061+ ((void *) (address) < (void*)(jmpbuf)->sp)
3062+
3063+#endif /* bits/setjmp.h */
3064--- /dev/null
3065@@ -0,0 +1,28 @@
3066+/* Copyright (C) 1999 Free Software Foundation, Inc.
3067+ This file is part of the GNU C Library.
3068+
3069+ The GNU C Library is free software; you can redistribute it and/or
3070+ modify it under the terms of the GNU Lesser General Public
3071+ License as published by the Free Software Foundation; either
3072+ version 2.1 of the License, or (at your option) any later version.
3073+
3074+ The GNU C Library is distributed in the hope that it will be useful,
3075+ but WITHOUT ANY WARRANTY; without even the implied warranty of
3076+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3077+ Lesser General Public License for more details.
3078+
3079+ You should have received a copy of the GNU Lesser General Public
3080+ License along with the GNU C Library; if not, write to the Free
3081+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3082+ 02111-1307 USA. */
3083+
3084+/* This file contains a bit of information about the stack allocation
3085+ of the processor. */
3086+
3087+#ifndef _STACKINFO_H
3088+#define _STACKINFO_H 1
3089+
3090+/* On Ubicom32 the stack grows down. */
3091+#define _STACK_GROWS_DOWN 1
3092+
3093+#endif /* stackinfo.h */
3094--- /dev/null
3095@@ -0,0 +1,81 @@
3096+#ifndef _BITS_SYSCALLS_H
3097+#define _BITS_SYSCALLS_H
3098+#ifndef _SYSCALL_H
3099+# error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead."
3100+#endif
3101+
3102+/* m68k headers does stupid stuff with __NR_iopl / __NR_vm86:
3103+ * #define __NR_iopl not supported
3104+ * #define __NR_vm86 not supported
3105+ */
3106+#undef __NR_iopl
3107+#undef __NR_vm86
3108+
3109+#ifndef __ASSEMBLER__
3110+
3111+#include <errno.h>
3112+
3113+/* Linux takes system call arguments in registers:
3114+
3115+ syscall number %d8
3116+ arg 1 %d0
3117+ arg 2 %d1
3118+ arg 3 %d2
3119+ arg 4 %d3
3120+ arg 5 %d4
3121+ arg 6 %d5
3122+*/
3123+
3124+#define __loadargs_0(name, dummy) \
3125+ d8 = (long int)name
3126+
3127+#define __loadargs_1(name, __arg1) \
3128+ __loadargs_0(name, 0); \
3129+ d0_retval = (long int) __arg1
3130+
3131+#define __loadargs_2(name, __arg1, __arg2) \
3132+ __loadargs_1(name, __arg1); \
3133+ d1 = (long int) __arg2
3134+
3135+#define __loadargs_3(name, __arg1, __arg2, __arg3) \
3136+ __loadargs_2(name, __arg1, __arg2); \
3137+ d2 = (long int) __arg3
3138+
3139+#define __loadargs_4(name, __arg1, __arg2, __arg3, __arg4) \
3140+ __loadargs_3(name, __arg1, __arg2, __arg3); \
3141+ d3 = (long int)__arg4
3142+
3143+#define __loadargs_5(name, __arg1, __arg2, __arg3, __arg4, __arg5) \
3144+ __loadargs_4(name, __arg1, __arg2, __arg3, __arg4); \
3145+ d4 = (long int)__arg5
3146+
3147+#define __loadargs_6(name, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6) \
3148+ __loadargs_5(name, __arg1, __arg2, __arg3, __arg4, __arg5); \
3149+ d5 = (long int)__arg6
3150+
3151+#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
3152+({ \
3153+ register long int d0_retval __asm__ ("d0"); \
3154+ register long int d1 __asm__ ("d1"); \
3155+ register long int d2 __asm__ ("d2"); \
3156+ register long int d3 __asm__ ("d3"); \
3157+ register long int d4 __asm__ ("d4"); \
3158+ register long int d5 __asm__ ("d5"); \
3159+ register long int d8 __asm__ ("d8"); \
3160+ __loadargs_##nr (name, args); \
3161+ __asm__ __volatile__ ( \
3162+ " moveai a5, #%%hi(0x40400000)\n\t" \
3163+ " calli a5, 16(a5)\n\t" \
3164+ : "+r" (d0_retval), "+r" (d1), "+r" (d2), "+r" (d3), \
3165+ "+r" (d4), "+r" (d5), "+r" (d8) : \
3166+ : "cc", "memory", \
3167+ "acc0_lo", "acc0_hi", "acc1_lo", "acc1_hi", \
3168+ "source3", \
3169+ "a0", "a3", "a4", "a5", \
3170+ "d6", "d7", "d9", "d14", "d15" \
3171+ ); \
3172+ d0_retval; \
3173+})
3174+
3175+#endif /* __ASSEMBLER__ */
3176+#endif /* _BITS_SYSCALLS_H */
3177--- /dev/null
3178@@ -0,0 +1,45 @@
3179+/*
3180+ * Track misc arch-specific features that aren't config options
3181+ */
3182+
3183+#ifndef _BITS_UCLIBC_ARCH_FEATURES_H
3184+#define _BITS_UCLIBC_ARCH_FEATURES_H
3185+
3186+/* instruction used when calling abort() to kill yourself */
3187+/*#define __UCLIBC_ABORT_INSTRUCTION__ "asm instruction"*/
3188+#undef __UCLIBC_ABORT_INSTRUCTION__
3189+
3190+/* can your target use syscall6() for mmap ? */
3191+#undef __UCLIBC_MMAP_HAS_6_ARGS__
3192+
3193+/* does your target use syscall4() for truncate64 ? (32bit arches only) */
3194+#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__
3195+
3196+/* does your target have a broken create_module() ? */
3197+#undef __UCLIBC_BROKEN_CREATE_MODULE__
3198+
3199+/* does your target have to worry about older [gs]etrlimit() ? */
3200+#undef __UCLIBC_HANDLE_OLDER_RLIMIT__
3201+
3202+/* does your target prefix all symbols with an _ ? */
3203+#define __UCLIBC_NO_UNDERSCORES__
3204+
3205+/* does your target have an asm .set ? */
3206+#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
3207+
3208+/* define if target doesn't like .global */
3209+#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__
3210+
3211+/* define if target supports .weak */
3212+#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__
3213+
3214+/* define if target supports .weakext */
3215+#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__
3216+
3217+/* needed probably only for ppc64 */
3218+#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__
3219+
3220+/* define if target supports IEEE signed zero floats */
3221+#define __UCLIBC_HAVE_SIGNED_ZERO__
3222+
3223+#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */
3224--- /dev/null
3225@@ -0,0 +1,19 @@
3226+/* Copyright (C) 1999 Free Software Foundation, Inc.
3227+ This file is part of the GNU C Library.
3228+
3229+ The GNU C Library is free software; you can redistribute it and/or
3230+ modify it under the terms of the GNU Lesser General Public
3231+ License as published by the Free Software Foundation; either
3232+ version 2.1 of the License, or (at your option) any later version.
3233+
3234+ The GNU C Library is distributed in the hope that it will be useful,
3235+ but WITHOUT ANY WARRANTY; without even the implied warranty of
3236+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3237+ Lesser General Public License for more details.
3238+
3239+ You should have received a copy of the GNU Lesser General Public
3240+ License along with the GNU C Library; if not, write to the Free
3241+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3242+ 02111-1307 USA. */
3243+
3244+#define __WORDSIZE 32
3245--- /dev/null
3246@@ -0,0 +1,71 @@
3247+#include <sys/syscall.h>
3248+
3249+ .global __syscall_error
3250+
3251+/* int _clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
3252+ .text
3253+ .type clone,@function
3254+ .global clone
3255+clone:
3256+ /* Sanity check arguments. */
3257+ sub.4 #0, #0, d0 /* Test if fn is zero. */
3258+ jmpeq.f 1f /* arg bad */
3259+ sub.4 #0, #0, d1 /* Test if child_stack is zero. */
3260+ jmpeq.f 1f /* arg bad */
3261+
3262+ /* Set up child_stack frame.. arg and fn */
3263+ move.4 a3, d1
3264+ move.4 -4(a3)++, d3 /* push 'arg' to child stack */
3265+ move.4 -4(a3)++, d0 /* push fn to child stack, this will become a5
3266+ * on new child */
3267+ move.4 d1, a3
3268+ move.4 -4(sp)++, a5 /* push a5 to our stack */
3269+
3270+ /*
3271+ * The syscall clone is clone(int flags, void *child_stack) so we set
3272+ * that up now
3273+ */
3274+ move.4 d0, d2 /* Move flags to d0 */
3275+
3276+ /* Do Clone syscall */
3277+ movei d8, #__NR_clone
3278+ moveai a5, #%hi(0x40400000)
3279+ calli a5, 0x10(a5)
3280+ move.4 a5, (sp)4++ /* pop a5 from stack */
3281+
3282+ /* Clone Complete */
3283+ cmpi d0, #0 /* Test if d0 is less than zero. If it is we
3284+ * return the error */
3285+ jmplt.f 2f /* If return is less than we had an error */
3286+ jmpeq.f 3f /* If return is 0 we are in the clone, jump to
3287+ * thread start */
3288+ ret a5 /* d0 is pid */
3289+
3290+ /* Invalid Value */
3291+1: movei d0, #-22 /* EINVAL */
3292+
3293+ /* Call syscall Error */
3294+2: sub.4 d0, #0, d0 /* d0 = -d0 */
3295+#if defined(__UBICOM32_FDPIC__)
3296+ call a3, __syscall_error
3297+#else
3298+ moveai a3, #%hi(__syscall_error)
3299+ calli a3, %lo(__syscall_error)(a3)
3300+#endif
3301+ /* Child Thread Start */
3302+3:
3303+#if defined(__UBICOM32_FDPIC__)
3304+ /* a5 actually contains a function descriptor for fdpic */
3305+ move.4 a0, 4(a5) /* set GOT for this function */
3306+ move.4 a5, 0(a5) /* get address of entry point */
3307+#endif
3308+ move.4 d0, (sp)4++ /* pop 'arg' to stack */
3309+ calli a5, 0(a5)
3310+ movei d8, #__NR_exit
3311+ moveai a3, #%hi(0x40400000)
3312+ calli a3, 0x10(a3)
3313+
3314+ .size clone, . - clone
3315+ .global __GI_clone
3316+ .hidden __GI_clone
3317+ .set __GI_clone,clone
3318--- /dev/null
3319@@ -0,0 +1,179 @@
3320+/* Startup code compliant to the ELF m68k ABI.
3321+ Copyright (C) 1996, 1997, 1998, 2001, 2002 Free Software Foundation, Inc.
3322+ This file is part of the GNU C Library.
3323+
3324+ The GNU C Library is free software; you can redistribute it and/or
3325+ modify it under the terms of the GNU Lesser General Public
3326+ License as published by the Free Software Foundation; either
3327+ version 2.1 of the License, or (at your option) any later version.
3328+
3329+ In addition to the permissions in the GNU Lesser General Public
3330+ License, the Free Software Foundation gives you unlimited
3331+ permission to link the compiled version of this file with other
3332+ programs, and to distribute those programs without any restriction
3333+ coming from the use of this file. (The GNU Lesser General Public
3334+ License restrictions do apply in other respects; for example, they
3335+ cover modification of the file, and distribution when not linked
3336+ into another program.)
3337+
3338+ Note that people who make modified versions of this file are not
3339+ obligated to grant this special exception for their modified
3340+ versions; it is their choice whether to do so. The GNU Lesser
3341+ General Public License gives permission to release a modified
3342+ version without this exception; this exception also makes it
3343+ possible to release a modified version which carries forward this
3344+ exception.
3345+
3346+ The GNU C Library is distributed in the hope that it will be useful,
3347+ but WITHOUT ANY WARRANTY; without even the implied warranty of
3348+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3349+ Lesser General Public License for more details.
3350+
3351+ You should have received a copy of the GNU Lesser General Public
3352+ License along with the GNU C Library; if not, write to the Free
3353+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3354+ 02111-1307 USA. */
3355+
3356+#include <features.h>
3357+
3358+/* This is the canonical entry point, usually the first thing in the text
3359+ segment. The SVR4/m68k ABI says that when the entry point runs,
3360+ most registers' values are unspecified, except for:
3361+
3362+ %a1 Contains a function pointer to be registered with `atexit'.
3363+ This is how the dynamic linker arranges to have DT_FINI
3364+ functions called for shared libraries that have been loaded
3365+ before this code runs.
3366+
3367+ %sp The stack contains the arguments and environment:
3368+ 0(%sp) argc
3369+ 4(%sp) argv[0]
3370+ ...
3371+ (4*argc)(%sp) NULL
3372+ (4*(argc+1))(%sp) envp[0]
3373+ ...
3374+ NULL
3375+
3376+ The uclinux conventions are different. %a1 is not defined on entry
3377+ and the stack is laid out as follows:
3378+
3379+ 0(%sp) argc
3380+ 4(%sp) argv
3381+ 8(%sp) envp
3382+*/
3383+
3384+
3385+ .text
3386+ .type main,@function
3387+ .type _init,%function
3388+ .type _fini,%function
3389+#ifndef __UCLIBC_CTOR_DTOR__
3390+ .weak _init
3391+ .weak _fini
3392+#endif
3393+ .globl _start
3394+ .global __uClibc_main;
3395+ .type __uClibc_main,@function;
3396+ .type _start,@function
3397+_start:
3398+
3399+#if defined(__UBICOM32_FDPIC__) && !defined(L_Scrt1)
3400+ /* P0 contains a pointer to the program's load map. */
3401+ call a3, .Lcall;
3402+.Lcall:
3403+ move.4 d0, d1 ; load exec_map_addr
3404+ moveai a4, #%hi(.Lcall)
3405+ lea.1 d15, %lo(.Lcall)(a4)
3406+ sub.4 d15, a3, d15 ; difference between .Lcall and actual address of .Lcall
3407+ moveai a3, #%hi(__ROFIXUP_LIST__)
3408+ lea.1 d1, %lo(__ROFIXUP_LIST__)(a3)
3409+ moveai a3, #%hi(__ROFIXUP_END__)
3410+ lea.1 d2, %lo(__ROFIXUP_END__)(a3)
3411+ add.4 d1, d1, d15
3412+ add.4 d2, d2, d15
3413+ call a5, __self_reloc ; returns GOT in d0
3414+ move.4 a0, d0 ; set GOT
3415+#endif
3416+
3417+/*
3418+ all this is setup to make the following call.
3419+
3420+ void __uClibc_main(
3421+ d0 - int (*main)(int, char **, char **),
3422+ d1 - int argc, (d1)
3423+ d2 - char **argv,
3424+ d3 - void (*app_init)(void),
3425+ d4 - void (*app_fini)(void),
3426+ d5 - void (*rtld_fini)(void),
3427+ d6 - void *stack_end
3428+ );
3429+ */
3430+
3431+ /*
3432+ * Load pointer to main into d0
3433+ */
3434+#ifdef __UBICOM32_FDPIC__
3435+ movei d0, #%got_funcdesc_lo(main)
3436+ move.4 d0, (a0, d0)
3437+#else
3438+ moveai a3, #%hi(main)
3439+ lea.1 d0, %lo(main)(a3)
3440+#endif
3441+
3442+ /*
3443+ * Grab the environment stuff from stack and set up d1, d2 with it.
3444+ */
3445+ move.4 d1, (sp)
3446+#ifdef __UBICOM32_FDPIC__
3447+ /* For FDPIC the calling convention is different than flat */
3448+ lea.1 d2, 4(sp)
3449+#else
3450+ move.4 d2, 4(sp)
3451+#endif
3452+
3453+#ifdef __UCLIBC_CTOR_DTOR__
3454+ /*
3455+ * Load pointer to _init into d3
3456+ */
3457+#ifdef __UBICOM32_FDPIC__
3458+ movei d3, #%got_funcdesc_lo(_init)
3459+ move.4 d3, (a0, d3)
3460+#else
3461+ moveai a3, #%hi(_init)
3462+ lea.1 d3, %lo(_init)(a3)
3463+#endif
3464+
3465+ /*
3466+ * Load pointer to _fini into d4
3467+ */
3468+#ifdef __UBICOM32_FDPIC__
3469+ movei d4, #%got_funcdesc_lo(_fini)
3470+ move.4 d4, (a0, d4)
3471+#else
3472+ moveai a3, #%hi(_fini)
3473+ lea.1 d4, %lo(_fini)(a3)
3474+#endif
3475+
3476+#else /* !__UCLIBC_CTOR_DTOR__ */
3477+ move.4 d3, #0 ; _init
3478+ move.4 d4, #0 ; _fini
3479+#endif
3480+
3481+#ifdef __UBICOM32_FDPIC__
3482+ move.4 d5, a1 ; ldso _fini funcdesc (see dl-startup.h)
3483+#else
3484+ movei d5, #0 ; rtld_fini (not used)
3485+#endif
3486+
3487+ move.4 d6, sp ; Stack End.
3488+
3489+ /* Call the user's main function, and exit with its value. But
3490+ let the libc call main. */
3491+#ifdef __UBICOM32_FDPIC__
3492+ call a5, __uClibc_main
3493+#else
3494+ moveai a5, #%hi(__uClibc_main)
3495+ calli a5, %lo(__uClibc_main)(a5)
3496+#endif
3497+
3498+ bkpt #-1 ; Crash if somehow `exit' does return.
3499--- /dev/null
3500@@ -0,0 +1,54 @@
3501+/* Specialized code needed to support construction and destruction of
3502+ file-scope objects in C++ and Java code, and to support exception handling.
3503+ Copyright (C) 1999 Free Software Foundation, Inc.
3504+ Contributed by Charles-Antoine Gauthier (charles.gauthier@iit.nrc.ca).
3505+
3506+This file is part of GCC.
3507+
3508+GCC is free software; you can redistribute it and/or modify
3509+it under the terms of the GNU General Public License as published by
3510+the Free Software Foundation; either version 2, or (at your option)
3511+any later version.
3512+
3513+GCC is distributed in the hope that it will be useful,
3514+but WITHOUT ANY WARRANTY; without even the implied warranty of
3515+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3516+GNU General Public License for more details.
3517+
3518+You should have received a copy of the GNU General Public License
3519+along with GCC; see the file COPYING. If not, write to
3520+the Free Software Foundation, 59 Temple Place - Suite 330,
3521+Boston, MA 02111-1307, USA. */
3522+
3523+/* As a special exception, if you link this library with files
3524+ compiled with GCC to produce an executable, this does not cause
3525+ the resulting executable to be covered by the GNU General Public License.
3526+ This exception does not however invalidate any other reasons why
3527+ the executable file might be covered by the GNU General Public License. */
3528+
3529+/*
3530+ * This file just supplies function prologues for the .init and .fini
3531+ * sections. It is linked in before crtbegin.o.
3532+ */
3533+ .file "crti.o"
3534+ .ident "GNU C crti.o"
3535+
3536+ .section .init
3537+ .align 2
3538+ .globl _init
3539+ .type _init, @function
3540+_init:
3541+ move.4 -4(sp)++, a5
3542+#ifdef __UBICOM32_FDPIC__
3543+ move.4 -4(sp)++, a0
3544+#endif
3545+
3546+ .section .fini
3547+ .align 2
3548+ .globl _fini
3549+ .type _fini, @function
3550+_fini:
3551+ move.4 -4(sp)++, a5
3552+#ifdef __UBICOM32_FDPIC__
3553+ move.4 -4(sp)++, a0
3554+#endif
3555--- /dev/null
3556@@ -0,0 +1,47 @@
3557+/* Specialized code needed to support construction and destruction of
3558+ file-scope objects in C++ and Java code, and to support exception handling.
3559+ Copyright (C) 1999 Free Software Foundation, Inc.
3560+ Contributed by Charles-Antoine Gauthier (charles.gauthier@iit.nrc.ca).
3561+
3562+This file is part of GCC.
3563+
3564+GCC is free software; you can redistribute it and/or modify
3565+it under the terms of the GNU General Public License as published by
3566+the Free Software Foundation; either version 2, or (at your option)
3567+any later version.
3568+
3569+GCC is distributed in the hope that it will be useful,
3570+but WITHOUT ANY WARRANTY; without even the implied warranty of
3571+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3572+GNU General Public License for more details.
3573+
3574+You should have received a copy of the GNU General Public License
3575+along with GCC; see the file COPYING. If not, write to
3576+the Free Software Foundation, 59 Temple Place - Suite 330,
3577+Boston, MA 02111-1307, USA. */
3578+
3579+/* As a special exception, if you link this library with files
3580+ compiled with GCC to produce an executable, this does not cause
3581+ the resulting executable to be covered by the GNU General Public License.
3582+ This exception does not however invalidate any other reasons why
3583+ the executable file might be covered by the GNU General Public License. */
3584+
3585+/*
3586+ * This file supplies function epilogues for the .init and .fini sections.
3587+ * It is linked in after all other files.
3588+ */
3589+
3590+ .file "crtn.o"
3591+ .ident "GNU C crtn.o"
3592+
3593+ .section .init
3594+#ifdef __UBICOM32_FDPIC__
3595+ move.4 a0, (sp)4++
3596+#endif
3597+ ret (sp)4++
3598+
3599+ .section .fini
3600+#ifdef __UBICOM32_FDPIC__
3601+ move.4 a0, (sp)4++
3602+#endif
3603+ ret (sp)4++
3604--- /dev/null
3605@@ -0,0 +1,145 @@
3606+/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
3607+ written by Alexandre Oliva <aoliva@redhat.com>
3608+This file is part of the GNU C Library.
3609+
3610+The GNU C Library is free software; you can redistribute it and/or
3611+modify it under the terms of the GNU Lesser General Public License as
3612+published by the Free Software Foundation; either version 2.1 of the
3613+License, or (at your option) any later version.
3614+
3615+In addition to the permissions in the GNU Lesser General Public
3616+License, the Free Software Foundation gives you unlimited
3617+permission to link the compiled version of this file with other
3618+programs, and to distribute those programs without any restriction
3619+coming from the use of this file. (The GNU Lesser General Public
3620+License restrictions do apply in other respects; for example, they
3621+cover modification of the file, and distribution when not linked
3622+into another program.)
3623+
3624+The GNU C Library is distributed in the hope that it will be useful,
3625+but WITHOUT ANY WARRANTY; without even the implied warranty of
3626+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3627+Library General Public License for more details.
3628+
3629+You should have received a copy of the GNU Lesser General Public
3630+License along with the GNU C Library; see the file COPYING.LIB. If
3631+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
3632+Cambridge, MA 02139, USA. */
3633+
3634+#ifdef __UBICOM32_FDPIC__
3635+
3636+#include <sys/types.h>
3637+#include <link.h>
3638+
3639+/* This file is to be compiled into crt object files, to enable
3640+ executables to easily self-relocate. */
3641+
3642+union word {
3643+ char c[4];
3644+ void *v;
3645+};
3646+
3647+/* Compute the runtime address of pointer in the range [p,e), and then
3648+ map the pointer pointed by it. */
3649+static __always_inline void ***
3650+reloc_range_indirect (void ***p, void ***e,
3651+ const struct elf32_fdpic_loadmap *map)
3652+{
3653+ while (p < e)
3654+ {
3655+ if (*p != (void **)-1)
3656+ {
3657+ void *ptr = __reloc_pointer (*p, map);
3658+ if (ptr != (void *)-1)
3659+ {
3660+ void *pt;
3661+ if ((long)ptr & 3)
3662+ {
3663+ unsigned char *c = ptr;
3664+ int i;
3665+ unsigned long v = 0;
3666+ for (i = 0; i < 4; i++)
3667+ v |= c[i] << 8 * i;
3668+ pt = (void *)v;
3669+ }
3670+ else
3671+ pt = *(void**)ptr;
3672+ pt = __reloc_pointer (pt, map);
3673+ if ((long)ptr & 3)
3674+ {
3675+ unsigned char *c = ptr;
3676+ int i;
3677+ unsigned long v = (unsigned long)pt;
3678+ for (i = 0; i < 4; i++, v >>= 8)
3679+ c[i] = v;
3680+ }
3681+ else
3682+ *(void**)ptr = pt;
3683+ }
3684+ }
3685+ p++;
3686+ }
3687+ return p;
3688+}
3689+
3690+/* Call __reloc_range_indirect for the given range except for the last
3691+ entry, whose contents are only relocated. It's expected to hold
3692+ the GOT value. */
3693+void* attribute_hidden
3694+__self_reloc (const struct elf32_fdpic_loadmap *map,
3695+ void ***p, void ***e)
3696+{
3697+ p = reloc_range_indirect (p, e-1, map);
3698+
3699+ if (p >= e)
3700+ return (void*)-1;
3701+
3702+ return __reloc_pointer (*p, map);
3703+}
3704+
3705+#if 0
3706+/* These are other functions that might be useful, but that we don't
3707+ need. */
3708+
3709+/* Remap pointers in [p,e). */
3710+static __always_inline void**
3711+reloc_range (void **p, void **e,
3712+ const struct elf32_fdpic_loadmap *map)
3713+{
3714+ while (p < e)
3715+ {
3716+ *p = __reloc_pointer (*p, map);
3717+ p++;
3718+ }
3719+ return p;
3720+}
3721+
3722+/* Remap p, adjust e by the same offset, then map the pointers in the
3723+ range determined by them. */
3724+void attribute_hidden
3725+__reloc_range (const struct elf32_fdpic_loadmap *map,
3726+ void **p, void **e)
3727+{
3728+ void **old = p;
3729+
3730+ p = __reloc_pointer (p, map);
3731+ e += p - old;
3732+ reloc_range (p, e, map);
3733+}
3734+
3735+/* Remap p, adjust e by the same offset, then map pointers referenced
3736+ by the (unadjusted) pointers in the range. Return the relocated
3737+ value of the last pointer in the range. */
3738+void* attribute_hidden
3739+__reloc_range_indirect (const struct elf32_fdpic_loadmap *map,
3740+ void ***p, void ***e)
3741+{
3742+ void ***old = p;
3743+
3744+ p = __reloc_pointer (p, map);
3745+ e += p - old;
3746+ return reloc_range_indirect (p, e, map);
3747+}
3748+#endif
3749+
3750+#endif /* __UBICOM32_FDPIC__ */
3751--- /dev/null
3752@@ -0,0 +1,72 @@
3753+/* Setjmp for Ubicom32 */
3754+ .text
3755+ .global _setjmp
3756+ .type _setjmp,@function
3757+_setjmp:
3758+ movea a3, d0 ; A3 now holds the jmp buf that was passed in.
3759+ move.4 (a3)4++, d10
3760+ move.4 (a3)4++, d11
3761+ move.4 (a3)4++, d12
3762+ move.4 (a3)4++, d13
3763+ move.4 (a3)4++, a1
3764+ move.4 (a3)4++, a2
3765+ move.4 (a3)4++, a5
3766+ move.4 (a3)4++, a6
3767+ move.4 (a3)4++, a7
3768+ move.4 d0, #0
3769+
3770+ calli a5, 0(a5)
3771+ .size _setjmp, . - _setjmp
3772+
3773+/*
3774+ * __sigsetjmp for Ubicom32
3775+ * 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.
3776+ */
3777+ .global __sigsetjmp
3778+ .type __sigsetjmp,@function
3779+__sigsetjmp:
3780+ movea a3, d0 ; A3 now holds the jmp buf that was passed in.
3781+ move.4 (a3)4++, d10
3782+ move.4 (a3)4++, d11
3783+ move.4 (a3)4++, d12
3784+ move.4 (a3)4++, d13
3785+ move.4 (a3)4++, a1
3786+ move.4 (a3)4++, a2
3787+ move.4 (a3)4++, a5
3788+ move.4 (a3)4++, a6
3789+ move.4 (a3)4++, a7
3790+
3791+ ;; 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.
3792+#if defined(__UBICOM32_FDPIC__)
3793+ call a3, __sigjmp_save
3794+#else
3795+ moveai a3, #%hi(__sigjmp_save)
3796+ calli a3, %lo(__sigjmp_save)(a3)
3797+#endif
3798+ .size __sigjmp_save, . - __sigjmp_save
3799+
3800+ .global __longjmp
3801+ .type __longjmp,@function
3802+__longjmp:
3803+ movea a3, d0 ; A3 now holds the jmp buf that was passed in.
3804+ move.4 d10, (a3)4++
3805+ move.4 d11, (a3)4++
3806+ move.4 d12, (a3)4++
3807+ move.4 d13, (a3)4++
3808+ move.4 a1 , (a3)4++
3809+ move.4 a2 , (a3)4++
3810+ move.4 a5 , (a3)4++
3811+ move.4 a6 , (a3)4++
3812+ move.4 a7 , (a3)4++
3813+
3814+ sub.4 #0, #0, d1 ; Test if d1 is zero. If it is we have to return 1 other wise return content of d1
3815+ jmpeq.t 2f
3816+ move.4 d0, d1 ; d1 is non zero load it into d0
3817+ jmpt.t 3f
3818+
3819+2: move.4 d0, #1
3820+3: calli a5, 0(a5)
3821+ .size __longjmp, . - __longjmp
3822+ .global __GI___longjmp
3823+ .hidden __GI___longjmp
3824+ .set __GI___longjmp,__longjmp
3825--- /dev/null
3826@@ -0,0 +1,122 @@
3827+/* Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
3828+ This file is part of the GNU C Library.
3829+
3830+ The GNU C Library is free software; you can redistribute it and/or
3831+ modify it under the terms of the GNU Lesser General Public
3832+ License as published by the Free Software Foundation; either
3833+ version 2.1 of the License, or (at your option) any later version.
3834+
3835+ The GNU C Library is distributed in the hope that it will be useful,
3836+ but WITHOUT ANY WARRANTY; without even the implied warranty of
3837+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3838+ Lesser General Public License for more details.
3839+
3840+ You should have received a copy of the GNU Lesser General Public
3841+ License along with the GNU C Library; if not, write to the Free
3842+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3843+ 02111-1307 USA. */
3844+
3845+#ifndef _SYS_PROCFS_H
3846+#define _SYS_PROCFS_H 1
3847+
3848+/* This is somehow modelled after the file of the same name on SysVr4
3849+ systems. It provides a definition of the core file format for ELF
3850+ used on Linux. */
3851+
3852+#include <features.h>
3853+#include <signal.h>
3854+#include <sys/time.h>
3855+#include <sys/types.h>
3856+#include <sys/ucontext.h>
3857+#include <bits/wordsize.h>
3858+
3859+__BEGIN_DECLS
3860+
3861+#define ELF_NGREG 38
3862+
3863+typedef struct
3864+ {
3865+ union
3866+ {
3867+ unsigned long pr_regs[32];
3868+ double pr_dregs[16];
3869+ } pr_fr;
3870+ unsigned long __unused;
3871+ unsigned long pr_fsr;
3872+ unsigned char pr_qcnt;
3873+ unsigned char pr_q_entrysize;
3874+ unsigned char pr_en;
3875+ unsigned int pr_q[64];
3876+ } elf_fpregset_t;
3877+
3878+typedef unsigned long elf_greg_t;
3879+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
3880+
3881+struct elf_siginfo
3882+ {
3883+ int si_signo; /* Signal number. */
3884+ int si_code; /* Extra code. */
3885+ int si_errno; /* Errno. */
3886+ };
3887+
3888+/* Definitions to generate Intel SVR4-like core files. These mostly
3889+ have the same names as the SVR4 types with "elf_" tacked on the
3890+ front to prevent clashes with linux definitions, and the typedef
3891+ forms have been avoided. This is mostly like the SVR4 structure,
3892+ but more Linuxy, with things that Linux does not support and which
3893+ gdb doesn't really use excluded. Fields present but not used are
3894+ marked with "XXX". */
3895+struct elf_prstatus
3896+ {
3897+ struct elf_siginfo pr_info; /* Info associated with signal. */
3898+ short int pr_cursig; /* Current signal. */
3899+ unsigned long int pr_sigpend; /* Set of pending signals. */
3900+ unsigned long int pr_sighold; /* Set of held signals. */
3901+ __pid_t pr_pid;
3902+ __pid_t pr_ppid;
3903+ __pid_t pr_pgrp;
3904+ __pid_t pr_sid;
3905+ struct timeval pr_utime; /* User time. */
3906+ struct timeval pr_stime; /* System time. */
3907+ struct timeval pr_cutime; /* Cumulative user time. */
3908+ struct timeval pr_cstime; /* Cumulative system time. */
3909+ elf_gregset_t pr_reg; /* GP registers. */
3910+ int pr_fpvalid; /* True if math copro being used. */
3911+ };
3912+
3913+
3914+#define ELF_PRARGSZ (80) /* Number of chars for args */
3915+
3916+struct elf_prpsinfo
3917+ {
3918+ char pr_state; /* Numeric process state. */
3919+ char pr_sname; /* Char for pr_state. */
3920+ char pr_zomb; /* Zombie. */
3921+ char pr_nice; /* Nice val. */
3922+ unsigned long int pr_flag; /* Flags. */
3923+ unsigned short int pr_uid;
3924+ unsigned short int pr_gid;
3925+ int pr_pid, pr_ppid, pr_pgrp, pr_sid;
3926+ /* Lots missing */
3927+ char pr_fname[16]; /* Filename of executable. */
3928+ char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
3929+ };
3930+
3931+/* Addresses. */
3932+typedef void *psaddr_t;
3933+
3934+/* Register sets. Linux has different names. */
3935+typedef elf_gregset_t prgregset_t;
3936+typedef elf_fpregset_t prfpregset_t;
3937+
3938+/* We don't have any differences between processes and threads,
3939+ therefore have only one PID type. */
3940+typedef __pid_t lwpid_t;
3941+
3942+
3943+typedef struct elf_prstatus prstatus_t;
3944+typedef struct elf_prpsinfo prpsinfo_t;
3945+
3946+__END_DECLS
3947+
3948+#endif /* sys/procfs.h */
3949--- /dev/null
3950@@ -0,0 +1,104 @@
3951+/* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
3952+ This file is part of the GNU C Library.
3953+
3954+ The GNU C Library is free software; you can redistribute it and/or
3955+ modify it under the terms of the GNU Lesser General Public
3956+ License as published by the Free Software Foundation; either
3957+ version 2.1 of the License, or (at your option) any later version.
3958+
3959+ The GNU C Library is distributed in the hope that it will be useful,
3960+ but WITHOUT ANY WARRANTY; without even the implied warranty of
3961+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3962+ Lesser General Public License for more details.
3963+
3964+ You should have received a copy of the GNU Lesser General Public
3965+ License along with the GNU C Library; if not, write to the Free
3966+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3967+ 02111-1307 USA. */
3968+
3969+#ifndef _SYS_UCONTEXT_H
3970+#define _SYS_UCONTEXT_H 1
3971+
3972+#include <features.h>
3973+#include <signal.h>
3974+/*
3975+ * Location of the users' stored registers relative to R0.
3976+ * Usage is as an index into a gregset_t array or as u.u_ar0[XX].
3977+ */
3978+#define REG_PSR (0)
3979+#define REG_PC (1)
3980+#define REG_SPARE (2)
3981+#define REG_WVALID (3)
3982+#define REG_G1 (4)
3983+#define REG_G2 (5)
3984+#define REG_G3 (6)
3985+#define REG_G4 (7)
3986+#define REG_G5 (8)
3987+#define REG_G6 (9)
3988+#define REG_G7 (10)
3989+#define REG_O0 (11)
3990+#define REG_O1 (12)
3991+#define REG_O2 (13)
3992+#define REG_O3 (14)
3993+#define REG_O4 (15)
3994+#define REG_O5 (16)
3995+#define REG_O6 (17)
3996+#define REG_O7 (18)
3997+#define REG_GLOBALS (19)
3998+
3999+/*
4000+ * A gregset_t is defined as an array type for compatibility with the reference
4001+ * source. This is important due to differences in the way the C language
4002+ * treats arrays and structures as parameters.
4003+ *
4004+ * Note that NGREG is really (sizeof (struct regs) / sizeof (greg_t)),
4005+ * but that the ABI defines it absolutely to be 21 (resp. 19).
4006+ */
4007+
4008+#define NGREG 20
4009+typedef int greg_t;
4010+
4011+typedef greg_t gregset_t[NGREG];
4012+
4013+/*
4014+ * The following structures define how a register window can appear on the
4015+ * stack. This structure is available (when required) through the `gwins'
4016+ * field of an mcontext (nested within ucontext). NIOS_MAXWINDOW is the
4017+ * maximum number of outstanding register windows defined in the NIOS
4018+ * architecture (*not* implementation).
4019+ */
4020+#define NIOS_MAXREGWINDOW 31 /* max windows in NIOS arch. */
4021+struct rwindow
4022+ {
4023+ greg_t rw_local[8]; /* locals */
4024+ greg_t rw_in[8]; /* ins */
4025+ };
4026+
4027+#define rw_fp rw_in[6] /* frame pointer */
4028+#define rw_rtn rw_in[7] /* return address */
4029+
4030+typedef struct gwindows
4031+ {
4032+ int wbcnt;
4033+ int *spbuf[NIOS_MAXREGWINDOW];
4034+ struct rwindow wbuf[NIOS_MAXREGWINDOW];
4035+ } gwindows_t;
4036+
4037+typedef struct
4038+ {
4039+ gregset_t gregs; /* general register set */
4040+ gwindows_t *gwins; /* POSSIBLE pointer to register windows */
4041+ } mcontext_t;
4042+
4043+
4044+/* Userlevel context. */
4045+typedef struct ucontext
4046+ {
4047+ unsigned long uc_flags;
4048+ struct ucontext *uc_link;
4049+ __sigset_t uc_sigmask;
4050+ stack_t uc_stack;
4051+ mcontext_t uc_mcontext;
4052+ } ucontext_t;
4053+
4054+#endif /* sys/ucontext.h */
4055--- /dev/null
4056@@ -0,0 +1,32 @@
4057+/* vi: set sw=4 ts=4: */
4058+/* syscall for ubicom32/uClibc
4059+ *
4060+ * Copyright (C) 2008 by Ubicom Inc.
4061+ * Copyright (C) 2002 by Erik Andersen <andersen@uclibc.org>
4062+ *
4063+ * This program is free software; you can redistribute it and/or modify it
4064+ * under the terms of the GNU Library General Public License as published by
4065+ * the Free Software Foundation; either version 2 of the License, or (at your
4066+ * option) any later version.
4067+ *
4068+ * This program is distributed in the hope that it will be useful, but WITHOUT
4069+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4070+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
4071+ * for more details.
4072+ *
4073+ * You should have received a copy of the GNU Library General Public License
4074+ * along with this program; if not, write to the Free Software Foundation,
4075+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
4076+ */
4077+
4078+#include <features.h>
4079+#include <errno.h>
4080+#include <sys/types.h>
4081+#include <sys/syscall.h>
4082+
4083+extern long syscall(long sysnum, long a, long b, long c, long d, long e, long f);
4084+long syscall(long sysnum, long a, long b, long c, long d, long e, long f)
4085+{
4086+ int __NR_syscall_number = sysnum;
4087+ return (long) INLINE_SYSCALL(syscall_number, 6, a, b, c, d, e, f);
4088+}
4089--- /dev/null
4090@@ -0,0 +1,35 @@
4091+#include <sys/syscall.h>
4092+
4093+ .text
4094+ .type vfork,@function
4095+ .global vfork
4096+vfork:
4097+ move.4 -4(sp)++, a5 ; Save return address on the stack.
4098+ movei d8, #__NR_vfork
4099+ moveai a3, #%hi(0x40400000)
4100+ calli a5, 0x10(a3)
4101+
4102+ /*
4103+ * You get here only if the syscall bombed. If things had worked out the
4104+ * parent and child would have both returned to the instruction after
4105+ * the vfork call.
4106+ */
4107+ move.4 a5, (sp)4++ ; Pop the return address off the stack.
4108+ movei d1, #-125
4109+ sub.4 #0, d0, d1
4110+ jmplt.t 1f
4111+
4112+ ;; We have an error.
4113+ sub.4 d0, #0, d0 ; d0 = -res. Call __set_errno with that.
4114+#if defined(__UBICOM32_FDPIC__)
4115+ call a3, __syscall_error
4116+#else
4117+ moveai a3, #%hi(__syscall_error)
4118+ calli a3, %lo(__syscall_error)(a3) ; __syscall_error will return -1 and not come back here.
4119+#endif
4120+1:
4121+ calli a5, 0(a5)
4122+ .size vfork, . - vfork
4123+ .global __GI_vfork
4124+ .hidden __GI_vfork
4125+ .set __GI_vfork,vfork
4126--- a/libpthread/linuxthreads.old/pthread.c
4127@@ -393,6 +393,10 @@ void __pthread_initialize_minimal(void)
4128 #endif
4129
4130     __libc_multiple_threads_ptr = __libc_pthread_init (ptr_pthread_functions);
4131+#ifndef __ARCH_USE_MMU__
4132+ __pthread_initial_thread_tos =
4133+ (char *)(((long)CURRENT_STACK_FRAME + getpagesize()) & ~(getpagesize() - 1));
4134+#endif /* __ARCH_USE_MMU__ */
4135 }
4136
4137
4138@@ -461,8 +465,11 @@ static void pthread_initialize(void)
4139    * __pthread_initial_thread_bos at address 0. These bounds are refined as we
4140    * malloc other stack frames such that they don't overlap. -StS
4141    */
4142- __pthread_initial_thread_tos =
4143- (char *)(((long)CURRENT_STACK_FRAME + getpagesize()) & ~(getpagesize() - 1));
4144+ if (__pthread_initial_thread_tos == NULL) {
4145+ __pthread_initial_thread_tos =
4146+ (char *)(((long)CURRENT_STACK_FRAME + getpagesize()) & ~(getpagesize() - 1));
4147+ }
4148+
4149   __pthread_initial_thread_bos = (char *) 1; /* set it non-zero so we know we have been here */
4150   PDEBUG("initial thread stack bounds: bos=%p, tos=%p\n",
4151      __pthread_initial_thread_bos, __pthread_initial_thread_tos);
4152--- /dev/null
4153@@ -0,0 +1,68 @@
4154+/* Machine-dependent pthreads configuration and inline functions.
4155+
4156+ Copyright (C) 1996, 1997, 1998, 2000, 2002, 2003, 2004
4157+ Free Software Foundation, Inc.
4158+ This file is part of the GNU C Library.
4159+ Contributed by Ralf Baechle <ralf@gnu.org>.
4160+ Based on the Alpha version by Richard Henderson <rth@tamu.edu>.
4161+
4162+ The GNU C Library is free software; you can redistribute it and/or
4163+ modify it under the terms of the GNU Lesser General Public License as
4164+ published by the Free Software Foundation; either version 2.1 of the
4165+ License, or (at your option) any later version.
4166+
4167+ The GNU C Library is distributed in the hope that it will be useful,
4168+ but WITHOUT ANY WARRANTY; without even the implied warranty of
4169+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4170+ Lesser General Public License for more details.
4171+
4172+ You should have received a copy of the GNU Lesser General Public
4173+ License along with the GNU C Library; see the file COPYING.LIB. If
4174+ not, write to the Free Software Foundation, Inc.,
4175+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
4176+
4177+#ifndef _PT_MACHINE_H
4178+#define _PT_MACHINE_H 1
4179+
4180+#include <features.h>
4181+
4182+/*
4183+ * XXX try to make this inline
4184+ */
4185+extern long int testandset (int *spinlock);
4186+
4187+#ifndef PT_EI
4188+#define PT_EI
4189+#else
4190+/* Spinlock implementation; required. */
4191+
4192+/*
4193+ * testandset() is the basis for the pthread spin lock.
4194+ *
4195+ * This implementation only requires that we 'set' the state of *spinlock. As
4196+ * bset is allows us to atomically 'testandset' a single bit define our 'set' is
4197+ * such that we will set bit 0 (ignoring all other bits, which should also be
4198+ * zero).
4199+ * Return value of 1 implies that the bit was already set and is still
4200+ * set.
4201+ * Return value of 0 implies that the bit was not previously set but it
4202+ * now is.
4203+ */
4204+long int
4205+testandset (int *spinlock)
4206+{
4207+ int ret;
4208+ __asm__ volatile (
4209+ " move.4 %0, #0 \n\t" /* Assume that the bit is not currently set */
4210+ " bset %1, %1, #0 \n\t" /* Attempt to 'set' bit 0 */
4211+ " jmpeq.t 1f \n\t"
4212+ " move.4 %0, #1 \n\t" /* Bit was already set, so return 1 */
4213+ " 1: \n\t"
4214+ : "=r"(ret), "+U4"(*spinlock)
4215+ :
4216+ : "memory", "cc"
4217+ );
4218+ return ret;
4219+}
4220+#endif
4221+#endif /* pt-machine.h */
4222--- /dev/null
4223@@ -0,0 +1,26 @@
4224+/* Definitions for thread-local data handling. linuxthreads/MIPS version.
4225+ Copyright (C) 2005 Free Software Foundation, Inc.
4226+ This file is part of the GNU C Library.
4227+
4228+ The GNU C Library is free software; you can redistribute it and/or
4229+ modify it under the terms of the GNU Lesser General Public
4230+ License as published by the Free Software Foundation; either
4231+ version 2.1 of the License, or (at your option) any later version.
4232+
4233+ The GNU C Library is distributed in the hope that it will be useful,
4234+ but WITHOUT ANY WARRANTY; without even the implied warranty of
4235+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4236+ Lesser General Public License for more details.
4237+
4238+ You should have received a copy of the GNU Lesser General Public
4239+ License along with the GNU C Library; if not, write to the Free
4240+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4241+ 02111-1307 USA. */
4242+
4243+#ifndef _TLS_H
4244+#define _TLS_H
4245+#ifdef HAVE_TLS_SUPPORT
4246+#warning no tls support
4247+#undef USE_TLS
4248+#endif
4249+#endif /* tls.h */
4250--- /dev/null
4251@@ -0,0 +1,40 @@
4252+/* Copyright (C) 1998 Free Software Foundation, Inc.
4253+ This file is part of the GNU C Library.
4254+
4255+ The GNU C Library is free software; you can redistribute it and/or
4256+ modify it under the terms of the GNU Lesser General Public
4257+ License as published by the Free Software Foundation; either
4258+ version 2.1 of the License, or (at your option) any later version.
4259+
4260+ The GNU C Library is distributed in the hope that it will be useful,
4261+ but WITHOUT ANY WARRANTY; without even the implied warranty of
4262+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4263+ Lesser General Public License for more details.
4264+
4265+ You should have received a copy of the GNU Lesser General Public
4266+ License along with the GNU C Library; if not, write to the Free
4267+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4268+ 02111-1307 USA. */
4269+
4270+#ifndef _SYS_USER_H
4271+#define _SYS_USER_H 1
4272+
4273+#include <features.h>
4274+
4275+#include <asm/ptrace.h>
4276+
4277+struct user {
4278+ struct pt_regs regs; /* entire machine state */
4279+ size_t u_tsize; /* text size (pages) */
4280+ size_t u_dsize; /* data size (pages) */
4281+ size_t u_ssize; /* stack size (pages) */
4282+ unsigned long start_code; /* text starting address */
4283+ unsigned long start_data; /* data starting address */
4284+ unsigned long start_stack; /* stack starting address */
4285+ long int signal; /* signal causing core dump */
4286+ struct regs * u_ar0; /* help gdb find registers */
4287+ unsigned long magic; /* identifies a core file */
4288+ char u_comm[32]; /* user command name */
4289+};
4290+
4291+#endif /* _SYS_USER_H */
toolchain/uClibc/patches-0.9.31/901-MIPS-restore-INLINE_SYSCALL-macro.patch
1From 911bf867eb82e28799e81578c50d82ee166cebb5 Mon Sep 17 00:00:00 2001
2From: Gabor Juhos <juhosg@openwrt.org>
3Date: Tue, 6 Apr 2010 17:25:56 +0200
4Subject: [PATCH] MIPS: restore INLINE_SYSCALL macro
5
6The MIPS specific INLINE_SYSCALL macro has been renamed to
7INLINE_SYSCALL_NCS with:
8
9  763bbf9e9a27426c9be8322dca5ddf2cb4dbc464
10
11  syscall: unify part 2: NCS variety
12
13  Declare common NCS (non-constant syscall) variants and convert the
14  existing ports over to this.
15
16This change breaks system calls. The code generated with using of the
17new macro does not obey the restartable syscall convention used by the
18linux kernel. When it tries to restart the syscall the errno value is
19not being replaced by the syscall number.
20
21This causes weird behaviour of the 'ping' command in busybox for
22example:
23
24root@OpenWrt:/# ping 192.168.1.254
25PING 192.168.1.254 (192.168.1.254): 56 data bytes
2664 bytes from 192.168.1.254: seq=0 ttl=128 time=6.292 ms
27ping: recvfrom: Function not implemented
2864 bytes from 192.168.1.254: seq=1 ttl=128 time=0.719 ms
29ping: recvfrom: Function not implemented
3064 bytes from 192.168.1.254: seq=2 ttl=128 time=0.489 ms
31ping: recvfrom: Function not implemented
3264 bytes from 192.168.1.254: seq=3 ttl=128 time=0.486 ms
33ping: recvfrom: Function not implemented
3464 bytes from 192.168.1.254: seq=4 ttl=128 time=0.487 ms
35ping: recvfrom: Function not implemented
3664 bytes from 192.168.1.254: seq=5 ttl=128 time=0.939 ms
37ping: recvfrom: Function not implemented
3864 bytes from 192.168.1.254: seq=6 ttl=128 time=0.971 ms
39ping: recvfrom: Function not implemented
4064 bytes from 192.168.1.254: seq=7 ttl=128 time=0.488 ms
41ping: recvfrom: Funct^C
42--- 192.168.1.254 ping statistics ---
439 packets transmitted, 9 packets received, 0% packet loss
44round-trip min/avg/max = 0.486/1.307/6.292 ms
45root@OpenWrt:/#
46
47Here is the relevant assembler code parts of the 'recvfrom' function:
48
49with the current INLINE_SYSCALL_NCS:
5000000000 <__GI_recvfrom>:
51  ...
52  2c: 24021050 li v0,4176
53  30: 8fd1003c lw s1,60(s8)
54  34: 8fd00038 lw s0,56(s8)
55  38: 27bdffe0 addiu sp,sp,-32
56  3c: afb00010 sw s0,16(sp)
57  40: afb10014 sw s1,20(sp) <-- wrong
58  44: 0000000c syscall
59  48: 27bd0020 addiu sp,sp,32
60  ...
61
62with the old INLINE_SYSCALL:
6300000000 <__libc_recvfrom>:
64  ...
65  28: 8fd0003c lw s0,60(s8)
66  2c: 8fc20038 lw v0,56(s8)
67  30: 27bdffe0 addiu sp,sp,-32
68  34: afa20010 sw v0,16(sp)
69  38: afb00014 sw s0,20(sp)
70  3c: 24021050 li v0,4176 <-- good
71  40: 0000000c syscall
72  44: 27bd0020 addiu sp,sp,32
73  ...
74
75Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
76Cc: Mike Frysinger <vapier@gentoo.org>
77---
78Notes:
79
80The ideal solution would to fix the 'internal_syscall' macros to generate
81correct code for the NCS case as well. However the INLINE_SYSCALL macro
82generates smaller code if the syscall number is constant, so it is
83useful in such cases.
84
85Additionally, the current INLINE_SYSCALL_NCS in the 'mips/bits/syscall.h'
86is a duplicate of the one in the 'common/bits/syscalls-common.h' so it
87should be removed anyway.
88---
89 libc/sysdeps/linux/mips/bits/syscalls.h | 4 ++--
90 1 files changed, 2 insertions(+), 2 deletions(-)
91
92diff --git a/libc/sysdeps/linux/mips/bits/syscalls.h b/libc/sysdeps/linux/mips/bits/syscalls.h
93index 28b0f91..944d038 100644
94--- a/libc/sysdeps/linux/mips/bits/syscalls.h
95@@ -19,9 +19,9 @@
96
97 /* Define a macro which expands into the inline wrapper code for a system
98    call. */
99-#define INLINE_SYSCALL_NCS(name, nr, args...) \
100+#define INLINE_SYSCALL(name, nr, args...) \
101   ({ INTERNAL_SYSCALL_DECL(err); \
102- long result_var = INTERNAL_SYSCALL_NCS (name, err, nr, args); \
103+ long result_var = INTERNAL_SYSCALL(name, err, nr, args); \
104      if ( INTERNAL_SYSCALL_ERROR_P (result_var, err) ) \
105        { \
106      __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, err)); \
107--
1081.5.3.2
109
toolchain/uClibc/patches-0.9.31/902-Fix-use-after-free-bug-in-__dns_lookup.patch
1From c602079e5b7ba998d1dd6cae4a305af80e6cba52 Mon Sep 17 00:00:00 2001
2From: Gabor Juhos <juhosg@openwrt.org>
3Date: Tue, 23 Mar 2010 08:35:27 +0100
4Subject: [PATCH] Fix use-after-free bug in __dns_lookup.
5
6If the type of the first answer does not match with the requested type,
7then the dotted name will be freed. If there are no further answers in
8the DNS reply, this pointer will be used later on in the same function.
9Additionally it is passed to the caller, and may cause strange behaviour.
10
11For example, the following busybox commands are triggering a segmentation
12fault with uClibc 0.9.30.x
13
14  - nslookup ipv6.google.com
15  - ping ipv6.google.com
16  - wget http//ipv6.google.com/
17
18Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
19
20---
21
22See https://dev.openwrt.org/ticket/6886 for a testcase
23---
24 libc/inet/resolv.c | 4 +---
25 1 files changed, 1 insertions(+), 3 deletions(-)
26
27--- a/libc/inet/resolv.c
28@@ -1517,10 +1517,8 @@ int attribute_hidden __dns_lookup(const
29                 memcpy(a, &ma, sizeof(ma));
30                 if (a->atype != T_SIG && (NULL == a->buf || (type != T_A && type != T_AAAA)))
31                     break;
32- if (a->atype != type) {
33- free(a->dotted);
34+ if (a->atype != type)
35                     continue;
36- }
37                 a->add_count = h.ancount - j - 1;
38                 if ((a->rdlength + sizeof(struct in_addr*)) * a->add_count > a->buflen)
39                     break;
toolchain/uClibc/patches-0.9.31/903-fcntl64_fix.patch
164 bit targets often don't have a separate fcntl64() system call, because they don't need one.
2
3Signed-off-by: Rob Landley <rob at landley.net>
4
5--- uClibc/include/fcntl.h 2010-04-02 10:34:27.000000000 -0500
6@@ -73,7 +73,7 @@
7
8    This function is a cancellation point and therefore not marked with
9    __THROW. */
10-#ifndef __USE_FILE_OFFSET64
11+#if !defined(__USE_FILE_OFFSET64) || defined(__LP64__)
12 extern int fcntl (int __fd, int __cmd, ...);
13 libc_hidden_proto(fcntl)
14 #else
15@@ -83,7 +83,7 @@
16 # define fcntl fcntl64
17 # endif
18 #endif
19-#ifdef __USE_LARGEFILE64
20+#if defined(__USE_LARGEFILE64) && !defined(__LP64__)
21 extern int fcntl64 (int __fd, int __cmd, ...);
22 libc_hidden_proto(fcntl64)
23 #endif
24
25--
toolchain/uClibc/patches-0.9.32/100-do_not_select_extra-warnings.patch
1diff -ruN uClibc-0.9.32.orig/extra/Configs/Config.in uClibc-0.9.32/extra/Configs/Config.in
2--- uClibc-0.9.32.orig/extra/Configs/Config.in 2010-08-05 08:41:15.880201300 +0000
3@@ -460,7 +460,6 @@
4     select UCLIBC_HAS_TLS
5     select UCLIBC_HAS_STDIO_FUTEXES
6     # NPTL local:
7- select EXTRA_WARNINGS
8     help
9       If you want to compile uClibc with NPTL support, then answer Y.
10
toolchain/uClibc/patches-0.9.32/110-compat_macros.patch
1--- a/include/string.h
2@@ -357,18 +357,40 @@ extern char *index (__const char *__s, i
3 /* Find the last occurrence of C in S (same as strrchr). */
4 extern char *rindex (__const char *__s, int __c)
5      __THROW __attribute_pure__ __nonnull ((1));
6-# else
7-# ifdef __UCLIBC_SUSV3_LEGACY_MACROS__
8+# elif defined(__UCLIBC_SUSV3_LEGACY_MACROS__) && !defined(_STRINGS_H)
9 /* bcopy/bzero/bcmp/index/rindex are marked LEGACY in SuSv3.
10  * They are replaced as proposed by SuSv3. Don't sync this part
11  * with glibc and keep it in sync with strings.h. */
12
13-# define bcopy(src,dest,n) (memmove((dest), (src), (n)), (void) 0)
14-# define bzero(s,n) (memset((s), '\0', (n)), (void) 0)
15-# define bcmp(s1,s2,n) memcmp((s1), (s2), (size_t)(n))
16-# define index(s,c) strchr((s), (c))
17-# define rindex(s,c) strrchr((s), (c))
18-# endif
19+/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
20+static __inline__ void bcopy (__const void *__src, void *__dest, size_t __n)
21+{
22+ memmove(__dest, __src, __n);
23+}
24+
25+/* Set N bytes of S to 0. */
26+static __inline__ void bzero (void *__s, size_t __n)
27+{
28+ memset(__s, 0, __n);
29+}
30+
31+/* Compare N bytes of S1 and S2 (same as memcmp). */
32+static __inline__ int bcmp (__const void *__s1, __const void *__s2, size_t __n)
33+{
34+ return memcmp(__s1, __s2, __n);
35+}
36+
37+/* Find the first occurrence of C in S (same as strchr). */
38+static __inline__ char *index (__const char *__s, int __c)
39+{
40+ return strchr(__s, __c);
41+}
42+
43+/* Find the last occurrence of C in S (same as strrchr). */
44+static __inline__ char *rindex (__const char *__s, int __c)
45+{
46+ return strrchr(__s, __c);
47+}
48 # endif
49
50 /* Return the position of the first bit set in I, or 0 if none are set.
toolchain/uClibc/patches-0.9.32/120-adjtimex.patch
1--- a/include/sys/timex.h
2@@ -116,9 +116,8 @@ struct timex
3
4 __BEGIN_DECLS
5
6-#if 0
7-extern int __adjtimex (struct timex *__ntx) __THROW;
8-#endif
9+#undef __adjtimex
10+#define __adjtimex adjtimex
11 extern int adjtimex (struct timex *__ntx) __THROW;
12 libc_hidden_proto(adjtimex)
13
toolchain/uClibc/patches-0.9.32/140-math_decl.patch
1--- a/libc/sysdeps/linux/common/bits/mathcalls.h
2@@ -237,8 +237,7 @@ __END_NAMESPACE_C99
3
4
5 /* Return nonzero if VALUE is not a number. */
6-/* DELETE? __MATHDECL_PRIV adds another "__": so this is "____isnan"???! */
7-/*__MATHDECL_PRIV (int,__isnan,, (_Mdouble_ __value), (__const__))*/
8+__MATHDECL_PRIV (int,isnan,, (_Mdouble_ __value), (__const__));
9
10 #if defined __USE_MISC || defined __USE_XOPEN
11 /* Return nonzero if VALUE is not a number. */
toolchain/uClibc/patches-0.9.32/170-math_finite.patch
1--- a/include/math.h
2@@ -198,7 +198,7 @@ libm_hidden_proto(signgam)
3
4
5 /* ISO C99 defines some generic macros which work on any data type. */
6-#ifdef __USE_ISOC99
7+#if defined(__USE_ISOC99) || defined(__USE_BSD)
8
9 /* Get the architecture specific values describing the floating-point
10    evaluation. The following symbols will get defined:
11@@ -318,6 +318,11 @@ enum
12
13 #endif /* Use ISO C99. */
14
15+/* BSD compat */
16+#define finite(x) __finite(x)
17+#define finitef(x) __finitef(x)
18+#define finitel(x) __finitel(x)
19+
20 #ifdef __USE_MISC
21 /* Support for various different standard error handling behaviors. */
22 typedef enum
toolchain/uClibc/patches-0.9.32/410-llvm_workaround.patch
1--- a/libc/stdio/_stdio.c
2@@ -119,7 +119,7 @@ static FILE _stdio_streams[] = {
3                              __FLAG_NBF|__FLAG_WRITEONLY, \
4                              2, \
5                              NULL, \
6- NULL, \
7+ 0, \
8                              0 )
9 };
10
toolchain/uClibc/patches-0.9.32/450-powerpc_copysignl.patch
1--- a/libc/sysdeps/linux/powerpc/Makefile.arch
2@@ -5,7 +5,7 @@
3 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
4 #
5
6-CSRC := __syscall_error.c pread_write.c ioctl.c
7+CSRC := __syscall_error.c pread_write.c ioctl.c copysignl.c
8
9 ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y)
10 CSRC += posix_fadvise.c posix_fadvise64.c
11--- /dev/null
12@@ -0,0 +1,89 @@
13+/* s_copysignl.c -- long double version of s_copysign.c.
14+ * Conversion to long double by Ulrich Drepper,
15+ * Cygnus Support, drepper@cygnus.com.
16+ */
17+
18+/*
19+ * ====================================================
20+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
21+ *
22+ * Developed at SunPro, a Sun Microsystems, Inc. business.
23+ * Permission to use, copy, modify, and distribute this
24+ * software is freely granted, provided that this notice
25+ * is preserved.
26+ * ====================================================
27+ */
28+
29+/*
30+ * copysignl(long double x, long double y)
31+ * copysignl(x,y) returns a value with the magnitude of x and
32+ * with the sign bit of y.
33+ */
34+
35+#include <endian.h>
36+#include <stdint.h>
37+
38+#if __FLOAT_WORD_ORDER == BIG_ENDIAN
39+
40+typedef union
41+{
42+ long double value;
43+ struct
44+ {
45+ int sign_exponent:16;
46+ unsigned int empty:16;
47+ uint32_t msw;
48+ uint32_t lsw;
49+ } parts;
50+} ieee_long_double_shape_type;
51+
52+#endif
53+
54+#if __FLOAT_WORD_ORDER == LITTLE_ENDIAN
55+
56+typedef union
57+{
58+ long double value;
59+ struct
60+ {
61+ uint32_t lsw;
62+ uint32_t msw;
63+ int sign_exponent:16;
64+ unsigned int empty:16;
65+ } parts;
66+} ieee_long_double_shape_type;
67+
68+#endif
69+
70+/* Get int from the exponent of a long double. */
71+
72+#define GET_LDOUBLE_EXP(exp,d) \
73+do { \
74+ ieee_long_double_shape_type ge_u; \
75+ ge_u.value = (d); \
76+ (exp) = ge_u.parts.sign_exponent; \
77+} while (0)
78+
79+/* Set exponent of a long double from an int. */
80+
81+#define SET_LDOUBLE_EXP(d,exp) \
82+do { \
83+ ieee_long_double_shape_type se_u; \
84+ se_u.value = (d); \
85+ se_u.parts.sign_exponent = (exp); \
86+ (d) = se_u.value; \
87+} while (0)
88+
89+long double copysignl(long double x, long double y);
90+libc_hidden_proto(copysignl);
91+
92+long double copysignl(long double x, long double y)
93+{
94+ uint32_t es1,es2;
95+ GET_LDOUBLE_EXP(es1,x);
96+ GET_LDOUBLE_EXP(es2,y);
97+ SET_LDOUBLE_EXP(x,(es1&0x7fff)|(es2&0x8000));
98+ return x;
99+}
100+
101+libc_hidden_def(copysignl);
toolchain/uClibc/patches-0.9.32/600-ubicom32-uClibc.patch
1--- a/Rules.mak
2@@ -477,6 +477,17 @@ ifeq ($(TARGET_ARCH),microblaze)
3       SYMBOL_PREFIX=_
4 endif
5
6+ifeq ($(TARGET_ARCH),ubicom32)
7+ OPTIMIZATION+=-fstrict-aliasing
8+ CPU_CFLAGS-$(CONFIG_UBICOM32_V3)+=-march=ubicom32v3
9+ CPU_CFLAGS-$(CONFIG_UBICOM32_V4)+=-march=ubicom32v4
10+ifeq ($(UCLIBC_FORMAT_FDPIC_ELF),y)
11+ CPU_CFLAGS-y:=-mfdpic
12+ CPU_LDFLAGS-y += -Wl,-melf32ubicom32fdpic
13+endif
14+
15+endif
16+
17 ifeq ($(TARGET_ARCH),v850)
18       SYMBOL_PREFIX=_
19 endif
20--- a/extra/Configs/Config.in
21@@ -102,6 +102,9 @@ config TARGET_sh64
22 config TARGET_sparc
23     bool "sparc"
24
25+config TARGET_ubicom32
26+ bool "ubicom32"
27+
28 config TARGET_v850
29     bool "v850 (BROKEN)"
30
31@@ -203,6 +206,10 @@ if TARGET_sparc
32 source "extra/Configs/Config.sparc"
33 endif
34
35+if TARGET_ubicom32
36+source "extra/Configs/Config.ubicom32"
37+endif
38+
39 if TARGET_v850
40 source "extra/Configs/Config.v850"
41 endif
42--- a/extra/Configs/Config.in.arch
43@@ -149,7 +149,7 @@ config UCLIBC_HAS_SOFT_FLOAT
44 config DO_C99_MATH
45     bool "Enable full C99 math library support"
46     depends on UCLIBC_HAS_FLOATS
47- default n
48+ default y
49     help
50       If you want the uClibc math library to contain the full set C99
51       math library features, then answer Y. If you leave this set to
52--- /dev/null
53@@ -0,0 +1,44 @@
54+#
55+# For a description of the syntax of this configuration file,
56+# see extra/config/Kconfig-language.txt
57+#
58+
59+config TARGET_ARCH
60+ string
61+ default "ubicom32"
62+
63+config FORCE_OPTIONS_FOR_ARCH
64+ bool
65+ default y
66+ select ARCH_BIG_ENDIAN
67+ select ARCH_HAS_NO_MMU
68+
69+choice
70+ prompt "Target Processor Architecture"
71+ default CONFIG_UC_UBICOM32_V3
72+ help
73+ This selects the instruction set architecture of your Ubicom32 CPU. This
74+ information is used for optimizing purposes. To build a library that
75+ will run on any Ubicom32 CPU, you can specify "v3" here.
76+ If you pick anything other than "v3," there is no
77+ guarantee that uClibc will even run on anything other than the
78+ selected processor type.
79+
80+ You should probably select the Ubicom32 ISA that best matches the
81+ CPU you will be using on your device. uClibc will be tuned
82+ for that architecture.
83+
84+ If you don't know what to do, choose "v3"
85+
86+config CONFIG_UC_UBICOM32_V3
87+ bool "ISA v3"
88+
89+config CONFIG_UC_UBICOM32_V4
90+ bool "ISA v4"
91+endchoice
92+
93+config ARCH_CFLAGS
94+ string
95+
96+config CROSS
97+ string
98--- a/include/elf.h
99@@ -337,6 +337,8 @@ typedef struct
100
101 #define EM_XSTORMY16 0xad45
102
103+#define EM_UBICOM32 0xde3d /* Ubicom32; no ABI */
104+
105 /* FRV magic number - no EABI available??. */
106 #define EM_CYGNUS_FRV 0x5441
107
108@@ -3063,6 +3065,55 @@ typedef Elf32_Addr Elf32_Conflict;
109 /* Keep this the last entry. */
110 #define R_XTENSA_NUM 50
111
112+/* Ubicom32 ELF relocation types */
113+#define R_UBICOM32_NONE 0
114+#define R_UBICOM32_16 1
115+#define R_UBICOM32_32 2
116+#define R_UBICOM32_LO16 3
117+#define R_UBICOM32_HI16 4
118+#define R_UBICOM32_21_PCREL 5
119+#define R_UBICOM32_24_PCREL 6
120+#define R_UBICOM32_HI24 7
121+#define R_UBICOM32_LO7_S 8
122+#define R_UBICOM32_LO7_2_S 9
123+#define R_UBICOM32_LO7_4_S 10
124+#define R_UBICOM32_LO7_D 11
125+#define R_UBICOM32_LO7_2_D 12
126+#define R_UBICOM32_LO7_4_D 13
127+#define R_UBICOM32_32_HARVARD 14
128+#define R_UBICOM32_LO7_CALLI 15
129+#define R_UBICOM32_LO16_CALLI 16
130+#define R_UBICOM32_GOT_HI24 17
131+#define R_UBICOM32_GOT_LO7_S 18
132+#define R_UBICOM32_GOT_LO7_2_S 19
133+#define R_UBICOM32_GOT_LO7_4_S 20
134+#define R_UBICOM32_GOT_LO7_D 21
135+#define R_UBICOM32_GOT_LO7_2_D 22
136+#define R_UBICOM32_GOT_LO7_4_D 23
137+#define R_UBICOM32_FUNCDESC_GOT_HI24 24
138+#define R_UBICOM32_FUNCDESC_GOT_LO7_S 25
139+#define R_UBICOM32_FUNCDESC_GOT_LO7_2_S 26
140+#define R_UBICOM32_FUNCDESC_GOT_LO7_4_S 27
141+#define R_UBICOM32_FUNCDESC_GOT_LO7_D 28
142+#define R_UBICOM32_FUNCDESC_GOT_LO7_2_D 29
143+#define R_UBICOM32_FUNCDESC_GOT_LO7_4_D 30
144+#define R_UBICOM32_GOT_LO7_CALLI 31
145+#define R_UBICOM32_FUNCDESC_GOT_LO7_CALLI 32
146+#define R_UBICOM32_FUNCDESC_VALUE 33
147+#define R_UBICOM32_FUNCDESC 34
148+#define R_UBICOM32_GOTOFFSET_LO 35
149+#define R_UBICOM32_GOTOFFSET_HI 36
150+#define R_UBICOM32_FUNCDESC_GOTOFFSET_LO 37
151+#define R_UBICOM32_FUNCDESC_GOTOFFSET_HI 38
152+#define R_UBICOM32_GNU_VTINHERIT 200
153+#define R_UBICOM32_GNU_VTENTRY 201
154+
155+/* Ubicom32 Flags. */
156+#define EF_UBICOM32_V3 0x00000001 /* -fmarch=ubicom32v3 */
157+#define EF_UBICOM32_V4 0x00000002 /* -fmarch=ubicom32v4 */
158+#define EF_UBICOM32_PIC 0x80000000 /* -fpic */
159+#define EF_UBICOM32_FDPIC 0x40000000 /* -mfdpic */
160+
161 #ifdef __cplusplus
162 }
163 #endif
164--- a/include/features.h
165@@ -445,4 +445,10 @@ uClibc was built without large file supp
166 # include <libc-internal.h>
167 #endif
168
169+#ifndef libc_hidden_proto
170+#define libc_hidden_proto(name, attrs...)
171+#endif
172+#ifndef libm_hidden_proto
173+#define libm_hidden_proto(name, attrs...)
174+#endif
175 #endif /* features.h */
176--- a/ldso/ldso/dl-startup.c
177@@ -164,10 +164,13 @@ DL_START(unsigned long args)
178         aux_dat += 2;
179     }
180
181+#if !defined __FDPIC__
182     /* locate the ELF header. We need this done as soon as possible
183      * (esp since SEND_STDERR() needs this on some platforms... */
184     if (!auxvt[AT_BASE].a_un.a_val)
185         auxvt[AT_BASE].a_un.a_val = elf_machine_load_address();
186+#endif
187+
188     DL_INIT_LOADADDR_BOOT(load_addr, auxvt[AT_BASE].a_un.a_val);
189     header = (ElfW(Ehdr) *) auxvt[AT_BASE].a_un.a_val;
190
191--- a/ldso/ldso/ldso.c
192@@ -325,10 +325,12 @@ void _dl_get_ready_to_run(struct elf_res
193         _dl_progname = argv[0];
194     }
195
196+#if 0 // blackfin does this, we do to avoid die during reloc
197     if (_start == (void *) auxvt[AT_ENTRY].a_un.a_val) {
198         _dl_dprintf(_dl_debug_file, "Standalone execution is not supported yet\n");
199         _dl_exit(1);
200     }
201+#endif
202
203     /* Start to build the tables of the modules that are required for
204      * this beast to run. We start with the basic executable, and then
205--- /dev/null
206@@ -0,0 +1,72 @@
207+/* vi: set sw=4 ts=4: */
208+/* Ubicom32 ELF shared library loader suppport
209+ *
210+ * Copyright (c) 2009 Ubicom Inc.
211+ * Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald,
212+ * David Engel, Hongjiu Lu and Mitch D'Souza
213+ * Copyright (C) 2001-2004 Erik Andersen
214+ *
215+ * All rights reserved.
216+ *
217+ * Redistribution and use in source and binary forms, with or without
218+ * modification, are permitted provided that the following conditions
219+ * are met:
220+ * 1. Redistributions of source code must retain the above copyright
221+ * notice, this list of conditions and the following disclaimer.
222+ * 2. The name of the above contributors may not be
223+ * used to endorse or promote products derived from this software
224+ * without specific prior written permission.
225+ *
226+ * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
227+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
228+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
229+ * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE
230+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
231+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
232+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
233+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
234+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
235+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
236+ * SUCH DAMAGE.
237+ */
238+
239+static const char *_dl_reltypes_tab[] =
240+{
241+ "R_UBICOM32_NONE", /* 0 */
242+ "R_UBICOM32_16",
243+ "R_UBICOM32_32",
244+ "R_UBICOM32_LO16",
245+ "R_UBICOM32_HI16",
246+ "R_UBICOM32_21_PCREL", /* 5 */
247+ "R_UBICOM32_24_PCREL",
248+ "R_UBICOM32_HI24",
249+ "R_UBICOM32_LO7_S",
250+ "R_UBICOM32_LO7_2_S",
251+ "R_UBICOM32_LO7_4_S", /* 10 */
252+ "R_UBICOM32_LO7_D",
253+ "R_UBICOM32_LO7_2_D",
254+ "R_UBICOM32_LO7_4_D",
255+ "R_UBICOM32_32_HARVARD",
256+ "R_UBICOM32_LO7_CALLI", /* 15 */
257+ "R_UBICOM32_LO16_CALLI",
258+ "R_UBICOM32_GOT_HI24",
259+ "R_UBICOM32_GOT_LO7_S",
260+ "R_UBICOM32_GOT_LO7_2_S"
261+ "R_UBICOM32_GOT_LO7_4_S", /* 20 */
262+ "R_UBICOM32_GOT_LO7_D",
263+ "R_UBICOM32_GOT_LO7_2_D",
264+ "R_UBICOM32_GOT_LO7_4_D",
265+ "R_UBICOM32_FUNCDESC_GOT_HI24 24",
266+ "R_UBICOM32_FUNCDESC_GOT_LO7_S", /* 25 */
267+ "R_UBICOM32_FUNCDESC_GOT_LO7_2_S",
268+ "R_UBICOM32_FUNCDESC_GOT_LO7_4_S",
269+ "R_UBICOM32_FUNCDESC_GOT_LO7_D",
270+ "R_UBICOM32_FUNCDESC_GOT_LO7_2_D",
271+ "R_UBICOM32_FUNCDESC_GOT_LO7_4_D", /* 30 */
272+ "R_UBICOM32_GOT_LO7_CALLI",
273+ "R_UBICOM32_FUNCDESC_VALUE",
274+ "R_UBICOM32_FUNCDESC",
275+#if 1
276+ [200] "R_UBICOM32_GNU_VTINHERIT" , "R_UBICOM32_GNU_VTENTRY"
277+#endif
278+};
279--- /dev/null
280@@ -0,0 +1,582 @@
281+ /* Copyright (C) 2003, 2004 Red Hat, Inc.
282+ Contributed by Alexandre Oliva <aoliva@redhat.com>
283+
284+This file is part of uClibc.
285+
286+uClibc is free software; you can redistribute it and/or modify it
287+under the terms of the GNU Lesser General Public License as
288+published by the Free Software Foundation; either version 2.1 of the
289+License, or (at your option) any later version.
290+
291+uClibc is distributed in the hope that it will be useful, but WITHOUT
292+ANY WARRANTY; without even the implied warranty of
293+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
294+Library General Public License for more details.
295+
296+You should have received a copy of the GNU Lesser General Public
297+License along with uClibc; see the file COPYING.LIB. If not, write to
298+the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
299+USA. */
300+
301+//#include <bfin_sram.h>
302+#define SRAM_TEST(x) 0
303+#ifndef _dl_assert
304+# define _dl_assert(expr)
305+#endif
306+
307+/* Initialize a DL_LOADADDR_TYPE given a got pointer and a complete
308+ load map. */
309+static __always_inline void
310+__dl_init_loadaddr_map (struct elf32_fdpic_loadaddr *loadaddr, Elf32_Addr dl_boot_got_pointer,
311+ struct elf32_fdpic_loadmap *map)
312+{
313+ if (map->version != 0)
314+ {
315+ SEND_EARLY_STDERR ("Invalid loadmap version number\n");
316+ _dl_exit(-1);
317+ }
318+ if (map->nsegs == 0)
319+ {
320+ SEND_EARLY_STDERR ("Invalid segment count in loadmap\n");
321+ _dl_exit(-1);
322+ }
323+ loadaddr->got_value = (void*)dl_boot_got_pointer;
324+ loadaddr->map = map;
325+}
326+
327+/* Figure out how many LOAD segments there are in the given headers,
328+ and allocate a block for the load map big enough for them.
329+ got_value will be properly initialized later on, with INIT_GOT. */
330+static __always_inline int
331+__dl_init_loadaddr (struct elf32_fdpic_loadaddr *loadaddr, Elf32_Phdr *ppnt,
332+ int pcnt)
333+{
334+ int count = 0, i;
335+ size_t size;
336+
337+ for (i = 0; i < pcnt; i++)
338+ if (ppnt[i].p_type == PT_LOAD)
339+ count++;
340+
341+ loadaddr->got_value = 0;
342+
343+ size = sizeof (struct elf32_fdpic_loadmap)
344+ + sizeof (struct elf32_fdpic_loadseg) * count;
345+ loadaddr->map = _dl_malloc (size);
346+ if (! loadaddr->map)
347+ _dl_exit (-1);
348+
349+ loadaddr->map->version = 0;
350+ loadaddr->map->nsegs = 0;
351+
352+ return count;
353+}
354+
355+#if defined (__SUPPORT_LD_DEBUG__)
356+extern char *_dl_debug;
357+extern int _dl_debug_file;
358+#endif
359+
360+/* Incrementally initialize a load map. */
361+static __always_inline void
362+__dl_init_loadaddr_hdr (struct elf32_fdpic_loadaddr loadaddr, void *addr,
363+ Elf32_Phdr *phdr, int maxsegs)
364+{
365+ struct elf32_fdpic_loadseg *segdata;
366+
367+ if (loadaddr.map->nsegs == maxsegs)
368+ _dl_exit (-1);
369+
370+ segdata = &loadaddr.map->segs[loadaddr.map->nsegs++];
371+ segdata->addr = (Elf32_Addr) addr;
372+ segdata->p_vaddr = phdr->p_vaddr;
373+ segdata->p_memsz = phdr->p_memsz;
374+
375+#if defined (__SUPPORT_LD_DEBUG__)
376+ {
377+ if (_dl_debug)
378+ _dl_dprintf(_dl_debug_file, "%i: mapped %x at %x, size %x\n",
379+ loadaddr.map->nsegs-1,
380+ segdata->p_vaddr, segdata->addr, segdata->p_memsz);
381+ }
382+#endif
383+}
384+
385+static __always_inline void __dl_loadaddr_unmap
386+(struct elf32_fdpic_loadaddr loadaddr, struct funcdesc_ht *funcdesc_ht);
387+
388+/* Figure out whether the given address is in one of the mapped
389+ segments. */
390+static __always_inline int
391+__dl_addr_in_loadaddr (void *p, struct elf32_fdpic_loadaddr loadaddr)
392+{
393+ struct elf32_fdpic_loadmap *map = loadaddr.map;
394+ int c;
395+
396+ for (c = 0; c < map->nsegs; c++)
397+ if ((void*)map->segs[c].addr <= p
398+ && (char*)p < (char*)map->segs[c].addr + map->segs[c].p_memsz)
399+ return 1;
400+
401+ return 0;
402+}
403+
404+static __always_inline void * _dl_funcdesc_for (void *entry_point, void *got_value);
405+
406+/* The hashcode handling code below is heavily inspired in libiberty's
407+ hashtab code, but with most adaptation points and support for
408+ deleting elements removed.
409+
410+ Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
411+ Contributed by Vladimir Makarov (vmakarov@cygnus.com). */
412+
413+static __always_inline unsigned long
414+higher_prime_number (unsigned long n)
415+{
416+ /* These are primes that are near, but slightly smaller than, a
417+ power of two. */
418+ static const unsigned long primes[] = {
419+ (unsigned long) 7,
420+ (unsigned long) 13,
421+ (unsigned long) 31,
422+ (unsigned long) 61,
423+ (unsigned long) 127,
424+ (unsigned long) 251,
425+ (unsigned long) 509,
426+ (unsigned long) 1021,
427+ (unsigned long) 2039,
428+ (unsigned long) 4093,
429+ (unsigned long) 8191,
430+ (unsigned long) 16381,
431+ (unsigned long) 32749,
432+ (unsigned long) 65521,
433+ (unsigned long) 131071,
434+ (unsigned long) 262139,
435+ (unsigned long) 524287,
436+ (unsigned long) 1048573,
437+ (unsigned long) 2097143,
438+ (unsigned long) 4194301,
439+ (unsigned long) 8388593,
440+ (unsigned long) 16777213,
441+ (unsigned long) 33554393,
442+ (unsigned long) 67108859,
443+ (unsigned long) 134217689,
444+ (unsigned long) 268435399,
445+ (unsigned long) 536870909,
446+ (unsigned long) 1073741789,
447+ (unsigned long) 2147483647,
448+ /* 4294967291L */
449+ ((unsigned long) 2147483647) + ((unsigned long) 2147483644),
450+ };
451+
452+ const unsigned long *low = &primes[0];
453+ const unsigned long *high = &primes[sizeof(primes) / sizeof(primes[0])];
454+
455+ while (low != high)
456+ {
457+ const unsigned long *mid = low + (high - low) / 2;
458+ if (n > *mid)
459+ low = mid + 1;
460+ else
461+ high = mid;
462+ }
463+
464+#if 0
465+ /* If we've run out of primes, abort. */
466+ if (n > *low)
467+ {
468+ fprintf (stderr, "Cannot find prime bigger than %lu\n", n);
469+ abort ();
470+ }
471+#endif
472+
473+ return *low;
474+}
475+
476+struct funcdesc_ht
477+{
478+ /* Table itself. */
479+ struct funcdesc_value **entries;
480+
481+ /* Current size (in entries) of the hash table */
482+ size_t size;
483+
484+ /* Current number of elements. */
485+ size_t n_elements;
486+};
487+
488+static __always_inline int
489+hash_pointer (const void *p)
490+{
491+ return (int) ((long)p >> 3);
492+}
493+
494+static __always_inline struct funcdesc_ht *
495+htab_create (void)
496+{
497+ struct funcdesc_ht *ht = _dl_malloc (sizeof (struct funcdesc_ht));
498+
499+ if (! ht)
500+ return NULL;
501+ ht->size = 3;
502+ ht->entries = _dl_malloc (sizeof (struct funcdesc_ht_value *) * ht->size);
503+ if (! ht->entries)
504+ return NULL;
505+
506+ ht->n_elements = 0;
507+
508+ _dl_memset (ht->entries, 0, sizeof (struct funcdesc_ht_value *) * ht->size);
509+
510+ return ht;
511+}
512+
513+/* This is only called from _dl_loadaddr_unmap, so it's safe to call
514+ _dl_free(). See the discussion below. */
515+static __always_inline void
516+htab_delete (struct funcdesc_ht *htab)
517+{
518+ int i;
519+
520+ for (i = htab->size - 1; i >= 0; i--)
521+ if (htab->entries[i])
522+ _dl_free (htab->entries[i]);
523+
524+ _dl_free (htab->entries);
525+ _dl_free (htab);
526+}
527+
528+/* Similar to htab_find_slot, but without several unwanted side effects:
529+ - Does not call htab->eq_f when it finds an existing entry.
530+ - Does not change the count of elements/searches/collisions in the
531+ hash table.
532+ This function also assumes there are no deleted entries in the table.
533+ HASH is the hash value for the element to be inserted. */
534+
535+static __always_inline struct funcdesc_value **
536+find_empty_slot_for_expand (struct funcdesc_ht *htab, int hash)
537+{
538+ size_t size = htab->size;
539+ unsigned int index = hash % size;
540+ struct funcdesc_value **slot = htab->entries + index;
541+ int hash2;
542+
543+ if (! *slot)
544+ return slot;
545+
546+ hash2 = 1 + hash % (size - 2);
547+ for (;;)
548+ {
549+ index += hash2;
550+ if (index >= size)
551+ index -= size;
552+
553+ slot = htab->entries + index;
554+ if (! *slot)
555+ return slot;
556+ }
557+}
558+
559+/* The following function changes size of memory allocated for the
560+ entries and repeatedly inserts the table elements. The occupancy
561+ of the table after the call will be about 50%. Naturally the hash
562+ table must already exist. Remember also that the place of the
563+ table entries is changed. If memory allocation failures are allowed,
564+ this function will return zero, indicating that the table could not be
565+ expanded. If all goes well, it will return a non-zero value. */
566+
567+static __always_inline int
568+htab_expand (struct funcdesc_ht *htab)
569+{
570+ struct funcdesc_value **oentries;
571+ struct funcdesc_value **olimit;
572+ struct funcdesc_value **p;
573+ struct funcdesc_value **nentries;
574+ size_t nsize;
575+
576+ oentries = htab->entries;
577+ olimit = oentries + htab->size;
578+
579+ /* Resize only when table after removal of unused elements is either
580+ too full or too empty. */
581+ if (htab->n_elements * 2 > htab->size)
582+ nsize = higher_prime_number (htab->n_elements * 2);
583+ else
584+ nsize = htab->size;
585+
586+ nentries = _dl_malloc (sizeof (struct funcdesc_value *) * nsize);
587+ _dl_memset (nentries, 0, sizeof (struct funcdesc_value *) * nsize);
588+ if (nentries == NULL)
589+ return 0;
590+ htab->entries = nentries;
591+ htab->size = nsize;
592+
593+ p = oentries;
594+ do
595+ {
596+ if (*p)
597+ *find_empty_slot_for_expand (htab, hash_pointer ((*p)->entry_point))
598+ = *p;
599+
600+ p++;
601+ }
602+ while (p < olimit);
603+
604+#if 0 /* We can't tell whether this was allocated by the _dl_malloc()
605+ built into ld.so or malloc() in the main executable or libc,
606+ and calling free() for something that wasn't malloc()ed could
607+ do Very Bad Things (TM). Take the conservative approach
608+ here, potentially wasting as much memory as actually used by
609+ the hash table, even if multiple growths occur. That's not
610+ so bad as to require some overengineered solution that would
611+ enable us to keep track of how it was allocated. */
612+ _dl_free (oentries);
613+#endif
614+ return 1;
615+}
616+
617+/* This function searches for a hash table slot containing an entry
618+ equal to the given element. To delete an entry, call this with
619+ INSERT = 0, then call htab_clear_slot on the slot returned (possibly
620+ after doing some checks). To insert an entry, call this with
621+ INSERT = 1, then write the value you want into the returned slot.
622+ When inserting an entry, NULL may be returned if memory allocation
623+ fails. */
624+
625+static __always_inline struct funcdesc_value **
626+htab_find_slot (struct funcdesc_ht *htab, void *ptr, int insert)
627+{
628+ unsigned int index;
629+ int hash, hash2;
630+ size_t size;
631+ struct funcdesc_value **entry;
632+
633+ if (htab->size * 3 <= htab->n_elements * 4
634+ && htab_expand (htab) == 0)
635+ return NULL;
636+
637+ hash = hash_pointer (ptr);
638+
639+ size = htab->size;
640+ index = hash % size;
641+
642+ entry = &htab->entries[index];
643+ if (!*entry)
644+ goto empty_entry;
645+ else if ((*entry)->entry_point == ptr)
646+ return entry;
647+
648+ hash2 = 1 + hash % (size - 2);
649+ for (;;)
650+ {
651+ index += hash2;
652+ if (index >= size)
653+ index -= size;
654+
655+ entry = &htab->entries[index];
656+ if (!*entry)
657+ goto empty_entry;
658+ else if ((*entry)->entry_point == ptr)
659+ return entry;
660+ }
661+
662+ empty_entry:
663+ if (!insert)
664+ return NULL;
665+
666+ htab->n_elements++;
667+ return entry;
668+}
669+
670+void *
671+_dl_funcdesc_for (void *entry_point, void *got_value)
672+{
673+ struct elf_resolve *tpnt = ((void**)got_value)[2];
674+ struct funcdesc_ht *ht = tpnt->funcdesc_ht;
675+ struct funcdesc_value **entry;
676+
677+ _dl_assert (got_value == tpnt->loadaddr.got_value);
678+
679+ if (! ht)
680+ {
681+ ht = htab_create ();
682+ if (! ht)
683+ return (void*)-1;
684+ tpnt->funcdesc_ht = ht;
685+ }
686+
687+ entry = htab_find_slot (ht, entry_point, 1);
688+ if (*entry)
689+ {
690+ _dl_assert ((*entry)->entry_point == entry_point);
691+ return _dl_stabilize_funcdesc (*entry);
692+ }
693+
694+ *entry = _dl_malloc (sizeof (struct funcdesc_value));
695+ (*entry)->entry_point = entry_point;
696+ (*entry)->got_value = got_value;
697+
698+ return _dl_stabilize_funcdesc (*entry);
699+}
700+
701+static __always_inline void const *
702+_dl_lookup_address (void const *address)
703+{
704+ struct elf_resolve *rpnt;
705+ struct funcdesc_value const *fd;
706+
707+ /* Make sure we don't make assumptions about its alignment. */
708+ __asm__ ("" : "+r" (address));
709+
710+ if ((Elf32_Addr)address & 7)
711+ /* It's not a function descriptor. */
712+ return address;
713+
714+ fd = (struct funcdesc_value const *)address;
715+
716+ for (rpnt = _dl_loaded_modules; rpnt; rpnt = rpnt->next)
717+ {
718+ if (! rpnt->funcdesc_ht)
719+ continue;
720+
721+ if (fd->got_value != rpnt->loadaddr.got_value)
722+ continue;
723+
724+ address = htab_find_slot (rpnt->funcdesc_ht, (void*)fd->entry_point, 0);
725+
726+ if (address && *(struct funcdesc_value *const*)address == fd)
727+ {
728+ address = (*(struct funcdesc_value *const*)address)->entry_point;
729+ break;
730+ }
731+ else
732+ address = fd;
733+ }
734+
735+ return address;
736+}
737+
738+void
739+__dl_loadaddr_unmap (struct elf32_fdpic_loadaddr loadaddr,
740+ struct funcdesc_ht *funcdesc_ht)
741+{
742+ int i;
743+
744+ for (i = 0; i < loadaddr.map->nsegs; i++)
745+ {
746+ struct elf32_fdpic_loadseg *segdata;
747+ ssize_t offs;
748+ segdata = loadaddr.map->segs + i;
749+
750+#if 0 /* SRAM */
751+ /* FIXME:
752+ A more cleaner way is to add type for struct elf32_fdpic_loadseg,
753+ and release the memory according to the type.
754+ Currently, we hardcode the memory address of L1 SRAM. */
755+ if ((segdata->addr & 0xff800000) == 0xff800000)
756+ {
757+ _dl_sram_free ((void *)segdata->addr);
758+ continue;
759+ }
760+#endif
761+ offs = (segdata->p_vaddr & ADDR_ALIGN);
762+ _dl_munmap ((void*)segdata->addr - offs,
763+ segdata->p_memsz + offs);
764+ }
765+ /* _dl_unmap is only called for dlopen()ed libraries, for which
766+ calling free() is safe, or before we've completed the initial
767+ relocation, in which case calling free() is probably pointless,
768+ but still safe. */
769+ _dl_free (loadaddr.map);
770+ if (funcdesc_ht)
771+ htab_delete (funcdesc_ht);
772+}
773+
774+#if 0 /* XXX TODO will look at enabling this if we decide to add support for OCM
775+ * code/data */
776+// OLD BLACKFIN CODE
777+static __always_inline int
778+__dl_is_special_segment (Elf32_Ehdr *epnt,
779+ Elf32_Phdr *ppnt)
780+{
781+ if (ppnt->p_type != PT_LOAD)
782+ return 0;
783+
784+ if ((epnt->e_flags & EF_BFIN_CODE_IN_L1)
785+ && !(ppnt->p_flags & PF_W)
786+ && (ppnt->p_flags & PF_X))
787+ return 1;
788+
789+ if ((epnt->e_flags & EF_BFIN_DATA_IN_L1)
790+ && (ppnt->p_flags & PF_W)
791+ && !(ppnt->p_flags & PF_X))
792+ return 1;
793+
794+ /* 0xff700000, 0xff800000, 0xff900000 and 0xffa00000 are also used in
795+ GNU ld and linux kernel. They need to be keep synchronized. */
796+ if (ppnt->p_vaddr == 0xff700000
797+ || ppnt->p_vaddr == 0xff800000
798+ || ppnt->p_vaddr == 0xff900000
799+ || ppnt->p_vaddr == 0xffa00000)
800+ return 1;
801+
802+ return 0;
803+}
804+
805+static __always_inline char *
806+__dl_map_segment (Elf32_Ehdr *epnt,
807+ Elf32_Phdr *ppnt,
808+ int infile,
809+ int flags)
810+{
811+ char *status, *tryaddr, *l1addr;
812+ size_t size;
813+
814+
815+ if (((epnt->e_flags & EF_BFIN_CODE_IN_L1) || ppnt->p_vaddr == 0xffa00000)
816+ && !(ppnt->p_flags & PF_W)
817+ && (ppnt->p_flags & PF_X)) {
818+ status = (char *) _dl_mmap
819+ (tryaddr = 0,
820+ size = (ppnt->p_vaddr & ADDR_ALIGN) + ppnt->p_filesz,
821+ LXFLAGS(ppnt->p_flags),
822+ flags | MAP_EXECUTABLE | MAP_DENYWRITE,
823+ infile, ppnt->p_offset & OFFS_ALIGN);
824+ if (_dl_mmap_check_error(status)
825+ || (tryaddr && tryaddr != status))
826+ return NULL;
827+ l1addr = (char *) _dl_sram_alloc (ppnt->p_filesz, L1_INST_SRAM);
828+ if (l1addr != NULL)
829+ _dl_dma_memcpy (l1addr, status + (ppnt->p_vaddr & ADDR_ALIGN), ppnt->p_filesz);
830+ _dl_munmap (status, size);
831+ if (l1addr == NULL)
832+ _dl_dprintf(2, "%s:%i: L1 allocation failed\n", _dl_progname, __LINE__);
833+ return l1addr;
834+ }
835+
836+ if (((epnt->e_flags & EF_BFIN_DATA_IN_L1)
837+ || ppnt->p_vaddr == 0xff700000
838+ || ppnt->p_vaddr == 0xff800000
839+ || ppnt->p_vaddr == 0xff900000)
840+ && (ppnt->p_flags & PF_W)
841+ && !(ppnt->p_flags & PF_X)) {
842+ if (ppnt->p_vaddr == 0xff800000)
843+ l1addr = (char *) _dl_sram_alloc (ppnt->p_memsz, L1_DATA_A_SRAM);
844+ else if (ppnt->p_vaddr == 0xff900000)
845+ l1addr = (char *) _dl_sram_alloc (ppnt->p_memsz, L1_DATA_B_SRAM);
846+ else
847+ l1addr = (char *) _dl_sram_alloc (ppnt->p_memsz, L1_DATA_SRAM);
848+ if (l1addr == NULL) {
849+ _dl_dprintf(2, "%s:%i: L1 allocation failed\n", _dl_progname, __LINE__);
850+ } else {
851+ if (_DL_PREAD (infile, l1addr, ppnt->p_filesz, ppnt->p_offset) != ppnt->p_filesz) {
852+ _dl_sram_free (l1addr);
853+ return NULL;
854+ }
855+ if (ppnt->p_filesz < ppnt->p_memsz)
856+ _dl_memset (l1addr + ppnt->p_filesz, 0, ppnt->p_memsz - ppnt->p_filesz);
857+ }
858+ return l1addr;
859+ }
860+ return 0;
861+}
862+#endif
863--- /dev/null
864@@ -0,0 +1,232 @@
865+/*
866+ Copyright (C) 2009 Ubicom, Inc.
867+ Copyright (C) 2003 Red Hat, Inc.
868+ Contributed by Alexandre Oliva <aoliva@redhat.com>
869+
870+This file is part of uClibc.
871+
872+uClibc is free software; you can redistribute it and/or modify it
873+under the terms of the GNU Lesser General Public License as
874+published by the Free Software Foundation; either version 2.1 of the
875+License, or (at your option) any later version.
876+
877+uClibc is distributed in the hope that it will be useful, but WITHOUT
878+ANY WARRANTY; without even the implied warranty of
879+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
880+Library General Public License for more details.
881+
882+You should have received a copy of the GNU Lesser General Public
883+License along with uClibc; see the file COPYING.LIB. If not, write to
884+the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
885+USA. */
886+
887+/* Any assembly language/system dependent hacks needed to setup
888+ * boot1.c so it will work as expected and cope with whatever platform
889+ * specific wierdness is needed for this architecture.
890+
891+ * We override the default _dl_boot function, and replace it with a
892+ * bit of asm. Then call the real _dl_boot function, which is now
893+ * named _dl_boot2. */
894+
895+/* At program start-up, p0 contains a pointer to a
896+ elf32_fdpic_loadmap that describes how the executable was loaded
897+ into memory. p1 contains a pointer to the interpreter (our!)
898+ loadmap, if there is an interpreter, or 0 if we're being run as an
899+ executable. p2 holds a pointer to the interpreter's dynamic
900+ section, if there is an interpreter, or to the executable's dynamic
901+ section, otherwise. If the executable is not dynamic, gr18 is 0.
902+
903+ We rely on the fact that the linker adds a pointer to the
904+ _GLOBAL_OFFSET_TABLE_ as the last ROFIXUP entry, and that
905+ __self_reloc returns the relocated pointer to us, so that we can
906+ use this value to initialize the PIC register. */
907+
908+
909+/*
910+ * _dl_boot is the entry point for ldso.
911+ *
912+ * The kernel leaves the main apps args on the stack (positive offsets), and
913+ * communicates the load maps as follows
914+ *
915+ * - d1 is set to the exec_map_addr (struct elf32_fdpic_loadmap *), which is the
916+ * current state of the mapped application.
917+ *
918+ * - d2 is set to interp_map_addr (struct elf32_fdpic_loadmap *), which is use
919+ * by ldso to relocate itself.
920+ *
921+ * - d3 is dynamic_addr which as far as I can tell is the stack pointer.
922+ *
923+ * - a1 is set to zero and will later be initialised to ldso _dl_fini funcdesc
924+ */
925+
926+__asm__(
927+ " .text \n\t"
928+ " .global _start \n\t"
929+ " .type _start,@function \n\t"
930+ "_start:\n\t"
931+ /*
932+ * Jump to .Lcall storing the location .Lcall in a5
933+ */
934+ " call a5, .Lcall \n\t"
935+ ".Lcall: \n\t"
936+ /*
937+ * Reserve and Push inputs to stack.
938+ * 32 byte stack layout as follows
939+ * offset 0 exec_map_addr
940+ * 4 interp_map_addr
941+ * 8 dynamic_addr
942+ * 12 not used
943+ * 16 dl_main_funcdesc structure for _dl_boot
944+ * (12 bytes sizeof funcdesc_value)
945+ * 28 reserved
946+ * 32 start of &original stack
947+ */
948+ " pdec sp, 32(sp); reserve stack space \n\t"
949+ " move.4 0(sp), d1 ; exec_map_addr \n\t"
950+ " move.4 4(sp), d2 ; interp_map_addr \n\t"
951+ " move.4 8(sp), d3; dynamic_addr \n\t"
952+
953+ /*
954+ * Load linker version of .Lcall in to d0
955+ */
956+ " moveai a3, #%hi(.Lcall) \n\t"
957+ " lea.1 d0, %lo(.Lcall)(a3) \n\t"
958+
959+ /*
960+ * Determine the offset from loaded .Lcall and put it in d0.
961+ */
962+ " sub.4 d0, a5, d0 \n\t"
963+
964+ /*
965+ * Load linker version of __ROFIXUP_LIST__ and __ROFIXUP_END__ in to d1
966+ * and d2.
967+ */
968+ " moveai a3, #%hi(__ROFIXUP_LIST__) \n\t"
969+ " lea.1 d1, %lo(__ROFIXUP_LIST__)(a3) \n\t"
970+ " moveai a3, #%hi(__ROFIXUP_END__) \n\t"
971+ " lea.1 d2, %lo(__ROFIXUP_END__)(a3) \n\t"
972+ /*
973+ * Use offset determined above to find the loaded versions.
974+ */
975+ " add.4 d1, d1, d0 \n\t"
976+ " add.4 d2, d2, d0 \n\t"
977+
978+ /*
979+ * Load interp_map_addr into d0, if interp_map_addr is null use
980+ * exec_map_addr.
981+ */
982+ " move.4 d0, 4(sp) ; load interp_map_addr \n\t"
983+ " cmpi d0, #0 \n\t"
984+ " jmpne.f 1f \n\t"
985+ " move.4 d0, 0(sp) ; load exec_map_addr \n\t"
986+
987+ /*
988+ * call __self_reloc(map, void ***p, void ***e)
989+ * it returns the the GOT in d0.
990+ */
991+ "1: call a5, __self_reloc ; returns a0 in d0 \n\t"
992+ " move.4 a0, d0 ; set GOT \n\t"
993+ " move.4 a2, d0 ; save GOT \n\t"
994+
995+ /*
996+ * now setup to call
997+ * _dl_start (Elf32_Addr dl_boot_got_pointer, (d0)
998+ * struct elf32_fdpic_loadmap *dl_boot_progmap, (d1)
999+ * struct elf32_fdpic_loadmap *dl_boot_ldsomap, (d2)
1000+ * Elf32_Dyn *dl_boot_ldso_dyn_pointer, (d3)
1001+ * struct funcdesc_value *dl_main_funcdesc, (d4)
1002+ * unsigned long args (d5)
1003+ *
1004+ * NOTE: for dl_main_funcdesc we reserved space on the stack for this
1005+ * structure.
1006+ */
1007+ " move.4 d1, 0(sp) ; d1 = exec_map_addr \n\t"
1008+ " move.4 d2, 4(sp) ; d2 = interp_map_addr \n\t"
1009+ " move.4 d3, 8(sp) ; d3 = dynamic_addr \n\t"
1010+ " lea.1 d4, 16(sp) ; d4 = &dl_main_funcdesc \n\t"
1011+ " lea.1 d5, 32(sp) ; d5 = original stack ptr (args)\n\t"
1012+ " call a5, _dl_start \n\t"
1013+
1014+ /*
1015+ * Setup to call the main entry point, starting with passing our FINI
1016+ * ptr() to the user in a1 (remember we saved the got in a2)
1017+ */
1018+ " movei d15, #%got_funcdesc_lo(_dl_fini) \n\t"
1019+ " move.4 a1, (a2, d15) \n\t"
1020+
1021+ /*
1022+ * restore the load map from the kernel.
1023+ */
1024+ " move.4 d1, 0(sp) ; restore exec_map_addr \n\t"
1025+ " move.4 d2, 4(sp) ; restore interp_map_addr \n\t"
1026+ " move.4 d3, 8(sp) ; restore dynamic_addr \n\t"
1027+
1028+ /*
1029+ * _dl_start returned the main apps entry point in dl_main_funcdesc,
1030+ * load that information now.
1031+ */
1032+ " move.4 a5, 16(sp) ; a5 = dl_main_funcdesc.entry_point \n\t"
1033+ " move.4 a0, 20(sp) ; a0 = dl_main_funcdesc.got_value \n\t"
1034+ " lea.1 sp, 32(sp); restore original stack ptr (args) \n\t"
1035+ " calli a5, 0(a5) \n\t"
1036+ " bkpt -1; should never get here \n\t"
1037+ " .size _start, . - _start \n\t"
1038+);
1039+
1040+#undef DL_START
1041+#define DL_START(X) \
1042+static void __attribute__ ((used)) \
1043+_dl_start (Elf32_Addr dl_boot_got_pointer, \
1044+ struct elf32_fdpic_loadmap *dl_boot_progmap, \
1045+ struct elf32_fdpic_loadmap *dl_boot_ldsomap, \
1046+ Elf32_Dyn *dl_boot_ldso_dyn_pointer, \
1047+ struct funcdesc_value *dl_main_funcdesc, \
1048+ X)
1049+
1050+struct elf32_fdpic_loadmap;
1051+
1052+/*
1053+ * Get a pointer to the argv array. On many platforms this can be just
1054+ * the address if the first argument, on other platforms we need to
1055+ * do something a little more subtle here.
1056+ */
1057+#define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long*) ARGS) + 1)
1058+
1059+/*
1060+ * Here is a macro to perform a relocation. This is only used when
1061+ * bootstrapping the dynamic loader. RELP is the relocation that we
1062+ * are performing, REL is the pointer to the address we are relocating.
1063+ * SYMBOL is the symbol involved in the relocation, and LOAD is the
1064+ * load address.
1065+ */
1066+#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \