diff options
author | "Steven J. Hill" <sjhill@realitydiluted.com> | 2006-02-27 23:12:57 +0000 |
---|---|---|
committer | "Steven J. Hill" <sjhill@realitydiluted.com> | 2006-02-27 23:12:57 +0000 |
commit | d032c07a7913c9aa932e35eb04a3cccdae8a9a1d (patch) | |
tree | 602adadabd571e89b1288643647510533baef791 | |
parent | 589a76ea96e1153a3d4c30a09ecb6b54546d3bf8 (diff) | |
download | uClibc-alpine-d032c07a7913c9aa932e35eb04a3cccdae8a9a1d.tar.bz2 uClibc-alpine-d032c07a7913c9aa932e35eb04a3cccdae8a9a1d.tar.xz |
Merge from trunk.
-rw-r--r-- | extra/Configs/Config.ia64 | 1 | ||||
-rw-r--r-- | extra/Configs/Config.in | 123 | ||||
-rw-r--r-- | extra/locale/Makefile.in | 6 | ||||
-rw-r--r-- | include/glob.h | 20 | ||||
-rw-r--r-- | libc/unistd/Makefile.in | 11 | ||||
-rw-r--r-- | libc/unistd/getopt-susv3.c | 2 | ||||
-rw-r--r-- | libpthread/linuxthreads.old/manager.c | 14 | ||||
-rw-r--r-- | libpthread/linuxthreads.old/pthread.c | 15 | ||||
-rw-r--r-- | libpthread/linuxthreads.old/sysdeps/ia64/pt-machine.h | 136 | ||||
-rw-r--r-- | libpthread/linuxthreads.old/sysdeps/ia64/tls.h | 139 | ||||
-rw-r--r-- | test/misc/Makefile | 134 | ||||
-rw-r--r-- | utils/ldd.c | 2 |
12 files changed, 442 insertions, 161 deletions
diff --git a/extra/Configs/Config.ia64 b/extra/Configs/Config.ia64 index f13b82302..6c240621a 100644 --- a/extra/Configs/Config.ia64 +++ b/extra/Configs/Config.ia64 @@ -11,7 +11,6 @@ config FORCE_OPTIONS_FOR_ARCH default y select ARCH_LITTLE_ENDIAN select ARCH_HAS_MMU - select HAS_NO_THREADS select ARCH_HAS_NO_LDSO config ARCH_CFLAGS diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in index 151ca35d2..64d4a9fb3 100644 --- a/extra/Configs/Config.in +++ b/extra/Configs/Config.in @@ -21,7 +21,7 @@ config TARGET_bfin bool "bfin (BROKEN)" config TARGET_cris - bool "cris (BROKEN)" + bool "cris" config TARGET_e1 bool "e1 (BROKEN)" @@ -41,6 +41,9 @@ config TARGET_i386 config TARGET_i960 bool "i960 (BROKEN)" +config TARGET_ia64 + bool "ia64" + config TARGET_m68k bool "m68k" @@ -51,10 +54,10 @@ config TARGET_mips bool "mips" config TARGET_nios - bool "nios (BROKEN)" + bool "nios" config TARGET_nios2 - bool "nios2 (BROKEN)" + bool "nios2" config TARGET_powerpc bool "powerpc" @@ -71,6 +74,9 @@ config TARGET_sparc config TARGET_v850 bool "v850 (BROKEN)" +config TARGET_vax + bool "vax" + config TARGET_x86_64 bool "x86_64" @@ -119,6 +125,10 @@ if TARGET_i960 source "extra/Configs/Config.i960" endif +if TARGET_ia64 +source "extra/Configs/Config.ia64" +endif + if TARGET_m68k source "extra/Configs/Config.m68k" endif @@ -159,6 +169,10 @@ if TARGET_v850 source "extra/Configs/Config.v850" endif +if TARGET_vax +source "extra/Configs/Config.vax" +endif + if TARGET_x86_64 source "extra/Configs/Config.x86_64" endif @@ -217,7 +231,7 @@ config FORCE_SHAREABLE_TEXT_SEGMENTS coded shared libraries. config LDSO_LDD_SUPPORT - bool "Native shared library loader 'ldd' support" + bool "Native 'ldd' support" depends on HAVE_SHARED default y help @@ -228,7 +242,7 @@ config LDSO_LDD_SUPPORT shared library loader a little bit smaller. Most people will answer Y. config LDSO_CACHE_SUPPORT - bool "Enable shared library loader cache" + bool "Enable library loader cache (ld.so.conf)" depends on HAVE_SHARED default y help @@ -238,7 +252,7 @@ config LDSO_CACHE_SUPPORT the /etc/ld.so.cache shared library loader cache file. config LDSO_PRELOAD_FILE_SUPPORT - bool "Enable shared library loader preload file support" + bool "Enable library loader preload file (ld.so.preload)" depends on HAVE_SHARED default n help @@ -263,6 +277,18 @@ config LDSO_BASE_FILENAME WARNING: Changing the default prefix could cause problems with binutils' ld ! +config UCLIBC_STATIC_LDCONFIG + bool "Link ldconfig statically" + depends on HAVE_SHARED + default y + help + Enable this option to statically link the ldconfig binary. + + Making ldconfig static can be beneficial if you have a library + problem and need to use ldconfig to recover. Sometimes, it is + preferable to instead keep the size of the system down, in which + case you should disable this option. + config LDSO_RUNPATH bool "Enable ELF RUNPATH tag support" depends on HAVE_SHARED @@ -278,6 +304,7 @@ config LDSO_RUNPATH config UCLIBC_CTOR_DTOR bool "Support global constructors and destructors" + depends on !TARGET_bfin default y help If you wish to build uClibc with support for global constructor @@ -370,21 +397,10 @@ config UCLIBC_HAS_LFS if you are using an older Linux kernel (2.0.x) that lacks large file support. Enabling this option will increase the size of uClibc. -config UCLIBC_STATIC_LDCONFIG - bool "Link ldconfig statically" - default y - help - Enable this option to statically link the ldconfig binary. - - Making ldconfig static can be beneficial if you have a library - problem and need to use ldconfig to recover. Sometimes, it is - preferable to instead keep the size of the system down, in which - case you should disable this option. - choice prompt "Malloc Implementation" - default MALLOC if ! ARCH_HAS_MMU - default MALLOC_STANDARD if ARCH_HAS_MMU + default MALLOC if ! ARCH_USE_MMU + default MALLOC_STANDARD if ARCH_USE_MMU help "malloc" use mmap for all allocations and so works very well on MMU-less systems that do not support the brk() system call. It is pretty smart @@ -416,7 +432,7 @@ config MALLOC_SIMPLE config MALLOC_STANDARD bool "malloc-standard" - depends on ARCH_HAS_MMU + depends on ARCH_USE_MMU endchoice @@ -1099,6 +1115,24 @@ config UCLIBC_HAS_STDIO_FUTEXES If you want to compile uClibc to use futexes for low-level I/O locking, answer Y. Otherwise, answer N. +config UCLIBC_HAS_GETOPT_LONG + bool "Support getopt_long/getopt_long_only" + depends !UCLIBC_HAS_GNU_GETOPT + default y + help + Answer Y if you want to include getopt_long[_only() used by many + apps, even busybox. + + Most people will answer Y. + +config UCLIBC_HAS_GNU_GETSUBOPT + bool "Support glibc getsubopt" + default y + help + Answer Y if you want to include glibc getsubopt() instead of a + smaller SUSv3 compatible getsubopt(). + + Most people will answer Y. endmenu @@ -1174,15 +1208,31 @@ config UCLIBC_HAS_FTW config UCLIBC_HAS_GLOB bool "Support the glob() interface" + depends on UCLIBC_HAS_FNMATCH default y help - The glob interface is somewhat large (weighing in at about 4k). It + The glob interface is somewhat large (weighing in at about 2,5k). It is used fairly often, but is an option since people wanting to go for absolute minimum size may wish to omit it. Most people will answer Y. +config UCLIBC_HAS_GNU_GLOB + bool "Support gnu glob() interface" + depends on UCLIBC_HAS_GLOB + default y + help + The gnu glob interface is somewhat larger (weighing in at about 4,2k) than + it's SuSv3 counterpart (and is out of date). It is an old copy from glibc and + does not support all the GNU specific options. + + Answer Y if you want to include full gnu glob() instead of the smaller SUSv3 + compatible glob(). + It is only default, because it is the old/stable version. + + Most people will answer N. + endmenu @@ -1260,6 +1310,19 @@ config UCLIBC_BUILD_PIE libraries have to be built with -fPIC or -fpic, and all assembler functions must be written as position independent code (PIC). +config UCLIBC_HAS_ARC4RANDOM + bool "Include the arc4random() function" + default n + help + Answer Y to support the OpenBSD-like arc4random() function. This + function picks a random number between 0 and N, and will always return + something even if the random driver is dead. If urandom fails then + gettimeofday(2) will be used as the random seed. This function is + designed to be more dependable than invoking /dev/urandom directly. + OpenSSL and OpenNTPD currently support this function. + + Most people will answer N. + config HAVE_NO_SSP bool default n @@ -1329,7 +1392,7 @@ config UCLIBC_BUILD_RELRO config UCLIBC_BUILD_NOW bool "Build uClibc with NOW" depends on HAVE_SHARED - default y + default n help Build all libraries and executables with -z now. @@ -1355,8 +1418,8 @@ config CROSS_COMPILER_PREFIX config DODEBUG bool "Build uClibc with debugging symbols" - select PTHREADS_DEBUG_SUPPORT if UCLIBC_HAS_THREADS default n + select NOSTRIP help Say Y here if you wish to compile uClibc with debugging symbols. This will allow you to use a debugger to examine uClibc internals @@ -1376,6 +1439,14 @@ config DODEBUG_PT Otherwise, answer N. +config NOSTRIP + bool "Do not build stripped libraries and executables" + default n + help + Say Y here if you do not wish to strip all uClibc libraries and + executables. This increases the size of the binaries considerably. + Most people will answer N. + config DOASSERTS bool "Build uClibc with run-time assertion testing" default n @@ -1458,6 +1529,12 @@ config WARNINGS help Set this to the set of gcc warnings you wish to see while compiling. +config EXTRA_WARNINGS + bool "Enable extra annoying warnings" + default n + help + If you wish to build with extra warnings enabled, say Y here. + config DOMULTI bool "Compile all sources at once into an object" default n diff --git a/extra/locale/Makefile.in b/extra/locale/Makefile.in index 57c9ba213..6c302077f 100644 --- a/extra/locale/Makefile.in +++ b/extra/locale/Makefile.in @@ -163,12 +163,6 @@ $(locale_OUT)/uClibc_locale_data.h: $(locale_OUT)/lt_defines.h $(locale_OUT)/c8t endif -$(locale_OBJ): $(locale_SRC) | $(headers_dep) - $(compile.c) - -$(locale_OBJ:.o=.os): $(locale_SRC) | $(headers_dep) - $(compile.c) - $(top_builddir)include/bits/uClibc_locale_data.h: $(locale_OUT)/uClibc_locale_data.h | $(top_builddir)include/bits/uClibc_config.h cat $< | awk 'BEGIN{i=1}{ if ( /WANT_/ ) i = /endif/ ; else if (i) print $0 }' > $@ diff --git a/include/glob.h b/include/glob.h index 3d401f082..a8b76523e 100644 --- a/include/glob.h +++ b/include/glob.h @@ -53,8 +53,9 @@ typedef __SIZE_TYPE__ size_t; #define GLOB_NOESCAPE (1 << 6)/* Backslashes don't quote metacharacters. */ #define GLOB_PERIOD (1 << 7)/* Leading `.' can be matched by metachars. */ -#if !defined __USE_POSIX2 || defined __USE_BSD || defined __USE_GNU +#if ( !defined __USE_POSIX2 || defined __USE_BSD || defined __USE_GNU ) && defined __UCLIBC_HAS_GNU_GLOB__ # define GLOB_MAGCHAR (1 << 8)/* Set in gl_flags if any metachars seen. */ +#if 0 /* uClibc's gnu glob does not support these */ # define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions. */ # define GLOB_BRACE (1 << 10)/* Expand "{a,b}" to "a" "b". */ # define GLOB_NOMAGIC (1 << 11)/* If no magic chars, return the pattern. */ @@ -71,20 +72,25 @@ typedef __SIZE_TYPE__ size_t; GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \ GLOB_PERIOD) #endif +#else +# define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \ + GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \ + GLOB_PERIOD) +#endif /* Error returns from `glob'. */ #define GLOB_NOSPACE 1 /* Ran out of memory. */ #define GLOB_ABORTED 2 /* Read error. */ #define GLOB_NOMATCH 3 /* No matches found. */ #define GLOB_NOSYS 4 /* Not implemented. */ -#ifdef __USE_GNU +#if defined __USE_GNU && defined __UCLIBC_HAS_GNU_GLOB__ /* Previous versions of this file defined GLOB_ABEND instead of GLOB_ABORTED. Provide a compatibility definition here. */ # define GLOB_ABEND GLOB_ABORTED #endif /* Structure describing a globbing run. */ -#ifdef __USE_GNU +#if defined __USE_GNU && defined __UCLIBC_HAS_GNU_GLOB__ struct stat; #endif typedef struct @@ -92,6 +98,7 @@ typedef struct __size_t gl_pathc; /* Count of paths matched by the pattern. */ char **gl_pathv; /* List of matched pathnames. */ __size_t gl_offs; /* Slots to reserve in `gl_pathv'. */ +#ifdef __UCLIBC_HAS_GNU_GLOB__ int gl_flags; /* Set to FLAGS, maybe | GLOB_MAGCHAR. */ /* If the GLOB_ALTDIRFUNC flag is set, the following functions @@ -110,10 +117,11 @@ typedef struct int (*gl_lstat) (__const char *__restrict, void *__restrict); int (*gl_stat) (__const char *__restrict, void *__restrict); #endif +#endif /* __UCLIBC_HAS_GNU_GLOB__ */ } glob_t; #ifdef __USE_LARGEFILE64 -# ifdef __USE_GNU +# if defined __USE_GNU && defined __UCLIBC_HAS_GNU_GLOB__ struct stat64; # endif typedef struct @@ -121,6 +129,7 @@ typedef struct __size_t gl_pathc; char **gl_pathv; __size_t gl_offs; +#ifdef __UCLIBC_HAS_GNU_GLOB__ int gl_flags; /* If the GLOB_ALTDIRFUNC flag is set, the following functions @@ -139,6 +148,7 @@ typedef struct int (*gl_lstat) (__const char *__restrict, void *__restrict); int (*gl_stat) (__const char *__restrict, void *__restrict); # endif +#endif /* __UCLIBC_HAS_GNU_GLOB__ */ } glob64_t; #endif @@ -180,7 +190,7 @@ extern void globfree64 (glob64_t *__pglob) __THROW; #endif -#ifdef __USE_GNU +#if defined __USE_GNU && defined __UCLIBC_HAS_GNU_GLOB__ /* Return nonzero if PATTERN contains any metacharacters. Metacharacters can be quoted with backslashes if QUOTE is nonzero. diff --git a/libc/unistd/Makefile.in b/libc/unistd/Makefile.in index 4a0bb0734..6e85e10c9 100644 --- a/libc/unistd/Makefile.in +++ b/libc/unistd/Makefile.in @@ -19,9 +19,18 @@ CSRC := $(filter-out daemon.c,$(CSRC)) endif ifeq ($(UCLIBC_HAS_GNU_GETOPT),y) -CSRC := $(filter-out getopt-susv3.c,$(CSRC)) +CSRC := $(filter-out getopt-susv3.c getopt_long-susv3.c,$(CSRC)) else CSRC := $(filter-out getopt.c,$(CSRC)) +ifneq ($(UCLIBC_HAS_GETOPT_LONG),y) +CSRC := $(filter-out getopt_long-susv3.c,$(CSRC)) +endif +endif + +ifeq ($(UCLIBC_HAS_GNU_GETSUBOPT),y) +CSRC := $(filter-out getsubopt-susv3.c,$(CSRC)) +else +CSRC := $(filter-out getsubopt.c,$(CSRC)) endif ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) diff --git a/libc/unistd/getopt-susv3.c b/libc/unistd/getopt-susv3.c index 70a616011..df36bfbb8 100644 --- a/libc/unistd/getopt-susv3.c +++ b/libc/unistd/getopt-susv3.c @@ -59,6 +59,7 @@ int optind = 1; int optopt = 0; char *optarg = NULL; +libc_hidden_proto(getopt) int getopt(int argc, char * const argv[], const char *optstring) { static const char *o; /* multi opt position */ @@ -135,3 +136,4 @@ int getopt(int argc, char * const argv[], const char *optstring) DONE: return retval; } +libc_hidden_def(getopt) diff --git a/libpthread/linuxthreads.old/manager.c b/libpthread/linuxthreads.old/manager.c index df26344e7..e57080d17 100644 --- a/libpthread/linuxthreads.old/manager.c +++ b/libpthread/linuxthreads.old/manager.c @@ -583,9 +583,16 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, __pthread_lock(new_thread->p_lock, NULL); /* We have to report this event. */ +#ifdef __ia64__ + pid = __clone2(pthread_start_thread_event, (void **) new_thread, + (char *)new_thread - new_thread_bottom, + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | + __pthread_sig_cancel, new_thread); +#else pid = clone(pthread_start_thread_event, (void **) new_thread, CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | __pthread_sig_cancel, new_thread); +#endif saved_errno = errno; if (pid != -1) @@ -614,9 +621,16 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, if (pid == 0) { PDEBUG("cloning new_thread = %p\n", new_thread); +#ifdef __ia64__ + pid = __clone2(pthread_start_thread, (void **) new_thread, + (char *)new_thread - new_thread_bottom, + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | + __pthread_sig_cancel, new_thread); +#else pid = clone(pthread_start_thread, (void **) new_thread, CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | __pthread_sig_cancel, new_thread); +#endif saved_errno = errno; } /* Check if cloning succeeded */ diff --git a/libpthread/linuxthreads.old/pthread.c b/libpthread/linuxthreads.old/pthread.c index 4adf66cd6..d9adfa432 100644 --- a/libpthread/linuxthreads.old/pthread.c +++ b/libpthread/linuxthreads.old/pthread.c @@ -528,10 +528,18 @@ int __pthread_initialize_manager(void) __pthread_lock(__pthread_manager_thread.p_lock, NULL); +#ifdef __ia64__ + pid = __clone2(__pthread_manager_event, + (void **) __pthread_manager_thread_tos, + THREAD_MANAGER_STACK_SIZE, + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, + (void *)(long)manager_pipe[0]); +#else pid = clone(__pthread_manager_event, (void **) __pthread_manager_thread_tos, CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, (void *)(long)manager_pipe[0]); +#endif if (pid != -1) { @@ -555,9 +563,16 @@ int __pthread_initialize_manager(void) } if (pid == 0) { +#ifdef __ia64__ + pid = __clone2(__pthread_manager, (void **) __pthread_manager_thread_tos, + THREAD_MANAGER_STACK_SIZE, + CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, + (void *)(long)manager_pipe[0]); +#else pid = clone(__pthread_manager, (void **) __pthread_manager_thread_tos, CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, (void *)(long)manager_pipe[0]); +#endif } if (pid == -1) { free(__pthread_manager_thread_bos); diff --git a/libpthread/linuxthreads.old/sysdeps/ia64/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/ia64/pt-machine.h new file mode 100644 index 000000000..98cd183f8 --- /dev/null +++ b/libpthread/linuxthreads.old/sysdeps/ia64/pt-machine.h @@ -0,0 +1,136 @@ +/* Machine-dependent pthreads configuration and inline functions. + IA-64 version. + Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _PT_MACHINE_H +#define _PT_MACHINE_H 1 + +#include <ia64intrin.h> + +extern int __clone2 (int (*__fn) (void *__arg), void *__child_stack_base, + size_t __child_stack_size, int __flags, void *__arg, ...); + +#ifndef PT_EI +# define PT_EI extern inline __attribute__ ((always_inline)) +#endif + +extern long int testandset (int *spinlock); +extern int __compare_and_swap (long int *p, long int oldval, long int newval); + +/* Make sure gcc doesn't try to be clever and move things around on + us. We need to use _exactly_ the address the user gave us, not some + alias that contains the same information. */ +#define __atomic_fool_gcc(x) (*(volatile struct { int a[100]; } *)x) + +#ifndef ELF_MACHINE_NAME + +#define NEED_SEPARATE_REGISTER_STACK + +/* We want the OS to assign stack addresses. */ +#define FLOATING_STACKS 1 + +/* Maximum size of the stack if the rlimit is unlimited. */ +#define ARCH_STACK_MAX_SIZE 32*1024*1024 + +/* Get some notion of the current stack. Need not be exactly the top + of the stack, just something somewhere in the current frame. + r12 (sp) is the stack pointer. */ +#define CURRENT_STACK_FRAME stack_pointer +register char *stack_pointer __asm__ ("sp"); + + +/* Register r13 (tp) is reserved by the ABI as "thread pointer". */ +struct _pthread_descr_struct; +register struct _pthread_descr_struct *__thread_self __asm__("r13"); + +/* Return the thread descriptor for the current thread. */ +#define THREAD_SELF __thread_self + +/* Initialize the thread-unique value. */ +#define INIT_THREAD_SELF(descr, nr) (__thread_self = (descr)) + + +/* Access to data in the thread descriptor is easy. */ +#define THREAD_GETMEM(descr, member) \ + ((void) sizeof (descr), THREAD_SELF->member) +#define THREAD_GETMEM_NC(descr, member) \ + ((void) sizeof (descr), THREAD_SELF->member) +#define THREAD_SETMEM(descr, member, value) \ + ((void) sizeof (descr), THREAD_SELF->member = (value)) +#define THREAD_SETMEM_NC(descr, member, value) \ + ((void) sizeof (descr), THREAD_SELF->member = (value)) + + +/* Memory barrier */ +#define MEMORY_BARRIER() __sync_synchronize () + + +#define HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS + +PT_EI int +__compare_and_swap (long int *p, long int oldval, long int newval) +{ + long int readval; + + __asm__ __volatile__ + ("mov ar.ccv=%4;;\n\t" + "cmpxchg8.acq %0=%1,%2,ar.ccv" + : "=r" (readval), "=m" (__atomic_fool_gcc (p)) + : "r"(newval), "m" (__atomic_fool_gcc (p)), "r" (oldval) + : "memory"); + return readval == oldval; +} + +PT_EI int +__compare_and_swap_with_release_semantics (long int *p, + long int oldval, + long int newval) +{ + long int readval; + + __asm__ __volatile__ + ("mov ar.ccv=%4;;\n\t" + "cmpxchg8.rel %0=%1,%2,ar.ccv" + : "=r" (readval), "=m" (__atomic_fool_gcc (p)) + : "r"(newval), "m" (__atomic_fool_gcc (p)), "r" (oldval) + : "memory"); + return readval == oldval; +} + +#endif /* ELF_MACHINE_NAME */ + +/* Spinlock implementation; required. */ +PT_EI long int +testandset (int *spinlock) +{ + long int ret; + + __asm__ __volatile__( + "xchg4 %0=%1,%2" + : "=r"(ret), "=m"(__atomic_fool_gcc (spinlock)) + : "r"(1), "m"(__atomic_fool_gcc (spinlock)) + : "memory"); + + return ret; +} + +/* Indicate that we are looping. */ +#define BUSY_WAIT_NOP __asm__ ("hint @pause") + +#endif /* pt-machine.h */ diff --git a/libpthread/linuxthreads.old/sysdeps/ia64/tls.h b/libpthread/linuxthreads.old/sysdeps/ia64/tls.h new file mode 100644 index 000000000..81b41eb73 --- /dev/null +++ b/libpthread/linuxthreads.old/sysdeps/ia64/tls.h @@ -0,0 +1,139 @@ +/* Definitions for thread-local data handling. linuxthreads/IA-64 version. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _TLS_H +#define _TLS_H + +#ifndef __ASSEMBLER__ + +# include <pt-machine.h> +# include <stdbool.h> +# include <stddef.h> + +/* Type for the dtv. */ +typedef union dtv +{ + size_t counter; + struct + { + void *val; + bool is_static; + } pointer; +} dtv_t; + +#else /* __ASSEMBLER__ */ +# include <tcb-offsets.h> +#endif /* __ASSEMBLER__ */ + +#ifdef HAVE_TLS_SUPPORT + +/* Signal that TLS support is available. */ +# define USE_TLS 1 + +# ifndef __ASSEMBLER__ + +typedef struct +{ + dtv_t *dtv; + void *private; +} tcbhead_t; + +/* This is the size of the initial TCB. */ +# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t) + +/* Alignment requirements for the initial TCB. */ +# define TLS_INIT_TCB_ALIGN __alignof__ (tcbhead_t) + +/* This is the size of the TCB. */ +# define TLS_TCB_SIZE sizeof (tcbhead_t) + +/* This is the size we need before TCB. */ +# define TLS_PRE_TCB_SIZE sizeof (struct _pthread_descr_struct) + +/* Alignment requirements for the TCB. */ +# define TLS_TCB_ALIGN __alignof__ (struct _pthread_descr_struct) + +/* The DTV is allocated at the TP; the TCB is placed elsewhere. */ +# define TLS_DTV_AT_TP 1 + +/* Install the dtv pointer. The pointer passed is to the element with + index -1 which contain the length. */ +# define INSTALL_DTV(tcbp, dtvp) \ + ((tcbhead_t *) (tcbp))->dtv = (dtvp) + 1 + +/* Install new dtv for current thread. */ +# define INSTALL_NEW_DTV(DTV) \ + (((tcbhead_t *)__thread_self)->dtv = (DTV)) + +/* Return dtv of given thread descriptor. */ +# define GET_DTV(tcbp) \ + (((tcbhead_t *) (tcbp))->dtv) + +#if defined NEED_DL_SYSINFO +# define INIT_SYSINFO \ + (((tcbhead_t *) __thread_self)->private = (void *) GLRO(dl_sysinfo)) +#else +# define INIT_SYSINFO 0 +#endif + +/* Code to initially initialize the thread pointer. This might need + special attention since 'errno' is not yet available and if the + operation can cause a failure 'errno' must not be touched. */ +# define TLS_INIT_TP(tcbp, secondcall) \ + (__thread_self = (__typeof (__thread_self)) (tcbp), INIT_SYSINFO, NULL) + +/* Return the address of the dtv for the current thread. */ +# define THREAD_DTV() \ + (((tcbhead_t *)__thread_self)->dtv) + +/* Return the thread descriptor for the current thread. */ +# undef THREAD_SELF +# define THREAD_SELF (__thread_self - 1) + +# undef INIT_THREAD_SELF +# define INIT_THREAD_SELF(descr, nr) \ + (__thread_self = (struct _pthread_descr_struct *)(descr) + 1) + +# define TLS_MULTIPLE_THREADS_IN_TCB 1 + +# endif + +#else + +# ifndef __ASSEMBLER__ + +typedef struct +{ + void *tcb; + dtv_t *dtv; + void *self; + int multiple_threads; +} tcbhead_t; + +# define NONTLS_INIT_TP \ + do { \ + static const tcbhead_t nontls_init_tp = { .multiple_threads = 0 }; \ + __thread_self = (__typeof (__thread_self)) &nontls_init_tp; \ + } while (0) + +#endif + +#endif /* USE_TLS */ + +#endif /* tls.h */ diff --git a/test/misc/Makefile b/test/misc/Makefile index a8921913a..ca9f51c42 100644 --- a/test/misc/Makefile +++ b/test/misc/Makefile @@ -1,130 +1,14 @@ -# Makefile for uClibc -# -# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org> -# -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU Library General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) any -# later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more -# details. -# -# You should have received a copy of the GNU Library General Public License -# along with this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# uClibc misc tests +# Licensed under the GNU Library General Public License, see COPYING.LIB -include ../Rules.mak +TESTS_DISABLED := outb tst-fnmatch -CFLAGS64=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 +include ../Test.mak -TARGETS=sem fdopen dirent_diff dirent64_diff #outb -all: $(TARGETS) +CFLAGS_dirent64 := -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 +CFLAGS_tst-regex2 := -std=c99 -outb: outb.c ../testsuite.h Makefile $(TESTDIR)/Rules.mak - -@ echo "-------" - -@ echo " " - -@ echo "Compiling $@ vs uClibc: " - -@ echo " " - $(CC) $(CFLAGS) -c $< -o $@.o - $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - $(STRIPTOOL) -x -R .note -R .comment $@ - ./$@ - -@ echo " " +DODIFF_dirent := 1 +DODIFF_dirent64 := 1 -sem: sem.c Makefile $(TESTDIR)/Rules.mak - -@ echo "-------" - -@ echo " " - -@ echo "Compiling $@ vs uClibc: " - -@ echo " " - $(CC) $(CFLAGS) -c $< -o $@.o - $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - $(STRIPTOOL) -x -R .note -R .comment $@ - ./$@ - -@ echo " " - -fdopen: fdopen.c Makefile $(TESTDIR)/Rules.mak - -@ echo "-------" - -@ echo " " - -@ echo "Compiling $@ vs uClibc: " - -@ echo " " - $(CC) $(CFLAGS) -c $< -o $@.o - $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - $(STRIPTOOL) -x -R .note -R .comment $@ - ./$@ - -@ echo " " - -dirent_source: - -@ $(RM) $(TARGETS) - -@ echo "-------" - -@ echo "dirent.c source: " - -@ echo " " - -@ cat dirent.c - -@ echo " " - -dirent: dirent.c Makefile $(TESTDIR)/Rules.mak - -@ echo "-------" - -@ echo " " - -@ echo "Compiling $@ vs uClibc: " - -@ echo " " - $(CC) $(CFLAGS) -c $< -o $@.o - $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - $(STRIPTOOL) -x -R .note -R .comment $@ - ./$@ dirent.c > $@.out - -@ echo " " - -dirent_glibc: dirent.c Makefile - -@ echo "-------" - -@ echo " " - -@ echo "Compiling $@ vs glibc: " - -@ echo " " - $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o - $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ - $(STRIPTOOL) -x -R .note -R .comment $@ - ./$@ dirent.c > $@.out - -@ echo " " - -dirent_diff: dirent dirent_glibc - -@ echo "-------" - -@ echo " " - -@ echo "Diffing dirent output: " - -@ echo " " - -diff -u dirent_glibc.out dirent.out - -@ echo " " - -dirent64: dirent.c Makefile $(TESTDIR)/Rules.mak - -@ echo "-------" - -@ echo " " - -@ echo "Compiling $@ vs uClibc: " - -@ echo " " - $(CC) $(CFLAGS) $(CFLAGS64) -c $< -o $@.o - $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - $(STRIPTOOL) -x -R .note -R .comment $@ - ./$@ dirent.c > $@.out - -@ echo " " - -dirent64_glibc: dirent.c Makefile - -@ echo "-------" - -@ echo " " - -@ echo "Compiling $@ vs glibc: " - -@ echo " " - $(HOSTCC) $(GLIBC_CFLAGS) $(CFLAGS64) -c $< -o $@.o - $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ - $(STRIPTOOL) -x -R .note -R .comment $@ - ./$@ dirent.c > $@.out - -@ echo " " - -dirent64_diff: dirent64 dirent64_glibc - -@ echo "-------" - -@ echo " " - -@ echo "Diffing dirent64 output: " - -@ echo " " - -diff -u dirent64_glibc.out dirent64.out - -@ echo " " - -clean: - $(RM) *.[oa] *~ core dirent dirent_glibc dirent_glibc.out dirent.out \ - dirent64 dirent64_glibc dirent64_glibc.out dirent64.out \ - outb sem fdopen +OPTS_tst-fnmatch := < tst-fnmatch.input diff --git a/utils/ldd.c b/utils/ldd.c index 314798354..ed0551175 100644 --- a/utils/ldd.c +++ b/utils/ldd.c @@ -645,7 +645,9 @@ static struct library * find_elf_interpreter(ElfW(Ehdr)* ehdr) } /* map the .so, and locate interesting pieces */ +/* #warning "There may be two warnings here about vfork() clobbering, ignore them" +*/ int find_dependancies(char* filename) { int is_suid = 0; |