diff options
Diffstat (limited to 'libpthread/nptl/sysdeps')
28 files changed, 194 insertions, 216 deletions
diff --git a/libpthread/nptl/sysdeps/i386/tls.h b/libpthread/nptl/sysdeps/i386/tls.h index c0331140f..65566ff7a 100644 --- a/libpthread/nptl/sysdeps/i386/tls.h +++ b/libpthread/nptl/sysdeps/i386/tls.h @@ -49,6 +49,7 @@ typedef struct void *self; /* Pointer to the thread descriptor. */ int multiple_threads; uintptr_t sysinfo; + uintptr_t stack_guard; } tcbhead_t; # define TLS_MULTIPLE_THREADS_IN_TCB 1 @@ -416,6 +417,14 @@ union user_desc_init __res; }) +/* Set the stack guard field in TCB head. */ +#define THREAD_SET_STACK_GUARD(value) \ + THREAD_SETMEM (THREAD_SELF, header.stack_guard, value) +#define THREAD_COPY_STACK_GUARD(descr) \ + ((descr)->header.stack_guard \ + = THREAD_GETMEM (THREAD_SELF, header.stack_guard)) + + #endif /* __ASSEMBLER__ */ #endif /* tls.h */ diff --git a/libpthread/nptl/sysdeps/mips/Makefile b/libpthread/nptl/sysdeps/mips/Makefile index 5a1d6bff1..851d3b841 100644 --- a/libpthread/nptl/sysdeps/mips/Makefile +++ b/libpthread/nptl/sysdeps/mips/Makefile @@ -25,25 +25,32 @@ CFLAGS-dl-support.c = -D_GNU_SOURCE AR_LIBP_AOBJS = $(patsubst %.S, %.o, $(wildcard *.S)) SO_LIBP_AOBJS = $(patsubst %.S, %.os, $(wildcard *.S)) -AR_LIBC_COBJS = $(patsubst %.c, %.o, $(wildcard *.c)) +AR_LIBP_COBJS = $(patsubst %.c, %.o, pt-raise.c) +SO_LIBP_COBJS = $(patsubst %.c, %.os, pt-raise.c) + +AR_LIBC_COBJS = $(patsubst %.c, %.o, dl-support.c dl-tls.c libc-tls.c) all: $(AR_LIB_NAME) $(AR_SO_LIB_NAME) -$(AR_LIB_NAME): $(AR_LIBP_AOBJS) +$(AR_LIB_NAME): $(AR_LIBP_AOBJS) $(AR_LIBP_COBJS) ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y) - $(STRIPTOOL) -X --strip-debug -R .note -R .comment $(AR_LIBP_AOBJS) + $(STRIPTOOL) -X --strip-debug -R .note -R .comment \ + $(AR_LIBP_AOBJS) $(AR_LIBP_COBJS) else - $(STRIPTOOL) -x -R .note -R .comment $(AR_LIBP_AOBJS) $(AR_LIBP_AOBJS) + $(STRIPTOOL) -x -R .note -R .comment \ + $(AR_LIBP_AOBJS) $(AR_LIBP_COBJS) endif - $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(AR_LIBP_AOBJS) + $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(AR_LIBP_AOBJS) $(AR_LIBP_COBJS) -$(AR_SO_LIB_NAME): $(SO_LIBP_AOBJS) +$(AR_SO_LIB_NAME): $(SO_LIBP_AOBJS) $(SO_LIBP_COBJS) ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y) - $(STRIPTOOL) -X --strip-debug -R .note -R .comment $(SO_LIBP_AOBJS) + $(STRIPTOOL) -X --strip-debug -R .note -R .comment \ + $(SO_LIBP_AOBJS) $(SO_LIBP_COBJS) else - $(STRIPTOOL) -x -R .note -R .comment $(AR_LIBP_AOBJS) $(SO_LIBP_AOBJS) + $(STRIPTOOL) -x -R .note -R .comment \ + $(SO_LIBP_AOBJS) $(SO_LIBP_COBJS) endif - $(AR) $(ARFLAGS) $(AR_SO_LIB_NAME) $(SO_LIBP_AOBJS) + $(AR) $(ARFLAGS) $(AR_SO_LIB_NAME) $(SO_LIBP_AOBJS) $(SO_LIBP_COBJS) obj.pthread.ar: $(AR_LIBC_COBJS) ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y) @@ -57,13 +64,19 @@ endif done $(AR_LIBP_AOBJS): %.o : %.S - $(CC) $(ASFLAGS) $(ASFLAGS-NPTL) -c $< -o $@ + $(CC) $(ASFLAGS-NPTL) -c $< -o $@ $(SO_LIBP_AOBJS): %.os : %.S - $(CC) $(ASFLAGS) $(ASFLAGS-NPTL) -DSHARED -c $< -o $@ + $(CC) $(ASFLAGS-NPTL) -DSHARED -c $< -o $@ + +$(AR_LIBP_COBJS): %.o : %.c + $(CC) $(CFLAGS-$<) $(CFLAGS-LIBP) -c $< -o $@ + +$(SO_LIBP_COBJS): %.os : %.c + $(CC) $(CFLAGS-$<) $(CFLAGS-LIBP) -DSHARED -c $< -o $@ $(AR_LIBC_COBJS): %.o : %.c - $(CC) $(CFLAGS-LIBC) $(CFLAGS-$<) -c $< -o $@ + $(CC) $(CFLAGS-$<) $(CFLAGS-LIBC) -c $< -o $@ clean: $(RM) *.o *.os *~ core diff --git a/libpthread/nptl/sysdeps/mips/dl-support.c b/libpthread/nptl/sysdeps/mips/dl-support.c index 528ffffc5..7ed833fc6 100644 --- a/libpthread/nptl/sysdeps/mips/dl-support.c +++ b/libpthread/nptl/sysdeps/mips/dl-support.c @@ -1 +1 @@ -#include <sysdeps/generic/dl-support.c> +#include <../generic/dl-support.c> diff --git a/libpthread/nptl/sysdeps/mips/jmpbuf-unwind.h b/libpthread/nptl/sysdeps/mips/jmpbuf-unwind.h index e882f13b2..a9cfe43b3 100644 --- a/libpthread/nptl/sysdeps/mips/jmpbuf-unwind.h +++ b/libpthread/nptl/sysdeps/mips/jmpbuf-unwind.h @@ -27,8 +27,4 @@ ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[0].__sp - (_adj)) /* We use the normal longjmp for unwinding. */ -#ifdef __UCLIBC__ #define __libc_unwind_longjmp(buf, val) longjmp (buf, val) -#else -#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val) -#endif diff --git a/libpthread/nptl/sysdeps/mips/libc-tls.c b/libpthread/nptl/sysdeps/mips/libc-tls.c index 157ba3389..fdedc9f5a 100644 --- a/libpthread/nptl/sysdeps/mips/libc-tls.c +++ b/libpthread/nptl/sysdeps/mips/libc-tls.c @@ -17,7 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include <sysdeps/generic/libc-tls.c> +#include <../generic/libc-tls.c> #include <dl-tls.h> #if USE_TLS diff --git a/libpthread/nptl/sysdeps/powerpc/tls.h b/libpthread/nptl/sysdeps/powerpc/tls.h index a7f69074e..b2322b09b 100644 --- a/libpthread/nptl/sysdeps/powerpc/tls.h +++ b/libpthread/nptl/sysdeps/powerpc/tls.h @@ -65,11 +65,11 @@ typedef union dtv /* Get the thread descriptor definition. */ # include <nptl/descr.h> -/* This layout is actually wholly private and not affected by the ABI. - Nor does it overlap the pthread data structure, so we need nothing - extra here at all. */ +/* The stack_guard is accessed directly by GCC -fstack-protector code, + so it is a part of public ABI. The dtv field is private. */ typedef struct { + uintptr_t stack_guard; dtv_t *dtv; } tcbhead_t; @@ -127,7 +127,7 @@ register void *__thread_register __asm__ ("r13"); /* Return the address of the dtv for the current thread. */ # define THREAD_DTV() \ - (((tcbhead_t *) (__thread_register - TLS_TCB_OFFSET))[-1].dtv) + (((tcbhead_t *) (__thread_register - TLS_TCB_OFFSET))[-1].dtv) /* Return the thread descriptor for the current thread. */ # define THREAD_SELF \ @@ -136,9 +136,9 @@ register void *__thread_register __asm__ ("r13"); /* Magic for libthread_db to know how to do THREAD_SELF. */ # define DB_THREAD_SELF \ - REGISTER (32, 32, PT_THREAD_POINTER * 4, \ + REGISTER (32, 32, PT_THREAD_POINTER * 4, \ - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE) \ - REGISTER (64, 64, PT_THREAD_POINTER * 8, \ + REGISTER (64, 64, PT_THREAD_POINTER * 8, \ - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE) /* Read member of the thread descriptor directly. */ @@ -156,6 +156,16 @@ register void *__thread_register __asm__ ("r13"); # define THREAD_SETMEM_NC(descr, member, idx, value) \ ((void)(descr), (THREAD_SELF)->member[idx] = (value)) +/* Set the stack guard field in TCB head. */ +# define THREAD_SET_STACK_GUARD(value) \ + (((tcbhead_t *) ((char *) __thread_register \ + - TLS_TCB_OFFSET))[-1].stack_guard = (value)) +# define THREAD_COPY_STACK_GUARD(descr) \ + (((tcbhead_t *) ((char *) (descr) \ + + TLS_PRE_TCB_SIZE))[-1].stack_guard \ + = ((tcbhead_t *) ((char *) __thread_register \ + - TLS_TCB_OFFSET))[-1].stack_guard) + /* l_tls_offset == 0 is perfectly valid on PPC, so we have to use some different value to mean unset l_tls_offset. */ # define NO_TLS_OFFSET -1 diff --git a/libpthread/nptl/sysdeps/pthread/Makefile b/libpthread/nptl/sysdeps/pthread/Makefile index 280db89f1..0f03668e1 100644 --- a/libpthread/nptl/sysdeps/pthread/Makefile +++ b/libpthread/nptl/sysdeps/pthread/Makefile @@ -32,20 +32,26 @@ CSRC = pthread_barrier_wait.c pthread_cond_broadcast.c pthread_cond_signal.c \ pthread_rwlock_timedwrlock.c pthread_rwlock_unlock.c \ pthread_rwlock_wrlock.c pthread_sigmask.c pthread_spin_destroy.c \ pthread_spin_init.c pthread_spin_unlock.c sigaction.c \ - unwind-forcedunwind.c + sigfillset.c sigprocmask.c unwind-forcedunwind.c -# -# Needed to get pthread types. -# CFLAGS-pthread_barrier_wait.c = -D_GNU_SOURCE CFLAGS-pthread_spin_destroy.c = -D_GNU_SOURCE CFLAGS-pthread_spin_init.c = -D_GNU_SOURCE CFLAGS-pthread_spin_unlock.c = -D_GNU_SOURCE +CFLAGS-sigaction.c = -I$(TOPDIR)libc/sysdeps/linux/$(TARGET_ARCH) \ + -I$(TOPDIR)libc/signal +CFLAGS-sigfillset.c = -I$(TOPDIR)libc/sysdeps/linux/$(TARGET_ARCH) \ + -I$(TOPDIR)libc/signal +CFLAGS-sigprocmask.c = -I$(TOPDIR)libc/sysdeps/linux/common AR_LIBP_COBJS = $(patsubst %.c, %.o, $(CSRC)) SO_LIBP_COBJS = $(patsubst %.c, %.os, $(CSRC)) +ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y) +all: $(AR_LIB_NAME) $(AR_SO_LIB_NAME) crti.o crtn.o +else all: $(AR_LIB_NAME) $(AR_SO_LIB_NAME) +endif $(AR_LIB_NAME): $(AR_LIBP_COBJS) ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y) @@ -64,12 +70,39 @@ endif $(AR) $(ARFLAGS) $(AR_SO_LIB_NAME) $(SO_LIBP_COBJS) $(AR_LIBP_COBJS): %.o : %.c - $(CC) $(CFLAGS-$<) $(CFLAGS-LIBP) -c $< -o $@ + $(CC) $(CFLAGS-LIBP) $(CFLAGS-$<) -c $< -o $@ $(SO_LIBP_COBJS): %.os : %.c - $(CC) $(CFLAGS-$<) $(CFLAGS-LIBP) -DSHARED -c $< -o $@ + $(CC) $(CFLAGS-LIBP) $(CFLAGS-$<) -DSHARED -c $< -o $@ + +pt-initfini.s: pt-initfini.c + $(CC) -S $(CFLAGS-LIBP) -g0 -fPIC -fno-inline-functions \ + $(call check_gcc,-fno-unit-at-a-time,) \ + -finhibit-size-directive \ + $(patsubst -f%,-fno-%,$(call check_gcc,-fexceptions,)) \ + $< -o $@ + +crti.S: pt-initfini.s + sed -n -e '1,/@HEADER_ENDS/p' \ + -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \ + -e '/@TRAILER_BEGINS/,$$p' $< > $@ + +crtn.S: pt-initfini.s + sed -n -e '1,/@HEADER_ENDS/p' \ + -e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \ + -e '/@TRAILER_BEGINS/,$$p' $< > $@ + +defs.h: pt-initfini.s defs.awk + sed -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \ + awk -f defs.awk > $@ + +crti.o: crti.S defs.h + $(CC) -g0 $(ASFLAGS-LIBC) -c $< -o $@ + +crtn.o: crtn.S defs.h + $(CC) -g0 $(ASFLAGS-LIBC) -c $< -o $@ clean: - $(RM) *.o *.os *~ core + $(RM) *.o *.os *.s crt* *~ core defs.h .PHONY: $(AR_LIB_NAME) $(AR_SO_LIB_NAME) diff --git a/libpthread/nptl/sysdeps/pthread/pthread.h b/libpthread/nptl/sysdeps/pthread/pthread.h index 7157e4718..e2601c609 100644 --- a/libpthread/nptl/sysdeps/pthread/pthread.h +++ b/libpthread/nptl/sysdeps/pthread/pthread.h @@ -26,11 +26,7 @@ #define __need_sigset_t #include <signal.h> #include <bits/pthreadtypes.h> -#ifdef __UCLIBC__ #include <setjmp.h> -#else -#include <bits/setjmp.h> -#endif #include <bits/wordsize.h> @@ -66,22 +62,22 @@ enum /* Mutex initializers. */ #define PTHREAD_MUTEX_INITIALIZER \ - { { 0, } } + { { 0, 0, 0, 0, 0, 0 } } #ifdef __USE_GNU # if __WORDSIZE == 64 # define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \ - { { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP } } + { { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, 0 } } # define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \ - { { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP } } + { { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, 0 } } # define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \ - { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP } } + { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, 0 } } # else # define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \ - { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP } } + { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, 0, 0 } } # define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \ - { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP } } + { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, 0, 0 } } # define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \ - { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP } } + { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, 0, 0 } } # endif #endif @@ -97,8 +93,13 @@ enum }; /* Read-write lock initializers. */ -# define PTHREAD_RWLOCK_INITIALIZER \ - { { 0, } } +# if __WORDSIZE == 64 +# define PTHREAD_RWLOCK_INITIALIZER \ + { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } +# else +# define PTHREAD_RWLOCK_INITIALIZER \ + { { 0, 0, 0, 0, 0, 0, 0, 0 } } +# endif # ifdef __USE_GNU # if __WORDSIZE == 64 # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \ @@ -106,7 +107,7 @@ enum PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP } } # else # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \ - { { 0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP } } + { { 0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, 0 } } # endif # endif #endif /* Unix98 or XOpen2K */ @@ -144,7 +145,7 @@ enum /* Conditional variable handling. */ -#define PTHREAD_COND_INITIALIZER { { 0, } } +#define PTHREAD_COND_INITIALIZER { { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } } /* Cleanup buffers */ diff --git a/libpthread/nptl/sysdeps/pthread/sigaction.c b/libpthread/nptl/sysdeps/pthread/sigaction.c index 62f9daa3c..6ec1153ba 100644 --- a/libpthread/nptl/sysdeps/pthread/sigaction.c +++ b/libpthread/nptl/sysdeps/pthread/sigaction.c @@ -22,32 +22,19 @@ exact file anyway. */ #ifndef LIBC_SIGACTION -#include <features.h> - -#ifdef __UCLIBC__ -#include <errno.h> -#include <signal.h> #include <pthreadP.h> -#else -#include <nptl/pthreadP.h> -#endif /* We use the libc implementation but we tell it to not allow SIGCANCEL or SIGTIMER to be handled. */ # define LIBC_SIGACTION 1 -#ifndef __UCLIBC__ -# include <nptl/sysdeps/pthread/sigaction.c> +# include_next <sigaction.c> int __sigaction (sig, act, oact) int sig; const struct sigaction *act; struct sigaction *oact; -#else -int -__sigaction (int sig, const struct sigaction *act, struct sigaction *oact) -#endif { if (__builtin_expect (sig == SIGCANCEL || sig == SIGSETXID, 0)) { @@ -55,16 +42,10 @@ __sigaction (int sig, const struct sigaction *act, struct sigaction *oact) return -1; } -#ifdef __UCLIBC__ - return sigaction (sig, act, oact); -#else return __libc_sigaction (sig, act, oact); -#endif } libc_hidden_weak (__sigaction) -#ifndef __UCLIBC__ weak_alias (__sigaction, sigaction) -#endif #else diff --git a/libpthread/nptl/sysdeps/pthread/sigfillset.c b/libpthread/nptl/sysdeps/pthread/sigfillset.c index fe58ccd53..c95847f65 100644 --- a/libpthread/nptl/sysdeps/pthread/sigfillset.c +++ b/libpthread/nptl/sysdeps/pthread/sigfillset.c @@ -16,6 +16,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include <nptl/pthreadP.h> +#include <pthreadP.h> -#include <sysdeps/generic/sigfillset.c> +#include_next <sigfillset.c> diff --git a/libpthread/nptl/sysdeps/pthread/sigprocmask.c b/libpthread/nptl/sysdeps/pthread/sigprocmask.c index 855b43396..3c3209384 100644 --- a/libpthread/nptl/sysdeps/pthread/sigprocmask.c +++ b/libpthread/nptl/sysdeps/pthread/sigprocmask.c @@ -16,5 +16,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include <nptl/pthreadP.h> -#include <sysdeps/unix/sysv/linux/sigprocmask.c> +#include <pthreadP.h> + +#include_next <sigprocmask.c> diff --git a/libpthread/nptl/sysdeps/sparc/tls.h b/libpthread/nptl/sysdeps/sparc/tls.h index 54b54859d..ddc484855 100644 --- a/libpthread/nptl/sysdeps/sparc/tls.h +++ b/libpthread/nptl/sysdeps/sparc/tls.h @@ -46,6 +46,8 @@ typedef struct dtv_t *dtv; void *self; int multiple_threads; + uintptr_t sysinfo; + uintptr_t stack_guard; } tcbhead_t; #else /* __ASSEMBLER__ */ @@ -126,6 +128,13 @@ register struct pthread *__thread_self __asm__("%g7"); #define THREAD_SETMEM_NC(descr, member, idx, value) \ descr->member[idx] = (value) +/* Set the stack guard field in TCB head. */ +#define THREAD_SET_STACK_GUARD(value) \ + THREAD_SETMEM (THREAD_SELF, header.stack_guard, value) +# define THREAD_COPY_STACK_GUARD(descr) \ + ((descr)->header.stack_guard \ + = THREAD_GETMEM (THREAD_SELF, header.stack_guard)) + #endif /* !ASSEMBLER */ #endif /* tls.h */ diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile index 3dd1430b7..43f4bb409 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile @@ -34,25 +34,26 @@ SO_LIBC_CSRC = $(AR_LIBC_CSRC) ifeq ($(strip $(TARGET_ARCH)),alpha) AR_LIBC_CSRC += libc-lowlevellock.c -AR_LIBP_CSRC += rtld-libc-lowlevellock.c +AR_LIBP_CSRC += lowlevellock.c endif ifeq ($(strip $(TARGET_ARCH)),mips) AR_LIBC_CSRC += libc-lowlevellock.c -AR_LIBP_CSRC += rtld-libc-lowlevellock.c +AR_LIBP_CSRC += lowlevellock.c endif ifeq ($(strip $(TARGET_ARCH)),powerpc) AR_LIBC_CSRC += libc-lowlevellock.c -AR_LIBP_CSRC += rtld-libc-lowlevellock.c +AR_LIBP_CSRC += lowlevellock.c endif ifeq ($(strip $(TARGET_ARCH)),sparc) AR_LIBC_CSRC += libc-lowlevellock.c -AR_LIBP_CSRC += rtld-libc-lowlevellock.c +AR_LIBP_CSRC += lowlevellock.c endif # # Needed to get pthread types. # CFLAGS-pt-fork.c = -D_GNU_SOURCE +CFLAGS-pthread_getcpuclockid.c = -I$(TOPDIR)/librt AR_LIBP_COBJS = $(patsubst %.c, %.o, $(AR_LIBP_CSRC)) SO_LIBP_COBJS = $(patsubst %.c, %.os, $(SO_LIBP_CSRC)) @@ -111,10 +112,7 @@ $(AR_LIBC_COBJS): %.o : %.c $(SO_LIBC_COBJS): %.os : %.c $(CC) $(CFLAGS-$<) $(CFLAGS-LIBC) -DSHARED -c $< -o $@ -rtld-libc-lowlevellock.c: libc-lowlevellock.c - $(LN) -fs $< $@ - clean: - $(RM) *.o *.os *~ core rtld-libc-lowlevellock.c + $(RM) *.o *.os *~ core .PHONY: $(AR_LIB_NAME) $(AR_SO_LIB_NAME) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h b/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h index d13d6e86a..86b47037e 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h @@ -1,5 +1,5 @@ /* Machine-specific pthread type layouts. Alpha version. - Copyright (C) 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 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 @@ -117,8 +117,9 @@ typedef union unsigned int __nr_readers_queued; unsigned int __nr_writers_queued; int __writer; - - unsigned int __reserved[6]; + int __pad1; + unsigned long int __pad2; + unsigned long int __pad3; /* FLAGS must stay at this position in the structure to maintain binary compatibility. */ unsigned int __flags; diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c b/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c index c03bfd4d6..f62e4b919 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c @@ -22,9 +22,6 @@ #include <unistd.h> #include <sys/types.h> #include <sysdep.h> -#ifndef __UCLIBC__ -#include <libio/libioP.h> -#endif #include <tls.h> #include "fork.h" #include <hp-timing.h> @@ -70,11 +67,7 @@ fresetlockfiles (void) pid_t -#ifdef __UCLIBC__ __libc_fork_nptl (void) -#else -__libc_fork (void) -#endif { pid_t pid; struct used_handler @@ -258,8 +251,3 @@ __libc_fork (void) return pid; } -#ifndef __UCLIBC__ -weak_alias (__libc_fork, __fork) -libc_hidden_def (__fork) -weak_alias (__libc_fork, fork) -#endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/internaltypes.h b/libpthread/nptl/sysdeps/unix/sysv/linux/internaltypes.h index 7da94d860..07ee9d7dd 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/internaltypes.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/internaltypes.h @@ -21,9 +21,7 @@ #define _INTERNALTYPES_H 1 #include <stdint.h> -#ifdef __UCLIBC__ #include <sched.h> -#endif struct pthread_attr diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/kernel-features.h b/libpthread/nptl/sysdeps/unix/sysv/linux/kernel-features.h index ef8240b00..dd2d40a44 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/kernel-features.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/kernel-features.h @@ -25,10 +25,8 @@ # include <sgidefs.h> #endif -#if __UCLIBC__ # include <linux/version.h> # define __LINUX_KERNEL_VERSION LINUX_VERSION_CODE -#endif #ifndef __LINUX_KERNEL_VERSION /* We assume the worst; all kernels should be supported. */ diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/kernel-posix-timers.h b/libpthread/nptl/sysdeps/unix/sysv/linux/kernel-posix-timers.h index 3ff4cda3f..9be630268 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/kernel-posix-timers.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/kernel-posix-timers.h @@ -1,60 +1 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. - - 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. */ - -#include <pthread.h> -#include <setjmp.h> -#include <signal.h> -#include <sys/types.h> - - -/* Nonzero if the system calls are not available. */ -extern int __no_posix_timers attribute_hidden; - -/* Callback to start helper thread. */ -extern void __start_helper_thread (void) attribute_hidden; - -/* Control variable for helper thread creation. */ -extern pthread_once_t __helper_once attribute_hidden; - -/* TID of the helper thread. */ -extern pid_t __helper_tid attribute_hidden; - - -/* Type of timers in the kernel. */ -typedef int kernel_timer_t; - - -/* Internal representation of timer. */ -struct timer -{ - /* Notification mechanism. */ - int sigev_notify; - - /* Timer ID returned by the kernel. */ - kernel_timer_t ktimerid; - - /* All new elements must be added after ktimerid. And if the thrfunc - element is not the third element anymore the memory allocation in - timer_create needs to be changed. */ - - /* Parameters for the thread to be started for SIGEV_THREAD. */ - void (*thrfunc) (sigval_t); - sigval_t sival; - pthread_attr_t attr; -}; +#include <../../../../../../librt/kernel-posix-timers.h> diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c b/libpthread/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c index 85b75221e..3d1c02181 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c @@ -57,11 +57,3 @@ __libc_pthread_init (ptr, reclaim, functions) return &__libc_multiple_threads; #endif } - -/* I would rather not talk about this. */ -#ifdef SHARED -#include <link.h> -void _dl_aux_init (ElfW(auxv_t) *av) -{ -} -#endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.c b/libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.c index 8fdccac70..f93891431 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.c @@ -50,11 +50,7 @@ __lll_timedlock_wait (int *futex, const struct timespec *abstime) struct timespec rt; /* Get the current time. */ -#ifdef __UCLIBC__ (void) gettimeofday (&tv, NULL); -#else - (void) __gettimeofday (&tv, NULL); -#endif /* Compute relative timeout. */ rt.tv_sec = abstime->tv_sec - tv.tv_sec; @@ -109,11 +105,7 @@ __lll_timedwait_tid (int *tidp, const struct timespec *abstime) struct timespec rt; /* Get the current time. */ -#ifdef __UCLIBC__ (void) gettimeofday (&tv, NULL); -#else - (void) __gettimeofday (&tv, NULL); -#endif /* Compute relative timeout. */ rt.tv_sec = abstime->tv_sec - tv.tv_sec; diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile index 865f74149..084708397 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile @@ -21,7 +21,8 @@ TOPDIR=../../../../../../../ include $(TOPDIR)Rules.mak include ../../../../../Rules.mak -AR_LIBP_ASRC = pt-vfork.S clone.S +#AR_LIBP_ASRC = pt-vfork.S clone.S +AR_LIBP_ASRC = pt-vfork.S SO_LIBP_ASRC = $(AR_LIBP_ASRC) AR_LIBP_CSRC = pthread_once.c SO_LIBP_CSRC = $(AR_LIBP_CSRC) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/createthread.c b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/createthread.c index d07d04e09..d8a7c5539 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/createthread.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/createthread.c @@ -21,8 +21,4 @@ + TLS_TCB_OFFSET + TLS_PRE_TCB_SIZE) /* Get the real implementation. */ -#ifdef __UCLIBC__ #include <sysdeps/pthread/createthread.c> -#else -#include <nptl/sysdeps/pthread/createthread.c> -#endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/not-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/not-cancel.h index f79953d88..9418417b4 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/not-cancel.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/not-cancel.h @@ -1,4 +1,4 @@ -/* Uncancelable versions of cancelable interfaces. Generic version. +/* Uncancelable versions of cancelable interfaces. Linux version. Copyright (C) 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. @@ -18,37 +18,43 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -/* By default we have none. Map the name to the normal functions. */ +#include <sysdep.h> + +/* Uncancelable open. */ #define open_not_cancel(name, flags, mode) \ - __libc_open (name, flags, mode) -#ifdef __UCLIBC__ -extern int __libc_open(__const char *__file, int __oflag, ...) __THROW; -#define open_not_cancel_2(name, flags) \ - __libc_open (name, flags, 0) -#else + INLINE_SYSCALL (open, 3, (const char *) (name), (flags), (mode)) #define open_not_cancel_2(name, flags) \ - __libc_open (name, flags) -#endif + INLINE_SYSCALL (open, 2, (const char *) (name), (flags)) + +/* Uncancelable close. */ #define close_not_cancel(fd) \ - __close (fd) -#ifdef __UCLIBC__ -#define close_not_cancel_no_status(fd) \ - (void) close (fd) -#define read_not_cancel(fd, buf, n) \ - read (fd, buf, n) -#define write_not_cancel(fd, buf, n) \ - write (fd, buf, n) -#else + INLINE_SYSCALL (close, 1, fd) #define close_not_cancel_no_status(fd) \ - (void) __close (fd) + (void) ({ INTERNAL_SYSCALL_DECL (err); \ + INTERNAL_SYSCALL (close, err, 1, (fd)); }) + +/* Uncancelable read. */ #define read_not_cancel(fd, buf, n) \ - __read (fd, buf, n) + INLINE_SYSCALL (read, 3, (fd), (buf), (n)) + +/* Uncancelable write. */ #define write_not_cancel(fd, buf, n) \ - __write (fd, buf, n) -#endif + INLINE_SYSCALL (write, 3, (fd), (buf), (n)) + +/* Uncancelable writev. */ #define writev_not_cancel_no_status(fd, iov, n) \ - (void) __writev (fd, iov, n) + (void) ({ INTERNAL_SYSCALL_DECL (err); \ + INTERNAL_SYSCALL (writev, err, 3, (fd), (iov), (n)); }) + +/* Uncancelable fcntl. */ #define fcntl_not_cancel(fd, cmd, val) \ - __fcntl (fd, cmd, val) + __fcntl_nocancel (fd, cmd, val) + +/* Uncancelable waitpid. */ +#ifdef __NR_waitpid +# define waitpid_not_cancel(pid, stat_loc, options) \ + INLINE_SYSCALL (waitpid, 3, pid, stat_loc, options) +#else # define waitpid_not_cancel(pid, stat_loc, options) \ - __waitpid (pid, stat_loc, options) + INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL) +#endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h index 393c171ee..84acf3843 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h @@ -45,6 +45,7 @@ mflr 9; \ stw 9,52(1); \ cfi_offset (lr, 4); \ + CGOTSETUP; \ DOCARGS_##args; /* save syscall args around CENABLE. */ \ CENABLE; \ stw 3,16(1); /* store CENABLE return value (MASK). */ \ @@ -58,6 +59,7 @@ lwz 4,52(1); \ lwz 0,12(1); /* restore CR/R3. */ \ lwz 3,8(1); \ + CGOTRESTORE; \ mtlr 4; \ mtcr 0; \ addi 1,1,48; \ @@ -84,6 +86,9 @@ # define DOCARGS_6 stw 8,40(1); DOCARGS_5 # define UNDOCARGS_6 lwz 8,40(1); UNDOCARGS_5 +# define CGOTSETUP +# define CGOTRESTORE + # ifdef IS_IN_libpthread # define CENABLE bl __pthread_enable_asynccancel@local # define CDISABLE bl __pthread_disable_asynccancel@local @@ -93,6 +98,18 @@ # elif defined IS_IN_librt # define CENABLE bl JUMPTARGET(__librt_enable_asynccancel) # define CDISABLE bl JUMPTARGET(__librt_disable_asynccancel) +# if defined HAVE_AS_REL16 && defined PIC +# undef CGOTSETUP +# define CGOTSETUP \ + bcl 20,31,1f; \ + 1: stw 30,44(1); \ + mflr 30; \ + addis 30,30,_GLOBAL_OFFSET_TABLE-1b@ha; \ + addi 30,30,_GLOBAL_OFFSET_TABLE-1b@l +# undef CGOTRESTORE +# define CGOTRESTORE \ + lwz 30,44(1) +# endif # else # error Unsupported library # endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c index 9e1abd983..047c64322 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c @@ -5,8 +5,4 @@ #define __pthread_mutex_lock __pthread_mutex_cond_lock #define NO_INCR -#ifdef __UCLIBC__ #include <pthread_mutex_lock.c> -#else -#include <nptl/pthread_mutex_lock.c> -#endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c index d4ed1caba..5c8b0db7e 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c @@ -56,11 +56,7 @@ sem_timedwait (sem_t *sem, const struct timespec *abstime) int sec, nsec; /* Get the current time. */ -#ifdef __UCLIBC__ gettimeofday (&tv, NULL); -#else - __gettimeofday (&tv, NULL); -#endif /* Compute relative timeout. */ sec = abstime->tv_sec - tv.tv_sec; diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/smp.h b/libpthread/nptl/sysdeps/unix/sysv/linux/smp.h index fbe16bacd..41fa97ff4 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/smp.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/smp.h @@ -34,11 +34,7 @@ is_smp_system (void) size_t reslen = sizeof (buf); /* Try reading the number using `sysctl' first. */ -#ifdef __UCLIBC__ if (sysctl ((int *) sysctl_args, -#else - if (__sysctl ((int *) sysctl_args, -#endif sizeof (sysctl_args) / sizeof (sysctl_args[0]), buf, &reslen, NULL, 0) < 0) { diff --git a/libpthread/nptl/sysdeps/x86_64/tls.h b/libpthread/nptl/sysdeps/x86_64/tls.h index 3fc9b384a..516827b8e 100644 --- a/libpthread/nptl/sysdeps/x86_64/tls.h +++ b/libpthread/nptl/sysdeps/x86_64/tls.h @@ -47,6 +47,8 @@ typedef struct dtv_t *dtv; void *self; /* Pointer to the thread descriptor. */ int multiple_threads; + uintptr_t sysinfo; + uintptr_t stack_guard; } tcbhead_t; #else /* __ASSEMBLER__ */ @@ -320,6 +322,13 @@ typedef struct __res; }) +/* Set the stack guard field in TCB head. */ +# define THREAD_SET_STACK_GUARD(value) \ + THREAD_SETMEM (THREAD_SELF, header.stack_guard, value) +# define THREAD_COPY_STACK_GUARD(descr) \ + ((descr)->header.stack_guard \ + = THREAD_GETMEM (THREAD_SELF, header.stack_guard)) + #endif /* __ASSEMBLER__ */ #endif /* tls.h */ |
