summaryrefslogtreecommitdiff
path: root/libpthread/nptl/sysdeps/unix/sysv/linux
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 /libpthread/nptl/sysdeps/unix/sysv/linux
parent5e6d4834e6b35c6b0017fcdaf246c505dec10452 (diff)
Assorted fixed to get nptl compiling on ARM
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'libpthread/nptl/sysdeps/unix/sysv/linux')
-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
8 files changed, 105 insertions, 44 deletions
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)