1 diff -urN uClibc-0.9.27/extra/Configs/Config.h8300 uClibc-0.9.27-uc0/extra/Configs/Config.h8300
2 --- uClibc-0.9.27/extra/Configs/Config.h8300 2005-01-12 08:59:21.000000000 +0100
3 +++ uClibc-0.9.27-uc0/extra/Configs/Config.h8300 2005-01-26 07:37:19.000000000 +0100
7 select ARCH_HAS_C_SYMBOL_PREFIX
8 - select HAVE_NO_SHARED
9 select ARCH_HAS_NO_LDSO
16 +config CONFIG_BINFMT_SHARED_FLAT
17 + bool "Build Shared Library"
20 +config UCLIBC_HAS_SOFT_FLOAT
27 diff -urN uClibc-0.9.27/extra/Configs/Config.in uClibc-0.9.27-uc0/extra/Configs/Config.in
28 --- uClibc-0.9.27/extra/Configs/Config.in 2005-01-12 08:59:21.000000000 +0100
29 +++ uClibc-0.9.27-uc0/extra/Configs/Config.in 2006-02-27 08:31:05.000000000 +0100
32 Unless you use uClibc with C++, you should probably answer N.
35 + bool "Old (visible) atexit Support"
38 + Enable this option if you want to update from 0.9.28 to svn/0.9.29, else
39 + you will be missing atexit() until you rebuild all apps.
42 bool "Shadow Password Support"
43 diff -urN uClibc-0.9.27/extra/Configs/Config.in.arch uClibc-0.9.27-uc0/extra/Configs/Config.in.arch
44 --- uClibc-0.9.27/extra/Configs/Config.in.arch 2005-01-12 08:59:21.000000000 +0100
45 +++ uClibc-0.9.27-uc0/extra/Configs/Config.in.arch 2006-07-28 07:00:26.000000000 +0200
47 work at all. You have been warned.
49 config UCLIBC_UCLINUX_BROKEN_MUNMAP
51 + bool "If munmap expects 0 for the size"
52 depends on !ARCH_HAS_MMU
58 diff -urN uClibc-0.9.27/extra/Configs/Config.m68k uClibc-0.9.27-uc0/extra/Configs/Config.m68k
59 --- uClibc-0.9.27/extra/Configs/Config.m68k 2005-01-12 08:59:21.000000000 +0100
60 +++ uClibc-0.9.27-uc0/extra/Configs/Config.m68k 2005-01-26 07:37:19.000000000 +0100
67 - default "-Wa,--bitwise-or"
70 +# default "-Wa,--bitwise-or"
74 diff -urN uClibc-0.9.27/extra/Configs/Config.microblaze uClibc-0.9.27-uc0/extra/Configs/Config.microblaze
75 --- uClibc-0.9.27/extra/Configs/Config.microblaze 2005-01-12 08:59:21.000000000 +0100
76 +++ uClibc-0.9.27-uc0/extra/Configs/Config.microblaze 2005-01-26 07:37:19.000000000 +0100
80 select ARCH_HAS_NO_MMU
81 - select ARCH_HAS_C_SYMBOL_PREFIX
82 + select ARCH_BIG_ENDIAN
84 select ARCH_HAS_NO_LDSO
108 diff -urN uClibc-0.9.27/extra/Configs/Config.sh uClibc-0.9.27-uc0/extra/Configs/Config.sh
109 --- uClibc-0.9.27/extra/Configs/Config.sh 2005-01-12 08:59:21.000000000 +0100
110 +++ uClibc-0.9.27-uc0/extra/Configs/Config.sh 2005-02-10 03:09:15.000000000 +0100
115 - select FORCE_SHAREABLE_TEXT_SEGMENTS
119 diff -urN uClibc-0.9.27/extra/scripts/fix_includes.sh uClibc-0.9.27-uc0/extra/scripts/fix_includes.sh
120 --- uClibc-0.9.27/extra/scripts/fix_includes.sh 2005-01-12 08:59:21.000000000 +0100
121 +++ uClibc-0.9.27-uc0/extra/scripts/fix_includes.sh 2005-07-08 03:26:56.000000000 +0200
124 while [ -n "$1" ]; do
126 - -k ) shift; if [ -n "$1" ]; then KERNEL_SOURCE=$1; shift; else usage; fi; ;;
127 - -t ) shift; if [ -n "$1" ]; then TARGET_ARCH=$1; shift; else usage; fi; ;;
128 + -k ) shift; if [ -n "$1" ]; then KERNEL_SOURCE="$1"; shift; else usage; fi; ;;
129 + -t ) shift; if [ -n "$1" ]; then TARGET_ARCH="$1"; shift; else usage; fi; ;;
130 -n ) shift; HAS_MMU="n"; ;;
134 ln -fs $KERNEL_SOURCE/include/asm include/asm
137 +# 2.4 nommu targets may need include/asm-arch
138 +if [ "$HAS_MMU" != "y" ] && [ -d $KERNEL_SOURCE/include/asm-$TARGET_ARCH ]; then
139 + ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm-$TARGET_ARCH
143 # Annoyingly, 2.6.x kernel headers also need an include/asm-generic/ directory
144 if [ $VERSION -eq 2 ] && [ $PATCHLEVEL -ge 6 ] ; then
145 diff -urN uClibc-0.9.27/include/atomic.h uClibc-0.9.27-uc0/include/atomic.h
146 --- uClibc-0.9.27/include/atomic.h 1970-01-01 01:00:00.000000000 +0100
147 +++ uClibc-0.9.27-uc0/include/atomic.h 2006-01-16 07:46:31.000000000 +0100
149 +/* Internal macros for atomic operations for GNU C Library.
150 + Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
151 + This file is part of the GNU C Library.
152 + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
154 + The GNU C Library is free software; you can redistribute it and/or
155 + modify it under the terms of the GNU Lesser General Public
156 + License as published by the Free Software Foundation; either
157 + version 2.1 of the License, or (at your option) any later version.
159 + The GNU C Library is distributed in the hope that it will be useful,
160 + but WITHOUT ANY WARRANTY; without even the implied warranty of
161 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
162 + Lesser General Public License for more details.
164 + You should have received a copy of the GNU Lesser General Public
165 + License along with the GNU C Library; if not, write to the Free
166 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
174 +#include <bits/atomic.h>
176 +/* Wrapper macros to call pre_NN_post (mem, ...) where NN is the
177 + bit width of *MEM. The calling macro puts parens around MEM
178 + and following args. */
179 +#define __atomic_val_bysize(pre, post, mem, ...) \
181 + __typeof (*mem) __result; \
182 + if (sizeof (*mem) == 1) \
183 + __result = pre##_8_##post (mem, __VA_ARGS__); \
184 + else if (sizeof (*mem) == 2) \
185 + __result = pre##_16_##post (mem, __VA_ARGS__); \
186 + else if (sizeof (*mem) == 4) \
187 + __result = pre##_32_##post (mem, __VA_ARGS__); \
188 + else if (sizeof (*mem) == 8) \
189 + __result = pre##_64_##post (mem, __VA_ARGS__); \
194 +#define __atomic_bool_bysize(pre, post, mem, ...) \
197 + if (sizeof (*mem) == 1) \
198 + __result = pre##_8_##post (mem, __VA_ARGS__); \
199 + else if (sizeof (*mem) == 2) \
200 + __result = pre##_16_##post (mem, __VA_ARGS__); \
201 + else if (sizeof (*mem) == 4) \
202 + __result = pre##_32_##post (mem, __VA_ARGS__); \
203 + else if (sizeof (*mem) == 8) \
204 + __result = pre##_64_##post (mem, __VA_ARGS__); \
211 +/* Atomically store NEWVAL in *MEM if *MEM is equal to OLDVAL.
212 + Return the old *MEM value. */
213 +#if !defined atomic_compare_and_exchange_val_acq \
214 + && defined __arch_compare_and_exchange_val_32_acq
215 +# define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \
216 + __atomic_val_bysize (__arch_compare_and_exchange_val,acq, \
217 + mem, newval, oldval)
221 +#ifndef atomic_compare_and_exchange_val_rel
222 +# define atomic_compare_and_exchange_val_rel(mem, newval, oldval) \
223 + atomic_compare_and_exchange_val_acq (mem, newval, oldval)
227 +/* Atomically store NEWVAL in *MEM if *MEM is equal to OLDVAL.
228 + Return zero if *MEM was changed or non-zero if no exchange happened. */
229 +#ifndef atomic_compare_and_exchange_bool_acq
230 +# ifdef __arch_compare_and_exchange_bool_32_acq
231 +# define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
232 + __atomic_bool_bysize (__arch_compare_and_exchange_bool,acq, \
233 + mem, newval, oldval)
235 +# define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
236 + ({ /* Cannot use __oldval here, because macros later in this file might \
237 + call this macro with __oldval argument. */ \
238 + __typeof (oldval) __old = (oldval); \
239 + atomic_compare_and_exchange_val_acq (mem, newval, __old) != __old; \
245 +#ifndef atomic_compare_and_exchange_bool_rel
246 +# define atomic_compare_and_exchange_bool_rel(mem, newval, oldval) \
247 + atomic_compare_and_exchange_bool_acq (mem, newval, oldval)
251 +/* Store NEWVALUE in *MEM and return the old value. */
252 +#ifndef atomic_exchange_acq
253 +# define atomic_exchange_acq(mem, newvalue) \
254 + ({ __typeof (*(mem)) __oldval; \
255 + __typeof (mem) __memp = (mem); \
256 + __typeof (*(mem)) __value = (newvalue); \
259 + __oldval = (*__memp); \
260 + while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
268 +#ifndef atomic_exchange_rel
269 +# define atomic_exchange_rel(mem, newvalue) atomic_exchange_acq (mem, newvalue)
273 +/* Add VALUE to *MEM and return the old value of *MEM. */
274 +#ifndef atomic_exchange_and_add
275 +# define atomic_exchange_and_add(mem, value) \
276 + ({ __typeof (*(mem)) __oldval; \
277 + __typeof (mem) __memp = (mem); \
278 + __typeof (*(mem)) __value = (value); \
281 + __oldval = (*__memp); \
282 + while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
293 +# define atomic_add(mem, value) (void) atomic_exchange_and_add ((mem), (value))
297 +#ifndef atomic_increment
298 +# define atomic_increment(mem) atomic_add ((mem), 1)
302 +#ifndef atomic_increment_val
303 +# define atomic_increment_val(mem) (atomic_exchange_and_add ((mem), 1) + 1)
307 +/* Add one to *MEM and return true iff it's now zero. */
308 +#ifndef atomic_increment_and_test
309 +# define atomic_increment_and_test(mem) \
310 + (atomic_exchange_and_add ((mem), 1) + 1 == 0)
314 +#ifndef atomic_decrement
315 +# define atomic_decrement(mem) atomic_add ((mem), -1)
319 +#ifndef atomic_decrement_val
320 +# define atomic_decrement_val(mem) (atomic_exchange_and_add ((mem), -1) - 1)
324 +/* Subtract 1 from *MEM and return true iff it's now zero. */
325 +#ifndef atomic_decrement_and_test
326 +# define atomic_decrement_and_test(mem) \
327 + (atomic_exchange_and_add ((mem), -1) == 1)
331 +/* Decrement *MEM if it is > 0, and return the old value. */
332 +#ifndef atomic_decrement_if_positive
333 +# define atomic_decrement_if_positive(mem) \
334 + ({ __typeof (*(mem)) __oldval; \
335 + __typeof (mem) __memp = (mem); \
339 + __oldval = *__memp; \
340 + if (__builtin_expect (__oldval <= 0, 0)) \
343 + while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
352 +#ifndef atomic_add_negative
353 +# define atomic_add_negative(mem, value) \
354 + ({ __typeof (value) __aan_value = (value); \
355 + atomic_exchange_and_add (mem, __aan_value) < -__aan_value; })
359 +#ifndef atomic_add_zero
360 +# define atomic_add_zero(mem, value) \
361 + ({ __typeof (value) __aaz_value = (value); \
362 + atomic_exchange_and_add (mem, __aaz_value) == -__aaz_value; })
366 +#ifndef atomic_bit_set
367 +# define atomic_bit_set(mem, bit) \
368 + (void) atomic_bit_test_set(mem, bit)
372 +#ifndef atomic_bit_test_set
373 +# define atomic_bit_test_set(mem, bit) \
374 + ({ __typeof (*(mem)) __oldval; \
375 + __typeof (mem) __memp = (mem); \
376 + __typeof (*(mem)) __mask = ((__typeof (*(mem))) 1 << (bit)); \
379 + __oldval = (*__memp); \
380 + while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
386 + __oldval & __mask; })
390 +#ifndef atomic_full_barrier
391 +# define atomic_full_barrier() __asm ("" ::: "memory")
395 +#ifndef atomic_read_barrier
396 +# define atomic_read_barrier() atomic_full_barrier ()
400 +#ifndef atomic_write_barrier
401 +# define atomic_write_barrier() atomic_full_barrier ()
405 +#ifndef atomic_delay
406 +# define atomic_delay() do { /* nothing */ } while (0)
409 +#endif /* atomic.h */
410 diff -urN uClibc-0.9.27/include/dlfcn.h uClibc-0.9.27-uc0/include/dlfcn.h
411 --- uClibc-0.9.27/include/dlfcn.h 2005-01-12 08:59:21.000000000 +0100
412 +++ uClibc-0.9.27-uc0/include/dlfcn.h 2005-01-26 07:37:19.000000000 +0100
414 /* When any of the above functions fails, call this function
415 to return a string describing the error. Each call resets
416 the error string so that a following call returns null. */
417 -extern char *dlerror (void) __THROW;
418 +extern const char *dlerror (void) __THROW;
421 /* Structure containing information about object searched using
422 diff -urN uClibc-0.9.27/include/elf.h uClibc-0.9.27-uc0/include/elf.h
423 --- uClibc-0.9.27/include/elf.h 2005-01-12 08:59:21.000000000 +0100
424 +++ uClibc-0.9.27-uc0/include/elf.h 2005-01-26 07:37:19.000000000 +0100
425 @@ -2546,6 +2546,25 @@
426 #define R_V850_NUM 25
430 +#define EM_XILINX_MICROBLAZE 0xbaab
432 +/* Microblaze Relocations */
433 +#define R_MICROBLAZE_NONE 0
434 +#define R_MICROBLAZE_32 1
435 +#define R_MICROBLAZE_32_PCREL 2
436 +#define R_MICROBLAZE_64_PCREL 3
437 +#define R_MICROBLAZE_32_PCREL_LO 4
438 +#define R_MICROBLAZE_64 5
439 +#define R_MICROBLAZE_32_LO 6
440 +#define R_MICROBLAZE_SRO32 7
441 +#define R_MICROBLAZE_SRW32 8
442 +#define R_MICROBLAZE_64_NONE 9
443 +#define R_MICROBLAZE_32_SYM_OP_SYM 10
444 +/* Keep this the last entry. */
445 +#define R_MICROBLAZE_NUM 11
450 #define R_H8_DIR32_28 2
451 diff -urN uClibc-0.9.27/include/features.h uClibc-0.9.27-uc0/include/features.h
452 --- uClibc-0.9.27/include/features.h 2005-01-12 08:59:21.000000000 +0100
453 +++ uClibc-0.9.27-uc0/include/features.h 2005-07-08 03:33:44.000000000 +0200
455 extern __typeof (name) aliasname __attribute__ ((alias (#name)));
456 /* This comes between the return type and function name in
457 * a function definition to make that definition weak. */
459 +# define weak_decl(name) __asm__(".weak " #name ";");
461 +# define weak_decl(name)
463 # define weak_function __attribute__ ((weak))
464 # define weak_const_function __attribute__ ((weak, __const__))
465 /* Tacking on "\n\t#" to the section name makes gcc put it's bogus
466 diff -urN uClibc-0.9.27/include/net/if_arp.h uClibc-0.9.27-uc0/include/net/if_arp.h
467 --- uClibc-0.9.27/include/net/if_arp.h 2005-01-12 08:59:21.000000000 +0100
468 +++ uClibc-0.9.27-uc0/include/net/if_arp.h 2005-01-26 07:37:19.000000000 +0100
470 #define ARPHRD_ADAPT 264
471 #define ARPHRD_ROSE 270
472 #define ARPHRD_X25 271 /* CCITT X.25. */
473 -#define ARPHDR_HWX25 272 /* Boards with X.25 in firmware. */
474 +#define ARPHRD_HWX25 272 /* Boards with X.25 in firmware. */
475 #define ARPHRD_PPP 512
476 #define ARPHRD_CISCO 513 /* Cisco HDLC. */
477 #define ARPHRD_HDLC ARPHRD_CISCO
479 #define ARPHRD_FCPP 784 /* Point to point fibrechanel. */
480 #define ARPHRD_FCAL 785 /* Fibrechanel arbitrated loop. */
481 #define ARPHRD_FCPL 786 /* Fibrechanel public loop. */
482 +#define ARPHRD_FCPFABRIC 787 /* Fibrechanel fabric. */
483 #define ARPHRD_FCFABRIC 787 /* Fibrechanel fabric. */
484 #define ARPHRD_IEEE802_TR 800 /* Magic type ident for TR. */
485 #define ARPHRD_IEEE80211 801 /* IEEE 802.11. */
486 diff -urN uClibc-0.9.27/include/net/if.h uClibc-0.9.27-uc0/include/net/if.h
487 --- uClibc-0.9.27/include/net/if.h 2005-01-12 08:59:21.000000000 +0100
488 +++ uClibc-0.9.27-uc0/include/net/if.h 2003-09-10 07:17:26.000000000 +0200
491 IFF_PORTSEL = 0x2000, /* Can set media type. */
492 # define IFF_PORTSEL IFF_PORTSEL
493 - IFF_AUTOMEDIA = 0x4000 /* Auto media select active. */
494 + IFF_AUTOMEDIA = 0x4000, /* Auto media select active. */
495 # define IFF_AUTOMEDIA IFF_AUTOMEDIA
496 + IFF_DYNAMIC = 0x8000 /* dialup device with changing addresses*/
497 +# define IFF_DYNAMIC IFF_DYNAMIC
500 /* The ifaddr structure contains information about one address of an
501 diff -urN uClibc-0.9.27/include/netinet/in.h uClibc-0.9.27-uc0/include/netinet/in.h
502 --- uClibc-0.9.27/include/netinet/in.h 2005-01-12 08:59:21.000000000 +0100
503 +++ uClibc-0.9.27-uc0/include/netinet/in.h 2006-07-06 13:44:28.000000000 +0200
505 #define IPPROTO_PIM IPPROTO_PIM
506 IPPROTO_COMP = 108, /* Compression Header Protocol. */
507 #define IPPROTO_COMP IPPROTO_COMP
508 + IPPROTO_SCTP = 132, /* Stream Control Transmission Protocol. */
509 +#define IPPROTO_SCTP IPPROTO_SCTP
510 IPPROTO_RAW = 255, /* Raw IP packets. */
511 #define IPPROTO_RAW IPPROTO_RAW
513 diff -urN uClibc-0.9.27/include/stdint.h uClibc-0.9.27-uc0/include/stdint.h
514 --- uClibc-0.9.27/include/stdint.h 2005-01-12 08:59:21.000000000 +0100
515 +++ uClibc-0.9.27-uc0/include/stdint.h 2004-05-13 03:48:57.000000000 +0200
517 # define UINTPTR_MAX (4294967295U)
520 -#if !defined(__H8300H__) && !defined(__H8300S__)
521 +#if (__LONG_MAX__ != __LONG_LONG_MAX__) /* long long check */
522 /* Minimum for largest signed integral type. */
523 # define INTMAX_MIN (-__INT64_C(9223372036854775807)-1)
524 /* Maximum for largest signed integral type. */
526 # define INTMAX_MAX (LONG_LONG_MAX)
528 /* Maximum for largest unsigned integral type. */
529 -# define UINTMAX_MAX (LONG_LONG_MAX<<1+1)
530 +# define UINTMAX_MAX (LONG_LONG_MAX*2+1)
533 /* Limits of other integer types. */
534 diff -urN uClibc-0.9.27/ldso/ldso/dl-startup.c uClibc-0.9.27-uc0/ldso/ldso/dl-startup.c
535 --- uClibc-0.9.27/ldso/ldso/dl-startup.c 2005-01-12 08:59:21.000000000 +0100
536 +++ uClibc-0.9.27-uc0/ldso/ldso/dl-startup.c 2005-02-10 06:07:27.000000000 +0100
538 SEND_STDERR("scanning DYNAMIC section\n");
540 tpnt->dynamic_addr = dpnt;
542 +#if defined(__mips__) || defined(__sh__)
543 /* MIPS cannot call functions here, must inline */
544 __dl_parse_dynamic_info(dpnt, tpnt->dynamic_info, NULL);
546 diff -urN uClibc-0.9.27/ldso/ldso/ldso.c uClibc-0.9.27-uc0/ldso/ldso/ldso.c
547 --- uClibc-0.9.27/ldso/ldso/ldso.c 2005-01-12 08:59:21.000000000 +0100
548 +++ uClibc-0.9.27-uc0/ldso/ldso/ldso.c 2006-02-27 08:31:07.000000000 +0100
553 -static unsigned char *_dl_malloc_addr = 0; /* Lets _dl_malloc use the already allocated memory page */
554 -static unsigned char *_dl_mmap_zero = 0; /* Also used by _dl_malloc */
555 +unsigned char *_dl_malloc_addr = 0; /* Lets _dl_malloc use the already allocated memory page */
556 +unsigned char *_dl_mmap_zero = 0; /* Also used by _dl_malloc */
558 #if defined (__SUPPORT_LD_DEBUG__)
559 static void debug_fini (int status, void *arg)
560 diff -urN uClibc-0.9.27/ldso/ldso/Makefile uClibc-0.9.27-uc0/ldso/ldso/Makefile
561 --- uClibc-0.9.27/ldso/ldso/Makefile 2005-01-12 08:59:21.000000000 +0100
562 +++ uClibc-0.9.27-uc0/ldso/ldso/Makefile 2005-01-26 07:37:20.000000000 +0100
564 OBJS=$(AOBJS) $(COBJS)
566 ifneq ($(strip $(SUPPORT_LD_DEBUG)),y)
571 ifeq ($(strip $(SUPPORT_LD_DEBUG)),y)
573 #This stuff will not work with -fomit-frame-pointer
574 XXFLAGS := $(XXFLAGS:-fomit-frame-pointer=)
576 +#This stuff will not work with -fomit-frame-pointer
577 +XXFLAGS := $(XXFLAGS:-fomit-frame-pointer=)
581 lib:: $(OBJS) $(DLINK_OBJS)
582 diff -urN uClibc-0.9.27/ldso/libdl/libdl.c uClibc-0.9.27-uc0/ldso/libdl/libdl.c
583 --- uClibc-0.9.27/ldso/libdl/libdl.c 2005-01-12 08:59:21.000000000 +0100
584 +++ uClibc-0.9.27-uc0/ldso/libdl/libdl.c 2005-01-26 12:53:44.000000000 +0100
586 return do_dlclose(vhandle, 1);
590 +const char *dlerror(void)
594 diff -urN uClibc-0.9.27/libc/inet/rpc/rpc_thread.c uClibc-0.9.27-uc0/libc/inet/rpc/rpc_thread.c
595 --- uClibc-0.9.27/libc/inet/rpc/rpc_thread.c 2005-01-12 08:59:21.000000000 +0100
596 +++ uClibc-0.9.27-uc0/libc/inet/rpc/rpc_thread.c 2005-07-08 03:33:44.000000000 +0200
601 +weak_decl(__pthread_once)
602 extern int weak_function __pthread_once (pthread_once_t *__once_control,
603 void (*__init_routine) (void));
605 diff -urN uClibc-0.9.27/libc/misc/assert/__assert.c uClibc-0.9.27-uc0/libc/misc/assert/__assert.c
606 --- uClibc-0.9.27/libc/misc/assert/__assert.c 2005-01-12 08:59:21.000000000 +0100
607 +++ uClibc-0.9.27-uc0/libc/misc/assert/__assert.c 2005-01-26 07:37:22.000000000 +0100
613 #include <bits/uClibc_uintmaxtostr.h>
615 /* Get the prototype from assert.h as a double-check. */
617 ((function == NULL) ? "?function?" : function),
622 + /* TODO: support program_name like glibc? */
623 + "%s: %s: %d: %s: Assertion `%s' failed.\n", program_name,
625 + "%s: %d: %s: Assertion `%s' failed.\n",
629 + /* Function name isn't available with some compilers. */
630 + ((function == NULL) ? "?function?" : function),
636 diff -urN uClibc-0.9.27/libc/misc/internals/__errno_location.c uClibc-0.9.27-uc0/libc/misc/internals/__errno_location.c
637 --- uClibc-0.9.27/libc/misc/internals/__errno_location.c 2005-01-12 08:59:21.000000000 +0100
638 +++ uClibc-0.9.27-uc0/libc/misc/internals/__errno_location.c 2005-07-08 03:33:44.000000000 +0200
643 +weak_decl(__errno_location)
644 int * weak_const_function __errno_location (void)
647 diff -urN uClibc-0.9.27/libc/misc/internals/__h_errno_location.c uClibc-0.9.27-uc0/libc/misc/internals/__h_errno_location.c
648 --- uClibc-0.9.27/libc/misc/internals/__h_errno_location.c 2005-01-12 08:59:21.000000000 +0100
649 +++ uClibc-0.9.27-uc0/libc/misc/internals/__h_errno_location.c 2005-07-08 03:33:44.000000000 +0200
654 +weak_decl(__h_errno_location)
655 int * weak_const_function __h_errno_location (void)
658 diff -urN uClibc-0.9.27/libc/misc/internals/__uClibc_main.c uClibc-0.9.27-uc0/libc/misc/internals/__uClibc_main.c
659 --- uClibc-0.9.27/libc/misc/internals/__uClibc_main.c 2005-01-12 08:59:21.000000000 +0100
660 +++ uClibc-0.9.27-uc0/libc/misc/internals/__uClibc_main.c 2006-04-24 15:45:17.000000000 +0200
664 extern int main(int argc, char **argv, char **envp);
665 +weak_decl(_stdio_init)
666 +weak_decl(__errno_location)
667 +weak_decl(__h_errno_location)
668 extern void weak_function _stdio_init(void);
669 extern int *weak_const_function __errno_location(void);
670 extern int *weak_const_function __h_errno_location(void);
671 #ifdef __UCLIBC_HAS_LOCALE__
672 +weak_decl(_locale_init)
673 extern void weak_function _locale_init(void);
675 #ifdef __UCLIBC_HAS_THREADS__
676 +weak_decl(__pthread_initialize_minimal)
677 extern void weak_function __pthread_initialize_minimal(void);
681 extern int __libc_fcntl(int fd, int cmd, ...);
682 extern int __libc_open(const char *file, int flags, ...);
684 +#ifdef __ARCH_HAS_MMU__
685 static void __check_one_fd(int fd, int mode)
687 /* Check if the specified fd is already open */
695 /* __uClibc_init completely initialize uClibc so it is ready to use.
696 diff -urN uClibc-0.9.27/libc/misc/locale/locale.c uClibc-0.9.27-uc0/libc/misc/locale/locale.c
697 --- uClibc-0.9.27/libc/misc/locale/locale.c 2005-01-12 08:59:21.000000000 +0100
698 +++ uClibc-0.9.27-uc0/libc/misc/locale/locale.c 2005-07-08 03:33:45.000000000 +0200
699 @@ -1376,11 +1376,13 @@
701 #ifdef __UCLIBC_HAS_THREADS__
703 +weak_decl(__curlocale)
704 __locale_t weak_const_function __curlocale(void)
706 return __curlocale_var; /* This is overriden by the thread version. */
709 +weak_decl(__curlocale_set)
710 __locale_t weak_function __curlocale_set(__locale_t newloc)
712 __locale_t oldloc = __curlocale_var;
713 diff -urN uClibc-0.9.27/libc/misc/regex/regex.c uClibc-0.9.27-uc0/libc/misc/regex/regex.c
714 --- uClibc-0.9.27/libc/misc/regex/regex.c 2005-01-12 08:59:21.000000000 +0100
715 +++ uClibc-0.9.27-uc0/libc/misc/regex/regex.c 2005-07-08 03:33:45.000000000 +0200
716 @@ -7955,12 +7955,14 @@
717 /* BSD has one and only one pattern buffer. */
718 static struct re_pattern_buffer re_comp_buf;
722 /* Make these definitions weak in libc, so POSIX programs can redefine
723 these names if they don't use our functions, and still use
724 regcomp/regexec below without link errors. */
733 @@ -8009,9 +8011,11 @@
747 diff -urN uClibc-0.9.27/libc/misc/time/time.c uClibc-0.9.27-uc0/libc/misc/time/time.c
748 --- uClibc-0.9.27/libc/misc/time/time.c 2005-01-12 08:59:21.000000000 +0100
749 +++ uClibc-0.9.27-uc0/libc/misc/time/time.c 2005-01-26 07:37:23.000000000 +0100
753 int i, isdst, isleap, day, day0, monlen, mday;
754 - int oday; /* Note: oday can be uninitialized. */
755 + int oday=0; /* Note: oday can be uninitialized. */
758 if (r[1].tzname[0] != 0) {
759 @@ -2003,7 +2003,7 @@
763 - int wday; /* Note: wday can be uninitialized. */
764 + int wday=0; /* Note: wday can be uninitialized. */
767 register const uint16_t *vp;
768 diff -urN uClibc-0.9.27/libc/misc/wchar/wchar.c uClibc-0.9.27-uc0/libc/misc/wchar/wchar.c
769 --- uClibc-0.9.27/libc/misc/wchar/wchar.c 2005-01-12 08:59:21.000000000 +0100
770 +++ uClibc-0.9.27-uc0/libc/misc/wchar/wchar.c 2005-07-08 03:33:45.000000000 +0200
771 @@ -1274,6 +1274,7 @@
772 return 0; /* No matching codeset! */
775 +weak_decl(iconv_open)
776 iconv_t weak_function iconv_open(const char *tocode, const char *fromcode)
778 register _UC_iconv_t *px;
779 @@ -1296,6 +1297,7 @@
780 return (iconv_t)(-1);
783 +weak_decl(iconv_close)
784 int weak_function iconv_close(iconv_t cd)
787 @@ -1303,6 +1305,7 @@
792 size_t weak_function iconv(iconv_t cd, char **__restrict inbuf,
793 size_t *__restrict inbytesleft,
794 char **__restrict outbuf,
795 diff -urN uClibc-0.9.27/libc/stdio/Makefile uClibc-0.9.27-uc0/libc/stdio/Makefile
796 --- uClibc-0.9.27/libc/stdio/Makefile 2005-01-12 08:59:21.000000000 +0100
797 +++ uClibc-0.9.27-uc0/libc/stdio/Makefile 2005-07-14 07:40:58.000000000 +0200
799 $(CC) $(CFLAGS) -c $< -o $@
800 $(STRIPTOOL) -x -R .note -R .comment $@
802 +ifeq ($(TARGET_m68k),y)
803 +# The old gcc-2.95.3 m68k-elf compiler (and probably quite a few newer
804 +# versions) have an optimization bug that occassionaly produces a compiler
805 +# internal error. To work around this reduce optimization to -O0 for the
807 +_fpmaxtostr.o: _fpmaxtostr.c
808 + $(CC) $(CFLAGS) -O0 -c $< -o $@
809 + $(STRIPTOOL) -x -R .note -R .comment $@
813 $(CC) $(CFLAGS) -D__DO_UNLOCKED -c $< -o $@
814 $(STRIPTOOL) -x -R .note -R .comment $@
815 diff -urN uClibc-0.9.27/libc/stdio/scanf.c uClibc-0.9.27-uc0/libc/stdio/scanf.c
816 --- uClibc-0.9.27/libc/stdio/scanf.c 2005-01-12 08:59:21.000000000 +0100
817 +++ uClibc-0.9.27-uc0/libc/stdio/scanf.c 2005-07-08 06:39:35.000000000 +0200
819 f.__user_locking = 1; /* Set user locking. */
820 __stdio_init_mutex(&f.__lock);
822 +#ifdef __STDIO_HAS_OPENLIST
826 /* Set these last since __bufgetc initialization depends on
827 * __user_locking and only gets set if user locking is on. */
829 f.f.__user_locking = 1; /* Set user locking. */
830 __stdio_init_mutex(&f.f.__lock);
832 +#ifdef __STDIO_HAS_OPENLIST
833 f.f.__nextopen = NULL;
836 return vfscanf(&f.f, fmt, ap);
839 f.__user_locking = 1; /* Set user locking. */
840 __stdio_init_mutex(&f.__lock);
842 +#ifdef __STDIO_HAS_OPENLIST
846 return vfwscanf(&f, format, arg);
848 diff -urN uClibc-0.9.27/libc/stdio/vasprintf.c uClibc-0.9.27-uc0/libc/stdio/vasprintf.c
849 --- uClibc-0.9.27/libc/stdio/vasprintf.c 2005-01-12 08:59:21.000000000 +0100
850 +++ uClibc-0.9.27-uc0/libc/stdio/vasprintf.c 2005-07-08 03:32:57.000000000 +0200
852 #warning Skipping vasprintf since no vsnprintf!
855 +/**********************************************************************/
856 +/* Deal with pre-C99 compilers. */
861 +#define va_copy(A,B) __va_copy(A,B)
863 + /* TODO -- maybe create a bits/vacopy.h for arch specific versions
864 + * to ensure we get the right behavior? Either that or fall back
865 + * on the portable (but costly in size) method of using a va_list *.
866 + * That means a pointer derefs in the va_arg() invocations... */
867 +#warning Neither va_copy (C99/SUSv3) or __va_copy is defined. Using a simple copy instead. But you should really check that this is appropriate...
868 + /* the glibc manual suggests that this will usually suffice when
869 + __va_copy doesn't exist. */
870 +#define va_copy(A,B) A = B
873 +#endif /* va_copy */
874 +/**********************************************************************/
876 int vasprintf(char **__restrict buf, const char * __restrict format,
879 diff -urN uClibc-0.9.27/libc/stdio/vdprintf.c uClibc-0.9.27-uc0/libc/stdio/vdprintf.c
880 --- uClibc-0.9.27/libc/stdio/vdprintf.c 2005-01-12 08:59:21.000000000 +0100
881 +++ uClibc-0.9.27-uc0/libc/stdio/vdprintf.c 2005-07-08 06:39:35.000000000 +0200
883 f.__user_locking = 1; /* Set user locking. */
884 __stdio_init_mutex(&f.__lock);
886 +#ifdef __STDIO_HAS_OPENLIST
890 rv = vfprintf(&f, format, arg);
892 diff -urN uClibc-0.9.27/libc/stdio/vsnprintf.c uClibc-0.9.27-uc0/libc/stdio/vsnprintf.c
893 --- uClibc-0.9.27/libc/stdio/vsnprintf.c 2005-01-12 08:59:21.000000000 +0100
894 +++ uClibc-0.9.27-uc0/libc/stdio/vsnprintf.c 2005-07-08 06:39:35.000000000 +0200
896 f.__user_locking = 1; /* Set user locking. */
897 __stdio_init_mutex(&f.__lock);
899 +#ifdef __STDIO_HAS_OPENLIST
903 if (size > SIZE_MAX - (size_t) buf) {
904 size = SIZE_MAX - (size_t) buf;
906 f.f.__user_locking = 1; /* Set user locking. */
907 __stdio_init_mutex(&f.f.__lock);
909 +#ifdef __STDIO_HAS_OPENLIST
910 f.f.__nextopen = NULL;
913 rv = vfprintf((FILE *) &f, format, arg);
916 f.__user_locking = 1; /* Set user locking. */
917 __stdio_init_mutex(&f.__lock);
919 +#ifdef __STDIO_HAS_OPENLIST
923 rv = vfprintf(&f, format, arg);
925 diff -urN uClibc-0.9.27/libc/stdlib/atexit.c uClibc-0.9.27-uc0/libc/stdlib/atexit.c
926 --- uClibc-0.9.27/libc/stdlib/atexit.c 2005-01-12 08:59:21.000000000 +0100
927 +++ uClibc-0.9.27-uc0/libc/stdlib/atexit.c 2006-05-25 16:01:12.000000000 +0200
929 * August 2002 Erik Andersen
930 * Added locking so atexit and friends can be thread safe
932 + * August 2005 Stephen Warren
933 + * Added __cxa_atexit and __cxa_finalize support
945 #ifdef __UCLIBC_HAS_THREADS__
949 typedef void (*aefuncp) (void); /* atexit function pointer */
950 typedef void (*oefuncp) (int, void *); /* on_exit function pointer */
951 +typedef void (*cxaefuncp) (void *); /* __cxa_atexit function pointer */
959 } ef_type; /* exit function types */
961 /* this is in the L_exit object */
963 extern int __exit_count;
964 extern void __exit_handler(int);
965 struct exit_function {
966 - ef_type type; /* ef_atexit or ef_on_exit */
968 + * 'type' should be of type of the 'enum ef_type' above but since we
969 + * need this element in an atomic operation we have to use 'long int'.
971 + long int type; /* enum ef_type */
989 #ifdef __UCLIBC_DYNAMIC_ATEXIT__
992 extern struct exit_function __exit_function_table[__UCLIBC_MAX_ATEXIT];
994 +extern struct exit_function *__new_exitfn (void);
998 +/* this is in the L___cxa_atexit object */
999 +extern int __cxa_atexit (cxaefuncp, void *arg, void *dso_handle);
1002 +/* remove old_atexit after 0.9.29 */
1003 +#if defined(L_atexit) || defined(L_old_atexit)
1004 +extern void *__dso_handle __attribute__ ((__weak__));
1007 * register a function to be called at normal program termination
1008 * (the registered function takes no arguments)
1010 -int atexit(aefuncp func)
1013 +int attribute_hidden atexit(aefuncp func)
1015 +int old_atexit(aefuncp func)
1018 - struct exit_function *efp;
1022 -#ifdef __UCLIBC_DYNAMIC_ATEXIT__
1023 - /* If we are out of function table slots, make some more */
1024 - if (__exit_slots < __exit_count+1) {
1025 - efp=realloc(__exit_function_table,
1026 - (__exit_slots+20)*sizeof(struct exit_function));
1029 - __set_errno(ENOMEM);
1032 - __exit_function_table = efp;
1036 + * glibc casts aefuncp to cxaefuncp.
1037 + * This seems dodgy, but I guess callling a function with more
1038 + * parameters than it needs will work everywhere?
1040 +#ifdef ARCH_HAS_MMU
1041 + return __cxa_atexit((cxaefuncp)func, NULL,
1042 + &__dso_handle == NULL ? NULL : __dso_handle);
1044 - if (__exit_count >= __UCLIBC_MAX_ATEXIT) {
1046 - __set_errno(ENOMEM);
1049 + return __cxa_atexit((cxaefuncp)func, NULL, NULL);
1051 - __exit_cleanup = __exit_handler; /* enable cleanup */
1052 - efp = &__exit_function_table[__exit_count++];
1053 - efp->type = ef_atexit;
1054 - efp->funcs.atexit = func;
1060 +weak_alias(old_atexit,atexit);
1065 @@ -133,41 +142,92 @@
1066 int on_exit(oefuncp func, void *arg)
1068 struct exit_function *efp;
1070 + if (func == NULL) {
1076 -#ifdef __UCLIBC_DYNAMIC_ATEXIT__
1077 - /* If we are out of function table slots, make some more */
1078 - if (__exit_slots < __exit_count+1) {
1079 - efp=realloc(__exit_function_table,
1080 - (__exit_slots+20)*sizeof(struct exit_function));
1083 - __set_errno(ENOMEM);
1086 - __exit_function_table=efp;
1090 - if (__exit_count >= __UCLIBC_MAX_ATEXIT) {
1092 - __set_errno(ENOMEM);
1095 + efp = __new_exitfn();
1096 + if (efp == NULL) {
1100 + efp->funcs.on_exit.func = func;
1101 + efp->funcs.on_exit.arg = arg;
1102 + /* assign last for thread safety, since we're now unlocked */
1103 + efp->type = ef_on_exit;
1109 - __exit_cleanup = __exit_handler; /* enable cleanup */
1110 - efp = &__exit_function_table[__exit_count++];
1111 - efp->type = ef_on_exit;
1112 - efp->funcs.on_exit.func = func;
1113 - efp->funcs.on_exit.arg = arg;
1114 +#ifdef L___cxa_atexit
1115 +extern int __cxa_atexit (cxaefuncp func, void *arg, void *dso_handle)
1117 + struct exit_function *efp;
1119 + if (func == NULL) {
1124 + efp = __new_exitfn();
1125 + if (efp == NULL) {
1129 + efp->funcs.cxa_atexit.func = func;
1130 + efp->funcs.cxa_atexit.arg = arg;
1131 + efp->funcs.cxa_atexit.dso_handle = dso_handle;
1132 + /* assign last for thread safety, since we're now unlocked */
1133 + efp->type = ef_cxa_atexit;
1139 +#ifdef L___cxa_finalize
1141 + * If D is non-NULL, call all functions registered with `__cxa_atexit'
1142 + * with the same dso handle. Otherwise, if D is NULL, call all of the
1143 + * registered handlers.
1145 +void __cxa_finalize (void *dso_handle)
1147 + struct exit_function *efp;
1148 + int exit_count_snapshot = __exit_count;
1150 + /* In reverse order */
1151 + while (exit_count_snapshot) {
1152 + efp = &__exit_function_table[--exit_count_snapshot];
1155 + * We check dso_handle match before we verify the type of the union entry.
1156 + * However, the atomic_exchange will validate that we were really "allowed"
1157 + * to read dso_handle...
1159 + if ((dso_handle == NULL || dso_handle == efp->funcs.cxa_atexit.dso_handle)
1160 + /* We don't want to run this cleanup more than once. */
1161 + && !atomic_compare_and_exchange_bool_acq(&efp->type, ef_free, ef_cxa_atexit)
1163 + /* glibc passes status (0) too, but that's not in the prototype */
1164 + (*efp->funcs.cxa_atexit.func)(efp->funcs.cxa_atexit.arg);
1168 +#if 0 /* haven't looked into this yet... */
1170 + * Remove the registered fork handlers. We do not have to
1171 + * unregister anything if the program is going to terminate anyway.
1173 +#ifdef UNREGISTER_ATFORK
1175 + UNREGISTER_ATFORK (d);
1182 #ifdef L___exit_handler
1183 int __exit_count = 0; /* Number of registered exit functions */
1184 #ifdef __UCLIBC_DYNAMIC_ATEXIT__
1185 @@ -177,6 +237,45 @@
1186 struct exit_function __exit_function_table[__UCLIBC_MAX_ATEXIT];
1190 + * Find and return a new exit_function pointer, for atexit,
1191 + * onexit and __cxa_atexit to initialize
1193 +struct exit_function *__new_exitfn(void)
1195 + struct exit_function *efp;
1199 +#ifdef __UCLIBC_DYNAMIC_ATEXIT__
1200 + /* If we are out of function table slots, make some more */
1201 + if (__exit_slots < __exit_count+1) {
1202 + efp=realloc(__exit_function_table,
1203 + (__exit_slots+20)*sizeof(struct exit_function));
1204 + if (efp == NULL) {
1206 + __set_errno(ENOMEM);
1209 + __exit_function_table = efp;
1210 + __exit_slots += 20;
1213 + if (__exit_count >= __UCLIBC_MAX_ATEXIT) {
1215 + __set_errno(ENOMEM);
1220 + __exit_cleanup = __exit_handler; /* enable cleanup */
1221 + efp = &__exit_function_table[__exit_count++];
1222 + efp->type = ef_in_use;
1230 * Handle the work of executing the registered exit functions
1231 @@ -196,11 +295,12 @@
1232 (efp->funcs.on_exit.func) (status, efp->funcs.on_exit.arg);
1236 - if (efp->funcs.atexit) {
1237 - (efp->funcs.atexit) ();
1240 + case ef_cxa_atexit:
1241 + if (efp->funcs.cxa_atexit.func) {
1242 + /* glibc passes status too, but that's not in the prototype */
1243 + (efp->funcs.cxa_atexit.func) (efp->funcs.cxa_atexit.arg);
1248 #ifdef __UCLIBC_DYNAMIC_ATEXIT__
1253 +weak_decl(_stdio_term)
1254 extern void weak_function _stdio_term(void);
1255 void (*__exit_cleanup) (int) = 0;
1256 #ifdef __UCLIBC_HAS_THREADS__
1257 diff -urN uClibc-0.9.27/libc/stdlib/bsd_getpt.c uClibc-0.9.27-uc0/libc/stdlib/bsd_getpt.c
1258 --- uClibc-0.9.27/libc/stdlib/bsd_getpt.c 2005-01-12 08:59:21.000000000 +0100
1259 +++ uClibc-0.9.27-uc0/libc/stdlib/bsd_getpt.c 2004-06-21 01:49:19.000000000 +0200
1262 /* Letters indicating the position within a series. */
1264 -#define PTYNAME2 "0123456789abcdefghijklmnopqrstuv";
1265 +#define PTYNAME2 "0123456789abcdefghijklmnopqrstuv"
1267 const char _ptyname2[] = PTYNAME2;
1269 diff -urN uClibc-0.9.27/libc/stdlib/getpt.c uClibc-0.9.27-uc0/libc/stdlib/getpt.c
1270 --- uClibc-0.9.27/libc/stdlib/getpt.c 2005-01-12 08:59:21.000000000 +0100
1271 +++ uClibc-0.9.27-uc0/libc/stdlib/getpt.c 2004-06-21 01:49:19.000000000 +0200
1274 #if !defined __UNIX98PTY_ONLY__
1275 have_no_dev_ptmx = 1;
1284 #if !defined __UNIX98PTY_ONLY__
1285 -# define PTYNAME1 "pqrstuvwxyzabcde";
1286 -# define PTYNAME2 "0123456789abcdef";
1287 +# define PTYNAME1 "pqrstuvwxyzabcde"
1288 +# define PTYNAME2 "0123456789abcdef"
1290 # define __getpt __bsd_getpt
1291 # include "bsd_getpt.c"
1292 diff -urN uClibc-0.9.27/libc/stdlib/Makefile uClibc-0.9.27-uc0/libc/stdlib/Makefile
1293 --- uClibc-0.9.27/libc/stdlib/Makefile 2005-01-12 08:59:21.000000000 +0100
1294 +++ uClibc-0.9.27-uc0/libc/stdlib/Makefile 2006-02-27 08:31:09.000000000 +0100
1296 # wcstod wcstof wcstold
1299 -MOBJ2 = atexit.o on_exit.o __exit_handler.o exit.o
1300 +MOBJ2 = on_exit.o __cxa_atexit.o __cxa_finalize.o __exit_handler.o exit.o
1301 +ifeq ($(COMPAT_ATEXIT),y)
1302 +MOBJ2 += old_atexit.o
1305 CSRC = abort.c getenv.c mkdtemp.c mktemp.c realpath.c mkstemp.c mkstemp64.c \
1306 rand.c random.c random_r.c setenv.c system.c div.c ldiv.c lldiv.c \
1308 $(CC) $(CFLAGS) -DL_$* -D__UCLIBC_DO_XLOCALE $< -c -o $*.o
1309 $(STRIPTOOL) -x -R .note -R .comment $*.o
1312 +$(MOBJ2) atexit.o: $(MSRC2)
1313 $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
1314 $(STRIPTOOL) -x -R .note -R .comment $*.o
1316 diff -urN uClibc-0.9.27/libc/stdlib/malloc-simple/alloc.c uClibc-0.9.27-uc0/libc/stdlib/malloc-simple/alloc.c
1317 --- uClibc-0.9.27/libc/stdlib/malloc-simple/alloc.c 2005-01-12 08:59:21.000000000 +0100
1318 +++ uClibc-0.9.27-uc0/libc/stdlib/malloc-simple/alloc.c 2005-07-08 03:33:45.000000000 +0200
1323 +weak_decl(__libc_free_aligned)
1324 extern int weak_function __libc_free_aligned(void *ptr);
1325 void free(void *ptr)
1329 #ifdef __UCLIBC_HAS_THREADS__
1330 #include <pthread.h>
1331 -pthread_mutex_t __malloc_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
1332 +static pthread_mutex_t __malloc_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
1333 # define LOCK __pthread_mutex_lock(&__malloc_lock)
1334 # define UNLOCK __pthread_mutex_unlock(&__malloc_lock);
1336 diff -urN uClibc-0.9.27/libc/stdlib/malloc-standard/free.c uClibc-0.9.27-uc0/libc/stdlib/malloc-standard/free.c
1337 --- uClibc-0.9.27/libc/stdlib/malloc-standard/free.c 2005-01-12 08:59:21.000000000 +0100
1338 +++ uClibc-0.9.27-uc0/libc/stdlib/malloc-standard/free.c 2006-02-27 08:31:09.000000000 +0100
1343 +static int __malloc_trim(size_t pad, mstate av);
1345 /* ------------------------- malloc_trim -------------------------
1346 malloc_trim(size_t pad);
1347 diff -urN uClibc-0.9.27/libc/stdlib/stdlib.c uClibc-0.9.27-uc0/libc/stdlib/stdlib.c
1348 --- uClibc-0.9.27/libc/stdlib/stdlib.c 2005-01-12 08:59:21.000000000 +0100
1349 +++ uClibc-0.9.27-uc0/libc/stdlib/stdlib.c 2005-01-26 07:37:23.000000000 +0100
1354 -#include <inttypes.h>
1359 #define abs __ignore_abs
1361 #if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX)
1362 +#define strtoimax __ignore_strtoimax
1363 +#define strtoumax __ignore_strtoumax
1364 #define llabs __ignore_llabs
1365 +#define imaxabs __ignore_imaxabs
1366 #define atoll __ignore_atoll
1367 #define strtoll __ignore_strtoll
1368 #define strtoull __ignore_strtoull
1370 #define wcstoull_l __ignore_wcstoull_l
1373 +#include <inttypes.h>
1379 #if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX)
1389 #if defined(L__stdlib_strto_ll) || defined(L__stdlib_strto_ll_l)
1391 -#if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX)
1392 +#if defined(ULLONG_MAX) // && (LLONG_MAX > LONG_MAX)
1394 #if defined(L__stdlib_wcsto_ll) || defined(L__stdlib_wcsto_ll_l)
1395 #define _stdlib_strto_ll _stdlib_wcsto_ll
1396 diff -urN uClibc-0.9.27/libc/sysdeps/linux/alpha/bits/atomic.h uClibc-0.9.27-uc0/libc/sysdeps/linux/alpha/bits/atomic.h
1397 --- uClibc-0.9.27/libc/sysdeps/linux/alpha/bits/atomic.h 1970-01-01 01:00:00.000000000 +0100
1398 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/alpha/bits/atomic.h 2006-01-16 07:46:31.000000000 +0100
1400 +/* Copyright (C) 2003 Free Software Foundation, Inc.
1401 + This file is part of the GNU C Library.
1403 + The GNU C Library is free software; you can redistribute it and/or
1404 + modify it under the terms of the GNU Lesser General Public
1405 + License as published by the Free Software Foundation; either
1406 + version 2.1 of the License, or (at your option) any later version.
1408 + The GNU C Library is distributed in the hope that it will be useful,
1409 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1410 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1411 + Lesser General Public License for more details.
1413 + You should have received a copy of the GNU Lesser General Public
1414 + License along with the GNU C Library; if not, write to the Free
1415 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1416 + 02111-1307 USA. */
1418 +#include <stdint.h>
1420 +typedef int8_t atomic8_t;
1421 +typedef uint8_t uatomic8_t;
1422 +typedef int_fast8_t atomic_fast8_t;
1423 +typedef uint_fast8_t uatomic_fast8_t;
1425 +typedef int16_t atomic16_t;
1426 +typedef uint16_t uatomic16_t;
1427 +typedef int_fast16_t atomic_fast16_t;
1428 +typedef uint_fast16_t uatomic_fast16_t;
1430 +typedef int32_t atomic32_t;
1431 +typedef uint32_t uatomic32_t;
1432 +typedef int_fast32_t atomic_fast32_t;
1433 +typedef uint_fast32_t uatomic_fast32_t;
1435 +typedef int64_t atomic64_t;
1436 +typedef uint64_t uatomic64_t;
1437 +typedef int_fast64_t atomic_fast64_t;
1438 +typedef uint_fast64_t uatomic_fast64_t;
1440 +typedef intptr_t atomicptr_t;
1441 +typedef uintptr_t uatomicptr_t;
1442 +typedef intmax_t atomic_max_t;
1443 +typedef uintmax_t uatomic_max_t;
1447 +# define __MB /* nothing */
1449 +# define __MB " mb\n"
1453 +/* Compare and exchange. For all of the "xxx" routines, we expect a
1454 + "__prev" and a "__cmp" variable to be provided by the enclosing scope,
1455 + in which values are returned. */
1457 +#define __arch_compare_and_exchange_xxx_8_int(mem, new, old, mb1, mb2) \
1459 + unsigned long __tmp, __snew, __addr64; \
1460 + __asm__ __volatile__ ( \
1462 + " andnot %[__addr8],7,%[__addr64]\n" \
1463 + " insbl %[__new],%[__addr8],%[__snew]\n" \
1464 + "1: ldq_l %[__tmp],0(%[__addr64])\n" \
1465 + " extbl %[__tmp],%[__addr8],%[__prev]\n" \
1466 + " cmpeq %[__prev],%[__old],%[__cmp]\n" \
1467 + " beq %[__cmp],2f\n" \
1468 + " mskbl %[__tmp],%[__addr8],%[__tmp]\n" \
1469 + " or %[__snew],%[__tmp],%[__tmp]\n" \
1470 + " stq_c %[__tmp],0(%[__addr64])\n" \
1471 + " beq %[__tmp],1b\n" \
1474 + : [__prev] "=&r" (__prev), \
1475 + [__snew] "=&r" (__snew), \
1476 + [__tmp] "=&r" (__tmp), \
1477 + [__cmp] "=&r" (__cmp), \
1478 + [__addr64] "=&r" (__addr64) \
1479 + : [__addr8] "r" (mem), \
1480 + [__old] "Ir" ((uint64_t)(uint8_t)(uint64_t)(old)), \
1481 + [__new] "r" (new) \
1485 +#define __arch_compare_and_exchange_xxx_16_int(mem, new, old, mb1, mb2) \
1487 + unsigned long __tmp, __snew, __addr64; \
1488 + __asm__ __volatile__ ( \
1490 + " andnot %[__addr16],7,%[__addr64]\n" \
1491 + " inswl %[__new],%[__addr16],%[__snew]\n" \
1492 + "1: ldq_l %[__tmp],0(%[__addr64])\n" \
1493 + " extwl %[__tmp],%[__addr16],%[__prev]\n" \
1494 + " cmpeq %[__prev],%[__old],%[__cmp]\n" \
1495 + " beq %[__cmp],2f\n" \
1496 + " mskwl %[__tmp],%[__addr16],%[__tmp]\n" \
1497 + " or %[__snew],%[__tmp],%[__tmp]\n" \
1498 + " stq_c %[__tmp],0(%[__addr64])\n" \
1499 + " beq %[__tmp],1b\n" \
1502 + : [__prev] "=&r" (__prev), \
1503 + [__snew] "=&r" (__snew), \
1504 + [__tmp] "=&r" (__tmp), \
1505 + [__cmp] "=&r" (__cmp), \
1506 + [__addr64] "=&r" (__addr64) \
1507 + : [__addr16] "r" (mem), \
1508 + [__old] "Ir" ((uint64_t)(uint16_t)(uint64_t)(old)), \
1509 + [__new] "r" (new) \
1513 +#define __arch_compare_and_exchange_xxx_32_int(mem, new, old, mb1, mb2) \
1515 + __asm__ __volatile__ ( \
1517 + "1: ldl_l %[__prev],%[__mem]\n" \
1518 + " cmpeq %[__prev],%[__old],%[__cmp]\n" \
1519 + " beq %[__cmp],2f\n" \
1520 + " mov %[__new],%[__cmp]\n" \
1521 + " stl_c %[__cmp],%[__mem]\n" \
1522 + " beq %[__cmp],1b\n" \
1525 + : [__prev] "=&r" (__prev), \
1526 + [__cmp] "=&r" (__cmp) \
1527 + : [__mem] "m" (*(mem)), \
1528 + [__old] "Ir" ((uint64_t)(atomic32_t)(uint64_t)(old)), \
1529 + [__new] "Ir" (new) \
1533 +#define __arch_compare_and_exchange_xxx_64_int(mem, new, old, mb1, mb2) \
1535 + __asm__ __volatile__ ( \
1537 + "1: ldq_l %[__prev],%[__mem]\n" \
1538 + " cmpeq %[__prev],%[__old],%[__cmp]\n" \
1539 + " beq %[__cmp],2f\n" \
1540 + " mov %[__new],%[__cmp]\n" \
1541 + " stq_c %[__cmp],%[__mem]\n" \
1542 + " beq %[__cmp],1b\n" \
1545 + : [__prev] "=&r" (__prev), \
1546 + [__cmp] "=&r" (__cmp) \
1547 + : [__mem] "m" (*(mem)), \
1548 + [__old] "Ir" ((uint64_t)(old)), \
1549 + [__new] "Ir" (new) \
1553 +/* For all "bool" routines, we return FALSE if exchange succesful. */
1555 +#define __arch_compare_and_exchange_bool_8_int(mem, new, old, mb1, mb2) \
1556 +({ unsigned long __prev; int __cmp; \
1557 + __arch_compare_and_exchange_xxx_8_int(mem, new, old, mb1, mb2); \
1560 +#define __arch_compare_and_exchange_bool_16_int(mem, new, old, mb1, mb2) \
1561 +({ unsigned long __prev; int __cmp; \
1562 + __arch_compare_and_exchange_xxx_16_int(mem, new, old, mb1, mb2); \
1565 +#define __arch_compare_and_exchange_bool_32_int(mem, new, old, mb1, mb2) \
1566 +({ unsigned long __prev; int __cmp; \
1567 + __arch_compare_and_exchange_xxx_32_int(mem, new, old, mb1, mb2); \
1570 +#define __arch_compare_and_exchange_bool_64_int(mem, new, old, mb1, mb2) \
1571 +({ unsigned long __prev; int __cmp; \
1572 + __arch_compare_and_exchange_xxx_64_int(mem, new, old, mb1, mb2); \
1575 +/* For all "val" routines, return the old value whether exchange
1576 + successful or not. */
1578 +#define __arch_compare_and_exchange_val_8_int(mem, new, old, mb1, mb2) \
1579 +({ unsigned long __prev; int __cmp; \
1580 + __arch_compare_and_exchange_xxx_8_int(mem, new, old, mb1, mb2); \
1581 + (typeof (*mem))__prev; })
1583 +#define __arch_compare_and_exchange_val_16_int(mem, new, old, mb1, mb2) \
1584 +({ unsigned long __prev; int __cmp; \
1585 + __arch_compare_and_exchange_xxx_16_int(mem, new, old, mb1, mb2); \
1586 + (typeof (*mem))__prev; })
1588 +#define __arch_compare_and_exchange_val_32_int(mem, new, old, mb1, mb2) \
1589 +({ unsigned long __prev; int __cmp; \
1590 + __arch_compare_and_exchange_xxx_32_int(mem, new, old, mb1, mb2); \
1591 + (typeof (*mem))__prev; })
1593 +#define __arch_compare_and_exchange_val_64_int(mem, new, old, mb1, mb2) \
1594 +({ unsigned long __prev; int __cmp; \
1595 + __arch_compare_and_exchange_xxx_64_int(mem, new, old, mb1, mb2); \
1596 + (typeof (*mem))__prev; })
1598 +/* Compare and exchange with "acquire" semantics, ie barrier after. */
1600 +#define atomic_compare_and_exchange_bool_acq(mem, new, old) \
1601 + __atomic_bool_bysize (__arch_compare_and_exchange_bool, int, \
1602 + mem, new, old, "", __MB)
1604 +#define atomic_compare_and_exchange_val_acq(mem, new, old) \
1605 + __atomic_val_bysize (__arch_compare_and_exchange_val, int, \
1606 + mem, new, old, "", __MB)
1608 +/* Compare and exchange with "release" semantics, ie barrier before. */
1610 +#define atomic_compare_and_exchange_bool_rel(mem, new, old) \
1611 + __atomic_bool_bysize (__arch_compare_and_exchange_bool, int, \
1612 + mem, new, old, __MB, "")
1614 +#define atomic_compare_and_exchange_val_rel(mem, new, old) \
1615 + __atomic_val_bysize (__arch_compare_and_exchange_val, int, \
1616 + mem, new, old, __MB, "")
1619 +/* Atomically store value and return the previous value. */
1621 +#define __arch_exchange_8_int(mem, value, mb1, mb2) \
1623 + unsigned long __ret, __tmp, __addr64, __sval; \
1624 + __asm__ __volatile__ ( \
1626 + " andnot %[__addr8],7,%[__addr64]\n" \
1627 + " insbl %[__value],%[__addr8],%[__sval]\n" \
1628 + "1: ldq_l %[__tmp],0(%[__addr64])\n" \
1629 + " extbl %[__tmp],%[__addr8],%[__ret]\n" \
1630 + " mskbl %[__tmp],%[__addr8],%[__tmp]\n" \
1631 + " or %[__sval],%[__tmp],%[__tmp]\n" \
1632 + " stq_c %[__tmp],0(%[__addr64])\n" \
1633 + " beq %[__tmp],1b\n" \
1635 + : [__ret] "=&r" (__ret), \
1636 + [__sval] "=&r" (__sval), \
1637 + [__tmp] "=&r" (__tmp), \
1638 + [__addr64] "=&r" (__addr64) \
1639 + : [__addr8] "r" (mem), \
1640 + [__value] "r" (value) \
1644 +#define __arch_exchange_16_int(mem, value, mb1, mb2) \
1646 + unsigned long __ret, __tmp, __addr64, __sval; \
1647 + __asm__ __volatile__ ( \
1649 + " andnot %[__addr16],7,%[__addr64]\n" \
1650 + " inswl %[__value],%[__addr16],%[__sval]\n" \
1651 + "1: ldq_l %[__tmp],0(%[__addr64])\n" \
1652 + " extwl %[__tmp],%[__addr16],%[__ret]\n" \
1653 + " mskwl %[__tmp],%[__addr16],%[__tmp]\n" \
1654 + " or %[__sval],%[__tmp],%[__tmp]\n" \
1655 + " stq_c %[__tmp],0(%[__addr64])\n" \
1656 + " beq %[__tmp],1b\n" \
1658 + : [__ret] "=&r" (__ret), \
1659 + [__sval] "=&r" (__sval), \
1660 + [__tmp] "=&r" (__tmp), \
1661 + [__addr64] "=&r" (__addr64) \
1662 + : [__addr16] "r" (mem), \
1663 + [__value] "r" (value) \
1667 +#define __arch_exchange_32_int(mem, value, mb1, mb2) \
1669 + signed int __ret, __tmp; \
1670 + __asm__ __volatile__ ( \
1672 + "1: ldl_l %[__ret],%[__mem]\n" \
1673 + " mov %[__val],%[__tmp]\n" \
1674 + " stl_c %[__tmp],%[__mem]\n" \
1675 + " beq %[__tmp],1b\n" \
1677 + : [__ret] "=&r" (__ret), \
1678 + [__tmp] "=&r" (__tmp) \
1679 + : [__mem] "m" (*(mem)), \
1680 + [__val] "Ir" (value) \
1684 +#define __arch_exchange_64_int(mem, value, mb1, mb2) \
1686 + unsigned long __ret, __tmp; \
1687 + __asm__ __volatile__ ( \
1689 + "1: ldq_l %[__ret],%[__mem]\n" \
1690 + " mov %[__val],%[__tmp]\n" \
1691 + " stq_c %[__tmp],%[__mem]\n" \
1692 + " beq %[__tmp],1b\n" \
1694 + : [__ret] "=&r" (__ret), \
1695 + [__tmp] "=&r" (__tmp) \
1696 + : [__mem] "m" (*(mem)), \
1697 + [__val] "Ir" (value) \
1701 +#define atomic_exchange_acq(mem, value) \
1702 + __atomic_val_bysize (__arch_exchange, int, mem, value, "", __MB)
1704 +#define atomic_exchange_rel(mem, value) \
1705 + __atomic_val_bysize (__arch_exchange, int, mem, value, __MB, "")
1708 +/* Atomically add value and return the previous (unincremented) value. */
1710 +#define __arch_exchange_and_add_8_int(mem, value, mb1, mb2) \
1711 + ({ __builtin_trap (); 0; })
1713 +#define __arch_exchange_and_add_16_int(mem, value, mb1, mb2) \
1714 + ({ __builtin_trap (); 0; })
1716 +#define __arch_exchange_and_add_32_int(mem, value, mb1, mb2) \
1718 + signed int __ret, __tmp; \
1719 + __asm__ __volatile__ ( \
1721 + "1: ldl_l %[__ret],%[__mem]\n" \
1722 + " addl %[__ret],%[__val],%[__tmp]\n" \
1723 + " stl_c %[__tmp],%[__mem]\n" \
1724 + " beq %[__tmp],1b\n" \
1726 + : [__ret] "=&r" (__ret), \
1727 + [__tmp] "=&r" (__tmp) \
1728 + : [__mem] "m" (*(mem)), \
1729 + [__val] "Ir" ((signed int)(value)) \
1733 +#define __arch_exchange_and_add_64_int(mem, value, mb1, mb2) \
1735 + unsigned long __ret, __tmp; \
1736 + __asm__ __volatile__ ( \
1738 + "1: ldq_l %[__ret],%[__mem]\n" \
1739 + " addq %[__ret],%[__val],%[__tmp]\n" \
1740 + " stq_c %[__tmp],%[__mem]\n" \
1741 + " beq %[__tmp],1b\n" \
1743 + : [__ret] "=&r" (__ret), \
1744 + [__tmp] "=&r" (__tmp) \
1745 + : [__mem] "m" (*(mem)), \
1746 + [__val] "Ir" ((unsigned long)(value)) \
1750 +/* ??? Barrier semantics for atomic_exchange_and_add appear to be
1751 + undefined. Use full barrier for now, as that's safe. */
1752 +#define atomic_exchange_and_add(mem, value) \
1753 + __atomic_val_bysize (__arch_exchange_and_add, int, mem, value, __MB, __MB)
1756 +/* ??? Blah, I'm lazy. Implement these later. Can do better than the
1757 + compare-and-exchange loop provided by generic code.
1759 +#define atomic_decrement_if_positive(mem)
1760 +#define atomic_bit_test_set(mem, bit)
1765 +# define atomic_full_barrier() __asm ("mb" : : : "memory");
1766 +# define atomic_read_barrier() __asm ("mb" : : : "memory");
1767 +# define atomic_write_barrier() __asm ("wmb" : : : "memory");
1769 diff -urN uClibc-0.9.27/libc/sysdeps/linux/arm/crt0.S uClibc-0.9.27-uc0/libc/sysdeps/linux/arm/crt0.S
1770 --- uClibc-0.9.27/libc/sysdeps/linux/arm/crt0.S 2005-01-12 08:59:21.000000000 +0100
1771 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/arm/crt0.S 2005-07-08 00:57:15.000000000 +0200
1774 /* Store the address of _init in r3 as an argument to main() */
1782 /* Push _fini onto the stack as the final argument to main() */
1783 - ldr r4, .L_init + 4
1788 /* Store the address of _init in r3 as an argument to main() */
1791 #if (defined L_crt1 ) && defined __UCLIBC_CTOR_DTOR__ && defined __PIC__
1793 - .word _init - .L_init
1794 - .word _fini - .L_init
1800 /* We need this stuff to make gdb behave itself, otherwise
1801 diff -urN uClibc-0.9.27/libc/sysdeps/linux/arm/sys/ucontext.h uClibc-0.9.27-uc0/libc/sysdeps/linux/arm/sys/ucontext.h
1802 --- uClibc-0.9.27/libc/sysdeps/linux/arm/sys/ucontext.h 2005-01-12 08:59:21.000000000 +0100
1803 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/arm/sys/ucontext.h 2005-01-26 07:37:24.000000000 +0100
1805 unsigned long uc_flags;
1806 struct ucontext *uc_link;
1808 - struct sigcontext uc_mcontext;
1809 + mcontext_t uc_mcontext;
1810 sigset_t uc_sigmask; /* mask last for extensibility */
1813 diff -urN uClibc-0.9.27/libc/sysdeps/linux/common/bits/atomic.h uClibc-0.9.27-uc0/libc/sysdeps/linux/common/bits/atomic.h
1814 --- uClibc-0.9.27/libc/sysdeps/linux/common/bits/atomic.h 1970-01-01 01:00:00.000000000 +0100
1815 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/common/bits/atomic.h 2006-01-16 07:46:31.000000000 +0100
1817 +/* Copyright (C) 2003 Free Software Foundation, Inc.
1818 + This file is part of the GNU C Library.
1819 + Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
1821 + The GNU C Library is free software; you can redistribute it and/or
1822 + modify it under the terms of the GNU Lesser General Public
1823 + License as published by the Free Software Foundation; either
1824 + version 2.1 of the License, or (at your option) any later version.
1826 + The GNU C Library is distributed in the hope that it will be useful,
1827 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1828 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1829 + Lesser General Public License for more details.
1831 + You should have received a copy of the GNU Lesser General Public
1832 + License along with the GNU C Library; if not, write to the Free
1833 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1834 + 02111-1307 USA. */
1836 +#ifndef _BITS_ATOMIC_H
1837 +#define _BITS_ATOMIC_H 1
1839 +/* We have by default no support for atomic operations. So define
1840 + them non-atomic. If this is a problem somebody will have to come
1841 + up with real definitions. */
1843 +/* The only basic operation needed is compare and exchange. */
1844 +#define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \
1845 + ({ __typeof (mem) __gmemp = (mem); \
1846 + __typeof (*mem) __gret = *__gmemp; \
1847 + __typeof (*mem) __gnewval = (newval); \
1849 + if (__gret == (oldval)) \
1850 + *__gmemp = __gnewval; \
1853 +#define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
1854 + ({ __typeof (mem) __gmemp = (mem); \
1855 + __typeof (*mem) __gnewval = (newval); \
1857 + *__gmemp == (oldval) ? (*__gmemp = __gnewval, 0) : 1; })
1859 +#endif /* bits/atomic.h */
1860 diff -urN uClibc-0.9.27/libc/sysdeps/linux/common/bits/uClibc_stdio.h uClibc-0.9.27-uc0/libc/sysdeps/linux/common/bits/uClibc_stdio.h
1861 --- uClibc-0.9.27/libc/sysdeps/linux/common/bits/uClibc_stdio.h 2005-01-12 08:59:21.000000000 +0100
1862 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/common/bits/uClibc_stdio.h 2005-07-08 06:39:36.000000000 +0200
1867 +#define __stdin stdin
1869 #endif /* __STDIO_GETC_MACRO */
1878 +#define __stdout stdout
1880 #endif /* __STDIO_PUTC_MACRO */
1881 diff -urN uClibc-0.9.27/libc/sysdeps/linux/common/cmsg_nxthdr.c uClibc-0.9.27-uc0/libc/sysdeps/linux/common/cmsg_nxthdr.c
1882 --- uClibc-0.9.27/libc/sysdeps/linux/common/cmsg_nxthdr.c 2005-01-12 08:59:21.000000000 +0100
1883 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/common/cmsg_nxthdr.c 2005-02-28 07:06:19.000000000 +0100
1885 if ((unsigned char *) (cmsg + 1) >= ((unsigned char *) mhdr->msg_control
1886 + mhdr->msg_controllen)
1887 || ((unsigned char *) cmsg + CMSG_ALIGN (cmsg->cmsg_len)
1888 - >= ((unsigned char *) mhdr->msg_control + mhdr->msg_controllen)))
1889 + > ((unsigned char *) mhdr->msg_control + mhdr->msg_controllen)))
1890 /* No more entries. */
1893 diff -urN uClibc-0.9.27/libc/sysdeps/linux/common/create_module.c uClibc-0.9.27-uc0/libc/sysdeps/linux/common/create_module.c
1894 --- uClibc-0.9.27/libc/sysdeps/linux/common/create_module.c 2005-01-12 08:59:21.000000000 +0100
1895 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/common/create_module.c 2005-01-26 12:53:45.000000000 +0100
1897 #ifdef __NR_create_module
1899 #if defined(__i386__) || defined(__m68k__) || defined(__arm__) || defined(__cris__) || defined(__i960__)
1900 +#ifdef __NR_create_module
1901 #define __NR___create_module __NR_create_module
1902 #ifdef __STR_NR_create_module
1903 #define __STR_NR___create_module __STR_NR_create_module
1909 +unsigned long create_module(const char *name, size_t size)
1911 + __set_errno(ENOSYS);
1915 #elif defined(__alpha__)
1916 #define __NR___create_module __NR_create_module
1917 /* Alpha doesn't have the same problem, exactly, but a bug in older
1918 diff -urN uClibc-0.9.27/libc/sysdeps/linux/common/pread_write.c uClibc-0.9.27-uc0/libc/sysdeps/linux/common/pread_write.c
1919 --- uClibc-0.9.27/libc/sysdeps/linux/common/pread_write.c 2005-01-12 08:59:21.000000000 +0100
1920 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/common/pread_write.c 2003-10-08 07:46:43.000000000 +0200
1923 ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
1925 - return(__syscall_pread(fd,buf,count,__LONG_LONG_PAIR (offset >> 31, offset)));
1926 + return(__syscall_pread(fd,buf,count,__LONG_LONG_PAIR ((off_t)0, offset)));
1928 weak_alias (__libc_pread, pread)
1932 ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
1934 - return(__syscall_pwrite(fd,buf,count,__LONG_LONG_PAIR (offset >> 31, offset)));
1935 + return(__syscall_pwrite(fd,buf,count,__LONG_LONG_PAIR ((off_t)0, offset)));
1937 weak_alias (__libc_pwrite, pwrite)
1939 diff -urN uClibc-0.9.27/libc/sysdeps/linux/cris/crt0.c uClibc-0.9.27-uc0/libc/sysdeps/linux/cris/crt0.c
1940 --- uClibc-0.9.27/libc/sysdeps/linux/cris/crt0.c 2005-01-12 08:59:21.000000000 +0100
1941 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/cris/crt0.c 2005-07-08 03:33:45.000000000 +0200
1943 extern void __uClibc_start_main(int argc, char **argv, char **envp,
1944 void (*app_init)(void), void (*app_fini)(void))
1945 __attribute__ ((__noreturn__));
1948 extern void weak_function _init(void);
1949 extern void weak_function _fini(void);
1951 diff -urN uClibc-0.9.27/libc/sysdeps/linux/i386/bits/atomic.h uClibc-0.9.27-uc0/libc/sysdeps/linux/i386/bits/atomic.h
1952 --- uClibc-0.9.27/libc/sysdeps/linux/i386/bits/atomic.h 1970-01-01 01:00:00.000000000 +0100
1953 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/i386/bits/atomic.h 2006-01-16 07:46:31.000000000 +0100
1955 +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
1956 + This file is part of the GNU C Library.
1957 + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
1959 + The GNU C Library is free software; you can redistribute it and/or
1960 + modify it under the terms of the GNU Lesser General Public
1961 + License as published by the Free Software Foundation; either
1962 + version 2.1 of the License, or (at your option) any later version.
1964 + The GNU C Library is distributed in the hope that it will be useful,
1965 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1966 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1967 + Lesser General Public License for more details.
1969 + You should have received a copy of the GNU Lesser General Public
1970 + License along with the GNU C Library; if not, write to the Free
1971 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1972 + 02111-1307 USA. */
1974 +#include <stdint.h>
1977 +typedef int8_t atomic8_t;
1978 +typedef uint8_t uatomic8_t;
1979 +typedef int_fast8_t atomic_fast8_t;
1980 +typedef uint_fast8_t uatomic_fast8_t;
1982 +typedef int16_t atomic16_t;
1983 +typedef uint16_t uatomic16_t;
1984 +typedef int_fast16_t atomic_fast16_t;
1985 +typedef uint_fast16_t uatomic_fast16_t;
1987 +typedef int32_t atomic32_t;
1988 +typedef uint32_t uatomic32_t;
1989 +typedef int_fast32_t atomic_fast32_t;
1990 +typedef uint_fast32_t uatomic_fast32_t;
1992 +typedef int64_t atomic64_t;
1993 +typedef uint64_t uatomic64_t;
1994 +typedef int_fast64_t atomic_fast64_t;
1995 +typedef uint_fast64_t uatomic_fast64_t;
1997 +typedef intptr_t atomicptr_t;
1998 +typedef uintptr_t uatomicptr_t;
1999 +typedef intmax_t atomic_max_t;
2000 +typedef uintmax_t uatomic_max_t;
2003 +#ifndef LOCK_PREFIX
2005 +# define LOCK_PREFIX /* nothing */
2007 +# define LOCK_PREFIX "lock;"
2012 +#define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \
2013 + ({ __typeof (*mem) ret; \
2014 + __asm __volatile (LOCK_PREFIX "cmpxchgb %b2, %1" \
2015 + : "=a" (ret), "=m" (*mem) \
2016 + : "q" (newval), "m" (*mem), "0" (oldval)); \
2019 +#define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \
2020 + ({ __typeof (*mem) ret; \
2021 + __asm __volatile (LOCK_PREFIX "cmpxchgw %w2, %1" \
2022 + : "=a" (ret), "=m" (*mem) \
2023 + : "r" (newval), "m" (*mem), "0" (oldval)); \
2026 +#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \
2027 + ({ __typeof (*mem) ret; \
2028 + __asm __volatile (LOCK_PREFIX "cmpxchgl %2, %1" \
2029 + : "=a" (ret), "=m" (*mem) \
2030 + : "r" (newval), "m" (*mem), "0" (oldval)); \
2033 +/* XXX We do not really need 64-bit compare-and-exchange. At least
2034 + not in the moment. Using it would mean causing portability
2035 + problems since not many other 32-bit architectures have support for
2036 + such an operation. So don't define any code for now. If it is
2037 + really going to be used the code below can be used on Intel Pentium
2038 + and later, but NOT on i486. */
2040 +# define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
2041 + ({ __typeof (*mem) ret = *(mem); abort (); ret = (newval); ret = (oldval); })
2044 +# define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
2045 + ({ __typeof (*mem) ret; \
2046 + __asm __volatile ("xchgl %2, %%ebx\n\t" \
2047 + LOCK_PREFIX "cmpxchg8b %1\n\t" \
2048 + "xchgl %2, %%ebx" \
2049 + : "=A" (ret), "=m" (*mem) \
2050 + : "DS" (((unsigned long long int) (newval)) \
2052 + "c" (((unsigned long long int) (newval)) >> 32), \
2053 + "m" (*mem), "a" (((unsigned long long int) (oldval)) \
2055 + "d" (((unsigned long long int) (oldval)) >> 32)); \
2058 +# define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
2059 + ({ __typeof (*mem) ret; \
2060 + __asm __volatile (LOCK_PREFIX "cmpxchg8b %1" \
2061 + : "=A" (ret), "=m" (*mem) \
2062 + : "b" (((unsigned long long int) (newval)) \
2064 + "c" (((unsigned long long int) (newval)) >> 32), \
2065 + "m" (*mem), "a" (((unsigned long long int) (oldval)) \
2067 + "d" (((unsigned long long int) (oldval)) >> 32)); \
2073 +/* Note that we need no lock prefix. */
2074 +#define atomic_exchange_acq(mem, newvalue) \
2075 + ({ __typeof (*mem) result; \
2076 + if (sizeof (*mem) == 1) \
2077 + __asm __volatile ("xchgb %b0, %1" \
2078 + : "=r" (result), "=m" (*mem) \
2079 + : "0" (newvalue), "m" (*mem)); \
2080 + else if (sizeof (*mem) == 2) \
2081 + __asm __volatile ("xchgw %w0, %1" \
2082 + : "=r" (result), "=m" (*mem) \
2083 + : "0" (newvalue), "m" (*mem)); \
2084 + else if (sizeof (*mem) == 4) \
2085 + __asm __volatile ("xchgl %0, %1" \
2086 + : "=r" (result), "=m" (*mem) \
2087 + : "0" (newvalue), "m" (*mem)); \
2096 +#define atomic_exchange_and_add(mem, value) \
2097 + ({ __typeof (*mem) __result; \
2098 + __typeof (value) __addval = (value); \
2099 + if (sizeof (*mem) == 1) \
2100 + __asm __volatile (LOCK_PREFIX "xaddb %b0, %1" \
2101 + : "=r" (__result), "=m" (*mem) \
2102 + : "0" (__addval), "m" (*mem)); \
2103 + else if (sizeof (*mem) == 2) \
2104 + __asm __volatile (LOCK_PREFIX "xaddw %w0, %1" \
2105 + : "=r" (__result), "=m" (*mem) \
2106 + : "0" (__addval), "m" (*mem)); \
2107 + else if (sizeof (*mem) == 4) \
2108 + __asm __volatile (LOCK_PREFIX "xaddl %0, %1" \
2109 + : "=r" (__result), "=m" (*mem) \
2110 + : "0" (__addval), "m" (*mem)); \
2113 + __typeof (mem) __memp = (mem); \
2114 + __typeof (*mem) __tmpval; \
2115 + __result = *__memp; \
2117 + __tmpval = __result; \
2118 + while ((__result = __arch_compare_and_exchange_val_64_acq \
2119 + (__memp, __result + __addval, __result)) == __tmpval); \
2124 +#define atomic_add(mem, value) \
2125 + (void) ({ if (__builtin_constant_p (value) && (value) == 1) \
2126 + atomic_increment (mem); \
2127 + else if (__builtin_constant_p (value) && (value) == -1) \
2128 + atomic_decrement (mem); \
2129 + else if (sizeof (*mem) == 1) \
2130 + __asm __volatile (LOCK_PREFIX "addb %b1, %0" \
2132 + : "ir" (value), "m" (*mem)); \
2133 + else if (sizeof (*mem) == 2) \
2134 + __asm __volatile (LOCK_PREFIX "addw %w1, %0" \
2136 + : "ir" (value), "m" (*mem)); \
2137 + else if (sizeof (*mem) == 4) \
2138 + __asm __volatile (LOCK_PREFIX "addl %1, %0" \
2140 + : "ir" (value), "m" (*mem)); \
2143 + __typeof (value) __addval = (value); \
2144 + __typeof (mem) __memp = (mem); \
2145 + __typeof (*mem) __oldval = *__memp; \
2146 + __typeof (*mem) __tmpval; \
2148 + __tmpval = __oldval; \
2149 + while ((__oldval = __arch_compare_and_exchange_val_64_acq \
2150 + (__memp, __oldval + __addval, __oldval)) == __tmpval); \
2155 +#define atomic_add_negative(mem, value) \
2156 + ({ unsigned char __result; \
2157 + if (sizeof (*mem) == 1) \
2158 + __asm __volatile (LOCK_PREFIX "addb %b2, %0; sets %1" \
2159 + : "=m" (*mem), "=qm" (__result) \
2160 + : "iq" (value), "m" (*mem)); \
2161 + else if (sizeof (*mem) == 2) \
2162 + __asm __volatile (LOCK_PREFIX "addw %w2, %0; sets %1" \
2163 + : "=m" (*mem), "=qm" (__result) \
2164 + : "ir" (value), "m" (*mem)); \
2165 + else if (sizeof (*mem) == 4) \
2166 + __asm __volatile (LOCK_PREFIX "addl %2, %0; sets %1" \
2167 + : "=m" (*mem), "=qm" (__result) \
2168 + : "ir" (value), "m" (*mem)); \
2174 +#define atomic_add_zero(mem, value) \
2175 + ({ unsigned char __result; \
2176 + if (sizeof (*mem) == 1) \
2177 + __asm __volatile (LOCK_PREFIX "addb %b2, %0; setz %1" \
2178 + : "=m" (*mem), "=qm" (__result) \
2179 + : "ir" (value), "m" (*mem)); \
2180 + else if (sizeof (*mem) == 2) \
2181 + __asm __volatile (LOCK_PREFIX "addw %w2, %0; setz %1" \
2182 + : "=m" (*mem), "=qm" (__result) \
2183 + : "ir" (value), "m" (*mem)); \
2184 + else if (sizeof (*mem) == 4) \
2185 + __asm __volatile (LOCK_PREFIX "addl %2, %0; setz %1" \
2186 + : "=m" (*mem), "=qm" (__result) \
2187 + : "ir" (value), "m" (*mem)); \
2193 +#define atomic_increment(mem) \
2194 + (void) ({ if (sizeof (*mem) == 1) \
2195 + __asm __volatile (LOCK_PREFIX "incb %b0" \
2198 + else if (sizeof (*mem) == 2) \
2199 + __asm __volatile (LOCK_PREFIX "incw %w0" \
2202 + else if (sizeof (*mem) == 4) \
2203 + __asm __volatile (LOCK_PREFIX "incl %0" \
2208 + __typeof (mem) __memp = (mem); \
2209 + __typeof (*mem) __oldval = *__memp; \
2210 + __typeof (*mem) __tmpval; \
2212 + __tmpval = __oldval; \
2213 + while ((__oldval = __arch_compare_and_exchange_val_64_acq \
2214 + (__memp, __oldval + 1, __oldval)) == __tmpval); \
2219 +#define atomic_increment_and_test(mem) \
2220 + ({ unsigned char __result; \
2221 + if (sizeof (*mem) == 1) \
2222 + __asm __volatile (LOCK_PREFIX "incb %0; sete %b1" \
2223 + : "=m" (*mem), "=qm" (__result) \
2225 + else if (sizeof (*mem) == 2) \
2226 + __asm __volatile (LOCK_PREFIX "incw %0; sete %w1" \
2227 + : "=m" (*mem), "=qm" (__result) \
2229 + else if (sizeof (*mem) == 4) \
2230 + __asm __volatile (LOCK_PREFIX "incl %0; sete %1" \
2231 + : "=m" (*mem), "=qm" (__result) \
2238 +#define atomic_decrement(mem) \
2239 + (void) ({ if (sizeof (*mem) == 1) \
2240 + __asm __volatile (LOCK_PREFIX "decb %b0" \
2243 + else if (sizeof (*mem) == 2) \
2244 + __asm __volatile (LOCK_PREFIX "decw %w0" \
2247 + else if (sizeof (*mem) == 4) \
2248 + __asm __volatile (LOCK_PREFIX "decl %0" \
2253 + __typeof (mem) __memp = (mem); \
2254 + __typeof (*mem) __oldval = *__memp; \
2255 + __typeof (*mem) __tmpval; \
2257 + __tmpval = __oldval; \
2258 + while ((__oldval = __arch_compare_and_exchange_val_64_acq \
2259 + (__memp, __oldval - 1, __oldval)) == __tmpval); \
2264 +#define atomic_decrement_and_test(mem) \
2265 + ({ unsigned char __result; \
2266 + if (sizeof (*mem) == 1) \
2267 + __asm __volatile (LOCK_PREFIX "decb %b0; sete %1" \
2268 + : "=m" (*mem), "=qm" (__result) \
2270 + else if (sizeof (*mem) == 2) \
2271 + __asm __volatile (LOCK_PREFIX "decw %w0; sete %1" \
2272 + : "=m" (*mem), "=qm" (__result) \
2274 + else if (sizeof (*mem) == 4) \
2275 + __asm __volatile (LOCK_PREFIX "decl %0; sete %1" \
2276 + : "=m" (*mem), "=qm" (__result) \
2283 +#define atomic_bit_set(mem, bit) \
2284 + (void) ({ if (sizeof (*mem) == 1) \
2285 + __asm __volatile (LOCK_PREFIX "orb %b2, %0" \
2287 + : "m" (*mem), "ir" (1 << (bit))); \
2288 + else if (sizeof (*mem) == 2) \
2289 + __asm __volatile (LOCK_PREFIX "orw %w2, %0" \
2291 + : "m" (*mem), "ir" (1 << (bit))); \
2292 + else if (sizeof (*mem) == 4) \
2293 + __asm __volatile (LOCK_PREFIX "orl %2, %0" \
2295 + : "m" (*mem), "ir" (1 << (bit))); \
2301 +#define atomic_bit_test_set(mem, bit) \
2302 + ({ unsigned char __result; \
2303 + if (sizeof (*mem) == 1) \
2304 + __asm __volatile (LOCK_PREFIX "btsb %3, %1; setc %0" \
2305 + : "=q" (__result), "=m" (*mem) \
2306 + : "m" (*mem), "ir" (bit)); \
2307 + else if (sizeof (*mem) == 2) \
2308 + __asm __volatile (LOCK_PREFIX "btsw %3, %1; setc %0" \
2309 + : "=q" (__result), "=m" (*mem) \
2310 + : "m" (*mem), "ir" (bit)); \
2311 + else if (sizeof (*mem) == 4) \
2312 + __asm __volatile (LOCK_PREFIX "btsl %3, %1; setc %0" \
2313 + : "=q" (__result), "=m" (*mem) \
2314 + : "m" (*mem), "ir" (bit)); \
2320 +#define atomic_delay() asm ("rep; nop")
2321 diff -urN uClibc-0.9.27/libc/sysdeps/linux/m68k/Makefile uClibc-0.9.27-uc0/libc/sysdeps/linux/m68k/Makefile
2322 --- uClibc-0.9.27/libc/sysdeps/linux/m68k/Makefile 2005-01-12 08:59:21.000000000 +0100
2323 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/m68k/Makefile 2005-01-26 07:37:25.000000000 +0100
2325 SSRC= __longjmp.S bsd-_setjmp.S bsd-setjmp.S clone.S setjmp.S vfork.S
2326 SOBJS=$(patsubst %.S,%.o, $(SSRC))
2328 -CSRC=ptrace.c brk.c
2329 +CSRC=ptrace.c brk.c syscall.c
2330 COBJS=$(patsubst %.c,%.o, $(CSRC))
2332 OBJS=$(SOBJS) $(MOBJ) $(COBJS)
2333 diff -urN uClibc-0.9.27/libc/sysdeps/linux/m68k/sys/ucontext.h uClibc-0.9.27-uc0/libc/sysdeps/linux/m68k/sys/ucontext.h
2334 --- uClibc-0.9.27/libc/sysdeps/linux/m68k/sys/ucontext.h 2005-01-12 08:59:21.000000000 +0100
2335 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/m68k/sys/ucontext.h 2006-07-28 08:09:17.000000000 +0200
2337 /* Structure to describe FPU registers. */
2338 typedef struct fpregset
2340 - int f_fpregs[8][3];
2344 + int f_fpregs[8][3];
2347 /* Context to describe whole processor state. */
2349 #define MCONTEXT_VERSION 2
2351 /* Userlevel context. */
2352 -typedef struct ucontext
2354 - unsigned long int uc_flags;
2355 +typedef struct ucontext {
2356 + unsigned long uc_flags;
2357 struct ucontext *uc_link;
2358 - __sigset_t uc_sigmask;
2360 mcontext_t uc_mcontext;
2361 - long int uc_filler[174];
2362 + unsigned long uc_filler[80];
2363 + __sigset_t uc_sigmask; /* mask last for extensibility */
2366 #endif /* sys/ucontext.h */
2367 diff -urN uClibc-0.9.27/libc/sysdeps/linux/m68k/syscall.c uClibc-0.9.27-uc0/libc/sysdeps/linux/m68k/syscall.c
2368 --- uClibc-0.9.27/libc/sysdeps/linux/m68k/syscall.c 1970-01-01 01:00:00.000000000 +0100
2369 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/m68k/syscall.c 2004-10-06 10:04:19.000000000 +0200
2371 +/* syscall for m68k/uClibc
2373 + * Copyright (C) 2004 by Christian Magnusson <mag@mag.cx>
2375 + * This program is free software; you can redistribute it and/or modify it
2376 + * under the terms of the GNU Library General Public License as published by
2377 + * the Free Software Foundation; either version 2 of the License, or (at your
2378 + * option) any later version.
2380 + * This program is distributed in the hope that it will be useful, but WITHOUT
2381 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2382 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
2383 + * for more details.
2385 + * You should have received a copy of the GNU Library General Public License
2386 + * along with this program; if not, write to the Free Software Foundation,
2387 + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2390 +#include <features.h>
2392 +#include <sys/types.h>
2393 +#include <sys/syscall.h>
2395 +long syscall(long sysnum, long a, long b, long c, long d, long e, long f)
2398 + __asm__ __volatile__ ("movel %7, %%d6\n\t"\
2399 + "movel %6, %%d5\n\t"\
2400 + "movel %5, %%d4\n\t"\
2401 + "movel %4, %%d3\n\t"\
2402 + "movel %3, %%d2\n\t"\
2403 + "movel %2, %%d1\n\t"\
2404 + "movel %1, %%d0\n\t"\
2415 + : "cc", "%d0", "%d1", "%d2", "%d3",\
2416 + "%d4", "%d5", "%d6");
2419 + __syscall_return(long,__res);
2421 + if ((unsigned long)(__res) >= (unsigned long)(-125)) {
2425 + return (long)__res;
2428 diff -urN uClibc-0.9.27/libc/sysdeps/linux/microblaze/bits/setjmp.h uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/bits/setjmp.h
2429 --- uClibc-0.9.27/libc/sysdeps/linux/microblaze/bits/setjmp.h 2005-01-12 08:59:21.000000000 +0100
2430 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/bits/setjmp.h 2003-12-01 06:55:42.000000000 +0100
2435 - /* Callee-saved registers r18-r30. */
2437 + /* SDA pointers */
2441 + /* Callee-saved registers r18-r31. */
2446 -#define JB_SIZE (4 * 15)
2447 +#define JB_SIZE (4 * 18)
2449 /* Test if longjmp to JMPBUF would unwind the frame
2450 containing a local variable at ADDRESS. */
2451 diff -urN uClibc-0.9.27/libc/sysdeps/linux/microblaze/clone.c uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/clone.c
2452 --- uClibc-0.9.27/libc/sysdeps/linux/microblaze/clone.c 2005-01-12 08:59:21.000000000 +0100
2453 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/clone.c 2005-08-05 03:10:51.000000000 +0200
2456 clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg)
2458 - register unsigned long rval asm (SYSCALL_RET) = -EINVAL;
2459 + register unsigned long rval = -EINVAL;
2461 if (fn && child_stack)
2463 - register unsigned long syscall asm (SYSCALL_NUM);
2464 - register unsigned long arg0 asm (SYSCALL_ARG0);
2465 - register unsigned long arg1 asm (SYSCALL_ARG1);
2466 + register unsigned long arg0;
2467 + register unsigned long arg1;
2469 /* Clone this thread. */
2471 arg1 = (unsigned long)child_stack;
2472 - syscall = __NR_clone;
2473 - asm volatile ("bralid r17, trap;nop;"
2474 - : "=r" (rval), "=r" (syscall)
2475 - : "1" (syscall), "r" (arg0), "r" (arg1)
2476 - : SYSCALL_CLOBBERS);
2477 + asm volatile ( "addik r12, r0, %1 \n\t"
2478 + "addk r5, r0, %2 \n\t"
2479 + "addk r6, r0, %3 \n\t"
2480 + "brki r14, 0x08 \n\t"
2481 + "addk %0, r3, r0 \n\t"
2483 + : "i" (__NR_clone), "r" (arg0), "r" (arg1)
2484 + : "r3", "r5", "r6", "r12", "r14", "cc");
2487 /* In child thread, call FN and exit. */
2490 - syscall = __NR_exit;
2491 - asm volatile ("bralid r17, trap;nop;"
2492 - : "=r" (rval), "=r" (syscall)
2493 - : "1" (syscall), "r" (arg0)
2494 - : SYSCALL_CLOBBERS);
2495 + asm volatile ("addik r12, r0, %1 \n\t"
2496 + "addk r5, r0, %2 \n\t"
2497 + "brki r14, 0x08 \n\t"
2498 + "addk %0, r0, r3 \n\t"
2500 + : "i" (__NR_exit), "r" (arg0)
2501 + : "r3", "r5", "r12", "r14", "cc");
2505 diff -urN uClibc-0.9.27/libc/sysdeps/linux/microblaze/fixdfsi.c uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/fixdfsi.c
2506 --- uClibc-0.9.27/libc/sysdeps/linux/microblaze/fixdfsi.c 1970-01-01 01:00:00.000000000 +0100
2507 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/fixdfsi.c 2004-03-02 06:47:36.000000000 +0100
2510 +** libgcc support for software floating point.
2511 +** Copyright (C) 1991 by Pipeline Associates, Inc. All rights reserved.
2512 +** Permission is granted to do *anything* you want with this file,
2513 +** commercial or otherwise, provided this message remains intact. So there!
2514 +** I would appreciate receiving any updates/patches/changes that anyone
2515 +** makes, and am willing to be the repository for said changes (am I
2516 +** making a big mistake?).
2518 +Warning! Only single-precision is actually implemented. This file
2519 +won't really be much use until double-precision is supported.
2521 +However, once that is done, this file might eventually become a
2522 +replacement for libgcc1.c. It might also make possible
2523 +cross-compilation for an IEEE target machine from a non-IEEE
2524 +host such as a VAX.
2526 +If you'd like to work on completing this, please talk to rms@gnu.ai.mit.edu.
2528 +--> Double precision floating support added by James Carlson on 20 April 1998.
2532 +** Pipeline Associates, Inc.
2533 +** pipeline!phw@motown.com or
2534 +** sun!pipeline!phw or
2535 +** uunet!motown!pipeline!phw
2537 +** 05/01/91 -- V1.0 -- first release to gcc mailing lists
2538 +** 05/04/91 -- V1.1 -- added float and double prototypes and return values
2539 +** -- fixed problems with adding and subtracting zero
2540 +** -- fixed rounding in truncdfsf2
2541 +** -- fixed SWAP define and tested on 386
2545 +** The following are routines that replace the libgcc soft floating point
2546 +** routines that are called automatically when -msoft-float is selected.
2547 +** The support single and double precision IEEE format, with provisions
2548 +** for byte-swapped machines (tested on 386). Some of the double-precision
2549 +** routines work at full precision, but most of the hard ones simply punt
2550 +** and call the single precision routines, producing a loss of accuracy.
2551 +** long long support is not assumed or included.
2552 +** Overall accuracy is close to IEEE (actually 68882) for single-precision
2553 +** arithmetic. I think there may still be a 1 in 1000 chance of a bit
2554 +** being rounded the wrong way during a multiply. I'm not fussy enough to
2555 +** bother with it, but if anyone is, knock yourself out.
2557 +** Efficiency has only been addressed where it was obvious that something
2558 +** would make a big difference. Anyone who wants to do this right for
2559 +** best speed should go in and rewrite in assembler.
2561 +** I have tested this only on a 68030 workstation and 386/ix integrated
2562 +** in with -msoft-float.
2565 +#include "floatlib.h"
2567 +/* convert double to int */
2569 +__fixdfsi (double a1)
2571 + register union double_long dl1;
2577 + if (!dl1.l.upper && !dl1.l.lower)
2580 + exp = EXPD (dl1) - EXCESSD - 31;
2584 + return SIGND(dl1) ? (1<<31) : ((1ul<<31)-1);
2586 + /* shift down until exp = 0 or l = 0 */
2587 + if (exp < 0 && exp > -32 && l)
2592 + return (SIGND (dl1) ? -l : l);
2594 diff -urN uClibc-0.9.27/libc/sysdeps/linux/microblaze/floatlib.h uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/floatlib.h
2595 --- uClibc-0.9.27/libc/sysdeps/linux/microblaze/floatlib.h 1970-01-01 01:00:00.000000000 +0100
2596 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/floatlib.h 2004-03-02 06:47:36.000000000 +0100
2599 +** libgcc support for software floating point.
2600 +** Copyright (C) 1991 by Pipeline Associates, Inc. All rights reserved.
2601 +** Permission is granted to do *anything* you want with this file,
2602 +** commercial or otherwise, provided this message remains intact. So there!
2603 +** I would appreciate receiving any updates/patches/changes that anyone
2604 +** makes, and am willing to be the repository for said changes (am I
2605 +** making a big mistake?).
2607 +Warning! Only single-precision is actually implemented. This file
2608 +won't really be much use until double-precision is supported.
2610 +However, once that is done, this file might eventually become a
2611 +replacement for libgcc1.c. It might also make possible
2612 +cross-compilation for an IEEE target machine from a non-IEEE
2613 +host such as a VAX.
2615 +If you'd like to work on completing this, please talk to rms@gnu.ai.mit.edu.
2617 +--> Double precision floating support added by James Carlson on 20 April 1998.
2621 +** Pipeline Associates, Inc.
2622 +** pipeline!phw@motown.com or
2623 +** sun!pipeline!phw or
2624 +** uunet!motown!pipeline!phw
2626 +** 05/01/91 -- V1.0 -- first release to gcc mailing lists
2627 +** 05/04/91 -- V1.1 -- added float and double prototypes and return values
2628 +** -- fixed problems with adding and subtracting zero
2629 +** -- fixed rounding in truncdfsf2
2630 +** -- fixed SWAP define and tested on 386
2634 +** The following are routines that replace the libgcc soft floating point
2635 +** routines that are called automatically when -msoft-float is selected.
2636 +** The support single and double precision IEEE format, with provisions
2637 +** for byte-swapped machines (tested on 386). Some of the double-precision
2638 +** routines work at full precision, but most of the hard ones simply punt
2639 +** and call the single precision routines, producing a loss of accuracy.
2640 +** long long support is not assumed or included.
2641 +** Overall accuracy is close to IEEE (actually 68882) for single-precision
2642 +** arithmetic. I think there may still be a 1 in 1000 chance of a bit
2643 +** being rounded the wrong way during a multiply. I'm not fussy enough to
2644 +** bother with it, but if anyone is, knock yourself out.
2646 +** Efficiency has only been addressed where it was obvious that something
2647 +** would make a big difference. Anyone who wants to do this right for
2648 +** best speed should go in and rewrite in assembler.
2650 +** I have tested this only on a 68030 workstation and 386/ix integrated
2651 +** in with -msoft-float.
2654 +#ifndef __FLOAT_LIB_H__
2655 +#define __FLOAT_LIB_H__
2656 +/* the following deal with IEEE single-precision numbers */
2658 +#define SIGNBIT 0x80000000
2659 +#define HIDDEN (1 << 23)
2660 +#define SIGN(fp) ((fp) & SIGNBIT)
2661 +#define EXP(fp) (((fp) >> 23) & 0xFF)
2662 +#define MANT(fp) (((fp) & 0x7FFFFF) | HIDDEN)
2663 +#define PACK(s,e,m) ((s) | ((e) << 23) | (m))
2665 +/* the following deal with IEEE double-precision numbers */
2666 +#define EXCESSD 1022
2667 +#define HIDDEND (1 << 20)
2668 +#define EXPD(fp) (((fp.l.upper) >> 20) & 0x7FF)
2669 +#define SIGND(fp) ((fp.l.upper) & SIGNBIT)
2670 +#define MANTD(fp) (((((fp.l.upper) & 0xFFFFF) | HIDDEND) << 10) | \
2671 + (fp.l.lower >> 22))
2672 +#define HIDDEND_LL ((long long)1 << 52)
2673 +#define MANTD_LL(fp) ((fp.ll & (HIDDEND_LL-1)) | HIDDEND_LL)
2674 +#define PACKD_LL(s,e,m) (((long long)((s)+((e)<<20))<<32)|(m))
2676 +/* define SWAP for 386/960 reverse-byte-order brain-damaged CPUs */
2677 +union double_long {
2681 + unsigned long lower;
2687 + unsigned long lower;
2701 +/* Functions defined in different files */
2703 +float __addsf3 (float, float);
2704 +float __subsf3 (float, float);
2705 +long __cmpsf2 (float, float);
2706 +float __mulsf3 (float, float);
2707 +float __divsf3 (float, float);
2708 +double __floatsidf (register long);
2709 +double __floatdidf (register long long);
2710 +float __floatsisf (register long );
2711 +float __floatdisf (register long long );
2712 +float __negsf2 (float);
2713 +double __negdf2 (double);
2714 +double __extendsfdf2 (float);
2715 +float __truncdfsf2 (double);
2716 +long __cmpdf2 (double, double);
2717 +long __fixsfsi (float);
2718 +long __fixdfsi (double);
2719 +long long __fixdfdi (double);
2720 +unsigned long __fixunsdfsi (double);
2721 +unsigned long long __fixunsdfdi (double);
2722 +double __adddf3 (double, double);
2723 +double __subdf3 (double, double);
2724 +double __muldf3 (double, double);
2725 +double __divdf3 (double, double);
2726 +int __gtdf2 (double, double);
2727 +int __gedf2 (double, double);
2728 +int __ltdf2 (double, double);
2729 +int __ledf2 (double, double);
2730 +int __eqdf2 (double, double);
2731 +int __nedf2 (double, double);
2732 +int __gtsf2 (float, float);
2733 +int __gesf2 (float, float);
2734 +int __ltsf2 (float, float);
2735 +int __lesf2 (float, float);
2736 +int __eqsf2 (float, float);
2737 +int __nesf2 (float, float);
2742 diff -urN uClibc-0.9.27/libc/sysdeps/linux/microblaze/initfini.awk uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/initfini.awk
2743 --- uClibc-0.9.27/libc/sysdeps/linux/microblaze/initfini.awk 1970-01-01 01:00:00.000000000 +0100
2744 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/initfini.awk 2005-08-10 13:46:42.000000000 +0200
2747 +# Contributed by Christian MICHON <christian_michon@yahoo.fr> to
2748 +# eliminate the compile time dependancy on perl introduced by
2749 +# Erik's older initfini.pl
2756 + system("touch crt[in].S");
2757 + system("/bin/rm -f crt[in].S");
2761 + while(getline < "initfini.S")
2762 + { if(/\.endp/) {endp=1}
2763 + if(/\.end/) {end=1}
2764 + if(/\.align/) {alignval=$2}
2765 +# here comes some special stuff for the SuperH targets
2766 +# We search for all labels, which uses the _GLOBAL_OFFSET_TABLE_
2767 +# or a call_gmon_start function reference, and store
2768 +# them in the glb_label array.
2769 + if(/_init_EPILOG_BEGINS/) {glb_idx=1;glb_idx_arr[glb_idx]=0}
2770 + if(/_fini_EPILOG_BEGINS/) {glb_idx=2;glb_idx_arr[glb_idx]=0}
2771 + if(/EPILOG_ENDS/) {glb_idx=0}
2772 + if(/_GLOBAL_OFFSET_TABLE_/||/call_gmon_start/) {
2773 + glb_label[glb_idx,glb_idx_arr[glb_idx]] = last;
2774 + glb_idx_arr[glb_idx] += 1;
2775 + glb_label[glb_idx,glb_idx_arr[glb_idx]] = $0;
2776 + glb_idx_arr[glb_idx] += 1;
2780 + close("initfini.S");
2782 +# special rules for the SuperH targets (They do nothing on other targets)
2783 +/SH_GLB_BEGINS/ && glb_idx_arr[1]==0 && glb_idx_arr[2]==0 {omitcrti +=1}
2784 +/_init_SH_GLB/ {glb_idx=1}
2785 +/_fini_SH_GLB/ {glb_idx=2}
2786 +/SH_GLB_ENDS/ {omitcrti -=1}
2791 + for (i=0;i<glb_idx_arr[glb_idx];i+=1) {
2792 + print glb_label[glb_idx,i] >> "crti.S";
2798 +# special rules for H8/300 (sorry quick hack)
2801 +# rules for all targets
2802 +/HEADER_ENDS/{omitcrti=1;omitcrtn=1;getline}
2803 +/PROLOG_BEGINS/{omitcrti=0;omitcrtn=0;getline}
2804 +/i_am_not_a_leaf/{getline}
2805 +/_init:/||/_fini:/{omitcrtn=1}
2806 +/PROLOG_PAUSES/{omitcrti=1;getline}
2807 +/PROLOG_UNPAUSES/{omitcrti=0;getline}
2808 +/PROLOG_ENDS/{omitcrti=1;getline}
2809 +/EPILOG_BEGINS/{omitcrtn=0;getline}
2810 +/EPILOG_ENDS/{omitcrtn=1;getline}
2811 +/TRAILER_BEGINS/{omitcrti=0;omitcrtn=0;getline}
2812 +/GMON_STUFF_BEGINS/{omitcrtn=1;getline}
2813 +/GMON_STUFF_PAUSES/{omitcrtn=0;getline}
2814 +/GMON_STUFF_UNPAUSES/{omitcrtn=1;getline}
2815 +/GMON_STUFF_ENDS/{omitcrtn=0;getline}
2817 +/_GLOBAL_OFFSET_TABLE_/||/gmon_start/ \
2819 + if(omitcrti==0) {print >> "crti.S";}
2820 + next; # no gmon_start or GLOBAL_OFFSET_TABLE references in crtn.S
2825 + { gsub("END_INIT",".endp _init",$0)
2829 + { gsub("END_INIT",".end _init",$0)
2832 + { gsub("END_INIT","",$0)
2839 + { gsub("END_FINI",".endp _fini",$0)
2843 + { gsub("END_FINI",".end _fini",$0)
2846 + { gsub("END_FINI","",$0)
2853 + { gsub("ALIGN",sprintf(".align %s",alignval),$0)
2856 + { gsub("ALIGN","",$0)
2860 +omitcrti==0 {print >> "crti.S"}
2861 +omitcrtn==0 {print >> "crtn.S"}
2867 diff -urN uClibc-0.9.27/libc/sysdeps/linux/microblaze/initfini.c uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/initfini.c
2868 --- uClibc-0.9.27/libc/sysdeps/linux/microblaze/initfini.c 1970-01-01 01:00:00.000000000 +0100
2869 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/initfini.c 2005-08-10 13:46:42.000000000 +0200
2871 +/* Special .init and .fini section support.
2872 + Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
2873 + This file is part of the GNU C Library.
2875 + The GNU C Library is free software; you can redistribute it and/or
2876 + modify it under the terms of the GNU Lesser General Public
2877 + License as published by the Free Software Foundation; either
2878 + version 2.1 of the License, or (at your option) any later version.
2880 + In addition to the permissions in the GNU Lesser General Public
2881 + License, the Free Software Foundation gives you unlimited
2882 + permission to link the compiled version of this file with other
2883 + programs, and to distribute those programs without any restriction
2884 + coming from the use of this file. (The GNU Lesser General Public
2885 + License restrictions do apply in other respects; for example, they
2886 + cover modification of the file, and distribution when not linked
2887 + into another program.)
2889 + The GNU C Library is distributed in the hope that it will be useful,
2890 + but WITHOUT ANY WARRANTY; without even the implied warranty of
2891 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2892 + Lesser General Public License for more details.
2894 + You should have received a copy of the GNU Lesser General Public
2895 + License along with the GNU C Library; if not, write to the Free
2896 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
2897 + 02111-1307 USA. */
2899 +/* This file is compiled into assembly code which is then munged by a sed
2900 + script into two files: crti.s and crtn.s.
2902 + * crti.s puts a function prologue at the beginning of the
2903 + .init and .fini sections and defines global symbols for
2904 + those addresses, so they can be called as functions.
2906 + * crtn.s puts the corresponding function epilogues
2907 + in the .init and .fini sections. */
2909 +#include <features.h>
2912 +/* We use embedded asm for .section unconditionally, as this makes it
2913 + easier to insert the necessary directives into crtn.S. */
2914 +#define SECTION(x) asm (".section " x );
2916 +/* Declare symbols as hidden. Hidden symbols are only seen by
2917 + * the link editor and not by the dynamic loader. */
2918 +#ifdef __HAVE_DOT_HIDDEN__
2919 +# define HIDDEN(func) asm (".hidden " #func );
2921 +# define HIDDEN(func)
2924 +#if defined(__sh__) && !defined(__SH5__)
2925 + /* The macro insert this sh specific stuff:
2930 + @func_SH_GLB_LABEL
2934 +#define GLB_STUFF(func) asm ("\n/*@_SH_GLB_BEGINS*/"); \
2935 + asm ("\n\tbra\t1f\n\tnop\n\tALIGN\n/*@" #func"_SH_GLB_LABEL*/\n1:"); \
2936 + asm ("\n/*@_SH_GLB_ENDS*/");
2938 +#define GLB_STUFF(func)
2941 +/* The initial common code ends here. */
2942 +asm ("\n/*@HEADER_ENDS*/");
2944 +/* To determine whether we need .end and .align: */
2945 +//asm ("\n/*@TESTS_BEGIN*/");
2946 +extern void dummy (void (*foo) (void));
2948 +dummy (void (*foo) (void))
2953 +//asm ("\n/*@TESTS_END*/");
2955 +/* The beginning of _init: */
2956 +asm ("\n/*@_init_PROLOG_BEGINS*/");
2958 +#ifdef GMON_SUPPORT
2959 +asm ("\n/*@_init_GMON_STUFF_BEGINS*/");
2961 +call_gmon_start(void)
2963 + extern void __gmon_start__ (void) __attribute__ ((weak)); /*weak_extern (__gmon_start__);*/
2964 + void (*gmon_start) (void) = __gmon_start__;
2969 +asm ("\n/*@_init_GMON_STUFF_PAUSES*/");
2975 +extern void i_am_not_a_leaf (void);
2976 +extern void _init (void);
2979 +#ifdef GMON_SUPPORT
2980 +asm ("\n/*@_init_GMON_STUFF_UNPAUSES*/");
2981 + /* We cannot use the normal constructor mechanism in gcrt1.o because it
2982 + appears before crtbegin.o in the link, so the header elt of .ctors
2983 + would come after the elt for __gmon_start__. One approach is for
2984 + gcrt1.o to reference a symbol which would be defined by some library
2985 + module which has a constructor; but then user code's constructors
2986 + would come first, and not be profiled. */
2987 + call_gmon_start ();
2988 +asm ("\n/*@_init_GMON_STUFF_ENDS*/");
2990 + asm ("\n/*@_init_PROLOG_PAUSES*/");
2992 + /* Let GCC know that _init is not a leaf function by having a dummy
2993 + * function call here. We arrange for this call to be omitted from
2994 + * either crt file. */
2995 + i_am_not_a_leaf ();
2997 + asm ("\n/*@_init_PROLOG_UNPAUSES*/");
3003 + /* Now the epilog. */
3004 + asm ("\n/*@_init_PROLOG_ENDS*/");
3005 + asm ("\n/*@_init_EPILOG_BEGINS*/");
3008 +/* End of the _init epilog, beginning of the _fini prolog. */
3009 +asm ("\n/*@_init_EPILOG_ENDS*/");
3010 +asm ("\n/*@_fini_PROLOG_BEGINS*/");
3015 +extern void i_am_not_a_leaf2 (void);
3016 +extern void _fini (void);
3020 + /* End of the _fini prolog. */
3024 + asm ("\n/*@_fini_PROLOG_ENDS*/");
3027 + /* Let GCC know that _fini is not a leaf function by having a dummy
3028 + function call here. We arrange for this call to be omitted from
3029 + either crt file. */
3030 + i_am_not_a_leaf2 ();
3033 + /* Beginning of the _fini epilog. */
3034 + asm ("\n/*@_fini_EPILOG_BEGINS*/");
3037 +/* End of the _fini epilog. Any further generated assembly (e.g. .ident)
3038 + is shared between both crt files. */
3039 +asm ("\n/*@_fini_EPILOG_ENDS*/");
3040 +asm ("\n/*@TRAILER_BEGINS*/");
3043 diff -urN uClibc-0.9.27/libc/sysdeps/linux/microblaze/__longjmp.S uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/__longjmp.S
3044 --- uClibc-0.9.27/libc/sysdeps/linux/microblaze/__longjmp.S 2005-01-12 08:59:21.000000000 +0100
3045 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/__longjmp.S 2003-12-01 06:55:42.000000000 +0100
3047 /* load registers from memory to r5 (arg0)*/
3079 addi r3, r0, 1 // return val
3080 rtsd r15, 8 // normal return
3081 diff -urN uClibc-0.9.27/libc/sysdeps/linux/microblaze/Makefile uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/Makefile
3082 --- uClibc-0.9.27/libc/sysdeps/linux/microblaze/Makefile 2005-01-12 08:59:21.000000000 +0100
3083 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/Makefile 2005-08-10 13:46:42.000000000 +0200
3085 include $(TOPDIR)Rules.mak
3087 #FIXME -- this arch should include its own crti.S and crtn.S
3092 ASFLAGS+=-I.. -D__ASSEMBLER -DASM_GLOBAL_DIRECTIVE=.globl
3094 SSRC = setjmp.S __longjmp.S vfork.S
3095 SOBJS = $(patsubst %.S,%.o, $(SSRC))
3097 -CSRC = mmap.c syscall.c clone.c
3098 +CSRC = mmap.c syscall.c clone.c fixdfsi.c
3099 COBJS = $(patsubst %.c,%.o, $(CSRC))
3101 OBJS = $(SOBJS) $(COBJS)
3104 ar-target: $(OBJS) $(CRT0_OBJ) $(CTOR_TARGETS)
3105 $(AR) $(ARFLAGS) $(LIBC) $(OBJS)
3106 + mkdir -p $(TOPDIR)lib/
3107 cp $(CRT0_OBJ) $(TOPDIR)lib/
3109 $(CRT0_OBJ): $(CRT0_SRC)
3111 $(STRIPTOOL) -x -R .note -R .comment $*.o
3113 ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
3115 - $(CC) $(ASFLAGS) -c crti.S -o crti.o
3116 +initfini.S: initfini.c
3117 + $(CC) $(SAFECFLAGS) -I$(TOPDIR)include -c initfini.c -S -o initfini.S
3119 +crti.S crtn.S: initfini.S initfini.awk
3120 + awk -f initfini.awk initfini.S
3122 $(TOPDIR)lib/crti.o: crti.o
3123 $(INSTALL) -d $(TOPDIR)lib/
3124 - cp crti.o $(TOPDIR)lib/
3127 - $(CC) $(ASFLAGS) -c crtn.S -o crtn.o
3128 + $(AR) $(ARFLAGS) $(TOPDIR)lib/crti.o
3130 $(TOPDIR)lib/crtn.o: crtn.o
3131 $(INSTALL) -d $(TOPDIR)lib/
3132 - cp crtn.o $(TOPDIR)lib/
3134 -$(TOPDIR)lib/crti.o:
3135 - $(INSTALL) -d $(TOPDIR)lib/
3136 - $(AR) $(ARFLAGS) $(TOPDIR)lib/crti.o
3137 -$(TOPDIR)lib/crtn.o:
3138 - $(INSTALL) -d $(TOPDIR)lib/
3139 $(AR) $(ARFLAGS) $(TOPDIR)lib/crtn.o
3144 $(RM) *.[oa] *~ core
3146 + ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
3153 diff -urN uClibc-0.9.27/libc/sysdeps/linux/microblaze/setjmp.S uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/setjmp.S
3154 --- uClibc-0.9.27/libc/sysdeps/linux/microblaze/setjmp.S 2005-01-12 08:59:21.000000000 +0100
3155 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/setjmp.S 2003-12-01 06:55:42.000000000 +0100
3157 /* Save registers relative to r5 (arg0)*/
3158 swi r1, r5, 0 /* stack pointer */
3159 swi r15, r5, 4 /* link register */
3160 - swi r18, r5, 8 /* assembler temp */
3161 - swi r19, r5, 12 /* now call-preserved regs */
3173 + swi r2, r5, 8 /* SDA and SDA2 ptrs */
3175 + swi r18, r5, 16 /* assembler temp */
3176 + swi r19, r5, 20 /* now call-preserved regs */
3190 /* Make a tail call to __sigjmp_save; it takes the same args. */
3191 braid C_SYMBOL_NAME(__sigjmp_save)
3192 diff -urN uClibc-0.9.27/libc/sysdeps/linux/microblaze/sys/procfs.h uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/sys/procfs.h
3193 --- uClibc-0.9.27/libc/sysdeps/linux/microblaze/sys/procfs.h 1970-01-01 01:00:00.000000000 +0100
3194 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/sys/procfs.h 2003-12-01 06:55:42.000000000 +0100
3196 +/* Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
3197 + This file is part of the GNU C Library.
3199 + The GNU C Library is free software; you can redistribute it and/or
3200 + modify it under the terms of the GNU Lesser General Public
3201 + License as published by the Free Software Foundation; either
3202 + version 2.1 of the License, or (at your option) any later version.
3204 + The GNU C Library is distributed in the hope that it will be useful,
3205 + but WITHOUT ANY WARRANTY; without even the implied warranty of
3206 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3207 + Lesser General Public License for more details.
3209 + You should have received a copy of the GNU Lesser General Public
3210 + License along with the GNU C Library; if not, write to the Free
3211 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3212 + 02111-1307 USA. */
3214 +#ifndef _SYS_PROCFS_H
3215 +#define _SYS_PROCFS_H 1
3217 +/* This is somewhat modelled after the file of the same name on SVR4
3218 + systems. It provides a definition of the core file format for ELF
3219 + used on Linux. It doesn't have anything to do with the /proc file
3220 + system, even though Linux has one.
3222 + Anyway, the whole purpose of this file is for GDB and GDB only.
3223 + Don't read too much into it. Don't use it for anything other than
3224 + GDB unless you know what you are doing. */
3226 +#include <features.h>
3227 +#include <sys/time.h>
3228 +#include <sys/types.h>
3231 +/* Type for a general-purpose register. */
3232 +typedef unsigned long elf_greg_t;
3234 +/* This is exactly the same as `struct pt_regs' in the kernel. */
3237 + elf_greg_t gpr[32]; /* General purpose registers. */
3239 + elf_greg_t pc; /* program counter */
3240 + elf_greg_t psw; /* program status word */
3242 + elf_greg_t kernel_mode; /* 1 if in `kernel mode', 0 if user mode */
3243 + elf_greg_t single_step; /* 1 if in single step mode */
3246 +#define ELF_NGREG (sizeof (struct elf_gregset) / sizeof(elf_greg_t))
3247 +typedef elf_greg_t elf_gregset_t[ELF_NGREG];
3249 +/* Register set for the floating-point registers. */
3250 +typedef void elf_fpregset_t;
3254 + int si_signo; /* signal number */
3255 + int si_code; /* extra code */
3256 + int si_errno; /* errno */
3261 + * Definitions to generate Intel SVR4-like core files.
3262 + * These mostly have the same names as the SVR4 types with "elf_"
3263 + * tacked on the front to prevent clashes with linux definitions,
3264 + * and the typedef forms have been avoided. This is mostly like
3265 + * the SVR4 structure, but more Linuxy, with things that Linux does
3266 + * not support and which gdb doesn't really use excluded.
3267 + * Fields present but not used are marked with "XXX".
3269 +struct elf_prstatus
3271 + struct elf_siginfo pr_info; /* Info associated with signal */
3272 + short pr_cursig; /* Current signal */
3273 + unsigned long pr_sigpend; /* Set of pending signals */
3274 + unsigned long pr_sighold; /* Set of held signals */
3275 + __kernel_pid_t pr_pid;
3276 + __kernel_pid_t pr_ppid;
3277 + __kernel_pid_t pr_pgrp;
3278 + __kernel_pid_t pr_sid;
3279 + struct timeval pr_utime; /* User time */
3280 + struct timeval pr_stime; /* System time */
3281 + struct timeval pr_cutime; /* Cumulative user time */
3282 + struct timeval pr_cstime; /* Cumulative system time */
3283 + elf_gregset_t pr_reg; /* GP registers */
3284 + int pr_fpvalid; /* True if math co-processor being used. */
3287 +#define ELF_PRARGSZ (80) /* Number of chars for args */
3289 +struct elf_prpsinfo
3291 + char pr_state; /* numeric process state */
3292 + char pr_sname; /* char for pr_state */
3293 + char pr_zomb; /* zombie */
3294 + char pr_nice; /* nice val */
3295 + unsigned long pr_flag; /* flags */
3296 + __kernel_uid_t pr_uid;
3297 + __kernel_gid_t pr_gid;
3298 + __kernel_pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid;
3299 + /* Lots missing */
3300 + char pr_fname[16]; /* filename of executable */
3301 + char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */
3305 +/* The rest of this file provides the types for emulation of the
3306 + Solaris <proc_service.h> interfaces that should be implemented by
3307 + users of libthread_db. */
3310 +typedef void *psaddr_t;
3312 +/* Register sets. Linux has different names. */
3313 +typedef elf_gregset_t prgregset_t;
3314 +typedef elf_fpregset_t prfpregset_t;
3316 +/* We don't have any differences between processes and threads,
3317 + therefore have only one PID type. */
3318 +typedef __kernel_pid_t lwpid_t;
3320 +/* Process status and info. In the end we do provide typedefs for them. */
3321 +typedef struct elf_prstatus prstatus_t;
3322 +typedef struct elf_prpsinfo prpsinfo_t;
3325 +#endif /* sys/procfs.h */
3326 diff -urN uClibc-0.9.27/libc/sysdeps/linux/microblaze/sys/ptrace.h uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/sys/ptrace.h
3327 --- uClibc-0.9.27/libc/sysdeps/linux/microblaze/sys/ptrace.h 2005-01-12 08:59:21.000000000 +0100
3328 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/sys/ptrace.h 2003-12-01 06:55:42.000000000 +0100
3330 /* `ptrace' debugger support interface. Linux/microblaze version.
3331 - Copyright (C) 2001, 2002 Free Software Foundation, Inc.
3332 + Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
3333 This file is part of the GNU C Library.
3335 The GNU C Library is free software; you can redistribute it and/or
3338 #define PT_KILL PTRACE_KILL
3340 + /* Single step the process. */
3341 + PTRACE_SINGLESTEP = 9,
3342 +#define PT_STEP PTRACE_SINGLESTEP
3344 /* Attach to a process that is already running. */
3345 - PTRACE_ATTACH = 0x10,
3346 + PTRACE_ATTACH = 16,
3347 #define PT_ATTACH PTRACE_ATTACH
3349 /* Detach from a process attached to with PTRACE_ATTACH. */
3350 - PTRACE_DETACH = 0x11,
3351 + PTRACE_DETACH = 17,
3352 #define PT_DETACH PTRACE_DETACH
3354 /* Continue and stop at the next (return from) syscall. */
3355 diff -urN uClibc-0.9.27/libc/sysdeps/linux/microblaze/syscall.c uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/syscall.c
3356 --- uClibc-0.9.27/libc/sysdeps/linux/microblaze/syscall.c 2005-01-12 08:59:21.000000000 +0100
3357 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/syscall.c 2005-08-05 03:10:51.000000000 +0200
3359 off the stack even for (the majority of) system calls with fewer
3360 arguments; hopefully this won't cause any problems. A1-A4 are in
3361 registers, so they're OK. */
3362 - register arg_t a asm (SYSCALL_ARG0) = a1;
3363 - register arg_t b asm (SYSCALL_ARG1) = a2;
3364 - register arg_t c asm (SYSCALL_ARG2) = a3;
3365 - register arg_t d asm (SYSCALL_ARG3) = a4;
3366 - register arg_t e asm (SYSCALL_ARG4) = a5;
3367 - register arg_t f asm (SYSCALL_ARG5) = a6;
3368 - register unsigned long syscall asm (SYSCALL_NUM) = num;
3369 - register unsigned long ret asm (SYSCALL_RET);
3370 - unsigned long ret_sav;
3371 + register unsigned long ret;
3373 - *((unsigned long *)0xFFFF4004) = (unsigned int)('+');
3374 - asm ("brlid r17, 08x; nop;"
3375 + asm ( "addk r5, r0, %2 \n\t"
3376 + "addk r6, r0, %3 \n\t"
3377 + "addk r7, r0, %4 \n\t"
3378 + "addk r8, r0, %5 \n\t"
3379 + "addk r9, r0, %6 \n\t"
3380 + "addk r10,r0, %7 \n\t"
3381 + "addk r12,r0, %1 \n\t"
3382 + "brki r14, 0x08 \n\t"
3383 + "addk %0, r0, r3 \n\t"
3385 - : "r" (syscall), "r" (a), "r" (b), "r" (c), "r" (d), "r" (e), "r" (f)
3386 - : SYSCALL_CLOBBERS);
3387 + : "r" (syscall), "r" (a1), "r" (a2), "r" (a3), "r" (a4), "r" (a5),
3389 + : "r3", "r5", "r6", "r7", "r8", "r9", "r10", "r12", "r14", "cc");
3392 - *((unsigned long *)0xFFFF4004) = (unsigned int)('-');
3396 __syscall_return (long, ret);
3398 diff -urN uClibc-0.9.27/libc/sysdeps/linux/microblaze/vfork.S uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/vfork.S
3399 --- uClibc-0.9.27/libc/sysdeps/linux/microblaze/vfork.S 2005-01-12 08:59:21.000000000 +0100
3400 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/microblaze/vfork.S 2005-08-05 03:10:51.000000000 +0200
3404 addi r12, r0, SYS_vfork
3408 addi r4, r3, 125 // minimum err value
3409 blti r4, 1f // is r3 < -125?
3410 - rtsd r15, 8 // normal return
3412 + bri 2f // normal return
3413 1: sub r3, r3, r0 // r3 = -r3
3414 swi r3, r0, C_SYMBOL_NAME(errno);
3415 - rtsd r15, 8 // error return
3416 + // state restore etc
3417 +2: rtsd r15, 8 // error return
3421 diff -urN uClibc-0.9.27/libc/sysdeps/linux/mips/bits/atomic.h uClibc-0.9.27-uc0/libc/sysdeps/linux/mips/bits/atomic.h
3422 --- uClibc-0.9.27/libc/sysdeps/linux/mips/bits/atomic.h 1970-01-01 01:00:00.000000000 +0100
3423 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/mips/bits/atomic.h 2006-01-16 07:46:31.000000000 +0100
3425 +/* Low-level functions for atomic operations. Mips version.
3426 + Copyright (C) 2005 Free Software Foundation, Inc.
3427 + This file is part of the GNU C Library.
3429 + The GNU C Library is free software; you can redistribute it and/or
3430 + modify it under the terms of the GNU Lesser General Public
3431 + License as published by the Free Software Foundation; either
3432 + version 2.1 of the License, or (at your option) any later version.
3434 + The GNU C Library is distributed in the hope that it will be useful,
3435 + but WITHOUT ANY WARRANTY; without even the implied warranty of
3436 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3437 + Lesser General Public License for more details.
3439 + You should have received a copy of the GNU Lesser General Public
3440 + License along with the GNU C Library; if not, write to the Free
3441 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3442 + 02111-1307 USA. */
3444 +#ifndef _MIPS_BITS_ATOMIC_H
3445 +#define _MIPS_BITS_ATOMIC_H 1
3447 +#include <inttypes.h>
3448 +#include <sgidefs.h>
3450 +typedef int32_t atomic32_t;
3451 +typedef uint32_t uatomic32_t;
3452 +typedef int_fast32_t atomic_fast32_t;
3453 +typedef uint_fast32_t uatomic_fast32_t;
3455 +typedef int64_t atomic64_t;
3456 +typedef uint64_t uatomic64_t;
3457 +typedef int_fast64_t atomic_fast64_t;
3458 +typedef uint_fast64_t uatomic_fast64_t;
3460 +typedef intptr_t atomicptr_t;
3461 +typedef uintptr_t uatomicptr_t;
3462 +typedef intmax_t atomic_max_t;
3463 +typedef uintmax_t uatomic_max_t;
3465 +#if _MIPS_SIM == _ABIO32
3466 +#define MIPS_PUSH_MIPS2 ".set mips2\n\t"
3468 +#define MIPS_PUSH_MIPS2
3471 +/* See the comments in <sys/asm.h> about the use of the sync instruction. */
3473 +# define MIPS_SYNC sync
3476 +#define MIPS_SYNC_STR_2(X) #X
3477 +#define MIPS_SYNC_STR_1(X) MIPS_SYNC_STR_2(X)
3478 +#define MIPS_SYNC_STR MIPS_SYNC_STR_1(MIPS_SYNC)
3480 +/* Compare and exchange. For all of the "xxx" routines, we expect a
3481 + "__prev" and a "__cmp" variable to be provided by the enclosing scope,
3482 + in which values are returned. */
3484 +#define __arch_compare_and_exchange_xxx_8_int(mem, newval, oldval, rel, acq) \
3485 + (abort (), __prev = __cmp = 0)
3487 +#define __arch_compare_and_exchange_xxx_16_int(mem, newval, oldval, rel, acq) \
3488 + (abort (), __prev = __cmp = 0)
3490 +#define __arch_compare_and_exchange_xxx_32_int(mem, newval, oldval, rel, acq) \
3491 + __asm__ __volatile__ ( \
3497 + "move %1,$0\n\t" \
3498 + "bne %0,%2,2f\n\t" \
3499 + "move %1,%3\n\t" \
3505 + : "=&r" (__prev), "=&r" (__cmp) \
3506 + : "r" (oldval), "r" (newval), "m" (*mem) \
3509 +#if _MIPS_SIM == _ABIO32
3510 +/* We can't do an atomic 64-bit operation in O32. */
3511 +#define __arch_compare_and_exchange_xxx_64_int(mem, newval, oldval, rel, acq) \
3512 + (abort (), __prev = __cmp = 0)
3514 +#define __arch_compare_and_exchange_xxx_64_int(mem, newval, oldval, rel, acq) \
3515 + __asm__ __volatile__ ("\n" \
3521 + "move %1,$0\n\t" \
3522 + "bne %0,%2,2f\n\t" \
3523 + "move %1,%3\n\t" \
3529 + : "=&r" (__prev), "=&r" (__cmp) \
3530 + : "r" (oldval), "r" (newval), "m" (*mem) \
3534 +/* For all "bool" routines, we return FALSE if exchange succesful. */
3536 +#define __arch_compare_and_exchange_bool_8_int(mem, new, old, rel, acq) \
3537 +({ typeof (*mem) __prev; int __cmp; \
3538 + __arch_compare_and_exchange_xxx_8_int(mem, new, old, rel, acq); \
3541 +#define __arch_compare_and_exchange_bool_16_int(mem, new, old, rel, acq) \
3542 +({ typeof (*mem) __prev; int __cmp; \
3543 + __arch_compare_and_exchange_xxx_16_int(mem, new, old, rel, acq); \
3546 +#define __arch_compare_and_exchange_bool_32_int(mem, new, old, rel, acq) \
3547 +({ typeof (*mem) __prev; int __cmp; \
3548 + __arch_compare_and_exchange_xxx_32_int(mem, new, old, rel, acq); \
3551 +#define __arch_compare_and_exchange_bool_64_int(mem, new, old, rel, acq) \
3552 +({ typeof (*mem) __prev; int __cmp; \
3553 + __arch_compare_and_exchange_xxx_64_int(mem, new, old, rel, acq); \
3556 +/* For all "val" routines, return the old value whether exchange
3557 + successful or not. */
3559 +#define __arch_compare_and_exchange_val_8_int(mem, new, old, rel, acq) \
3560 +({ typeof (*mem) __prev; int __cmp; \
3561 + __arch_compare_and_exchange_xxx_8_int(mem, new, old, rel, acq); \
3562 + (typeof (*mem))__prev; })
3564 +#define __arch_compare_and_exchange_val_16_int(mem, new, old, rel, acq) \
3565 +({ typeof (*mem) __prev; int __cmp; \
3566 + __arch_compare_and_exchange_xxx_16_int(mem, new, old, rel, acq); \
3567 + (typeof (*mem))__prev; })
3569 +#define __arch_compare_and_exchange_val_32_int(mem, new, old, rel, acq) \
3570 +({ typeof (*mem) __prev; int __cmp; \
3571 + __arch_compare_and_exchange_xxx_32_int(mem, new, old, rel, acq); \
3572 + (typeof (*mem))__prev; })
3574 +#define __arch_compare_and_exchange_val_64_int(mem, new, old, rel, acq) \
3575 +({ typeof (*mem) __prev; int __cmp; \
3576 + __arch_compare_and_exchange_xxx_64_int(mem, new, old, rel, acq); \
3577 + (typeof (*mem))__prev; })
3579 +/* Compare and exchange with "acquire" semantics, ie barrier after. */
3581 +#define atomic_compare_and_exchange_bool_acq(mem, new, old) \
3582 + __atomic_bool_bysize (__arch_compare_and_exchange_bool, int, \
3583 + mem, new, old, "", MIPS_SYNC_STR)
3585 +#define atomic_compare_and_exchange_val_acq(mem, new, old) \
3586 + __atomic_val_bysize (__arch_compare_and_exchange_val, int, \
3587 + mem, new, old, "", MIPS_SYNC_STR)
3589 +/* Compare and exchange with "release" semantics, ie barrier before. */
3591 +#define atomic_compare_and_exchange_bool_rel(mem, new, old) \
3592 + __atomic_bool_bysize (__arch_compare_and_exchange_bool, int, \
3593 + mem, new, old, MIPS_SYNC_STR, "")
3595 +#define atomic_compare_and_exchange_val_rel(mem, new, old) \
3596 + __atomic_val_bysize (__arch_compare_and_exchange_val, int, \
3597 + mem, new, old, MIPS_SYNC_STR, "")
3601 +/* Atomic exchange (without compare). */
3603 +#define __arch_exchange_xxx_8_int(mem, newval, rel, acq) \
3606 +#define __arch_exchange_xxx_16_int(mem, newval, rel, acq) \
3609 +#define __arch_exchange_xxx_32_int(mem, newval, rel, acq) \
3610 +({ typeof (*mem) __prev; int __cmp; \
3611 + __asm__ __volatile__ ("\n" \
3617 + "move %1,%2\n\t" \
3623 + : "=&r" (__prev), "=&r" (__cmp) \
3624 + : "r" (newval), "m" (*mem) \
3628 +#if _MIPS_SIM == _ABIO32
3629 +/* We can't do an atomic 64-bit operation in O32. */
3630 +#define __arch_exchange_xxx_64_int(mem, newval, rel, acq) \
3633 +#define __arch_exchange_xxx_64_int(mem, newval, rel, acq) \
3634 +({ typeof (*mem) __prev; int __cmp; \
3635 + __asm__ __volatile__ ("\n" \
3641 + "move %1,%2\n\t" \
3647 + : "=&r" (__prev), "=&r" (__cmp) \
3648 + : "r" (newval), "m" (*mem) \
3653 +#define atomic_exchange_acq(mem, value) \
3654 + __atomic_val_bysize (__arch_exchange_xxx, int, mem, value, "", MIPS_SYNC_STR)
3656 +#define atomic_exchange_rel(mem, value) \
3657 + __atomic_val_bysize (__arch_exchange_xxx, int, mem, value, MIPS_SYNC_STR, "")
3660 +/* Atomically add value and return the previous (unincremented) value. */
3662 +#define __arch_exchange_and_add_8_int(mem, newval, rel, acq) \
3663 + (abort (), (typeof(*mem)) 0)
3665 +#define __arch_exchange_and_add_16_int(mem, newval, rel, acq) \
3666 + (abort (), (typeof(*mem)) 0)
3668 +#define __arch_exchange_and_add_32_int(mem, value, rel, acq) \
3669 +({ typeof (*mem) __prev; int __cmp; \
3670 + __asm__ __volatile__ ("\n" \
3676 + "addu %1,%0,%2\n\t" \
3682 + : "=&r" (__prev), "=&r" (__cmp) \
3683 + : "r" (value), "m" (*mem) \
3687 +#if _MIPS_SIM == _ABIO32
3688 +/* We can't do an atomic 64-bit operation in O32. */
3689 +#define __arch_exchange_and_add_64_int(mem, value, rel, acq) \
3690 + (abort (), (typeof(*mem)) 0)
3692 +#define __arch_exchange_and_add_64_int(mem, value, rel, acq) \
3693 +({ typeof (*mem) __prev; int __cmp; \
3694 + __asm__ __volatile__ ( \
3700 + "daddu %1,%0,%2\n\t" \
3706 + : "=&r" (__prev), "=&r" (__cmp) \
3707 + : "r" (value), "m" (*mem) \
3712 +/* ??? Barrier semantics for atomic_exchange_and_add appear to be
3713 + undefined. Use full barrier for now, as that's safe. */
3714 +#define atomic_exchange_and_add(mem, value) \
3715 + __atomic_val_bysize (__arch_exchange_and_add, int, mem, value, \
3716 + MIPS_SYNC_STR, MIPS_SYNC_STR)
3718 +/* TODO: More atomic operations could be implemented efficiently; only the
3719 + basic requirements are done. */
3721 +#define atomic_full_barrier() \
3722 + __asm__ __volatile__ (".set push\n\t" \
3724 + MIPS_SYNC_STR "\n\t" \
3725 + ".set pop" : : : "memory")
3727 +#endif /* bits/atomic.h */
3728 diff -urN uClibc-0.9.27/libc/sysdeps/linux/sh/bits/atomic.h uClibc-0.9.27-uc0/libc/sysdeps/linux/sh/bits/atomic.h
3729 --- uClibc-0.9.27/libc/sysdeps/linux/sh/bits/atomic.h 1970-01-01 01:00:00.000000000 +0100
3730 +++ uClibc-0.9.27-uc0/libc/sysdeps/linux/sh/bits/atomic.h 2006-01-16 07:46:31.000000000 +0100
3732 +/* Atomic operations used inside libc. Linux/SH version.
3733 + Copyright (C) 2003 Free Software Foundation, Inc.
3734 + This file is part of the GNU C Library.
3736 + The GNU C Library is free software; you can redistribute it and/or
3737 + modify it under the terms of the GNU Lesser General Public
3738 + License as published by the Free Software Foundation; either
3739 + version 2.1 of the License, or (at your option) any later version.
3741 + The GNU C Library is distributed in the hope that it will be useful,
3742 + but WITHOUT ANY WARRANTY; without even the implied warranty of
3743 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3744 + Lesser General Public License for more details.
3746 + You should have received a copy of the GNU Lesser General Public
3747 + License along with the GNU C Library; if not, write to the Free
3748 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3749 + 02111-1307 USA. */
3751 +#include <stdint.h>
3754 +typedef int8_t atomic8_t;
3755 +typedef uint8_t uatomic8_t;
3756 +typedef int_fast8_t atomic_fast8_t;
3757 +typedef uint_fast8_t uatomic_fast8_t;
3759 +typedef int16_t atomic16_t;
3760 +typedef uint16_t uatomic16_t;
3761 +typedef int_fast16_t atomic_fast16_t;
3762 +typedef uint_fast16_t uatomic_fast16_t;
3764 +typedef int32_t atomic32_t;
3765 +typedef uint32_t uatomic32_t;
3766 +typedef int_fast32_t atomic_fast32_t;
3767 +typedef uint_fast32_t uatomic_fast32_t;
3769 +typedef int64_t atomic64_t;
3770 +typedef uint64_t uatomic64_t;
3771 +typedef int_fast64_t atomic_fast64_t;
3772 +typedef uint_fast64_t uatomic_fast64_t;
3774 +typedef intptr_t atomicptr_t;
3775 +typedef uintptr_t uatomicptr_t;
3776 +typedef intmax_t atomic_max_t;
3777 +typedef uintmax_t uatomic_max_t;
3779 +/* SH kernel has implemented a gUSA ("g" User Space Atomicity) support
3780 + for the user space atomicity. The atomicity macros use this scheme.
3783 + Niibe Yutaka, "gUSA: Simple and Efficient User Space Atomicity
3784 + Emulation with Little Kernel Modification", Linux Conference 2002,
3785 + Japan. http://lc.linux.or.jp/lc2002/papers/niibe0919h.pdf (in
3788 + B.N. Bershad, D. Redell, and J. Ellis, "Fast Mutual Exclusion for
3789 + Uniprocessors", Proceedings of the Fifth Architectural Support for
3790 + Programming Languages and Operating Systems (ASPLOS), pp. 223-233,
3791 + October 1992. http://www.cs.washington.edu/homes/bershad/Papers/Rcs.ps
3794 + r15: -(size of atomic instruction sequence) < 0
3796 + r1: saved stack pointer
3799 +#define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \
3800 + ({ __typeof (*(mem)) __result; \
3801 + __asm __volatile ("\
3807 + 0: mov.b @%1,%0\n\
3812 + : "=&r" (__result) : "r" (mem), "r" (newval), "r" (oldval) \
3813 + : "r0", "r1", "t", "memory"); \
3816 +#define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \
3817 + ({ __typeof (*(mem)) __result; \
3818 + __asm __volatile ("\
3824 + 0: mov.w @%1,%0\n\
3829 + : "=&r" (__result) : "r" (mem), "r" (newval), "r" (oldval) \
3830 + : "r0", "r1", "t", "memory"); \
3833 +#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \
3834 + ({ __typeof (*(mem)) __result; \
3835 + __asm __volatile ("\
3841 + 0: mov.l @%1,%0\n\
3846 + : "=&r" (__result) : "r" (mem), "r" (newval), "r" (oldval) \
3847 + : "r0", "r1", "t", "memory"); \
3850 +/* XXX We do not really need 64-bit compare-and-exchange. At least
3851 + not in the moment. Using it would mean causing portability
3852 + problems since not many other 32-bit architectures have support for
3853 + such an operation. So don't define any code for now. */
3855 +# define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
3856 + (abort (), (__typeof (*mem)) 0)
3858 +#define atomic_exchange_and_add(mem, value) \
3859 + ({ __typeof (*(mem)) __result, __tmp, __value = (value); \
3860 + if (sizeof (*(mem)) == 1) \
3861 + __asm __volatile ("\
3866 + 0: mov.b @%2,%0\n\
3870 + : "=&r" (__result), "=&r" (__tmp) : "r" (mem), "1" (__value) \
3871 + : "r0", "r1", "memory"); \
3872 + else if (sizeof (*(mem)) == 2) \
3873 + __asm __volatile ("\
3878 + 0: mov.w @%2,%0\n\
3882 + : "=&r" (__result), "=&r" (__tmp) : "r" (mem), "1" (__value) \
3883 + : "r0", "r1", "memory"); \
3884 + else if (sizeof (*(mem)) == 4) \
3885 + __asm __volatile ("\
3890 + 0: mov.l @%2,%0\n\
3894 + : "=&r" (__result), "=&r" (__tmp) : "r" (mem), "1" (__value) \
3895 + : "r0", "r1", "memory"); \
3898 + __typeof (mem) memp = (mem); \
3900 + __result = *memp; \
3901 + while (__arch_compare_and_exchange_val_64_acq \
3902 + (memp, __result + __value, __result) == __result); \
3907 +#define atomic_add(mem, value) \
3908 + (void) ({ __typeof (*(mem)) __tmp, __value = (value); \
3909 + if (sizeof (*(mem)) == 1) \
3910 + __asm __volatile ("\
3915 + 0: mov.b @%1,r2\n\
3919 + : "=&r" (__tmp) : "r" (mem), "0" (__value) \
3920 + : "r0", "r1", "r2", "memory"); \
3921 + else if (sizeof (*(mem)) == 2) \
3922 + __asm __volatile ("\
3927 + 0: mov.w @%1,r2\n\
3931 + : "=&r" (__tmp) : "r" (mem), "0" (__value) \
3932 + : "r0", "r1", "r2", "memory"); \
3933 + else if (sizeof (*(mem)) == 4) \
3934 + __asm __volatile ("\
3939 + 0: mov.l @%1,r2\n\
3943 + : "=&r" (__tmp) : "r" (mem), "0" (__value) \
3944 + : "r0", "r1", "r2", "memory"); \
3947 + __typeof (*(mem)) oldval; \
3948 + __typeof (mem) memp = (mem); \
3951 + while (__arch_compare_and_exchange_val_64_acq \
3952 + (memp, oldval + __value, oldval) == oldval); \
3957 +#define atomic_add_negative(mem, value) \
3958 + ({ unsigned char __result; \
3959 + __typeof (*(mem)) __tmp, __value = (value); \
3960 + if (sizeof (*(mem)) == 1) \
3961 + __asm __volatile ("\
3966 + 0: mov.b @%2,r2\n\
3972 + : "=r" (__result), "=&r" (__tmp) : "r" (mem), "1" (__value) \
3973 + : "r0", "r1", "r2", "t", "memory"); \
3974 + else if (sizeof (*(mem)) == 2) \
3975 + __asm __volatile ("\
3980 + 0: mov.w @%2,r2\n\
3986 + : "=r" (__result), "=&r" (__tmp) : "r" (mem), "1" (__value) \
3987 + : "r0", "r1", "r2", "t", "memory"); \
3988 + else if (sizeof (*(mem)) == 4) \
3989 + __asm __volatile ("\
3994 + 0: mov.l @%2,r2\n\
4000 + : "=r" (__result), "=&r" (__tmp) : "r" (mem), "1" (__value) \
4001 + : "r0", "r1", "r2", "t", "memory"); \
4006 +#define atomic_add_zero(mem, value) \
4007 + ({ unsigned char __result; \
4008 + __typeof (*(mem)) __tmp, __value = (value); \
4009 + if (sizeof (*(mem)) == 1) \
4010 + __asm __volatile ("\
4015 + 0: mov.b @%2,r2\n\
4021 + : "=r" (__result), "=&r" (__tmp) : "r" (mem), "1" (__value) \
4022 + : "r0", "r1", "r2", "t", "memory"); \
4023 + else if (sizeof (*(mem)) == 2) \
4024 + __asm __volatile ("\
4029 + 0: mov.w @%2,r2\n\
4035 + : "=r" (__result), "=&r" (__tmp) : "r" (mem), "1" (__value) \
4036 + : "r0", "r1", "r2", "t", "memory"); \
4037 + else if (sizeof (*(mem)) == 4) \
4038 + __asm __volatile ("\
4043 + 0: mov.l @%2,r2\n\
4049 + : "=r" (__result), "=&r" (__tmp) : "r" (mem), "1" (__value) \
4050 + : "r0", "r1", "r2", "t", "memory"); \
4055 +#define atomic_increment_and_test(mem) atomic_add_zero((mem), 1)
4056 +#define atomic_decrement_and_test(mem) atomic_add_zero((mem), -1)
4058 +#define atomic_bit_set(mem, bit) \
4059 + (void) ({ unsigned int __mask = 1 << (bit); \
4060 + if (sizeof (*(mem)) == 1) \
4061 + __asm __volatile ("\
4066 + 0: mov.b @%0,r2\n\
4070 + : : "r" (mem), "r" (__mask) \
4071 + : "r0", "r1", "r2", "memory"); \
4072 + else if (sizeof (*(mem)) == 2) \
4073 + __asm __volatile ("\
4078 + 0: mov.w @%0,r2\n\
4082 + : : "r" (mem), "r" (__mask) \
4083 + : "r0", "r1", "r2", "memory"); \
4084 + else if (sizeof (*(mem)) == 4) \
4085 + __asm __volatile ("\
4090 + 0: mov.l @%0,r2\n\
4094 + : : "r" (mem), "r" (__mask) \
4095 + : "r0", "r1", "r2", "memory"); \
4100 +#define atomic_bit_test_set(mem, bit) \
4101 + ({ unsigned int __mask = 1 << (bit); \
4102 + unsigned int __result = __mask; \
4103 + if (sizeof (*(mem)) == 1) \
4104 + __asm __volatile ("\
4110 + 0: mov.b @%2,r2\n\
4115 + : "=&r" (__result), "=&r" (__mask) \
4116 + : "r" (mem), "0" (__result), "1" (__mask) \
4117 + : "r0", "r1", "r2", "memory"); \
4118 + else if (sizeof (*(mem)) == 2) \
4119 + __asm __volatile ("\
4125 + 0: mov.w @%2,r2\n\
4130 + : "=&r" (__result), "=&r" (__mask) \
4131 + : "r" (mem), "0" (__result), "1" (__mask) \
4132 + : "r0", "r1", "r2", "memory"); \
4133 + else if (sizeof (*(mem)) == 4) \
4134 + __asm __volatile ("\
4140 + 0: mov.l @%2,r2\n\
4145 + : "=&r" (__result), "=&r" (__mask) \
4146 + : "r" (mem), "0" (__result), "1" (__mask) \
4147 + : "r0", "r1", "r2", "memory"); \
4151 diff -urN uClibc-0.9.27/libcrypt/md5.c uClibc-0.9.27-uc0/libcrypt/md5.c
4152 --- uClibc-0.9.27/libcrypt/md5.c 2005-01-12 08:59:21.000000000 +0100
4153 +++ uClibc-0.9.27-uc0/libcrypt/md5.c 2003-07-14 17:11:41.000000000 +0200
4154 @@ -111,6 +111,11 @@
4158 +static void __md5_Encode (unsigned char *output, u_int32_t *input,
4159 + unsigned int len);
4160 +static void __md5_Decode (u_int32_t *output, const unsigned char *input,
4161 + unsigned int len);
4164 __md5_Encode (output, input, len)
4165 unsigned char *output;
4166 diff -urN uClibc-0.9.27/libpthread/linuxthreads/internals.h uClibc-0.9.27-uc0/libpthread/linuxthreads/internals.h
4167 --- uClibc-0.9.27/libpthread/linuxthreads/internals.h 2005-01-12 08:59:21.000000000 +0100
4168 +++ uClibc-0.9.27-uc0/libpthread/linuxthreads/internals.h 2005-09-16 08:11:17.000000000 +0200
4169 @@ -259,7 +259,10 @@
4170 extern char *__pthread_initial_thread_bos;
4171 #ifndef __ARCH_HAS_MMU__
4172 extern char *__pthread_initial_thread_tos;
4173 -#define NOMMU_INITIAL_THREAD_BOUNDS(tos,bos) if ((tos)>=__pthread_initial_thread_bos && (bos)<=__pthread_initial_thread_tos) __pthread_initial_thread_bos = (tos)+1
4174 +#define NOMMU_INITIAL_THREAD_BOUNDS(tos,bos) \
4175 + if ((tos)>=__pthread_initial_thread_bos \
4176 + && (bos)<__pthread_initial_thread_tos) \
4177 + __pthread_initial_thread_bos = (tos)+1
4179 #define NOMMU_INITIAL_THREAD_BOUNDS(tos,bos) /* empty */
4180 #endif /* __ARCH_HAS_MMU__ */
4181 diff -urN uClibc-0.9.27/libpthread/linuxthreads/pthread.c uClibc-0.9.27-uc0/libpthread/linuxthreads/pthread.c
4182 --- uClibc-0.9.27/libpthread/linuxthreads/pthread.c 2005-01-12 08:59:21.000000000 +0100
4183 +++ uClibc-0.9.27-uc0/libpthread/linuxthreads/pthread.c 2005-01-26 07:37:27.000000000 +0100
4185 #include "restart.h"
4186 #include "debug.h" /* added to linuxthreads -StS */
4189 /* Mods for uClibc: Some includes */
4191 #include <sys/types.h>
4192 @@ -224,15 +223,8 @@
4193 platform does not support any real-time signals we will define the
4194 values to some unreasonable value which will signal failing of all
4195 the functions below. */
4196 -#ifndef __NR_rt_sigaction
4197 -static int current_rtmin = -1;
4198 -static int current_rtmax = -1;
4199 -int __pthread_sig_restart = SIGUSR1;
4200 -int __pthread_sig_cancel = SIGUSR2;
4201 -int __pthread_sig_debug;
4204 -#if __SIGRTMAX - __SIGRTMIN >= 3
4205 +#if defined(__NR_rt_sigaction) && __SIGRTMAX - __SIGRTMIN >= 3
4206 static int current_rtmin = __SIGRTMIN + 3;
4207 static int current_rtmax = __SIGRTMAX;
4208 int __pthread_sig_restart = __SIGRTMIN;
4210 void (*__pthread_restart)(pthread_descr) = __pthread_restart_old;
4211 void (*__pthread_suspend)(pthread_descr) = __pthread_suspend_old;
4212 int (*__pthread_timedsuspend)(pthread_descr, const struct timespec *) = __pthread_timedsuspend_old;
4216 /* Return number of available real-time signal with highest priority. */
4219 return high ? current_rtmin++ : current_rtmax--;
4223 /* Initialize the pthread library.
4224 Initialization is split in two functions:
4226 struct timespec reltime;
4228 /* Compute a time offset relative to now. */
4229 - __gettimeofday (&now, NULL);
4230 + gettimeofday (&now, NULL);
4231 reltime.tv_nsec = abstime->tv_nsec - now.tv_usec * 1000;
4232 reltime.tv_sec = abstime->tv_sec - now.tv_sec;
4233 if (reltime.tv_nsec < 0) {
4234 diff -urN uClibc-0.9.27/libpthread/linuxthreads/restart.h uClibc-0.9.27-uc0/libpthread/linuxthreads/restart.h
4235 --- uClibc-0.9.27/libpthread/linuxthreads/restart.h 2005-01-12 08:59:21.000000000 +0100
4236 +++ uClibc-0.9.27-uc0/libpthread/linuxthreads/restart.h 2003-03-04 12:22:10.000000000 +0100
4239 #include <sys/syscall.h>
4242 +#undef __NR_rt_sigaction
4245 /* Primitives for controlling thread execution */
4247 static inline void restart(pthread_descr th)
4248 diff -urN uClibc-0.9.27/libpthread/linuxthreads/sysdeps/h8300/pt-machine.h uClibc-0.9.27-uc0/libpthread/linuxthreads/sysdeps/h8300/pt-machine.h
4249 --- uClibc-0.9.27/libpthread/linuxthreads/sysdeps/h8300/pt-machine.h 1970-01-01 01:00:00.000000000 +0100
4250 +++ uClibc-0.9.27-uc0/libpthread/linuxthreads/sysdeps/h8300/pt-machine.h 2004-05-13 03:48:57.000000000 +0200
4252 +/* Machine-dependent pthreads configuration and inline functions.
4254 + Copyright (C) 1996, 1998, 2000, 2002 Free Software Foundation, Inc.
4255 + This file is part of the GNU C Library.
4256 + Contributed by Richard Henderson <rth@tamu.edu>.
4258 + The GNU C Library is free software; you can redistribute it and/or
4259 + modify it under the terms of the GNU Lesser General Public License as
4260 + published by the Free Software Foundation; either version 2.1 of the
4261 + License, or (at your option) any later version.
4263 + The GNU C Library is distributed in the hope that it will be useful,
4264 + but WITHOUT ANY WARRANTY; without even the implied warranty of
4265 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4266 + Lesser General Public License for more details.
4268 + You should have received a copy of the GNU Lesser General Public
4269 + License along with the GNU C Library; see the file COPYING.LIB. If
4270 + not, write to the Free Software Foundation, Inc.,
4271 + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
4273 +#ifndef _PT_MACHINE_H
4274 +#define _PT_MACHINE_H 1
4277 +# define PT_EI extern inline
4280 +extern long int testandset (int *spinlock);
4282 +/* Spinlock implementation; required. */
4284 +testandset (int *spinlock)
4288 + __asm__ __volatile__(
4290 + "stc ccr,@-sp\n\t"
4291 + "orc #0x80,ccr\n\t"
4295 + "ldc @+sp,ccr\n\t"
4296 + :"=r"(ret),"=m"(*spinlock)
4304 +/* Get some notion of the current stack. Need not be exactly the top
4305 + of the stack, just something somewhere in the current frame. */
4306 +#define CURRENT_STACK_FRAME stack_pointer
4307 +register char * stack_pointer __asm__ ("%sp");
4309 +#endif /* pt-machine.h */
4310 diff -urN uClibc-0.9.27/libpthread/linuxthreads/sysdeps/h8300/sigcontextinfo.h uClibc-0.9.27-uc0/libpthread/linuxthreads/sysdeps/h8300/sigcontextinfo.h
4311 --- uClibc-0.9.27/libpthread/linuxthreads/sysdeps/h8300/sigcontextinfo.h 1970-01-01 01:00:00.000000000 +0100
4312 +++ uClibc-0.9.27-uc0/libpthread/linuxthreads/sysdeps/h8300/sigcontextinfo.h 2004-05-13 03:48:57.000000000 +0200
4314 +/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
4315 + This file is part of the GNU C Library.
4316 + Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>, 1998.
4318 + The GNU C Library is free software; you can redistribute it and/or
4319 + modify it under the terms of the GNU Lesser General Public
4320 + License as published by the Free Software Foundation; either
4321 + version 2.1 of the License, or (at your option) any later version.
4323 + The GNU C Library is distributed in the hope that it will be useful,
4324 + but WITHOUT ANY WARRANTY; without even the implied warranty of
4325 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4326 + Lesser General Public License for more details.
4328 + You should have received a copy of the GNU Lesser General Public
4329 + License along with the GNU C Library; if not, write to the Free
4330 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4331 + 02111-1307 USA. */
4333 +#define SIGCONTEXT int _code, struct sigcontext *
4334 +#define SIGCONTEXT_EXTRA_ARGS _code,
4335 +#define GET_PC(ctx) ((void *) (ctx)->sc_pc)
4336 +#define GET_FRAME(ctx) ((void *) __builtin_frame_address (1))
4337 +#define GET_STACK(ctx) ((void *) (ctx)->sc_usp)
4338 +#define CALL_SIGHANDLER(handler, signo, ctx) \
4339 + (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
4340 diff -urN uClibc-0.9.27/libpthread/linuxthreads/sysdeps/h8300/stackinfo.h uClibc-0.9.27-uc0/libpthread/linuxthreads/sysdeps/h8300/stackinfo.h
4341 --- uClibc-0.9.27/libpthread/linuxthreads/sysdeps/h8300/stackinfo.h 1970-01-01 01:00:00.000000000 +0100
4342 +++ uClibc-0.9.27-uc0/libpthread/linuxthreads/sysdeps/h8300/stackinfo.h 2004-05-13 03:48:57.000000000 +0200
4344 +/* Copyright (C) 1999 Free Software Foundation, Inc.
4345 + This file is part of the GNU C Library.
4347 + The GNU C Library is free software; you can redistribute it and/or
4348 + modify it under the terms of the GNU Lesser General Public
4349 + License as published by the Free Software Foundation; either
4350 + version 2.1 of the License, or (at your option) any later version.
4352 + The GNU C Library is distributed in the hope that it will be useful,
4353 + but WITHOUT ANY WARRANTY; without even the implied warranty of
4354 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4355 + Lesser General Public License for more details.
4357 + You should have received a copy of the GNU Lesser General Public
4358 + License along with the GNU C Library; if not, write to the Free
4359 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4360 + 02111-1307 USA. */
4362 +/* This file contains a bit of information about the stack allocation
4363 + of the processor. */
4365 +#ifndef _STACKINFO_H
4366 +#define _STACKINFO_H 1
4368 +/* On m68k the stack grows down. */
4369 +#define _STACK_GROWS_DOWN 1
4371 +#endif /* stackinfo.h */
4372 diff -urN uClibc-0.9.27/libpthread/linuxthreads/sysdeps/microblaze/pt-machine.h uClibc-0.9.27-uc0/libpthread/linuxthreads/sysdeps/microblaze/pt-machine.h
4373 --- uClibc-0.9.27/libpthread/linuxthreads/sysdeps/microblaze/pt-machine.h 1970-01-01 01:00:00.000000000 +0100
4374 +++ uClibc-0.9.27-uc0/libpthread/linuxthreads/sysdeps/microblaze/pt-machine.h 2005-08-05 03:10:51.000000000 +0200
4377 + * sysdeps/microblaze/pt-machine.h -- microblaze-specific pthread definitions
4379 + * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
4380 + * Copyright (C) 2002 NEC Electronics Corporation
4381 + * Copyright (C) 2002 Miles Bader <miles@gnu.org>
4383 + * This file is subject to the terms and conditions of the GNU Lesser
4384 + * General Public License. See the file COPYING.LIB in the main
4385 + * directory of this archive for more details.
4387 + * Written by Miles Bader <miles@gnu.org>
4391 +# define PT_EI extern inline
4394 +extern long int testandset (int *spinlock);
4395 +extern int __compare_and_swap (long *ptr, long old, long new);
4397 +/* Get some notion of the current stack. Need not be exactly the top
4398 + of the stack, just something somewhere in the current frame. */
4399 +#define CURRENT_STACK_FRAME __stack_pointer
4400 +register char *__stack_pointer __asm__ ("r1");
4402 +#define HAS_COMPARE_AND_SWAP
4403 +#define HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS
4404 +#define IMPLEMENT_TAS_WITH_CAS
4406 +/* Atomically: If *PTR == OLD, set *PTR to NEW and return true,
4407 + otherwise do nothing and return false. */
4408 +PT_EI int __compare_and_swap (long *ptr, long old, long new)
4410 + unsigned long psw;
4412 + /* disable interrupts */
4413 + /* This is ugly ugly ugly! */
4414 + __asm__ __volatile__ ("mfs %0, rmsr;"
4415 + "andi r3, %0, ~2;"
4421 + if (likely (*ptr == old))
4424 + __asm__ __volatile__ ("mts rmsr, %0;" :: "r" (psw)); /* re-enable */
4429 + __asm__ __volatile__ ("mts rmsr, %0;" :: "r" (psw)); /* re-enable */
4434 +/* like above's __compare_and_swap() but it first syncs the memory
4435 + (This is also the difference between both functions in e.g.
4436 + ../powerpc/pt-machine.h)
4437 + Doing this additional sync fixes a hang of __pthread_alt_unlock()
4438 + (Falk Brettschneider <fbrettschneider@baumeroptronic.de>) */
4440 +__compare_and_swap_with_release_semantics (long *p,
4441 + long oldval, long newval)
4443 + __asm__ __volatile__ ("" : : : "memory"); /*MEMORY_BARRIER ();*/
4444 + return __compare_and_swap (p, oldval, newval);
4448 +#ifndef IMPLEMENT_TAS_WITH_CAS
4449 +/* Spinlock implementation; required. */
4450 +PT_EI long int testandset (int *spinlock)
4455 + /* disable interrupts */
4456 + __asm__ __volatile__ ("mfs %0, rmsr;"
4457 + "andi r3, %0, ~2;"
4466 + __asm__ __volatile__ ("mts rmsr, %0;" :: "r" (psw));
4473 + __asm__ __volatile__ ("mts rmsr, %0;" :: "r" (psw));
4481 diff -urN uClibc-0.9.27/libpthread/linuxthreads/sysdeps/microblaze/sigcontextinfo.h uClibc-0.9.27-uc0/libpthread/linuxthreads/sysdeps/microblaze/sigcontextinfo.h
4482 --- uClibc-0.9.27/libpthread/linuxthreads/sysdeps/microblaze/sigcontextinfo.h 1970-01-01 01:00:00.000000000 +0100
4483 +++ uClibc-0.9.27-uc0/libpthread/linuxthreads/sysdeps/microblaze/sigcontextinfo.h 2003-12-01 06:55:43.000000000 +0100
4486 + * sysdeps/v850/sigcontextinfo.h -- v850-specific pthread signal definitions
4488 + * Copyright (C) 2002 NEC Electronics Corporation
4489 + * Copyright (C) 2002 Miles Bader <miles@gnu.org>
4491 + * This file is subject to the terms and conditions of the GNU Lesser
4492 + * General Public License. See the file COPYING.LIB in the main
4493 + * directory of this archive for more details.
4495 + * Written by Miles Bader <miles@gnu.org>
4498 +#include <signal.h>
4500 +#define SIGCONTEXT struct sigcontext *
4501 +#define SIGCONTEXT_EXTRA_ARGS
4502 diff -urN uClibc-0.9.27/librt/kernel-posix-timers.h uClibc-0.9.27-uc0/librt/kernel-posix-timers.h
4503 --- uClibc-0.9.27/librt/kernel-posix-timers.h 2005-01-12 08:59:21.000000000 +0100
4504 +++ uClibc-0.9.27-uc0/librt/kernel-posix-timers.h 2005-07-08 00:55:16.000000000 +0200
4508 #include <sys/types.h>
4509 +#include <pthread.h>
4511 /* Type of timers in the kernel */
4512 typedef int kernel_timer_t;
4513 diff -urN uClibc-0.9.27/Makefile uClibc-0.9.27-uc0/Makefile
4514 --- uClibc-0.9.27/Makefile 2005-01-12 08:59:21.000000000 +0100
4515 +++ uClibc-0.9.27-uc0/Makefile 2005-08-12 04:14:26.000000000 +0200
4517 # In this section, we need .config
4518 -include .config.cmd
4521 +shared: $(SHARED_TARGET)
4522 ifeq ($(strip $(HAVE_SHARED)),y)
4523 @$(MAKE) -C libc shared
4524 @$(MAKE) -C ldso shared
4526 @echo Finally finished compiling...
4529 +UCLIBC_VERSION := $(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL)
4531 include/bits/uClibc_config.h: .config
4532 @if [ ! -x ./extra/config/conf ] ; then \
4533 $(MAKE) -C extra/config conf; \
4534 @@ -359,4 +361,49 @@
4536 .PHONY: dummy subdirs release distclean clean config oldconfig menuconfig
4538 +ifneq ($(SHARED_TARGET),)
4539 +lib/main.o: $(ROOTDIR)/lib/libc/main.c
4540 + $(CC) $(CFLAGS) $(ARCH_CFLAGS) -c -o $@ $(ROOTDIR)/lib/libc/main.c
4542 +bogus $(SHARED_TARGET): lib/libc.a lib/main.o Makefile
4543 + make -C $(ROOTDIR) relink
4544 + $(CC) -nostartfiles -o $(SHARED_TARGET) $(ARCH_CFLAGS) \
4545 + -mid-shared-library -mshared-library-id=0 \
4546 + -Wl,-elf2flt -nostdlib -Wl,-shared-lib-id,${LIBID} \
4548 + -Wl,--whole-archive,lib/libc.a,-lgcc,--no-whole-archive
4549 + $(OBJCOPY) -L _GLOBAL_OFFSET_TABLE_ -L main -L __main -L _start \
4550 + -L __uClibc_main -L __uClibc_start_main -L lib_main \
4551 + -L _exit_dummy_ref \
4552 + -L __do_global_dtors -L __do_global_ctors \
4553 + -L __CTOR_LIST__ -L __DTOR_LIST__ \
4554 + -L _current_shared_library_a5_offset_ \
4555 + $(SHARED_TARGET).gdb
4556 + $(LN) -sf $(SHARED_TARGET).gdb .
4560 +# Target for uClinux distro
4564 + [ -e $(ROMFSDIR)/lib ] || mkdir $(ROMFSDIR)/lib
4565 + if [ "$(SHARED_TARGET)" ]; then \
4566 + $(ROMFSINST) $(SHARED_TARGET) /lib/lib$(LIBID).so; \
4568 +ifeq ($(strip $(HAVE_SHARED)),y)
4569 + set -e; for i in lib/lib*-$(UCLIBC_VERSION).so lib/*.so.*; do \
4570 + if [ -L $$i ]; then \
4571 + $(ROMFSINST) -s `readlink $$i` /$$i; \
4573 + $(ROMFSINST) -p 755 $$i /lib; \
4576 + set -e; if [ -x lib/ld-uClibc-$(UCLIBC_VERSION).so ] ; then \
4577 + $(ROMFSINST) -p 755 lib/ld-uClibc-$(UCLIBC_VERSION).so /lib; \
4579 + /lib/ld-uClibc-$(UCLIBC_VERSION).so \
4580 + /lib/ld-linux.so.2; \
4584 diff -urN uClibc-0.9.27/Rules.mak uClibc-0.9.27-uc0/Rules.mak
4585 --- uClibc-0.9.27/Rules.mak 2005-01-12 08:59:21.000000000 +0100
4586 +++ uClibc-0.9.27-uc0/Rules.mak 2005-07-08 03:28:17.000000000 +0200
4587 @@ -218,7 +218,10 @@
4588 # If -msoft-float isn't supported, we want an error anyway.
4589 # Hmm... might need to revisit this for arm since it has 2 different
4590 # soft float encodings.
4591 +# msoft-float changes m68k target arch, do not add it
4592 +ifneq ($(strip $(TARGET_ARCH)),m68k)
4593 CPU_CFLAGS += -msoft-float
4595 ifeq ($(strip $(TARGET_ARCH)),arm)
4596 # No longer needed with current toolchains, but leave it here for now.
4597 # If anyone is actually still using gcc 2.95 (say), they can uncomment it.
4599 LDFLAGS:= $(CPU_LDFLAGS-y) -shared --warn-common --warn-once -z combreloc
4600 STRIPTOOL:= true -Since_we_are_debugging
4602 - LDFLAGS := $(CPU_LDFLAGS-y) -s -shared --warn-common --warn-once -z combreloc
4603 + LDFLAGS := $(CPU_LDFLAGS-y) -shared --warn-common --warn-once -z combreloc
4606 ifeq ($(UCLIBC_BUILD_RELRO),y)
4609 # Sigh, some stupid versions of gcc can't seem to cope with '-iwithprefix include'
4610 #CFLAGS+=-iwithprefix include
4611 -CFLAGS+=-isystem $(shell $(CC) -print-file-name=include)
4612 +CFLAGS+=-isystem $(shell $(CC) -print-file-name=include || echo)
4614 ifneq ($(DOASSERTS),y)
4619 LIBGCC_CFLAGS ?= $(CFLAGS) $(CPU_CFLAGS-y)
4620 -LIBGCC:=$(shell $(CC) $(LIBGCC_CFLAGS) -print-libgcc-file-name)
4621 +LIBGCC:=$(shell $(CC) $(LIBGCC_CFLAGS) -print-libgcc-file-name || echo)
4622 LIBGCC_DIR:=$(dir $(LIBGCC))
4624 ########################################
4625 @@ -301,11 +304,13 @@
4628 ifeq ($(CONFIG_BINFMT_SHARED_FLAT),y)
4629 - # For the shared version of this, we specify no stack and its library ID
4632 - export LIBID FLTFLAGS
4633 - SHARED_TARGET = lib/libc
4634 + ifndef DISABLE_SHARED_LIBS
4635 + # For the shared version of this, we specify no stack and its library ID
4638 + export LIBID FLTFLAGS
4639 + SHARED_TARGET = lib/libc
4643 TARGET_ARCH:=$(strip $(subst ",, $(strip $(TARGET_ARCH))))