[git commit master] Assorted fixed to get nptl compiling on ARM

Khem Raj raj.khem at gmail.com
Fri Apr 23 14:31:55 UTC 2010


commit: http://git.uclibc.org/uClibc/commit/?id=94f3c30dc2d8193f977daf04414b1edd815ced83
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master

Signed-off-by: Khem Raj <raj.khem at gmail.com>
---
 include/libc-symbols.h                             |    6 ++
 libc/sysdeps/linux/arm/sysdep.h                    |    5 +
 libc/sysdeps/linux/common/bits/kernel-features.h   |    5 -
 libc/sysdeps/linux/common/not-cancel.h             |   61 ++++++++++++---
 libc/unistd/sysconf.c                              |    3 -
 libpthread/nptl/descr.h                            |    1 +
 libpthread/nptl/init.c                             |    8 --
 libpthread/nptl/pthread_create.c                   |    3 +-
 libpthread/nptl/pthread_getattr_np.c               |    2 +-
 libpthread/nptl/sysdeps/arm/tls.h                  |   28 ++++++-
 libpthread/nptl/sysdeps/pthread/Makefile.in        |    2 +-
 libpthread/nptl/sysdeps/pthread/bits/libc-lock.h   |    8 ++-
 libpthread/nptl/sysdeps/pthread/tpp.c              |    2 +-
 libpthread/nptl/sysdeps/pthread/uClibc-glue.h      |   47 +++++++++++
 .../nptl/sysdeps/pthread/unwind-forcedunwind.c     |    4 +
 libpthread/nptl/sysdeps/pthread/unwind-resume.c    |    4 +
 .../nptl/sysdeps/unix/sysv/linux/Makefile.in       |   86 +++++++++++---------
 .../nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch |    2 +-
 .../sysdeps/unix/sysv/linux/arm/lowlevellock.c     |    1 +
 .../unix/sysv/linux/arm/unwind-forcedunwind.c      |    5 +-
 .../sysdeps/unix/sysv/linux/arm/unwind-resume.c    |    5 +-
 .../nptl/sysdeps/unix/sysv/linux/internaltypes.h   |    2 +-
 .../nptl/sysdeps/unix/sysv/linux/not-cancel.h      |   47 +++++++++++-
 libpthread/nptl/sysdeps/unix/sysv/linux/sem_post.c |    1 +
 24 files changed, 258 insertions(+), 80 deletions(-)
 create mode 100644 libpthread/nptl/sysdeps/pthread/uClibc-glue.h

diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 2729d30..b2e0771 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 0c39dfa..b1ae2fd 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 c6647c8..db0a6d8 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 ebdc607..9418417 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 at 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 b92498b..b7cb494 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 c355eae..40f552d 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 765dc5d..b651a3e 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 a61cd71..8b53cb1 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 e0e6251..86a4385 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 29200a1..0ca597a 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 9497789..303b04f 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 70fe676..3268aa5 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 0325010..9adab79 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 0000000..b957ded
--- /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 e058604..273c8bb 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 3ca2fd8..94da075 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 fa73a8a..b5d8417 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 a82f8c8..c585281 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 60ccf77..8c8955e 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 e19facf..d095d30 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 8dcfd34..bf0348a 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 add20b6..3466c7f 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 9418417..80d33be 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 at 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 7ed0df8..edb97c4 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)
-- 
1.6.3.3



More information about the uClibc-cvs mailing list