summaryrefslogtreecommitdiff
path: root/libpthread/nptl/sysdeps/unix/sysv
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2010-07-01 10:28:46 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2010-07-06 18:33:22 +0200
commit9381d622e2411a35a5fd73a5a573eb269e2dd9c9 (patch)
tree84b4bcad496368d6ce9875451e5adcc9c6138560 /libpthread/nptl/sysdeps/unix/sysv
parenteaae6e6776ad091a5b84c3fb09f26ff01bda2f18 (diff)
nptl: fix buildsys
Now automatically picks the correct (arch and subarch specific) impls in favour of generic impls. make O=/tmp/objs PREFIX=/my/sysroot -j works now as expected (both out-of-tree as well as parallel-safe). Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libpthread/nptl/sysdeps/unix/sysv')
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch302
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch55
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/arm/libc-lowlevellock.c21
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch59
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch49
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Makefile.arch54
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch94
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Makefile.arch63
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/waitpid.S4
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile.arch72
10 files changed, 250 insertions, 523 deletions
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch
index 4f09da4e1..43bcc6789 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch
@@ -11,72 +11,112 @@ ifneq ($(abspath libpthread/nptl/sysdeps/unix/sysv/linux/$(TARGET_ARCH)),$(abspa
subdirs += libpthread/nptl/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/$(TARGET_SUBARCH)
endif
-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 \
- sem_trywait.c sem_wait.c pt-fork.c \
- sigtimedwait.c sigwaitinfo.c sigwait.c pt-sleep.c
-
-libpthread_SSRC = #ptw-close.S ptw-open.S ptw-waitid.S ptw-waidpid.S ptw-write.S
-
-libc_CSRC = libc_pthread_init.c libc_multiple_threads.c \
- register-atfork.c unregister-atfork.c getpid.c \
- raise.c sleep.c jmp-unwind.c
-
-# These provide both a cancellable and a not cancellable implementation
-libc_SSRC = close.S open.S write.S read.S waitpid.S
-
-librt_CSRC := mq_notify.c timer_create.c timer_delete.c \
- timer_getoverr.c timer_gettime.c timer_routines.c \
- timer_settime.c
-
-
-ifeq ($(TARGET_ARCH),alpha)
-libpthread_CSRC += lowlevellock.c
-libc_CSRC += libc-lowlevellock.c
-librt_CSRC := mq_notify.c
+libpthread_linux_DIR := $(top_srcdir)libpthread/nptl/sysdeps/unix/sysv/linux
+libpthread_linux_OUT := $(top_builddir)libpthread/nptl/sysdeps/unix/sysv/linux
+libpthread_linux_arch_DIR := $(libpthread_linux_DIR)/$(TARGET_ARCH)
+libpthread_linux_arch_OUT := $(libpthread_linux_OUT)/$(TARGET_ARCH)
+
+libc_linux_CSRC :=
+libpthread_linux_CSRC :=
+librt_linux_CSRC :=
+
+-include $(libpthread_linux_arch_DIR)/Makefile.arch
+
+ifneq ($(TARGET_SUBARCH),)
+libpthread_linux_subarch_DIR := $(libpthread_linux_arch_DIR)/$(TARGET_SUBARCH)
+libpthread_linux_subarch_OUT := $(libpthread_linux_arch_OUT)/$(TARGET_SUBARCH)
+
+libpthread_linux_subarch_SSRC := $(notdir $(wildcard $(libpthread_linux_subarch_DIR)/*.S))
+libc_linux_subarch_SSRC := $(notdir $(wildcard $(libpthread_linux_subarch_DIR)/libc-*.S))
+librt_linux_subarch_SSRC := $(notdir $(wildcard $(libpthread_linux_subarch_DIR)/librt-*.S))
+ifneq ($(libc_linux_subarch_SSRC)$(librt_linux_subarch_SSRC),)
+libpthread_linux_subarch_SSRC := $(filter-out $(libc_linux_subarch_SSRC) $(librt_linux_subarch_SSRC),$(libpthread_linux_subarch_SSRC))
+libc_linux_arch_CSRC := $(filter-out $(libc_linux_subarch_SSRC:.S=.c),$(libc_linux_arch_CSRC))
+libc_linux_arch_SSRC := $(filter-out $(libc_linux_subarch_SSRC),$(libc_linux_arch_SSRC))
endif
-
-ifeq ($(TARGET_ARCH),arm)
-libc_SSRC := $(filter-out waitpid.S,$(libc_SSRC))
-libpthread_CSRC += lowlevelrobustlock.c
+ifneq ($(libpthread_linux_subarch_SSRC),)
+libpthread_linux_arch_SSRC := $(filter-out $(libpthread_linux_subarch_SSRC),$(libpthread_linux_arch_SSRC))
+libpthread_linux_arch_CSRC := $(filter-out $(libpthread_linux_subarch_SSRC:.S=.c),$(libpthread_linux_arch_CSRC))
endif
-
-ifeq ($(TARGET_ARCH),mips)
-libpthread_CSRC += lowlevellock.c lowlevelrobustlock.c
-libc_CSRC += libc-lowlevellock.c
+ifneq ($(librt_linux_subarch_SSRC),)
+librt_linux_arch_SSRC := $(filter-out $(librt_linux_subarch_SSRC),$(librt_linux_arch_SSRC))
+librt_linux_arch_CSRC := $(filter-out $(librt_linux_subarch_SSRC:.S=.c),$(librt_linux_arch_CSRC))
endif
-
-ifeq ($(TARGET_ARCH),powerpc)
-libpthread_CSRC += lowlevellock.c lowlevelrobustlock.c
-libc_CSRC += libc-lowlevellock.c
-librt_CSRC += __syscall_error.c
+libpthread_linux_subarch_SOBJ = $(patsubst %.S,$(libpthread_linux_subarch_OUT)/%.o,$(libpthread_linux_subarch_SSRC))
+libc_linux_subarch_SOBJ := $(patsubst %.S,$(libpthread_linux_subarch_OUT)/%.o,$(libc_linux_subarch_SSRC))
+librt_linux_subarch_SOBJ := $(patsubst %.S,$(libpthread_linux_subarch_OUT)/%.o,$(librt_linux_subarch_SSRC))
endif
-ifeq ($(TARGET_ARCH),sparc)
-libpthread_CSRC += __syscall_error.c lowlevelrobustlock.c
-librt_CSRC += __syscall_error.c
-endif
+libpthread_linux_arch_SOBJ = $(patsubst %.S,$(libpthread_linux_arch_OUT)/%.o,$(libpthread_linux_arch_SSRC))
+libpthread_linux_arch_COBJ = $(patsubst %.c,$(libpthread_linux_arch_OUT)/%.o,$(libpthread_linux_arch_CSRC))
+libpthread_linux_arch_OBJS := $(libpthread_linux_subarch_SOBJ) $(libpthread_linux_arch_SOBJ) $(libpthread_linux_arch_COBJ)
+libc_linux_arch_SOBJ = $(patsubst %.S,$(libpthread_linux_arch_OUT)/%.o,$(libc_linux_arch_SSRC))
+libc_linux_arch_COBJ = $(patsubst %.c,$(libpthread_linux_arch_OUT)/%.o,$(libc_linux_arch_CSRC))
+libc_linux_arch_OBJS := $(libc_linux_subarch_SOBJ) $(libc_linux_arch_SOBJ) $(libc_linux_arch_COBJ)
+librt_linux_arch_SOBJ = $(patsubst %.S,$(libpthread_linux_arch_OUT)/%.o,$(librt_linux_arch_SSRC))
+librt_linux_arch_COBJ = $(patsubst %.c,$(libpthread_linux_arch_OUT)/%.o,$(librt_linux_arch_CSRC))
+librt_linux_arch_OBJS := $(librt_linux_subarch_SOBJ) $(librt_linux_arch_SOBJ) $(librt_linux_arch_COBJ)
+
+libpthread_linux_CSRC += pthread_attr_getaffinity.c pthread_attr_setaffinity.c \
+ pthread_getaffinity.c pthread_setaffinity.c \
+ pthread_getcpuclockid.c pthread_kill.c \
+ pthread_mutex_cond_lock.c pthread_yield.c \
+ sem_post.c sem_timedwait.c sem_trywait.c sem_wait.c \
+ pt-fork.c pt-sleep.c pthread_sigqueue.c \
+ sigtimedwait.c sigwaitinfo.c sigwait.c \
+ lowlevellock.c lowlevelrobustlock.c
+
+libpthread_linux_SSRC := #ptw-close.S ptw-open.S ptw-waitid.S ptw-waidpid.S ptw-write.S
+
+libc_linux_CSRC += libc_pthread_init.c libc_multiple_threads.c \
+ register-atfork.c unregister-atfork.c getpid.c \
+ raise.c sleep.c jmp-unwind.c libc-lowlevellock.c
+
+librt_linux_CSRC += mq_notify.c timer_create.c timer_delete.c \
+ timer_getoverr.c timer_gettime.c timer_routines.c \
+ timer_settime.c
-ifeq ($(TARGET_ARCH),sh)
-SH_PTHREAD_SPECIFIC := sem_post.c sem_wait.c sem_timedwait.c sem_trywait.c
-libpthread_CSRC := $(filter-out $(SH_PTHREAD_SPECIFIC),$(libpthread_CSRC))
+# These provide both a cancellable and a not cancellable implementation
+libc_linux_SSRC = close.S open.S write.S read.S waitpid.S
+libc_linux_SSRC := $(filter-out $(libc_linux_arch_SSRC-OMIT),$(libc_linux_SSRC))
+
+libpthread_linux_CSRC := $(filter-out $(notdir $(libpthread_linux_arch_OBJS:.o=.c)),$(libpthread_linux_CSRC))
+libpthread_linux_SSRC := $(filter-out $(notdir $(libpthread_linux_arch_OBJS:.o=.S)),$(libpthread_linux_SSRC))
+libc_linux_SSRC := $(filter-out $(notdir $(libc_linux_arch_OBJS:.o=.S)),$(libc_linux_SSRC))
+libc_linux_CSRC := $(filter-out $(notdir $(libc_linux_arch_OBJS:.o=.c)),$(libc_linux_CSRC))
+librt_linux_SSRC := $(filter-out $(notdir $(librt_linux_arch_OBJS:.o=.S)),$(librt_linux_SSRC))
+librt_linux_CSRC := $(filter-out $(notdir $(librt_linux_arch_OBJS:.o=.c)),$(librt_linux_CSRC))
+
+libpthread_linux_OBJS = $(libpthread_linux_arch_OBJS)
+libpthread_linux_OBJS += $(patsubst %.c,$(libpthread_linux_OUT)/%.o,$(libpthread_linux_CSRC))
+libpthread_linux_OBJS += $(patsubst %.S,$(libpthread_linux_OUT)/%.o,$(libpthread_linux_SSRC))
+ifneq ($(libpthread_linux_OMIT_OBJS),)
+libpthread_linux_OBJS := $(filter-out $(libpthread_linux_OMIT_OBJS),$(libpthread_linux_OBJS))
endif
-ifeq ($(TARGET_ARCH),i386)
-X86_PTHREAD_SPECIFIC := sem_post.c sem_wait.c sem_timedwait.c sem_trywait.c
-libpthread_CSRC := $(filter-out $(X86_PTHREAD_SPECIFIC),$(libpthread_CSRC))
-endif
+libpthread-a-y += $(if $(DOPIC),$(libpthread_linux_OBJS:.o=.os),$(libpthread_linux_OBJS))
+libpthread-so-y += $(libpthread_linux_OBJS:.o=.oS)
+libpthread-so-y += $(libpthread_linux_OUT)/pt-raise.oS
+#libpthread-nomulti-y += $(libpthread_linux_OBJS)
-ifeq ($(TARGET_ARCH),x86_64)
-libc_SSRC := $(filter-out waitpid.S,$(libc_SSRC))
-X64_PTHREAD_SPECIFIC := sem_post.c sem_wait.c sem_timedwait.c sem_trywait.c
-libpthread_CSRC := $(filter-out $(X64_PTHREAD_SPECIFIC),$(libpthread_CSRC))
+libc_linux_OBJS := $(libc_linux_arch_OBJS)
+libc_linux_OBJS += $(patsubst %.c,$(libpthread_linux_OUT)/%.o,$(libc_linux_CSRC))
+libc_linux_OBJS += $(patsubst %.S,$(libpthread_linux_OUT)/%.o,$(libc_linux_SSRC))
+ifneq ($(libc_linux_OMIT_OBJS),)
+libc_linux_OBJS := $(filter-out $(libc_linux_OMIT_OBJS),$(libc_linux_OBJS))
endif
+libc-static-y += $(libc_linux_OBJS)
+libc-shared-y += $(libc_linux_OBJS:.o=.oS)
+#libc-nomulti-y += $(libc_linux_OBJS)
+
+librt_linux_OBJS := $(librt_linux_arch_OBJS)
+librt_linux_OBJS += $(patsubst %.c,$(libpthread_linux_OUT)/%.o,$(librt_linux_CSRC))
+librt_linux_OBJS += $(patsubst %.S,$(libpthread_linux_OUT)/%.o,$(librt_linux_SSRC))
+
+objclean-y += CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux
+headers_clean-y += HEADERCLEAN_libpthread/nptl/sysdeps/unix/sysv/linux
+
CFLAGS-pthread_getcpuclockid.c = -I$(top_srcdir)librt
CFLAGS-pt-pread_pwrite.c = -I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH) \
-I$(top_srcdir)libc/sysdeps/linux/common
@@ -89,7 +129,6 @@ CFLAGS-timer_routines.c = -I$(top_srcdir)librt -DIS_IN_librt=1
CFLAGS-timer_settime.c = -I$(top_srcdir)librt -DIS_IN_librt=1
CFLAGS-linux = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 $(SSP_ALL_CFLAGS)
-#CFLAGS:=$(CFLAGS:-O1=-O2)
CFLAGS-OMIT-libc_pthread_init.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-OMIT-libc_multiple_threads.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
@@ -114,148 +153,59 @@ CFLAGS-OMIT-timer_gettime.c = -DIS_IN_libpthread=1
CFLAGS-OMIT-timer_routines.c = -DIS_IN_libpthread=1
CFLAGS-OMIT-timer_settime.c = -DIS_IN_libpthread=1
-PTHREAD_LINUX_DIR := $(top_srcdir)libpthread/nptl/sysdeps/unix/sysv/linux
-PTHREAD_LINUX_OUT := $(top_builddir)libpthread/nptl/sysdeps/unix/sysv/linux
-
-PTHREAD_LINUX_OBJ := $(patsubst %.c,$(PTHREAD_LINUX_OUT)/%.o,$(libpthread_CSRC))
-PTHREAD_LINUX_OBJ += $(patsubst %.S,$(PTHREAD_LINUX_OUT)/%.o,$(libpthread_SSRC))
-
-ifeq ($(DOPIC),y)
-libpthread-a-y += $(PTHREAD_LINUX_OBJ:.o=.os)
-else
-libpthread-a-y += $(PTHREAD_LINUX_OBJ)
-endif
-libpthread-so-y += $(PTHREAD_LINUX_OBJ:.o=.oS)
-libpthread-so-y += $(PTHREAD_LINUX_OUT)/pt-raise.oS
-libpthread-nomulti-y += $(PTHREAD_LINUX_OBJ)
-
ASFLAGS-open.S = -D_LIBC_REENTRANT
ASFLAGS-close.S = -D_LIBC_REENTRANT
ASFLAGS-read.S = -D_LIBC_REENTRANT
ASFLAGS-write.S = -D_LIBC_REENTRANT
ASFLAGS-waitpid.S = -D_LIBC_REENTRANT
-LIBC_LINUX_OBJ := $(patsubst %.c,$(PTHREAD_LINUX_OUT)/%.o,$(libc_CSRC))
-LIBC_LINUX_OBJ += $(patsubst %.S,$(PTHREAD_LINUX_OUT)/%.o,$(libc_SSRC))
-
-libc-static-y += $(LIBC_LINUX_OBJ)
-libc-shared-y += $(LIBC_LINUX_OBJ:.o=.oS)
-libc-nomulti-y += $(LIBC_LINUX_OBJ)
-
-LIBRT_LINUX_OBJ := $(patsubst %.c,$(PTHREAD_LINUX_OUT)/%.o,$(librt_CSRC))
-
-librt-a-y += $(LIBRT_LINUX_OBJ)
-librt-so-y += $(LIBRT_LINUX_OBJ:.o=.oS)
-
-objclean-y += CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux
-headers_clean-y += HEADERCLEAN_libpthread/nptl/sysdeps/unix/sysv/linux
-
#
# Create header files.
#
CFLAGS-gen_lowlevelbarrier.c = -S
CFLAGS-gen_lowlevelcond.c = -S
-CFLAGS-gen_lowlevelrwlock.c = -S
CFLAGS-gen_lowlevelrobustlock.c = -S
-CFLAGS-gen_lunwindbuf.c = -S
-CFLAGS-gen_lstructsem.c = -S
-CFLAGS-gen_lpthread-pi-defines.c = -S
-
-$(PTHREAD_LINUX_OUT)/gen_lowlevelbarrier.c: $(PTHREAD_LINUX_DIR)/lowlevelbarrier.sym
- $(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
-
-$(PTHREAD_LINUX_OUT)/gen_lowlevelcond.c: $(PTHREAD_LINUX_DIR)/lowlevelcond.sym
- $(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
-
-$(PTHREAD_LINUX_OUT)/gen_lowlevelrwlock.c: $(PTHREAD_LINUX_DIR)/lowlevelrwlock.sym
- $(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
-
-$(PTHREAD_LINUX_OUT)/gen_lowlevelrobustlock.c: $(PTHREAD_LINUX_DIR)/lowlevelrobustlock.sym
- $(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
+CFLAGS-gen_lowlevelrwlock.c = -S
+CFLAGS-gen_pthread-pi-defines.c = -S
+CFLAGS-gen_structsem.c = -S
+CFLAGS-gen_unwindbuf.c = -S
-$(PTHREAD_LINUX_OUT)/gen_lunwindbuf.c: $(PTHREAD_LINUX_DIR)/unwindbuf.sym
- $(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
+PTHREAD_GENERATE_MANGLE ?= -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*\$$/\#define \1 \2/p"
-$(PTHREAD_LINUX_OUT)/gen_lstructsem.c: $(PTHREAD_LINUX_DIR)/structsem.sym
- $(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
+PTHREAD_LINUX_SYM := $(notdir $(wildcard $(libpthread_linux_DIR)/*.sym))
+PTHREAD_LINUX_SYM_C := $(addprefix $(libpthread_linux_OUT)/gen_,$(PTHREAD_LINUX_SYM:.sym=.c))
+PTHREAD_LINUX_SYM_S := $(PTHREAD_LINUX_SYM_C:.c=.s)
+PTHREAD_LINUX_SYM_H := $(addprefix $(libpthread_linux_OUT)/,$(PTHREAD_LINUX_SYM:.sym=.h))
-$(PTHREAD_LINUX_OUT)/gen_lpthread-pi-defines.c: $(PTHREAD_LINUX_DIR)/pthread-pi-defines.sym
+$(PTHREAD_LINUX_SYM_C): $(libpthread_linux_OUT)/gen_%.c: $(libpthread_linux_DIR)/%.sym | $(libpthread_linux_OUT)
$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
-
-
-$(PTHREAD_LINUX_OUT)/gen_lowlevelbarrier.s: $(PTHREAD_LINUX_OUT)/gen_lowlevelbarrier.c
- $(compile.c)
-
-$(PTHREAD_LINUX_OUT)/gen_lowlevelcond.s: $(PTHREAD_LINUX_OUT)/gen_lowlevelcond.c
- $(compile.c)
-
-$(PTHREAD_LINUX_OUT)/gen_lowlevelrwlock.s: $(PTHREAD_LINUX_OUT)/gen_lowlevelrwlock.c
- $(compile.c)
-
-$(PTHREAD_LINUX_OUT)/gen_lowlevelrobustlock.s: $(PTHREAD_LINUX_OUT)/gen_lowlevelrobustlock.c
- $(compile.c)
-
-$(PTHREAD_LINUX_OUT)/gen_lunwindbuf.s: $(PTHREAD_LINUX_OUT)/gen_lunwindbuf.c
- $(compile.c)
-
-$(PTHREAD_LINUX_OUT)/gen_lstructsem.s: $(PTHREAD_LINUX_OUT)/gen_lstructsem.c
- $(compile.c)
-
-$(PTHREAD_LINUX_OUT)/gen_lpthread-pi-defines.s: $(PTHREAD_LINUX_OUT)/gen_lpthread-pi-defines.c
+$(PTHREAD_LINUX_SYM_S): $(libpthread_linux_OUT)/gen_%.s: $(libpthread_linux_OUT)/gen_%.c | headers
$(compile.c)
+libpthread-generated-y += $(PTHREAD_LINUX_SYM_S)
+$(PTHREAD_LINUX_SYM_H): $(libpthread_linux_OUT)/%.h: $(libpthread_linux_OUT)/gen_%.s
+ $(do_sed) $(PTHREAD_GENERATE_MANGLE) $< > $@
+ @if test ! -s $@ ; then rm -f $@ ; false ; fi
+pregen-headers-$(UCLIBC_HAS_THREADS_NATIVE) += $(PTHREAD_LINUX_SYM_H)
-$(PTHREAD_LINUX_OUT)/lowlevelbarrier.h: $(PTHREAD_LINUX_OUT)/gen_lowlevelbarrier.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)/gen_lowlevelcond.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)/gen_lowlevelrwlock.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)/gen_lowlevelrobustlock.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)/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)/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)/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" $< > $@
-
-pregen-headers-$(UCLIBC_HAS_THREADS_NATIVE) += \
- $(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
-
-HEADERS_BITS_PTHREAD := $(notdir $(wildcard $(PTHREAD_LINUX_DIR)/bits/*.h))
-ALL_HEADERS_BITS_PTHREAD := $(addprefix include/bits/,$(HEADERS_BITS_PTHREAD))
+HEADERS_BITS_PTHREAD := $(notdir $(wildcard $(libpthread_linux_DIR)/bits/*.h))
+ALL_HEADERS_BITS_PTHREAD := $(addprefix $(top_builddir)include/bits/,$(HEADERS_BITS_PTHREAD))
$(ALL_HEADERS_BITS_PTHREAD): $(top_builddir)include/bits/%: | $(top_builddir)include/bits
- $(do_ln) $(call rel_srcdir)$(PTHREAD_LINUX_DIR)/bits/$(@F) $@
+ $(do_ln) $(call rel_srcdir)$(libpthread_linux_DIR)/bits/$(@F) $@
HEADERCLEAN_libpthread/nptl/sysdeps/unix/sysv/linux:
- $(do_rm) $(addprefix $(PTHREAD_LINUX_OUT)/gen_lowlevelbarrier., c s) \
- $(addprefix $(PTHREAD_LINUX_OUT)/gen_lowlevelcond., c s) \
- $(addprefix $(PTHREAD_LINUX_OUT)/gen_lowlevelrwlock., c s) \
- $(addprefix $(PTHREAD_LINUX_OUT)/gen_lowlevelrobustlock., 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
+ $(do_rm) $(PTHREAD_LINUX_SYM_C) $(PTHREAD_LINUX_SYM_S) \
+ $(PTHREAD_LINUX_SYM_H)
CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux:
- $(do_rm) $(addprefix $(PTHREAD_LINUX_OUT)/*., o os oS)
+ $(do_rm) $(addprefix $(libpthread_linux_OUT)/*., o os oS)
+
+objclean-y+=CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux/$(TARGET_ARCH)
+CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux/$(TARGET_ARCH):
+ $(do_rm) $(addprefix $(libpthread_linux_arch_OUT)/*., o os oS)
+ifneq ($(TARGET_SUBARCH),)
+objclean-y+=CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/$(TARGET_SUBARCH)
+CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/$(TARGET_SUBARCH):
+ $(do_rm) $(addprefix $(libpthread_linux_subarch_OUT)/*., o os oS)
+endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch
index c5852818d..ec5eb1dd4 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch
@@ -5,54 +5,29 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-libpthread_SSRC = pt-vfork.S
-libpthread_CSRC = pthread_once.c lowlevellock.c \
- pt-__syscall_rt_sigaction.c pt-__syscall_error.c
+libpthread_linux_arch_SSRC = pt-vfork.S
+libpthread_linux_arch_CSRC = pthread_once.c \
+ pt-__syscall_rt_sigaction.c pt-__syscall_error.c \
+ lowlevellock.c
-libc_a_CSRC = fork.c lowlevellock.c
-libc_a_SSRC = clone.S vfork.S
+libc_linux_arch_CSRC = fork.c libc-lowlevellock.c
+libc_linux_arch_SSRC = clone.S vfork.S
+libc_linux_arch_SSRC-OMIT = waitpid.S
+
+CFLAGS += $(SSP_ALL_CFLAGS)
-ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y)
-CFLAGS-fork.c = -D__USE_STDIO_FUTEXES__
-endif
CFLAGS-pthread_once.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-pt-__syscall_rt_sigaction.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-lowlevellock.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-pt-__syscall_error.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
-
ASFLAGS-pt-vfork.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -marm
+
+ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y)
+CFLAGS-fork.c = -D__USE_STDIO_FUTEXES__
+endif
+CFLAGS-OMIT-fork.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-libc-lowlevellock.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
# We always compile it in arm mode because of SAVE_PID macro
# This macro should be alternatively implemented in THUMB
# assembly.
ASFLAGS-vfork.S = -marm
-
-CFLAGS += $(SSP_ALL_CFLAGS)
-#CFLAGS:=$(CFLAGS:-O1=-O2)
-
-LINUX_ARCH_DIR:=$(top_srcdir)libpthread/nptl/sysdeps/unix/sysv/linux/arm
-LINUX_ARCH_OUT:=$(top_builddir)libpthread/nptl/sysdeps/unix/sysv/linux/arm
-
-LINUX_ARCH_OBJ:=$(patsubst %.S,$(LINUX_ARCH_OUT)/%.o,$(libpthread_SSRC))
-LINUX_ARCH_OBJ+=$(patsubst %.c,$(LINUX_ARCH_OUT)/%.o,$(libpthread_CSRC))
-
-ifeq ($(DOPIC),y)
-libpthread-a-y += $(LINUX_ARCH_OBJ:.o=.os)
-else
-libpthread-a-y += $(LINUX_ARCH_OBJ)
-endif
-libpthread-so-y += $(LINUX_ARCH_OBJ:.o=.oS)
-
-libpthread-nomulti-y+=$(LINUX_ARCH_OBJ)
-
-LIBC_LINUX_ARCH_OBJ:=$(patsubst %.c,$(LINUX_ARCH_OUT)/%.o,$(libc_a_CSRC))
-LIBC_LINUX_ARCH_OBJ+=$(patsubst %.S,$(LINUX_ARCH_OUT)/%.o,$(libc_a_SSRC))
-
-libc-static-y+=$(LIBC_LINUX_ARCH_OBJ)
-libc-shared-y+=$(LIBC_LINUX_ARCH_OBJ:.o=.oS)
-
-libc-nomulti-y+=$(LIBC_LINUX_ARCH_OBJ)
-
-objclean-y+=pthread_linux_arch_objclean
-
-pthread_linux_arch_objclean:
- $(RM) $(LINUX_ARCH_OUT)/*.{o,os,oS}
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/libc-lowlevellock.c b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/libc-lowlevellock.c
new file mode 100644
index 000000000..b19282281
--- /dev/null
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/libc-lowlevellock.c
@@ -0,0 +1,21 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Paul Mackerras <paulus@au.ibm.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. */
+
+/* No difference to lowlevellock.c, except we lose a couple of functions. */
+#include "lowlevellock.c"
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch
index 8bd5492dc..f2159f5f8 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch
@@ -4,68 +4,27 @@
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-LINUX_ARCH_DIR:=$(top_srcdir)libpthread/nptl/sysdeps/unix/sysv/linux/i386
-LINUX_ARCH_OUT:=$(top_builddir)libpthread/nptl/sysdeps/unix/sysv/linux/i386
-ASFLAGS += -DUSE___THREAD
-
-libpthread_SSRC = pt-vfork.S clone.S pthread_spin_unlock.S pthread_once.S
-libpthread_CSRC = pthread_spin_init.c pt-__syscall_error.c
-
-libc_a_CSRC = fork.c
-libc_a_SSRC = clone.S vfork.S
-
-libpthread_SSRC += i486/lowlevellock.S i486/pthread_barrier_wait.S i486/pthread_cond_signal.S i486/pthread_cond_broadcast.S \
- i486/lowlevelrobustlock.S i486/sem_post.S i486/sem_timedwait.S \
- i486/sem_trywait.S i486/sem_wait.S i486/pthread_rwlock_rdlock.S i486/pthread_rwlock_wrlock.S \
- i486/pthread_rwlock_timedrdlock.S i486/pthread_rwlock_timedwrlock.S i486/pthread_rwlock_unlock.S
-#i486/pthread_cond_timedwait.S i486/pthread_cond_wait.S
+libpthread_linux_arch_SSRC = pt-vfork.S clone.S pthread_spin_unlock.S pthread_once.S
+libpthread_linux_arch_CSRC = pthread_spin_init.c pt-__syscall_error.c
-libc_a_SSRC += i486/libc-lowlevellock.S
+libc_linux_arch_CSRC = fork.c
+libc_linux_arch_SSRC = clone.S vfork.S
+ASFLAGS += -DUSE___THREAD
+CFLAGS += $(SSP_ALL_CFLAGS)
-CFLAGS-OMIT-fork.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-pt-__syscall_error.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
-
-ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y)
-CFLAGS-fork.c = -D__USE_STDIO_FUTEXES__
-endif
-
ASFLAGS-pt-vfork.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -D_LIBC_REENTRANT
ASFLAGS-lowlevellock.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -D_LIBC_REENTRANT
ASFLAGS-lowlevelrobustlock.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -D_LIBC_REENTRANT
ASFLAGS-pthread_once.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -D_LIBC_REENTRANT
ASFLAGS-pthread_spin_unlock.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -D_LIBC_REENTRANT
-
ASFLAGS-clone.S = -D_LIBC_REENTRANT
ASFLAGS-vfork.S = -D_LIBC_REENTRANT
ASFLAGS-libc-lowlevellock.S = -D_LIBC_REENTRANT
-
-CFLAGS += $(SSP_ALL_CFLAGS)
-#CFLAGS:=$(CFLAGS:-O1=-O2)
-
-LINUX_ARCH_OBJ:=$(patsubst %.S,$(LINUX_ARCH_OUT)/%.o,$(libpthread_SSRC))
-LINUX_ARCH_OBJ+=$(patsubst %.c,$(LINUX_ARCH_OUT)/%.o,$(libpthread_CSRC))
-
-ifeq ($(DOPIC),y)
-libpthread-a-y += $(LINUX_ARCH_OBJ:.o=.os)
-else
-libpthread-a-y += $(LINUX_ARCH_OBJ)
+ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y)
+CFLAGS-fork.c = -D__USE_STDIO_FUTEXES__
endif
-libpthread-so-y += $(LINUX_ARCH_OBJ:.o=.oS)
-
-libpthread-nomulti-y+=$(LINUX_ARCH_OBJS)
-
-LIBC_LINUX_ARCH_OBJ:=$(patsubst %.c,$(LINUX_ARCH_OUT)/%.o,$(libc_a_CSRC))
-LIBC_LINUX_ARCH_OBJ+=$(patsubst %.S,$(LINUX_ARCH_OUT)/%.o,$(libc_a_SSRC))
-
-libc-static-y+=$(LIBC_LINUX_ARCH_OBJ)
-libc-shared-y+=$(LIBC_LINUX_ARCH_OBJ:.o=.oS)
-
-libc-nomulti-y+=$(LIBC_LINUX_ARCH_OBJ)
-
-objclean-y+=CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux/i386
-
-CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux/i386:
- $(do_rm) $(addprefix $(LINUX_ARCH_OUT)/*., o os oS)
+CFLAGS-OMIT-fork.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch
index 0307977e7..61ca8c514 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch
@@ -5,11 +5,14 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-libpthread_SSRC = pt-vfork.S clone.S
-libpthread_CSRC = pthread_once.c pt-__syscall_rt_sigaction.c
+libpthread_linux_arch_SSRC = pt-vfork.S clone.S
+libpthread_linux_arch_CSRC = pthread_once.c pt-__syscall_rt_sigaction.c
-libc_a_CSRC = fork.c
-libc_a_SSRC = clone.S vfork.S
+libc_linux_arch_CSRC = fork.c
+libc_linux_arch_SSRC = clone.S vfork.S
+
+ASFLAGS += -DUSE___THREAD
+CFLAGS += $(SSP_ALL_CFLAGS)
CFLAGS-OMIT-fork.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y)
@@ -17,45 +20,7 @@ CFLAGS-fork.c = -D__USE_STDIO_FUTEXES__
endif
CFLAGS-pthread_once.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-pt-__syscall_rt_sigaction.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
-
ASFLAGS-pt-vfork.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
ASFLAGS-clone.S = -D_LIBC_REENTRANT
ASFLAGS-vfork.S = -D_LIBC_REENTRANT
-ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
- #Needed to use the correct SYSCALL_ERROR_HANDLER
- ASFLAGS-clone.S += -DUSE___THREAD
- ASFLAGS-vfork.S += -DUSE___THREAD
- ASFLAGS-pt-vfork.S += -DUSE___THREAD
-endif
-
-CFLAGS += $(SSP_ALL_CFLAGS)
-#CFLAGS:=$(CFLAGS:-O1=-O2)
-
-LINUX_ARCH_DIR:=$(top_srcdir)libpthread/nptl/sysdeps/unix/sysv/linux/mips
-LINUX_ARCH_OUT:=$(top_builddir)libpthread/nptl/sysdeps/unix/sysv/linux/mips
-
-LINUX_ARCH_OBJ:=$(patsubst %.S,$(LINUX_ARCH_OUT)/%.o,$(libpthread_SSRC))
-LINUX_ARCH_OBJ+=$(patsubst %.c,$(LINUX_ARCH_OUT)/%.o,$(libpthread_CSRC))
-
-ifeq ($(DOPIC),y)
-libpthread-a-y += $(LINUX_ARCH_OBJ:.o=.os)
-else
-libpthread-a-y += $(LINUX_ARCH_OBJ)
-endif
-libpthread-so-y += $(LINUX_ARCH_OBJ:.o=.oS)
-
-libpthread-nomulti-y+=$(LINUX_ARCH_OBJS)
-
-LIBC_LINUX_ARCH_OBJ:=$(patsubst %.c,$(LINUX_ARCH_OUT)/%.o,$(libc_a_CSRC))
-LIBC_LINUX_ARCH_OBJ+=$(patsubst %.S,$(LINUX_ARCH_OUT)/%.o,$(libc_a_SSRC))
-
-libc-static-y+=$(LIBC_LINUX_ARCH_OBJ)
-libc-shared-y+=$(LIBC_LINUX_ARCH_OBJ:.o=.oS)
-
-libc-nomulti-y+=$(LIBC_LINUX_ARCH_OBJ)
-
-objclean-y+=CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux/mips
-
-CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux/mips:
- $(do_rm) $(addprefix $(LINUX_ARCH_OUT)/*., o os oS)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Makefile.arch
index 2c39551dc..483c5adec 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Makefile.arch
@@ -5,58 +5,24 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-libpthread_LINUX_ARCH_SSRC = pt-vfork.S
-libpthread_LINUX_ARCH_CSRC = pthread_once.c pt-__syscall_error.c
+libpthread_linux_arch_SSRC = pt-vfork.S
+libpthread_linux_arch_CSRC = pthread_once.c pt-__syscall_error.c
-libc_a_CSRC = fork.c
-libc_a_SSRC = clone.S vfork.S
-
-ARCH_OBJS += $(libc_a_SSRC:.S=.c)
+libc_linux_arch_CSRC = fork.c
+libc_linux_arch_SSRC = clone.S vfork.S
+ASFLAGS += -DUSE___THREAD
CFLAGS += $(SSP_ALL_CFLAGS)
-ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y)
-CFLAGS-fork.c = -D__USE_STDIO_FUTEXES__
-endif
CFLAGS-pthread_once.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-lowlevellock.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-pt-__syscall_error.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+ASFLAGS-pt-vfork.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -D_LIBC_REENTRANT
+#ASFLAGS-lowlevellock.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -D_LIBC_REENTRANT
-ASFLAGS-pt-vfork.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -D_LIBC_REENTRANT -DUSE___THREAD
-#ASFLAGS-libc-lowlevellock.S = -D_LIBC_REENTRANT -DUSE___THREAD
-#ASFLAGS-lowlevellock.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -D_LIBC_REENTRANT -DUSE___THREAD
+#ASFLAGS-libc-lowlevellock.S = -D_LIBC_REENTRANT
ASFLAGS-clone.S = -D_LIBC_REENTRANT
ASFLAGS-vfork.S = -D_LIBC_REENTRANT
-
-ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
-#Needed to use the correct SYSCALL_ERROR_HANDLER
-ASFLAGS-clone.S += -DUSE___THREAD
-ASFLAGS-vfork.S += -DUSE___THREAD
-endif
-
-LINUX_ARCH_DIR:=$(top_srcdir)libpthread/nptl/sysdeps/unix/sysv/linux/powerpc
-LINUX_ARCH_OUT:=$(top_builddir)libpthread/nptl/sysdeps/unix/sysv/linux/powerpc
-LINUX_ARCH_OBJ:=$(patsubst %.S,$(LINUX_ARCH_OUT)/%.o,$(libpthread_LINUX_ARCH_SSRC))
-LINUX_ARCH_OBJ+=$(patsubst %.c,$(LINUX_ARCH_OUT)/%.o,$(libpthread_LINUX_ARCH_CSRC))
-
-ifeq ($(DOPIC),y)
-libpthread-a-y += $(LINUX_ARCH_OBJ:.o=.os)
-else
-libpthread-a-y += $(LINUX_ARCH_OBJ)
+ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y)
+CFLAGS-fork.c = -D__USE_STDIO_FUTEXES__
endif
-libpthread-so-y += $(LINUX_ARCH_OBJ:.o=.oS)
-
-libpthread-multi-y+=$(libpthread_LINUX_ARCH_CSRC)
-
-LIBC_LINUX_ARCH_OBJ:=$(patsubst %.c,$(LINUX_ARCH_OUT)/%.o,$(libc_a_CSRC))
-LIBC_LINUX_ARCH_OBJ+=$(patsubst %.S,$(LINUX_ARCH_OUT)/%.o,$(libc_a_SSRC))
-
-libc-static-y+=$(LIBC_LINUX_ARCH_OBJ)
-libc-shared-y+=$(LIBC_LINUX_ARCH_OBJ:.o=.oS)
-
-libc-multi-y+=$(libc_a_CSRC)
-
-objclean-y+=nptl_linux_arch_clean
-
-nptl_linux_arch_clean:
- $(do_rm) $(addprefix $(LINUX_ARCH_OUT)/*., o os oS)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch
index 187ad5e1a..056f6c03e 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch
@@ -5,81 +5,43 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-libpthread_SSRC = pt-vfork.S pthread_once.S pthread_rwlock_wrlock.S \
+libpthread_linux_arch_SSRC = pt-vfork.S pthread_once.S pthread_rwlock_wrlock.S \
pthread_rwlock_rdlock.S pthread_rwlock_unlock.S \
lowlevellock.S lowlevelrobustlock.S pthread_barrier_wait.S \
pthread_cond_broadcast.S pthread_cond_signal.S \
pthread_rwlock_timedwrlock.S pthread_rwlock_timedrdlock.S \
sem_post.S sem_timedwait.S sem_trywait.S sem_wait.S
-libc_a_CSRC = fork.c
-libc_a_SSRC = libc-lowlevellock.S clone.S vfork.S
+libc_linux_arch_CSRC = fork.c
+libc_linux_arch_SSRC = libc-lowlevellock.S clone.S vfork.S
-ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y)
-CFLAGS-fork.c = -D__USE_STDIO_FUTEXES__
-endif
-
-ASFLAGS-pt-vfork.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -D_LIBC_REENTRANT -DUSE___THREAD
-ASFLAGS-pthread_once.S = -D_LIBC_REENTRANT -DUSE___THREAD
-ASFLAGS-pthread_rwlock_wrlock.S = -D_LIBC_REENTRANT -DUSE___THREAD
-ASFLAGS-pthread_rwlock_rdlock.S = -D_LIBC_REENTRANT -DUSE___THREAD
-ASFLAGS-pthread_rwlock_unlock.S = -D_LIBC_REENTRANT -DUSE___THREAD
-ASFLAGS-pthread_rwlock_unlock.S = -D_LIBC_REENTRANT -DUSE___THREAD
-
-ASFLAGS-pthread_barrier_wait.S = -D_LIBC_REENTRANT -DUSE___THREAD
-ASFLAGS-pthread_cond_broadcast.S = -D_LIBC_REENTRANT -DUSE___THREAD
-ASFLAGS-pthread_cond_signal.S = -D_LIBC_REENTRANT -DUSE___THREAD
-ASFLAGS-pthread_cond_wait.S = -D_LIBC_REENTRANT -DUSE___THREAD
-ASFLAGS-pthread_cond_timedwait.S = -D_LIBC_REENTRANT -DUSE___THREAD
-
-ASFLAGS-pthread_rwlock_timedwrlock.S = -D_LIBC_REENTRANT -DUSE___THREAD
-ASFLAGS-pthread_rwlock_timedrdlock.S = -D_LIBC_REENTRANT -DUSE___THREAD
-
-ASFLAGS-sem_post.S = -D_LIBC_REENTRANT -DUSE___THREAD
-ASFLAGS-sem_timedwait.S = -D_LIBC_REENTRANT -DUSE___THREAD
-ASFLAGS-sem_trywait.S = -D_LIBC_REENTRANT -DUSE___THREAD
-ASFLAGS-sem_wait.S = -D_LIBC_REENTRANT -DUSE___THREAD
-
-ASFLAGS-libc-lowlevellock.S = -D_LIBC_REENTRANT -DUSE___THREAD
+ASFLAGS += -DUSE___THREAD
+CFLAGS += $(SSP_ALL_CFLAGS)
-ASFLAGS-lowlevellock.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -D_LIBC_REENTRANT -DUSE___THREAD
-ASFLAGS-lowlevelrobustlock.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -D_LIBC_REENTRANT -DUSE___THREAD
+ASFLAGS-pt-vfork.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -D_LIBC_REENTRANT
+ASFLAGS-pthread_once.S = -D_LIBC_REENTRANT
+ASFLAGS-pthread_rwlock_wrlock.S = -D_LIBC_REENTRANT
+ASFLAGS-pthread_rwlock_rdlock.S = -D_LIBC_REENTRANT
+ASFLAGS-pthread_rwlock_unlock.S = -D_LIBC_REENTRANT
+ASFLAGS-pthread_barrier_wait.S = -D_LIBC_REENTRANT
+ASFLAGS-pthread_cond_broadcast.S = -D_LIBC_REENTRANT
+ASFLAGS-pthread_cond_signal.S = -D_LIBC_REENTRANT
+ASFLAGS-pthread_cond_wait.S = -D_LIBC_REENTRANT
+ASFLAGS-pthread_cond_timedwait.S = -D_LIBC_REENTRANT
+ASFLAGS-pthread_rwlock_timedwrlock.S = -D_LIBC_REENTRANT
+ASFLAGS-pthread_rwlock_timedrdlock.S = -D_LIBC_REENTRANT
+ASFLAGS-sem_post.S = -D_LIBC_REENTRANT
+ASFLAGS-sem_timedwait.S = -D_LIBC_REENTRANT
+ASFLAGS-sem_trywait.S = -D_LIBC_REENTRANT
+ASFLAGS-sem_wait.S = -D_LIBC_REENTRANT
+
+ASFLAGS-libc-lowlevellock.S = -D_LIBC_REENTRANT
+
+ASFLAGS-lowlevellock.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -D_LIBC_REENTRANT
+ASFLAGS-lowlevelrobustlock.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -D_LIBC_REENTRANT
ASFLAGS-clone.S = -D_LIBC_REENTRANT
ASFLAGS-vfork.S = -D_LIBC_REENTRANT
-
-ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
-#Needed to use the correct SYSCALL_ERROR_HANDLER
-ASFLAGS-clone.S += -DUSE___THREAD
-ASFLAGS-vfork.S += -DUSE___THREAD
-endif
-
-CFLAGS += $(SSP_ALL_CFLAGS)
-#CFLAGS:=$(CFLAGS:-O1=-O2)
-
-LINUX_ARCH_DIR:=$(top_srcdir)libpthread/nptl/sysdeps/unix/sysv/linux/sh
-LINUX_ARCH_OUT:=$(top_builddir)libpthread/nptl/sysdeps/unix/sysv/linux/sh
-
-LINUX_ARCH_OBJ:=$(patsubst %.S,$(LINUX_ARCH_OUT)/%.o,$(libpthread_SSRC))
-
-ifeq ($(DOPIC),y)
-libpthread-a-y += $(LINUX_ARCH_OBJ:.o=.os)
-else
-libpthread-a-y += $(LINUX_ARCH_OBJ)
+ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y)
+CFLAGS-fork.c = -D__USE_STDIO_FUTEXES__
endif
-libpthread-so-y += $(LINUX_ARCH_OBJ:.o=.oS)
-
-libpthread-nomulti-y+=$(LINUX_ARCH_OBJS)
-
-LIBC_LINUX_ARCH_OBJ:=$(patsubst %.c,$(LINUX_ARCH_OUT)/%.o,$(libc_a_CSRC))
-LIBC_LINUX_ARCH_OBJ+=$(patsubst %.S,$(LINUX_ARCH_OUT)/%.o,$(libc_a_SSRC))
-
-libc-static-y+=$(LIBC_LINUX_ARCH_OBJ)
-libc-shared-y+=$(LIBC_LINUX_ARCH_OBJ:.o=.oS)
-
-libc-nomulti-y+=$(LIBC_LINUX_ARCH_OBJ)
-
-objclean-y+=CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux/sh
-
-CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux/sh:
- $(do_rm) $(addprefix $(LINUX_ARCH_OUT)/*., o os oS)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Makefile.arch
index 0e19fa59d..dc5b5b52d 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Makefile.arch
@@ -5,63 +5,24 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-libpthread_SSRC = pt-vfork.S clone.S
-libpthread_CSRC = pthread_once.c lowlevellock.c \
- pthread_barrier_init.c pthread_barrier_wait.c pthread_barrier_destroy.c
+libpthread_linux_arch_SSRC = pt-vfork.S clone.S
+libpthread_linux_arch_CSRC = pthread_once.c lowlevellock.c \
+ pthread_barrier_init.c pthread_barrier_wait.c pthread_barrier_destroy.c
-libc_a_CSRC = fork.c libc-lowlevellock.c
-libc_a_SSRC = clone.S vfork.S
+libc_linux_arch_CSRC = fork.c libc-lowlevellock.c
+libc_linux_arch_SSRC = clone.S vfork.S
-CFLAGS-OMIT-fork.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
-CFLAGS-OMIT-libc-lowlevellock.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
-
-ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y)
-CFLAGS-fork.c = -D__USE_STDIO_FUTEXES__
-endif
-
-ASFLAGS-pt-vfork.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -D_LIBC_REENTRANT -DUSE___THREAD
+ASFLAGS += -DUSE___THREAD
+CFLAGS += $(SSP_ALL_CFLAGS)
+ASFLAGS-pt-vfork.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -D_LIBC_REENTRANT
CFLAGS-pthread_once.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-lowlevellock.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
-
ASFLAGS-clone.S = -D_LIBC_REENTRANT
ASFLAGS-vfork.S = -D_LIBC_REENTRANT
-
-ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
-#Needed to use the correct SYSCALL_ERROR_HANDLER
-ASFLAGS-clone.S += -DUSE___THREAD
-ASFLAGS-vfork.S += -DUSE___THREAD
-ASFLAGS-pt-vfork.S += -DUSE___THREAD
-endif
-
-CFLAGS += $(SSP_ALL_CFLAGS)
-#CFLAGS:=$(CFLAGS:-O1=-O2)
-
-LINUX_ARCH_DIR:=$(top_srcdir)libpthread/nptl/sysdeps/unix/sysv/linux/sparc
-LINUX_ARCH_OUT:=$(top_builddir)libpthread/nptl/sysdeps/unix/sysv/linux/sparc
-
-LINUX_ARCH_OBJ:=$(patsubst %.S,$(LINUX_ARCH_OUT)/%.o,$(libpthread_SSRC))
-LINUX_ARCH_OBJ+=$(patsubst %.c,$(LINUX_ARCH_OUT)/%.o,$(libpthread_CSRC))
-
-ifeq ($(DOPIC),y)
-libpthread-a-y += $(LINUX_ARCH_OBJ:.o=.os)
-else
-libpthread-a-y += $(LINUX_ARCH_OBJ)
+ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y)
+CFLAGS-fork.c = -D__USE_STDIO_FUTEXES__
endif
-libpthread-so-y += $(LINUX_ARCH_OBJ:.o=.oS)
-
-libpthread-nomulti-y+=$(LINUX_ARCH_OBJS)
-
-LIBC_LINUX_ARCH_OBJ:=$(patsubst %.c,$(LINUX_ARCH_OUT)/%.o,$(libc_a_CSRC))
-LIBC_LINUX_ARCH_OBJ+=$(patsubst %.S,$(LINUX_ARCH_OUT)/%.o,$(libc_a_SSRC))
-
-libc-static-y+=$(LIBC_LINUX_ARCH_OBJ)
-libc-shared-y+=$(LIBC_LINUX_ARCH_OBJ:.o=.oS)
-
-libc-nomulti-y+=$(LIBC_LINUX_ARCH_OBJ)
-
-objclean-y+=CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux/sparc
-
-CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux/sparc:
- $(do_rm) $(addprefix $(LINUX_ARCH_OUT)/*., o os oS)
+CFLAGS-OMIT-fork.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-libc-lowlevellock.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/waitpid.S b/libpthread/nptl/sysdeps/unix/sysv/linux/waitpid.S
index f55d34629..52abb27f0 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/waitpid.S
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/waitpid.S
@@ -1,5 +1,9 @@
#include <sysdep-cancel.h>
+#ifndef __NR_waitpid
+#error Makefile error: No NR_waitpid on this arch
+#endif
+
/*
extern pid_t __waitpid_nocancel (pid_t, int *, int) attribute_hidden;
*/
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile.arch
index 40d9b9dd2..816ecc457 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile.arch
@@ -4,72 +4,36 @@
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-LINUX_ARCH_DIR:=$(top_srcdir)libpthread/nptl/sysdeps/unix/sysv/linux/x86_64
-LINUX_ARCH_OUT:=$(top_builddir)libpthread/nptl/sysdeps/unix/sysv/linux/x86_64
+libpthread_linux_arch_SSRC = pt-vfork.S clone.S pthread_once.S \
+ lowlevellock.S pthread_barrier_wait.S pthread_cond_signal.S pthread_cond_broadcast.S \
+ sem_post.S sem_timedwait.S lowlevelrobustlock.S \
+ sem_trywait.S sem_wait.S pthread_rwlock_rdlock.S pthread_rwlock_wrlock.S \
+ pthread_rwlock_timedrdlock.S pthread_rwlock_timedwrlock.S pthread_rwlock_unlock.S \
+ pthread_spin_unlock.S cancellation.S pthread_cond_timedwait.S pthread_cond_wait.S
+libpthread_linux_arch_CSRC = pthread_spin_init.c pt-__syscall_error.c
-libpthread_SSRC = pt-vfork.S clone.S pthread_once.S
-libpthread_CSRC = pthread_spin_init.c pt-__syscall_error.c
+libc_linux_arch_CSRC = fork.c
+libc_linux_arch_SSRC = clone.S vfork.S libc-cancellation.S libc-lowlevellock.S
+libc_linux_arch_SSRC-OMIT = waitpid.S
+librt_linux_arch_SSRC = librt-cancellation.S
-libc_a_CSRC = fork.c
-libc_a_SSRC = clone.S vfork.S libc-cancellation.S
-
-libpthread_SSRC += lowlevellock.S pthread_barrier_wait.S pthread_cond_signal.S pthread_cond_broadcast.S \
- sem_post.S sem_timedwait.S lowlevelrobustlock.S \
- sem_trywait.S sem_wait.S pthread_rwlock_rdlock.S pthread_rwlock_wrlock.S \
- pthread_rwlock_timedrdlock.S pthread_rwlock_timedwrlock.S pthread_rwlock_unlock.S \
- pthread_spin_unlock.S cancellation.S pthread_cond_timedwait.S pthread_cond_wait.S
-libc_a_SSRC += libc-lowlevellock.S
-librt_a_SSRC += librt-lowlevellock.S
+ASFLAGS += -DUSE___THREAD
+CFLAGS += $(SSP_ALL_CFLAGS)
-CFLAGS-OMIT-fork.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-pt-__syscall_error.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
-
-ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y)
-CFLAGS-fork.c = -D__USE_STDIO_FUTEXES__
-endif
-
-ASFLAGS += -DUSE___THREAD
ASFLAGS-pt-vfork.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -D_LIBC_REENTRANT
ASFLAGS-lowlevellock.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -D_LIBC_REENTRANT
ASFLAGS-pthread_once.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -D_LIBC_REENTRANT
ASFLAGS-cancellation.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -D_LIBC_REENTRANT
-
+ASFLAGS-pthread_cond_timedwait.S = -D_LIBC_REENTRANT
+ASFLAGS-pthread_cond_wait.S = -D_LIBC_REENTRANT
ASFLAGS-clone.S = -D_LIBC_REENTRANT
ASFLAGS-vfork.S = -D_LIBC_REENTRANT
-ASFLAGS-pthread_cond_timedwait.S = -D_LIBC_REENTRANT
-ASFLAGS-pthread_cond_wait.S = -D_LIBC_REENTRANT
ASFLAGS-libc-lowlevellock.S = -D_LIBC_REENTRANT
ASFLAGS-libc-cancellation.S = -D_LIBC_REENTRANT
-
-CFLAGS += $(SSP_ALL_CFLAGS)
-#CFLAGS:=$(CFLAGS:-O1=-O2)
-
-LINUX_ARCH_OBJ:=$(patsubst %.S,$(LINUX_ARCH_OUT)/%.o,$(libpthread_SSRC))
-LINUX_ARCH_OBJ+=$(patsubst %.c,$(LINUX_ARCH_OUT)/%.o,$(libpthread_CSRC))
-
-ifeq ($(DOPIC),y)
-libpthread-a-y += $(LINUX_ARCH_OBJ:.o=.os)
-else
-libpthread-a-y += $(LINUX_ARCH_OBJ)
+ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y)
+CFLAGS-fork.c = -D__USE_STDIO_FUTEXES__
endif
-libpthread-so-y += $(LINUX_ARCH_OBJ:.o=.oS)
-
-libpthread-nomulti-y+=$(LINUX_ARCH_OBJS)
-
-LIBC_LINUX_ARCH_OBJ:=$(patsubst %.c,$(LINUX_ARCH_OUT)/%.o,$(libc_a_CSRC))
-LIBC_LINUX_ARCH_OBJ+=$(patsubst %.S,$(LINUX_ARCH_OUT)/%.o,$(libc_a_SSRC))
-LIBRT_LINUX_ARCH_OBJ+=$(patsubst %.S,$(LINUX_ARCH_OUT)/%.o,$(librt_a_SSRC))
-
-libc-static-y+=$(LIBC_LINUX_ARCH_OBJ)
-libc-shared-y+=$(LIBC_LINUX_ARCH_OBJ:.o=.oS)
-librt-static-y+=$(LIBRT_LINUX_ARCH_OBJ)
-librt-shared-y+=$(LIBRT_LINUX_ARCH_OBJ:.o=.oS)
-
-libc-nomulti-y+=$(LIBC_LINUX_ARCH_OBJ)
-
-objclean-y+=CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux/x86_64
-
-CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux/x86_64:
- $(do_rm) $(addprefix $(LINUX_ARCH_OUT)/*., o os oS)
+CFLAGS-OMIT-fork.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1