summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2010-02-17 14:28:38 -0800
committerKhem Raj <raj.khem@gmail.com>2010-02-17 14:28:38 -0800
commit94f3c30dc2d8193f977daf04414b1edd815ced83 (patch)
tree830538d15828aa76991332aae8aa3a894ffa1c5b
parent5e6d4834e6b35c6b0017fcdaf246c505dec10452 (diff)
Assorted fixed to get nptl compiling on ARM
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--include/libc-symbols.h6
-rw-r--r--libc/sysdeps/linux/arm/sysdep.h5
-rw-r--r--libc/sysdeps/linux/common/bits/kernel-features.h5
-rw-r--r--libc/sysdeps/linux/common/not-cancel.h61
-rw-r--r--libc/unistd/sysconf.c3
-rw-r--r--libpthread/nptl/descr.h1
-rw-r--r--libpthread/nptl/init.c8
-rw-r--r--libpthread/nptl/pthread_create.c3
-rw-r--r--libpthread/nptl/pthread_getattr_np.c2
-rw-r--r--libpthread/nptl/sysdeps/arm/tls.h28
-rw-r--r--libpthread/nptl/sysdeps/pthread/Makefile.in2
-rw-r--r--libpthread/nptl/sysdeps/pthread/bits/libc-lock.h8
-rw-r--r--libpthread/nptl/sysdeps/pthread/tpp.c2
-rw-r--r--libpthread/nptl/sysdeps/pthread/uClibc-glue.h47
-rw-r--r--libpthread/nptl/sysdeps/pthread/unwind-forcedunwind.c4
-rw-r--r--libpthread/nptl/sysdeps/pthread/unwind-resume.c4
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in86
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch2
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/arm/lowlevellock.c1
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c5
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-resume.c5
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/internaltypes.h2
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/not-cancel.h47
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/sem_post.c1
24 files changed, 258 insertions, 80 deletions
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 2729d306c..b2e0771fc 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -99,6 +99,12 @@
# define attribute_noreturn
#endif
+#define libc_freeres_ptr(decl) \
+ __make_section_unallocated ("__libc_freeres_ptrs, \"aw\", %nobits") \
+ decl __attribute__ ((section ("__libc_freeres_ptrs" __sec_comment)))
+#define __libc_freeres_fn_section \
+ __attribute__ ((section ("__libc_freeres_fn")))
+
#ifndef NOT_IN_libc
# define IS_IN_libc 1
#endif
diff --git a/libc/sysdeps/linux/arm/sysdep.h b/libc/sysdeps/linux/arm/sysdep.h
index 0c39dfa31..b1ae2fdb0 100644
--- a/libc/sysdeps/linux/arm/sysdep.h
+++ b/libc/sysdeps/linux/arm/sysdep.h
@@ -359,4 +359,9 @@ __local_syscall_error: \
#endif
#endif /* __ASSEMBLER__ */
+
+/* Pointer mangling is not yet supported for ARM. */
+#define PTR_MANGLE(var) (void) (var)
+#define PTR_DEMANGLE(var) (void) (var)
+
#endif /* linux/arm/sysdep.h */
diff --git a/libc/sysdeps/linux/common/bits/kernel-features.h b/libc/sysdeps/linux/common/bits/kernel-features.h
index c6647c8e7..db0a6d8d9 100644
--- a/libc/sysdeps/linux/common/bits/kernel-features.h
+++ b/libc/sysdeps/linux/common/bits/kernel-features.h
@@ -448,8 +448,3 @@
#if __LINUX_KERNEL_VERSION >= 0x020609 && defined __alpha__
#define __ASSUME_IEEE_RAISE_EXCEPTION 1
#endif
-
-/* This header was added somewhere around 2.6.13 */
-#if __LINUX_KERNEL_VERSION >= 132621
-# define HAVE_LINUX_CPUMASK_H 1
-#endif
diff --git a/libc/sysdeps/linux/common/not-cancel.h b/libc/sysdeps/linux/common/not-cancel.h
index ebdc6078d..9418417b4 100644
--- a/libc/sysdeps/linux/common/not-cancel.h
+++ b/libc/sysdeps/linux/common/not-cancel.h
@@ -1,19 +1,60 @@
-/* By default we have none. Map the name to the normal functions. */
+/* 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.
+
+ 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. */
+
+#include <sysdep.h>
+
+/* Uncancelable open. */
#define open_not_cancel(name, flags, mode) \
- open (name, flags, mode)
+ INLINE_SYSCALL (open, 3, (const char *) (name), (flags), (mode))
#define open_not_cancel_2(name, flags) \
- open (name, flags)
+ INLINE_SYSCALL (open, 2, (const char *) (name), (flags))
+
+/* Uncancelable close. */
#define close_not_cancel(fd) \
- close (fd)
+ 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)
+ 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) \
- waitpid (pid, stat_loc, options)
+ INLINE_SYSCALL (waitpid, 3, pid, stat_loc, options)
+#else
+# define waitpid_not_cancel(pid, stat_loc, options) \
+ INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL)
+#endif
diff --git a/libc/unistd/sysconf.c b/libc/unistd/sysconf.c
index b92498b23..b7cb4946f 100644
--- a/libc/unistd/sysconf.c
+++ b/libc/unistd/sysconf.c
@@ -38,9 +38,6 @@
#include <sysdep.h>
#endif
-#ifdef HAVE_LINUX_CPUMASK_H
-# include <linux/cpumask.h>
-#endif
#ifndef num_present_cpus
# define num_present_cpus() (1)
#endif
diff --git a/libpthread/nptl/descr.h b/libpthread/nptl/descr.h
index c355eae3c..40f552d6d 100644
--- a/libpthread/nptl/descr.h
+++ b/libpthread/nptl/descr.h
@@ -37,6 +37,7 @@
#define __need_res_state
#include <resolv.h>
#include <bits/kernel-features.h>
+#include "uClibc-glue.h"
#ifndef TCB_ALIGNMENT
# define TCB_ALIGNMENT sizeof (double)
diff --git a/libpthread/nptl/init.c b/libpthread/nptl/init.c
index 765dc5da4..b651a3e62 100644
--- a/libpthread/nptl/init.c
+++ b/libpthread/nptl/init.c
@@ -410,14 +410,6 @@ __pthread_initialize_minimal_internal (void)
*__libc_dl_error_tsd () = *(*GL(dl_error_catch_tsd)) ();
GL(dl_error_catch_tsd) = &__libc_dl_error_tsd;
- /* Make __rtld_lock_{,un}lock_recursive use pthread_mutex_{,un}lock,
- keep the lock count from the ld.so implementation. */
- GL(dl_rtld_lock_recursive) = (void *) INTUSE (__pthread_mutex_lock);
- GL(dl_rtld_unlock_recursive) = (void *) INTUSE (__pthread_mutex_unlock);
- unsigned int rtld_lock_count = GL(dl_load_lock).mutex.__data.__count;
- GL(dl_load_lock).mutex.__data.__count = 0;
- while (rtld_lock_count-- > 0)
- INTUSE (__pthread_mutex_lock) (&GL(dl_load_lock).mutex);
#endif
GL(dl_init_static_tls) = &__pthread_init_static_tls;
diff --git a/libpthread/nptl/pthread_create.c b/libpthread/nptl/pthread_create.c
index a61cd715d..8b53cb199 100644
--- a/libpthread/nptl/pthread_create.c
+++ b/libpthread/nptl/pthread_create.c
@@ -302,8 +302,9 @@ start_thread (void *arg)
__nptl_deallocate_tsd ();
/* Clean up any state libc stored in thread-local variables. */
+ /* disable for now
__libc_thread_freeres ();
-
+ */
/* If this is the last thread we terminate the process now. We
do not notify the debugger, it might just irritate it if there
is no thread left. */
diff --git a/libpthread/nptl/pthread_getattr_np.c b/libpthread/nptl/pthread_getattr_np.c
index e0e6251c2..86a43853d 100644
--- a/libpthread/nptl/pthread_getattr_np.c
+++ b/libpthread/nptl/pthread_getattr_np.c
@@ -98,7 +98,7 @@ pthread_getattr_np (
while (! feof_unlocked (fp))
{
- if (__getdelim (&line, &linelen, '\n', fp) <= 0)
+ if (getdelim (&line, &linelen, '\n', fp) <= 0)
break;
uintptr_t from;
diff --git a/libpthread/nptl/sysdeps/arm/tls.h b/libpthread/nptl/sysdeps/arm/tls.h
index 29200a1d2..0ca597ac8 100644
--- a/libpthread/nptl/sysdeps/arm/tls.h
+++ b/libpthread/nptl/sysdeps/arm/tls.h
@@ -1,5 +1,5 @@
/* Definition for thread-local data handling. NPTL/ARM version.
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005,2007 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
@@ -50,9 +50,6 @@ typedef union dtv
/* Signal that TLS support is available. */
#define USE_TLS 1
-/* Like all other modern NPTL ports, ARM uses forced unwinding. */
-#define HAVE_FORCED_UNWIND
-
#ifndef __ASSEMBLER__
/* Get system call information. */
@@ -134,6 +131,29 @@ typedef struct
is not available. */
#define TLS_INIT_TP_EXPENSIVE 1
+/* Get and set the global scope generation counter in struct pthread. */
+#define THREAD_GSCOPE_FLAG_UNUSED 0
+#define THREAD_GSCOPE_FLAG_USED 1
+#define THREAD_GSCOPE_FLAG_WAIT 2
+#define THREAD_GSCOPE_RESET_FLAG() \
+ do \
+ { int __res \
+ = atomic_exchange_rel (&THREAD_SELF->header.gscope_flag, \
+ THREAD_GSCOPE_FLAG_UNUSED); \
+ if (__res == THREAD_GSCOPE_FLAG_WAIT) \
+ lll_futex_wake (&THREAD_SELF->header.gscope_flag, 1, LLL_PRIVATE); \
+ } \
+ while (0)
+#define THREAD_GSCOPE_SET_FLAG() \
+ do \
+ { \
+ THREAD_SELF->header.gscope_flag = THREAD_GSCOPE_FLAG_USED; \
+ atomic_write_barrier (); \
+ } \
+ while (0)
+#define THREAD_GSCOPE_WAIT() \
+ GL(dl_wait_lookup_done) ()
+
#endif /* __ASSEMBLER__ */
#endif /* tls.h */
diff --git a/libpthread/nptl/sysdeps/pthread/Makefile.in b/libpthread/nptl/sysdeps/pthread/Makefile.in
index 9497789ab..303b04f3f 100644
--- a/libpthread/nptl/sysdeps/pthread/Makefile.in
+++ b/libpthread/nptl/sysdeps/pthread/Makefile.in
@@ -63,7 +63,6 @@ endif
CFLAGS-pt-common = -DNOT_IN_libc=1 $(SSP_ALL_CFLAGS)
-
CFLAGS-pthread_barrier_wait.c = -D_GNU_SOURCE $(CFLAGS-pt-common) \
-DIS_IN_libpthread=1
CFLAGS-pthread_cond_broadcast.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
@@ -94,6 +93,7 @@ CFLAGS-librt-cancellation.c = -DIS_IN_librt=1 $(CFLAGS-pt-common) \
-fexceptions -fasynchronous-unwind-tables
CFLAGS-rt-unwind-resume.c = -DIS_IN_librt=1 $(CFLAGS-pt-common) \
-fexceptions -fasynchronous-unwind-tables
+CFLAGS-tpp.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
#CFLAGS:=$(CFLAGS:-O1=-O2)
diff --git a/libpthread/nptl/sysdeps/pthread/bits/libc-lock.h b/libpthread/nptl/sysdeps/pthread/bits/libc-lock.h
index 70fe6762f..3268aa5f6 100644
--- a/libpthread/nptl/sysdeps/pthread/bits/libc-lock.h
+++ b/libpthread/nptl/sysdeps/pthread/bits/libc-lock.h
@@ -61,6 +61,10 @@ typedef struct __libc_rwlock_opaque__ __libc_rwlock_t;
/* Type for key to thread-specific data. */
typedef pthread_key_t __libc_key_t;
+# define __libc_freeres_fn_section \
+ __attribute__ ((section ("__libc_freeres_fn")))
+
+
/* Define a lock variable NAME with storage class CLASS. The lock must be
initialized with __libc_lock_init before it can be used (or define it
with __libc_lock_define_initialized, below). Use `extern' for CLASS to
@@ -545,7 +549,7 @@ weak_extern (__pthread_key_create)
weak_extern (__pthread_setspecific)
weak_extern (__pthread_getspecific)
weak_extern (__pthread_once)
-weak_extern (__pthread_initialize)
+//weak_extern (__pthread_initialize)
weak_extern (__pthread_atfork)
#ifdef SHARED
weak_extern (_pthread_cleanup_push_defer)
@@ -571,7 +575,7 @@ weak_extern (pthread_setcancelstate)
# pragma weak __pthread_setspecific
# pragma weak __pthread_getspecific
# pragma weak __pthread_once
-# pragma weak __pthread_initialize
+//# pragma weak __pthread_initialize
# pragma weak __pthread_atfork
# pragma weak _pthread_cleanup_push_defer
# pragma weak _pthread_cleanup_pop_restore
diff --git a/libpthread/nptl/sysdeps/pthread/tpp.c b/libpthread/nptl/sysdeps/pthread/tpp.c
index 0325010b4..9adab791b 100644
--- a/libpthread/nptl/sysdeps/pthread/tpp.c
+++ b/libpthread/nptl/sysdeps/pthread/tpp.c
@@ -24,7 +24,7 @@
#include <pthreadP.h>
#include <sched.h>
#include <stdlib.h>
-
+#include "uClibc-glue.h"
int __sched_fifo_min_prio = -1;
int __sched_fifo_max_prio = -1;
diff --git a/libpthread/nptl/sysdeps/pthread/uClibc-glue.h b/libpthread/nptl/sysdeps/pthread/uClibc-glue.h
new file mode 100644
index 000000000..b957dedc9
--- /dev/null
+++ b/libpthread/nptl/sysdeps/pthread/uClibc-glue.h
@@ -0,0 +1,47 @@
+#ifndef _UCLIBC_GLUE_H
+#define _UCLIBC_GLUE_H 1
+
+#include <features.h>
+#include <sys/cdefs.h>
+#include <bits/uClibc_page.h>
+
+#ifdef IS_IN_libpthread
+#include <bits/kernel-features.h>
+
+#ifndef __GLIBC_HAVE_LONG_LONG
+# define __GLIBC_HAVE_LONG_LONG
+#endif
+
+#define __getpagesize getpagesize
+#define __sched_get_priority_max sched_get_priority_max
+#define __sched_get_priority_min sched_get_priority_min
+#define __sched_getscheduler sched_getscheduler
+#define __sched_setscheduler sched_setscheduler
+#define __sched_getparam sched_getparam
+#define __getpid getpid
+#define __gettimeofday gettimeofday
+#define __poll poll
+#define __sysctl sysctl
+#define __open open
+#define __read read
+#define __close close
+#define __on_exit on_exit
+#define __libc_current_sigrtmin_private __libc_current_sigrtmin
+#define __clone clone
+
+extern void *__libc_stack_end;
+extern int __cxa_atexit (void (*func) (void *), void *arg, void *d);
+
+#endif /* IS_IN_libpthread */
+
+#ifdef __UCLIBC_HAS_XLOCALE__
+# define __uselocale(x) uselocale(x)
+#else
+# define __uselocale(x) ((void)0)
+#endif
+
+/* Use a funky version in a probably vein attempt at preventing gdb
+ * from dlopen()'ing glibc's libthread_db library... */
+#define VERSION __stringify(__UCLIBC_MAJOR__) "." __stringify(__UCLIBC_MINOR__) "." __stringify(__UCLIBC_SUBLEVEL__)
+
+#endif
diff --git a/libpthread/nptl/sysdeps/pthread/unwind-forcedunwind.c b/libpthread/nptl/sysdeps/pthread/unwind-forcedunwind.c
index e058604f3..273c8bb3f 100644
--- a/libpthread/nptl/sysdeps/pthread/unwind-forcedunwind.c
+++ b/libpthread/nptl/sysdeps/pthread/unwind-forcedunwind.c
@@ -24,6 +24,10 @@
#include <sysdep.h>
#include <libgcc_s.h>
+#define __libc_dlopen(x) dlopen(x, (RTLD_LOCAL | RTLD_LAZY))
+#define __libc_dlsym dlsym
+#define __libc_dlclose dlclose
+
static void *libgcc_s_handle;
static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
static _Unwind_Reason_Code (*libgcc_s_personality)
diff --git a/libpthread/nptl/sysdeps/pthread/unwind-resume.c b/libpthread/nptl/sysdeps/pthread/unwind-resume.c
index 3ca2fd8fc..94da075d1 100644
--- a/libpthread/nptl/sysdeps/pthread/unwind-resume.c
+++ b/libpthread/nptl/sysdeps/pthread/unwind-resume.c
@@ -23,6 +23,10 @@
#include <unwind.h>
#include <libgcc_s.h>
+#define __libc_dlopen(x) dlopen(x, (RTLD_LOCAL | RTLD_LAZY))
+#define __libc_dlsym dlsym
+#define __libc_dlclose dlclose
+
static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
static _Unwind_Reason_Code (*libgcc_s_personality)
(int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *,
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in
index fa73a8a78..b5d841738 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in
@@ -5,14 +5,15 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-libpthread_CSRC = pthread_attr_getaffinity.c \
+libpthread_CSRC = pthread_attr_getaffinity.c \
pthread_attr_setaffinity.c pthread_getaffinity.c \
pthread_getcpuclockid.c pthread_kill.c \
pthread_mutex_cond_lock.c pthread_setaffinity.c \
pthread_yield.c sem_post.c sem_timedwait.c \
- pthread_sigqueue.c \
+ pthread_sigqueue.c \
sem_trywait.c sem_wait.c pt-fork.c \
- sigtimedwait.c sigwaitinfo.c sigwait.c pt-sleep.c
+ sigtimedwait.c sigwaitinfo.c sigwait.c pt-sleep.c \
+ lowlevelrobustlock.c
libpthread_SSRC = #ptw-close.S ptw-open.S ptw-waitid.S ptw-waidpid.S ptw-write.S
@@ -146,77 +147,77 @@ headers_clean-y += nptl_linux_headers_clean
#
# Create header files.
#
-CFLAGS-lowlevelbarrier.c = -S
-CFLAGS-lowlevelcond.c = -S
-CFLAGS-lowlevelrwlock.c = -S
-CFLAGS-lowlevelrobustlock.c = -S
-CFLAGS-unwindbuf.c = -S
-CFLAGS-structsem.c = -S
-CFLAGS-pthread-pi-defines.c = -S
-
-$(PTHREAD_LINUX_OUT)/lowlevelbarrier.c: $(PTHREAD_LINUX_DIR)/lowlevelbarrier.sym
+CFLAGS-gen_lowlevelbarrier.c = -S
+CFLAGS-gen_llowlevelcond.c = -S
+CFLAGS-gen_llowlevelrwlock.c = -S
+CFLAGS-gen_llowlevelrobustlock.c = -S
+CFLAGS-gen_lunwindbuf.c = -S
+CFLAGS-gen_lstructsem.c = -S
+CFLAGS-gen_lpthread-pi-defines.c = -S
+
+$(PTHREAD_LINUX_OUT)/gen_llowlevelbarrier.c: $(PTHREAD_LINUX_DIR)/lowlevelbarrier.sym
$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
-$(PTHREAD_LINUX_OUT)/lowlevelcond.c: $(PTHREAD_LINUX_DIR)/lowlevelcond.sym
+$(PTHREAD_LINUX_OUT)/gen_llowlevelcond.c: $(PTHREAD_LINUX_DIR)/lowlevelcond.sym
$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
-$(PTHREAD_LINUX_OUT)/lowlevelrwlock.c: $(PTHREAD_LINUX_DIR)/lowlevelrwlock.sym
+$(PTHREAD_LINUX_OUT)/gen_llowlevelrwlock.c: $(PTHREAD_LINUX_DIR)/lowlevelrwlock.sym
$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
-$(PTHREAD_LINUX_OUT)/lowlevelrobustlock.c: $(PTHREAD_LINUX_DIR)/lowlevelrobustlock.sym
+$(PTHREAD_LINUX_OUT)/gen_llowlevelrobustlock.c: $(PTHREAD_LINUX_DIR)/lowlevelrobustlock.sym
$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
-$(PTHREAD_LINUX_OUT)/unwindbuf.c: $(PTHREAD_LINUX_DIR)/unwindbuf.sym
+$(PTHREAD_LINUX_OUT)/gen_lunwindbuf.c: $(PTHREAD_LINUX_DIR)/unwindbuf.sym
$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
-$(PTHREAD_LINUX_OUT)/structsem.c: $(PTHREAD_LINUX_DIR)/structsem.sym
+$(PTHREAD_LINUX_OUT)/gen_lstructsem.c: $(PTHREAD_LINUX_DIR)/structsem.sym
$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
-$(PTHREAD_LINUX_OUT)/pthread-pi-defines.c: $(PTHREAD_LINUX_DIR)/pthread-pi-defines.sym
+$(PTHREAD_LINUX_OUT)/gen_lpthread-pi-defines.c: $(PTHREAD_LINUX_DIR)/pthread-pi-defines.sym
$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
-$(PTHREAD_LINUX_OUT)/lowlevelbarrier.s: $(PTHREAD_LINUX_OUT)/lowlevelbarrier.c
+$(PTHREAD_LINUX_OUT)/gen_llowlevelbarrier.s: $(PTHREAD_LINUX_OUT)/gen_llowlevelbarrier.c
$(compile.c)
-$(PTHREAD_LINUX_OUT)/lowlevelcond.s: $(PTHREAD_LINUX_OUT)/lowlevelcond.c
+$(PTHREAD_LINUX_OUT)/gen_llowlevelcond.s: $(PTHREAD_LINUX_OUT)/gen_llowlevelcond.c
$(compile.c)
-$(PTHREAD_LINUX_OUT)/lowlevelrwlock.s: $(PTHREAD_LINUX_OUT)/lowlevelrwlock.c
+$(PTHREAD_LINUX_OUT)/gen_llowlevelrwlock.s: $(PTHREAD_LINUX_OUT)/gen_llowlevelrwlock.c
$(compile.c)
-$(PTHREAD_LINUX_OUT)/lowlevelrobustlock.s: $(PTHREAD_LINUX_OUT)/lowlevelrobustlock.c
+$(PTHREAD_LINUX_OUT)/gen_llowlevelrobustlock.s: $(PTHREAD_LINUX_OUT)/gen_llowlevelrobustlock.c
$(compile.c)
-$(PTHREAD_LINUX_OUT)/unwindbuf.s: $(PTHREAD_LINUX_OUT)/unwindbuf.c
+$(PTHREAD_LINUX_OUT)/gen_lunwindbuf.s: $(PTHREAD_LINUX_OUT)/gen_lunwindbuf.c
$(compile.c)
-$(PTHREAD_LINUX_OUT)/structsem.s: $(PTHREAD_LINUX_OUT)/structsem.c
+$(PTHREAD_LINUX_OUT)/gen_lstructsem.s: $(PTHREAD_LINUX_OUT)/gen_lstructsem.c
$(compile.c)
-$(PTHREAD_LINUX_OUT)/pthread-pi-defines.s: $(PTHREAD_LINUX_OUT)/pthread-pi-defines.c
+$(PTHREAD_LINUX_OUT)/gen_lpthread-pi-defines.s: $(PTHREAD_LINUX_OUT)/gen_lpthread-pi-defines.c
$(compile.c)
-$(PTHREAD_LINUX_OUT)/lowlevelbarrier.h: $(PTHREAD_LINUX_OUT)/lowlevelbarrier.s
+$(PTHREAD_LINUX_OUT)/lowlevelbarrier.h: $(PTHREAD_LINUX_OUT)/gen_llowlevelbarrier.s
$(do_sed) -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$\/#define \1 \2/p" $< > $@
-$(PTHREAD_LINUX_OUT)/lowlevelcond.h: $(PTHREAD_LINUX_OUT)/lowlevelcond.s
+$(PTHREAD_LINUX_OUT)/lowlevelcond.h: $(PTHREAD_LINUX_OUT)/gen_llowlevelcond.s
$(do_sed) -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$\/#define \1 \2/p" $< > $@
-$(PTHREAD_LINUX_OUT)/lowlevelrwlock.h: $(PTHREAD_LINUX_OUT)/lowlevelrwlock.s
+$(PTHREAD_LINUX_OUT)/lowlevelrwlock.h: $(PTHREAD_LINUX_OUT)/gen_llowlevelrwlock.s
$(do_sed) -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$\/#define \1 \2/p" $< > $@
-$(PTHREAD_LINUX_OUT)/lowlevelrobustlock.h: $(PTHREAD_LINUX_OUT)/lowlevelrobustlock.s
+$(PTHREAD_LINUX_OUT)/lowlevelrobustlock.h: $(PTHREAD_LINUX_OUT)/gen_llowlevelrobustlock.s
$(do_sed) -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$\/#define \1 \2/p" $< > $@
-$(PTHREAD_LINUX_OUT)/unwindbuf.h: $(PTHREAD_LINUX_OUT)/unwindbuf.s
+$(PTHREAD_LINUX_OUT)/unwindbuf.h: $(PTHREAD_LINUX_OUT)/gen_lunwindbuf.s
$(do_sed) -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$\/#define \1 \2/p" $< > $@
-$(PTHREAD_LINUX_OUT)/structsem.h: $(PTHREAD_LINUX_OUT)/structsem.s
+$(PTHREAD_LINUX_OUT)/structsem.h: $(PTHREAD_LINUX_OUT)/gen_lstructsem.s
$(do_sed) -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$\/#define \1 \2/p" $< > $@
-$(PTHREAD_LINUX_OUT)/pthread-pi-defines.h: $(PTHREAD_LINUX_OUT)/pthread-pi-defines.s
+$(PTHREAD_LINUX_OUT)/pthread-pi-defines.h: $(PTHREAD_LINUX_OUT)/gen_lpthread-pi-defines.s
$(do_sed) -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$\/#define \1 \2/p" $< > $@
nptl_linux_headers: $(PTHREAD_LINUX_OUT)/lowlevelbarrier.h \
@@ -234,13 +235,20 @@ $(ALL_HEADERS_BITS_PTHREAD):
$(do_ln) ../../$(PTHREAD_LINUX_DIR)/bits/$(@F) $(top_builddir)$@
nptl_linux_headers_clean:
- $(do_rm) $(addprefix $(PTHREAD_LINUX_OUT)/lowlevelbarrier., c h s) \
- $(addprefix $(PTHREAD_LINUX_OUT)/lowlevelcond., c h s) \
- $(addprefix $(PTHREAD_LINUX_OUT)/lowlevelrwlock., c h s) \
- $(addprefix $(PTHREAD_LINUX_OUT)/lowlevelrobustlock., c h s) \
- $(addprefix $(PTHREAD_LINUX_OUT)/unwindbuf., c h s) \
- $(addprefix $(PTHREAD_LINUX_OUT)/structsem., c h s) \
- $(addprefix $(PTHREAD_LINUX_OUT)/pthread-pi-defines., c h s)
+ $(do_rm) $(addprefix $(PTHREAD_LINUX_OUT)/gen_llowlevelbarrier., c s) \
+ $(addprefix $(PTHREAD_LINUX_OUT)/gen_lowlevelcond., c s) \
+ $(addprefix $(PTHREAD_LINUX_OUT)/gen_llowlevelrwlock., c s) \
+ $(addprefix $(PTHREAD_LINUX_OUT)/gen_llowlevelrobustlock., c s) \
+ $(addprefix $(PTHREAD_LINUX_OUT)/gen_lunwindbuf., c s) \
+ $(addprefix $(PTHREAD_LINUX_OUT)/gen_lstructsem., c s) \
+ $(addprefix $(PTHREAD_LINUX_OUT)/gen_lpthread-pi-defines., c s) \
+ $(PTHREAD_LINUX_OUT)/lowlevelbarrier.h \
+ $(PTHREAD_LINUX_OUT)/lowlevelcond.h \
+ $(PTHREAD_LINUX_OUT)/lowlevelrwlock.h \
+ $(PTHREAD_LINUX_OUT)/lowlevelrobustlock.h \
+ $(PTHREAD_LINUX_OUT)/unwindbuf.h \
+ $(PTHREAD_LINUX_OUT)/structsem.h \
+ $(PTHREAD_LINUX_OUT)/pthread-pi-defines.h
nptl_linux_clean:
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch
index a82f8c8be..c5852818d 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch
@@ -9,7 +9,7 @@ libpthread_SSRC = pt-vfork.S
libpthread_CSRC = pthread_once.c lowlevellock.c \
pt-__syscall_rt_sigaction.c pt-__syscall_error.c
-libc_a_CSRC = fork.c
+libc_a_CSRC = fork.c lowlevellock.c
libc_a_SSRC = clone.S vfork.S
ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/lowlevellock.c b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/lowlevellock.c
index 60ccf7700..8c8955e05 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/lowlevellock.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/lowlevellock.c
@@ -21,6 +21,7 @@
#include <sysdep.h>
#include <lowlevellock.h>
#include <sys/time.h>
+#include <tls.h>
void
__lll_lock_wait_private (int *futex)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c
index e19facfb8..d095d3083 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c
@@ -21,6 +21,9 @@
#include <stdio.h>
#include <unwind.h>
#include <pthreadP.h>
+#define __libc_dlopen(x) dlopen(x, (RTLD_LOCAL | RTLD_LAZY))
+#define __libc_dlsym dlsym
+#define __libc_dlclose dlclose
static void *libgcc_s_handle;
static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
@@ -59,7 +62,7 @@ pthread_cancel_init (void)
== NULL
|| (getcfa = __libc_dlsym (handle, "_Unwind_GetCFA")) == NULL
)
- __libc_fatal ("libgcc_s.so.1 must be installed for pthread_cancel to work\n");
+ fprintf(stderr, "libgcc_s.so.1 must be installed for pthread_cancel to work\n");
libgcc_s_resume = resume;
libgcc_s_personality = personality;
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-resume.c b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-resume.c
index 8dcfd34b1..bf0348ac2 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-resume.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-resume.c
@@ -20,6 +20,9 @@
#include <dlfcn.h>
#include <stdio.h>
#include <unwind.h>
+#define __libc_dlopen(x) dlopen(x, (RTLD_LOCAL | RTLD_LAZY))
+#define __libc_dlsym dlsym
+#define __libc_dlclose dlclose
static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
static _Unwind_Reason_Code (*libgcc_s_personality)
@@ -42,7 +45,7 @@ init (void)
|| (sjlj_unregister = __libc_dlsym (handle, "_Unwind_SjLj_Unregister")) == NULL
|| (resume = __libc_dlsym (handle, "_Unwind_SjLj_Resume")) == NULL
|| (personality = __libc_dlsym (handle, "__gcc_personality_sj0")) == NULL)
- __libc_fatal ("libgcc_s.so.1 must be installed for pthread_cancel to work\n");
+ fprintf(stderr, "libgcc_s.so.1 must be installed for pthread_cancel to work\n");
libgcc_s_resume = resume;
libgcc_s_personality = personality;
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/internaltypes.h b/libpthread/nptl/sysdeps/unix/sysv/linux/internaltypes.h
index add20b6f7..3466c7fe5 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/internaltypes.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/internaltypes.h
@@ -21,7 +21,7 @@
#define _INTERNALTYPES_H 1
#include <stdint.h>
-
+#include <sched.h>
struct pthread_attr
{
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/not-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/not-cancel.h
index 9418417b4..80d33be29 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/not-cancel.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/not-cancel.h
@@ -1,5 +1,5 @@
/* Uncancelable versions of cancelable interfaces. Linux version.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
@@ -18,6 +18,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <sys/types.h>
#include <sysdep.h>
/* Uncancelable open. */
@@ -26,6 +27,28 @@
#define open_not_cancel_2(name, flags) \
INLINE_SYSCALL (open, 2, (const char *) (name), (flags))
+/* Uncancelable openat. */
+#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
+extern int __openat_nocancel (int fd, const char *fname, int oflag,
+ mode_t mode) attribute_hidden;
+extern int __openat64_nocancel (int fd, const char *fname, int oflag,
+ mode_t mode) attribute_hidden;
+#else
+# define __openat_nocancel(fd, fname, oflag, mode) \
+ openat (fd, fname, oflag, mode)
+# define __openat64_nocancel(fd, fname, oflag, mode) \
+ openat64 (fd, fname, oflag, mode)
+#endif
+
+#define openat_not_cancel(fd, fname, oflag, mode) \
+ __openat_nocancel (fd, fname, oflag, mode)
+#define openat_not_cancel_3(fd, fname, oflag) \
+ __openat_nocancel (fd, fname, oflag, 0)
+#define openat64_not_cancel(fd, fname, oflag, mode) \
+ __openat64_nocancel (fd, fname, oflag, mode)
+#define openat64_not_cancel_3(fd, fname, oflag) \
+ __openat64_nocancel (fd, fname, oflag, 0)
+
/* Uncancelable close. */
#define close_not_cancel(fd) \
INLINE_SYSCALL (close, 1, fd)
@@ -58,3 +81,25 @@
# define waitpid_not_cancel(pid, stat_loc, options) \
INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL)
#endif
+
+/* Uncancelable pause. */
+#ifdef __NR_pause
+# define pause_not_cancel() \
+ INLINE_SYSCALL (pause, 0)
+#else
+# define pause_not_cancel() \
+ __pause_nocancel ()
+#endif
+
+/* Uncancelable nanosleep. */
+#ifdef __NR_nanosleep
+# define nanosleep_not_cancel(requested_time, remaining) \
+ INLINE_SYSCALL (nanosleep, 2, requested_time, remaining)
+#else
+# define nanosleep_not_cancel(requested_time, remaining) \
+ __nanosleep_nocancel (requested_time, remaining)
+#endif
+
+/* Uncancelable sigsuspend. */
+#define sigsuspend_not_cancel(set) \
+ __sigsuspend_nocancel (set)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sem_post.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sem_post.c
index 7ed0df89a..edb97c4ba 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sem_post.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sem_post.c
@@ -23,6 +23,7 @@
#include <lowlevellock.h>
#include <internaltypes.h>
#include <semaphore.h>
+#include <tls.h>
int
__new_sem_post (sem_t *sem)