summaryrefslogtreecommitdiffstats
path: root/libpthread/nptl
diff options
context:
space:
mode:
author"Steven J. Hill" <sjhill@realitydiluted.com>2005-11-16 03:36:39 +0000
committer"Steven J. Hill" <sjhill@realitydiluted.com>2005-11-16 03:36:39 +0000
commitb823b17fa7dc5a15d822a4f31fe8ee846a65cfae (patch)
treecbf84b1c8fc0682e74165cc48b9baf0d7b382533 /libpthread/nptl
parent708121712921e39f6d81179c376e53d26ee817b4 (diff)
downloaduClibc-alpine-b823b17fa7dc5a15d822a4f31fe8ee846a65cfae.tar.bz2
uClibc-alpine-b823b17fa7dc5a15d822a4f31fe8ee846a65cfae.tar.xz
Sync with glibc reference tree and changes for uClibc thus far.
Diffstat (limited to 'libpthread/nptl')
-rw-r--r--libpthread/nptl/ChangeLog72
-rw-r--r--libpthread/nptl/Makefile13
-rw-r--r--libpthread/nptl/allocatestack.c24
-rw-r--r--libpthread/nptl/init.c12
-rw-r--r--libpthread/nptl/pt-allocrtsig.c12
-rw-r--r--libpthread/nptl/pt-system.c6
-rw-r--r--libpthread/nptl/pthread_attr_init.c4
-rw-r--r--libpthread/nptl/pthread_getschedparam.c8
-rw-r--r--libpthread/nptl/pthread_setschedparam.c4
-rw-r--r--libpthread/nptl/sem_open.c2
-rw-r--r--libpthread/nptl/sysdeps/i386/tls.h9
-rw-r--r--libpthread/nptl/sysdeps/mips/Makefile37
-rw-r--r--libpthread/nptl/sysdeps/mips/dl-support.c2
-rw-r--r--libpthread/nptl/sysdeps/mips/jmpbuf-unwind.h4
-rw-r--r--libpthread/nptl/sysdeps/mips/libc-tls.c2
-rw-r--r--libpthread/nptl/sysdeps/powerpc/tls.h22
-rw-r--r--libpthread/nptl/sysdeps/pthread/Makefile47
-rw-r--r--libpthread/nptl/sysdeps/pthread/pthread.h31
-rw-r--r--libpthread/nptl/sysdeps/pthread/sigaction.c21
-rw-r--r--libpthread/nptl/sysdeps/pthread/sigfillset.c4
-rw-r--r--libpthread/nptl/sysdeps/pthread/sigprocmask.c5
-rw-r--r--libpthread/nptl/sysdeps/sparc/tls.h9
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/Makefile14
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h7
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/fork.c12
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/internaltypes.h2
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/kernel-features.h2
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/kernel-posix-timers.h61
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c8
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.c8
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile3
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/mips/createthread.c4
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/mips/not-cancel.h58
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h17
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c4
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c4
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/smp.h4
-rw-r--r--libpthread/nptl/sysdeps/x86_64/tls.h9
38 files changed, 286 insertions, 281 deletions
diff --git a/libpthread/nptl/ChangeLog b/libpthread/nptl/ChangeLog
index 497b33d8a..7d103e655 100644
--- a/libpthread/nptl/ChangeLog
+++ b/libpthread/nptl/ChangeLog
@@ -1,3 +1,72 @@
+2005-08-23 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/timer_routines.c: Don't block SIGSETXID ever.
+
+2005-07-11 Jakub Jelinek <jakub@redhat.com>
+
+ [BZ #1102]
+ * sysdeps/pthread/pthread.h (PTHREAD_MUTEX_INITIALIZER,
+ PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP,
+ PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP,
+ PTHREAD_MUTEX_ADAPTIVE_NP, PTHREAD_RWLOCK_INITIALIZER,
+ PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
+ PTHREAD_COND_INITIALIZER): Supply zeros for all fields
+ in the structure.
+ * Makefile (tests): Add tst-initializers1.
+ (CFLAGS-tst-initializers1.c): Set.
+ * tst-initializers1.c: New test.
+
+2005-07-11 Jakub Jelinek <jakub@redhat.com>
+
+ * sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h (pthread_rwlock_t):
+ Make sure __flags are located at offset 48 from the start of the
+ structure.
+
+2005-07-02 Roland McGrath <roland@redhat.com>
+
+ * Makeconfig: Comment fix.
+
+2005-07-05 Jakub Jelinek <jakub@redhat.com>
+
+ * descr.h (PTHREAD_STRUCT_END_PADDING): Define.
+ * sysdeps/ia64/tls.h (TLS_PRE_TCB_SIZE): If PTHREAD_STRUCT_END_PADDING
+ is smaller than 8 bytes, increase TLS_PRE_TCB_SIZE by 16 bytes.
+ (THREAD_SYSINFO, THREAD_SELF, DB_THREAD_SELF): Don't assume
+ TLS_PRE_TCB_SIZE is sizeof (struct pthread).
+ (THREAD_SET_STACK_GUARD, THREAD_COPY_STACK_GUARD): Define.
+ * sysdeps/ia64/tcb-offsets.sym (PID, TID, MULTIPLE_THREADS_OFFSET):
+ Use TLS_PRE_TCB_SIZE instead of sizeof (struct pthread).
+ * sysdeps/unix/sysv/linux/ia64/createthread.c (TLS_VALUE): Don't
+ assume TLS_PRE_TCB_SIZE is sizeof (struct pthread).
+
+2005-06-25 Jakub Jelinek <jakub@redhat.com>
+
+ * sysdeps/i386/tls.h (tcbhead_t): Add stack_guard field.
+ (THREAD_SET_STACK_GUARD, THREAD_COPY_STACK_GUARD): Define.
+ * sysdeps/x86_64/tls.h (tcbhead_t): Add sysinfo and stack_guard
+ fields.
+ (THREAD_SET_STACK_GUARD, THREAD_COPY_STACK_GUARD): Define.
+ * sysdeps/s390/tls.h (tcbhead_t): Add stack_guard
+ field. Put in sysinfo field unconditionally.
+ (THREAD_SET_STACK_GUARD, THREAD_COPY_STACK_GUARD): Define.
+ * sysdeps/powerpc/tls.h (tcbhead_t): Add stack_guard field.
+ (THREAD_SET_STACK_GUARD, THREAD_COPY_STACK_GUARD): Define.
+ * sysdeps/sparc/tls.h (tcbhead_t): Add sysinfo and stack_guard
+ fields.
+ (THREAD_SET_STACK_GUARD, THREAD_COPY_STACK_GUARD): Define.
+ * pthread_create.c (__pthread_create_2_1): Use
+ THREAD_COPY_STACK_GUARD macro.
+ * Makefile: Add rules to build and run tst-stackguard1{,-static}
+ tests.
+ * tst-stackguard1.c: New file.
+ * tst-stackguard1-static.c: New file.
+
+2005-06-14 Alan Modra <amodra@bigpond.net.au>
+
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h (PSEUDO):
+ Invoke CGOTSETUP and CGOTRESTORE.
+ (CGOTSETUP, CGOTRESTORE): Define.
+
2005-05-29 Richard Henderson <rth@redhat.com>
* tst-cancel4.c (WRITE_BUFFER_SIZE): New.
@@ -50,6 +119,7 @@
2005-04-27 Ulrich Drepper <drepper@redhat.com>
+ [BZ #1075]
* tst-cancel17.c (do_test): Add arbitrary factor to make sure
aio_write blocks.
@@ -77,6 +147,7 @@
2005-04-05 Jakub Jelinek <jakub@redhat.com>
+ [BZ #1102]
* sysdeps/pthread/pthread.h (__pthread_cleanup_routine): Use
__inline instead of inline.
* sysdeps/pthread/bits/libc-lock.h (__libc_cleanup_routine): Likewise.
@@ -126,6 +197,7 @@
2005-03-23 Ulrich Drepper <drepper@redhat.com>
+ [BZ #1112]
* pthread_create.c (__pthread_create_2_1): Rename syscall error
variable to scerr.
diff --git a/libpthread/nptl/Makefile b/libpthread/nptl/Makefile
index c0c9edfc7..5f5864304 100644
--- a/libpthread/nptl/Makefile
+++ b/libpthread/nptl/Makefile
@@ -111,10 +111,6 @@ libpthread-routines = init vars events version \
pthread_getaffinity pthread_setaffinity \
pthread_attr_getaffinity pthread_attr_setaffinity \
cleanup_routine unwind-forcedunwind
-# pthread_setuid pthread_seteuid pthread_setreuid \
-# pthread_setresuid \
-# pthread_setgid pthread_setegid pthread_setregid \
-# pthread_setresgid
libpthread-shared-only-routines = version pt-allocrtsig unwind-forcedunwind
libpthread-static-only-routines = pthread_atfork
@@ -216,7 +212,6 @@ libpthread-misc-routines = pthread_rwlock_rdlock pthread_rwlock_timedrdlock \
ptw-msgrcv ptw-msgsnd ptw-sigwait \
pt-raise flockfile ftrylockfile \
funlockfile sigaction \
- pthread_kill_other_threads \
pthread_getaffinity \
pthread_setaffinity \
pthread_attr_getaffinity \
@@ -232,8 +227,7 @@ AR_LIBP_CSRC = $(patsubst %, %.c, $(filter-out $(libpthread-os-routines) \
$(libpthread-routines)))
SO_LIBP_CSRC = $(patsubst %, %.c, $(filter-out $(libpthread-os-routines) \
$(libpthread-misc-routines) \
- $(libpthread-static-only-routines) pt-allocrtsig, \
- $(libpthread-routines)))
+ $(libpthread-static-only-routines), $(libpthread-routines)))
AR_LIBC_CSRC = $(patsubst %, %.c, $(filter-out $(shared-only-routines) \
libc-lowlevellock, $(routines)))
SO_LIBC_CSRC = $(patsubst %, %.c, $(filter-out libc-lowlevellock, $(routines)))
@@ -243,6 +237,11 @@ SO_LIBP_COBJS = $(patsubst %.c, %.os, $(SO_LIBP_CSRC))
AR_LIBC_COBJS = $(patsubst %.c, %.o, $(AR_LIBC_CSRC))
SO_LIBC_COBJS = $(patsubst %.c, %.os, $(SO_LIBC_CSRC))
+ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
+SHARED_START_FILES = sysdeps/pthread/crti.o $(LIBGCC_DIR)crtbeginS.o
+SHARED_END_FILES = $(LIBGCC_DIR)crtendS.o sysdeps/pthread/crtn.o
+endif
+
all: headers $(AR_LIB_NAME) $(SO_LIB_NAME)
headers: version.h banner.h
diff --git a/libpthread/nptl/allocatestack.c b/libpthread/nptl/allocatestack.c
index 8d26b2e21..a228d090e 100644
--- a/libpthread/nptl/allocatestack.c
+++ b/libpthread/nptl/allocatestack.c
@@ -28,11 +28,9 @@
#include <dl-sysdep.h>
#include <tls.h>
#include <lowlevellock.h>
-
-#ifdef __UCLIBC__
#include <link.h>
+
#define __getpagesize getpagesize
-#endif
#ifndef NEED_SEPARATE_REGISTER_STACK
@@ -393,10 +391,10 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
size_t reqsize;
void *mem;
const int prot = (PROT_READ | PROT_WRITE
-#ifdef __UCLIBC__
- );
-#else
+#ifndef __UCLIBC__
| ((GL(dl_stack_flags) & PF_X) ? PROT_EXEC : 0));
+#else
+ );
#endif
#if COLORING_INCREMENT != 0
@@ -681,10 +679,10 @@ internal_function
__make_stacks_executable (void **stack_endp)
{
/* First the main thread's stack. */
-#ifdef __UCLIBC__
- int err = EPERM;
-#else
+#ifndef __UCLIBC__
int err = _dl_make_stack_executable (stack_endp);
+#else
+ int err = EPERM;
#endif
if (err != 0)
return err;
@@ -924,10 +922,6 @@ __nptl_setxid (struct xid_command *cmdp)
static inline void __attribute__((always_inline))
init_one_static_tls (struct pthread *curp, struct link_map *map)
{
-#ifdef __UCLIBC__
- extern void *__mempcpy (void *dstpp, const void *srcpp, size_t len);
-#endif
-
dtv_t *dtv = GET_DTV (TLS_TPADJ (curp));
# if TLS_TCB_AT_TP
void *dest = (char *) curp - map->l_tls_offset;
@@ -942,11 +936,7 @@ init_one_static_tls (struct pthread *curp, struct link_map *map)
dtv[map->l_tls_modid].pointer.is_static = true;
/* Initialize the memory. */
-#ifdef __UCLIBC__
- memset ((void *) __mempcpy (dest, map->l_tls_initimage, map->l_tls_initimage_size),
-#else
memset (__mempcpy (dest, map->l_tls_initimage, map->l_tls_initimage_size),
-#endif
'\0', map->l_tls_blocksize - map->l_tls_initimage_size);
}
diff --git a/libpthread/nptl/init.c b/libpthread/nptl/init.c
index e48f8ae35..ab48fa7b8 100644
--- a/libpthread/nptl/init.c
+++ b/libpthread/nptl/init.c
@@ -264,21 +264,13 @@ __pthread_initialize_minimal_internal (void)
sa.sa_flags = SA_SIGINFO;
__sigemptyset (&sa.sa_mask);
-#ifdef __UCLIBC__
- (void) sigaction (SIGCANCEL, &sa, NULL);
-#else
(void) __libc_sigaction (SIGCANCEL, &sa, NULL);
-#endif
/* Install the handle to change the threads' uid/gid. */
sa.sa_sigaction = sighandler_setxid;
sa.sa_flags = SA_SIGINFO | SA_RESTART;
-#ifdef __UCLIBC__
- (void) sigaction (SIGSETXID, &sa, NULL);
-#else
(void) __libc_sigaction (SIGSETXID, &sa, NULL);
-#endif
/* The parent process might have left the signals blocked. Just in
case, unblock it. We reuse the signal mask in the sigaction
@@ -304,11 +296,7 @@ __pthread_initialize_minimal_internal (void)
else
{
/* Round the resource limit up to page size. */
-#ifdef __UCLIBC__
- const uintptr_t pagesz = sysconf (_SC_PAGESIZE);
-#else
const uintptr_t pagesz = __sysconf (_SC_PAGESIZE);
-#endif
__default_stacksize = (limit.rlim_cur + pagesz - 1) & -pagesz;
}
diff --git a/libpthread/nptl/pt-allocrtsig.c b/libpthread/nptl/pt-allocrtsig.c
index 347bf139a..e33775d5a 100644
--- a/libpthread/nptl/pt-allocrtsig.c
+++ b/libpthread/nptl/pt-allocrtsig.c
@@ -22,9 +22,9 @@
/* These are defined in libc. We want to have only one definition
so we "forward" the calls. */
-extern int __libc_current_sigrtmin_private (void);
-extern int __libc_current_sigrtmax_private (void);
-extern int __libc_allocate_rtsig_private (int high);
+extern int __libc_current_sigrtmin (void);
+extern int __libc_current_sigrtmax (void);
+extern int __libc_allocate_rtsig (int high);
/* We reserve __SIGRTMIN for use as the cancellation signal and
@@ -33,19 +33,19 @@ extern int __libc_allocate_rtsig_private (int high);
int
__libc_current_sigrtmin (void)
{
- return __libc_current_sigrtmin_private ();
+ return __libc_current_sigrtmin ();
}
int
__libc_current_sigrtmax (void)
{
- return __libc_current_sigrtmax_private ();
+ return __libc_current_sigrtmax ();
}
int
__libc_allocate_rtsig (int high)
{
- return __libc_allocate_rtsig_private (high);
+ return __libc_allocate_rtsig (high);
}
diff --git a/libpthread/nptl/pt-system.c b/libpthread/nptl/pt-system.c
index 2d7f5d172..462fbf33a 100644
--- a/libpthread/nptl/pt-system.c
+++ b/libpthread/nptl/pt-system.c
@@ -22,15 +22,11 @@
#include <sysdep.h>
#include "pthreadP.h"
-/* Compatibility define. */
-#ifdef __UCLIBC__
-#define __libc_system system
-#endif
int
system (const char *line)
{
- return __libc_system (line);
+ return system (line);
}
/* __libc_system in libc.so handles cancellation. */
diff --git a/libpthread/nptl/pthread_attr_init.c b/libpthread/nptl/pthread_attr_init.c
index b31c08686..9fd15c4e0 100644
--- a/libpthread/nptl/pthread_attr_init.c
+++ b/libpthread/nptl/pthread_attr_init.c
@@ -45,11 +45,7 @@ __pthread_attr_init_2_1 (attr)
iattr = (struct pthread_attr *) attr;
/* Default guard size specified by the standard. */
-#ifdef __UCLIBC__
iattr->guardsize = getpagesize ();
-#else
- iattr->guardsize = __getpagesize ();
-#endif
return 0;
}
diff --git a/libpthread/nptl/pthread_getschedparam.c b/libpthread/nptl/pthread_getschedparam.c
index b9808bb68..64b15cde9 100644
--- a/libpthread/nptl/pthread_getschedparam.c
+++ b/libpthread/nptl/pthread_getschedparam.c
@@ -51,11 +51,7 @@ __pthread_getschedparam (threadid, policy, param)
not yet been retrieved do it now. */
if ((pd->flags & ATTR_FLAG_SCHED_SET) == 0)
{
-#ifdef __UCLIBC__
if (sched_getparam (pd->tid, &pd->schedparam) != 0)
-#else
- if (__sched_getparam (pd->tid, &pd->schedparam) != 0)
-#endif
result = 1;
else
pd->flags |= ATTR_FLAG_SCHED_SET;
@@ -63,11 +59,7 @@ __pthread_getschedparam (threadid, policy, param)
if ((pd->flags & ATTR_FLAG_POLICY_SET) == 0)
{
-#ifdef __UCLIBC__
pd->schedpolicy = sched_getscheduler (pd->tid);
-#else
- pd->schedpolicy = __sched_getscheduler (pd->tid);
-#endif
if (pd->schedpolicy == -1)
result = 1;
else
diff --git a/libpthread/nptl/pthread_setschedparam.c b/libpthread/nptl/pthread_setschedparam.c
index a3947ba25..c72116bcb 100644
--- a/libpthread/nptl/pthread_setschedparam.c
+++ b/libpthread/nptl/pthread_setschedparam.c
@@ -46,11 +46,7 @@ __pthread_setschedparam (threadid, policy, param)
lll_lock (pd->lock);
/* Try to set the scheduler information. */
-#ifdef __UCLIBC__
if (__builtin_expect (sched_setscheduler (pd->tid, policy,
-#else
- if (__builtin_expect (__sched_setscheduler (pd->tid, policy,
-#endif
param) == -1, 0))
result = errno;
else
diff --git a/libpthread/nptl/sem_open.c b/libpthread/nptl/sem_open.c
index 8727bd057..e388d99de 100644
--- a/libpthread/nptl/sem_open.c
+++ b/libpthread/nptl/sem_open.c
@@ -37,7 +37,6 @@
/* Compatibility defines. */
-#if __UCLIBC__
#define __endmntent endmntent
#define __fxstat64(vers, fd, buf) fstat64(fd, buf)
#define __getmntent_r getmntent_r
@@ -46,7 +45,6 @@
#define __libc_close close
#define __libc_open open
#define __libc_write write
-#endif
/* Information about the mount point. */
struct mountpoint_info mountpoint attribute_hidden;
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 */