summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in8
-rw-r--r--Makerules12
-rw-r--r--Rules.mak6
-rw-r--r--ldso/ldso/mips/dl-sysdep.h2
-rw-r--r--libc/sysdeps/linux/Makefile.commonarch6
-rw-r--r--libc/sysdeps/linux/arm/Makefile.arch5
-rw-r--r--libc/sysdeps/linux/common/Makefile.in3
-rw-r--r--libpthread/nptl/.gitignore27
-rw-r--r--libpthread/nptl/Makefile.in408
-rw-r--r--libpthread/nptl/sysdeps/Makefile6
-rw-r--r--libpthread/nptl/sysdeps/Makefile.commonarch83
-rw-r--r--libpthread/nptl/sysdeps/Makefile.in29
-rw-r--r--libpthread/nptl/sysdeps/arm/Makefile.arch10
-rw-r--r--libpthread/nptl/sysdeps/generic/Makefile.in14
-rw-r--r--libpthread/nptl/sysdeps/generic/dl-tls.c3
-rw-r--r--libpthread/nptl/sysdeps/i386/Makefile.arch4
-rw-r--r--libpthread/nptl/sysdeps/mips/Makefile.arch8
-rw-r--r--libpthread/nptl/sysdeps/powerpc/Makefile.arch3
-rw-r--r--libpthread/nptl/sysdeps/pthread/Makefile.in212
-rw-r--r--libpthread/nptl/sysdeps/sh/Makefile.arch3
-rw-r--r--libpthread/nptl/sysdeps/sparc/Makefile.arch2
-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
-rw-r--r--libpthread/nptl/sysdeps/x86_64/Makefile.arch3
32 files changed, 596 insertions, 1034 deletions
diff --git a/Makefile.in b/Makefile.in
index 628091876..e3dd29d81 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -146,7 +146,7 @@ $(ALL_HEADERS_SYS_ARCH):
$(do_ln) $(call rel_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/sys/$(@F) $@
endif
-$(target-headers-sysdep): | $(top_builddir)include/bits $(top_builddir)include/sys
+$(target-headers-sysdep) $(pregen-headers-y): | $(top_builddir)include/bits $(top_builddir)include/sys
HEADERCLEAN_common:
$(do_rm) $(ALL_HEADERS_COMMON)
@@ -157,10 +157,10 @@ headers_clean-y += HEADERCLEAN_common
# libc/sysdeps/linux/Makefile.commonarch to headers-y
headers-y += $(target-headers-sysdep)
-headers: $(top_builddir)include/bits/uClibc_config.h $(top_builddir)include/bits/sysnum.h
+headers: $(top_builddir)include/bits/uClibc_config.h $(top_builddir)include/bits/sysnum.h | subdirs
subdirs: $(addprefix $(top_builddir),$(subdirs))
-pregen-headers: headers $(pregen-headers-y)
-pregen: pregen-headers subdirs
+pregen-headers: $(pregen-headers-y)
+pregen: pregen-headers
$(Q)$(if $(UCLIBC_HAS_LOCALE),$(MAKE) -C extra/locale locale_headers)
$(top_builddir)include/bits/sysnum.h: $(top_srcdir)extra/scripts/gen_bits_syscall_h.sh | $(top_builddir)include/bits
@$(disp_gen)
diff --git a/Makerules b/Makerules
index 4c081bea4..ed36dab90 100644
--- a/Makerules
+++ b/Makerules
@@ -358,22 +358,21 @@ $(top_builddir)%.s: $(top_srcdir)%.c FORCE | pregen; $(compile.s)
$(top_builddir)%.s: $(top_srcdir)%.S FORCE | pregen; $(compile.s)
$(top_builddir)%.dep:
-$(top_builddir)lib/interp.c: | $(sub_headers) $(top_builddir)lib
+$(top_builddir)lib/interp.c: | $(top_builddir)lib
$(Q)echo "/* Force shared libraries to know about the correct library loader */" > $@.tmp
$(Q)echo "#include <features.h>" >> $@.tmp
$(Q)echo "const char __dl_ldso__[] attribute_hidden __attribute__ ((weak)) __attribute__ ((section " \
"(\".interp\"))) =\""$(RUNTIME_PREFIX)$(MULTILIB_DIR)/$(UCLIBC_LDSO)"\";" >> $@.tmp
$(Q)mv $@.tmp $@
-$(interp): $(top_builddir)lib/interp.c
+$(interp): $(top_builddir)lib/interp.c | $(sub_headers)
$(compile.c)
$(Q)$(STRIPTOOL) -x -R .note -R .comment $@
$(ldso):
- @cd $(top_builddir); $(MAKE) lib/$(patsubst %.$(ABI_VERSION),%,$(notdir $@))
-
+ $(Q)cd $(top_builddir); $(MAKE) lib/$(patsubst %.$(ABI_VERSION),%,$(notdir $@))
$(libc):
- @cd $(top_builddir); $(MAKE) lib/$(patsubst %.$(ABI_VERSION),%,$(notdir $@))
+ $(Q)cd $(top_builddir); $(MAKE) lib/$(patsubst %.$(ABI_VERSION),%,$(notdir $@))
CRT := crt1
@@ -451,11 +450,12 @@ $(top_builddir)lib/libpthread_nonshared.a: $(libpthread-nonshared-y)
files.dep := $(libc-a-y) $(libc-so-y) $(libc-nonshared-y) \
$(libm-a-y) $(libm-so-y) \
$(libpthread-a-y) $(libpthread-so-y) $(libpthread-nonshared-y) \
- $(libthread_db-a-y) $(libthread_db-so-y) \
+ $(libthread_db-a-y) $(libthread_db-so-y) $(libpthread-generated-y) \
$(librt-a-y) $(librt-so-y) $(libresolv-a-y) $(libresolv-so-y) \
$(libcrypt-a-y) $(libcrypt-so-y) $(libutil-a-y) $(libutil-so-y) \
$(libnsl-a-y) $(libnsl-so-y) $(ldso-y) $(libdl-a-y) $(libdl-so-y)
.depends.dep := \
+ $(patsubst %.s,%.s.dep,$(filter %.s,$(files.dep))) \
$(patsubst %.o,%.o.dep,$(filter %.o,$(files.dep))) \
$(patsubst %.os,%.os.dep,$(filter %.os,$(files.dep))) \
$(patsubst %.oS,%.oS.dep,$(filter %.oS,$(files.dep)))
diff --git a/Rules.mak b/Rules.mak
index f6c4b4ad4..2fc2b8bec 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -130,8 +130,12 @@ UCLIBC_LDSO := $(UCLIBC_LDSO_NAME).so.$(ABI_VERSION)
NONSHARED_LIBNAME := uclibc_nonshared.a
libc := $(top_builddir)lib/$(SHARED_LIBNAME)
libc.depend := $(top_builddir)lib/$(SHARED_LIBNAME:.$(ABI_VERSION)=)
+ifneq ($(ARCH_HAS_NO_SHARED),y)
libdl.depend := $(top_builddir)lib/libdl.so
+endif
+ifneq ($(HAS_NO_THREADS),y)
libpthread.depend := $(top_builddir)lib/libpthread.so
+endif
interp := $(top_builddir)lib/interp.os
ldso := $(top_builddir)lib/$(UCLIBC_LDSO)
headers_dep := $(top_builddir)include/bits/sysnum.h
@@ -638,7 +642,7 @@ PTDIR := libpthread/$(PTNAME)
ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
PTINC:= -I$(top_builddir)$(PTDIR) \
-I$(top_srcdir)$(PTDIR) \
- -I$(top_srcdir)$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/$(TARGET_SUBARCH) \
+ $(if $(TARGET_ARCH),-I$(top_srcdir)$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/$(TARGET_SUBARCH)) \
-I$(top_srcdir)$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH) \
-I$(top_builddir)$(PTDIR)/sysdeps/$(TARGET_ARCH) \
-I$(top_srcdir)$(PTDIR)/sysdeps/$(TARGET_ARCH) \
diff --git a/ldso/ldso/mips/dl-sysdep.h b/ldso/ldso/mips/dl-sysdep.h
index c1aad6661..099281840 100644
--- a/ldso/ldso/mips/dl-sysdep.h
+++ b/ldso/ldso/mips/dl-sysdep.h
@@ -127,7 +127,7 @@ do { \
GOT_BASE[0] = (unsigned long) _dl_runtime_resolve; \
GOT_BASE[1] = (unsigned long) MODULE; \
\
- pltgot = MODULE->dynamic_info[DT_MIPS_PLTGOT_IDX]; \
+ pltgot = &MODULE->dynamic_info[DT_MIPS_PLTGOT_IDX]; \
if (pltgot) { \
pltgot[0] = (unsigned long) _dl_runtime_pltresolve; \
pltgot[1] = (unsigned long) MODULE; \
diff --git a/libc/sysdeps/linux/Makefile.commonarch b/libc/sysdeps/linux/Makefile.commonarch
index fe391d848..4e4815949 100644
--- a/libc/sysdeps/linux/Makefile.commonarch
+++ b/libc/sysdeps/linux/Makefile.commonarch
@@ -10,10 +10,10 @@ ARCH_OUT := $(top_builddir)libc/sysdeps/linux/$(TARGET_ARCH)
ARCH_CSRC := $(patsubst %.c,$(ARCH_DIR)/%.c,$(CSRC))
ARCH_COBJ := $(patsubst %.c,$(ARCH_OUT)/%.o,$(CSRC))
-ARCH_SSRC := $(patsubst %.s,$(ARCH_DIR)/%.s,$(patsubst %.S,$(ARCH_DIR)/%.S,$(SSRC)))
-ARCH_SOBJ := $(patsubst %.s,$(ARCH_OUT)/%.o,$(patsubst %.S,$(ARCH_OUT)/%.o,$(SSRC)))
+ARCH_SSRC = $(patsubst %.s,$(ARCH_DIR)/%.s,$(patsubst %.S,$(ARCH_DIR)/%.S,$(SSRC)))
+ARCH_SOBJ = $(patsubst %.s,$(ARCH_OUT)/%.o,$(patsubst %.S,$(ARCH_OUT)/%.o,$(SSRC)))
-ARCH_OBJS := $(ARCH_COBJ) $(ARCH_SOBJ)
+ARCH_OBJS = $(ARCH_COBJ) $(ARCH_SOBJ)
crt-y := FORCE
libc-y += $(ARCH_OBJS)
diff --git a/libc/sysdeps/linux/arm/Makefile.arch b/libc/sysdeps/linux/arm/Makefile.arch
index bec06ff44..b53c539bf 100644
--- a/libc/sysdeps/linux/arm/Makefile.arch
+++ b/libc/sysdeps/linux/arm/Makefile.arch
@@ -13,12 +13,11 @@ endif
SSRC := \
__longjmp.S setjmp.S bsd-setjmp.S \
- bsd-_setjmp.S sigrestorer.S mmap64.S
+ bsd-_setjmp.S sigrestorer.S mmap64.S \
+ vfork.S clone.S
ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
SSRC += libc-aeabi_read_tp.S libc-thumb_atomics.S
-else
-SSRC += vfork.S clone.S
endif
ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y)
diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in
index 6f833cec4..4f0a72c09 100644
--- a/libc/sysdeps/linux/common/Makefile.in
+++ b/libc/sysdeps/linux/common/Makefile.in
@@ -99,7 +99,8 @@ CSRC := $(filter-out vfork.c,$(CSRC))
endif
# provided via pthreads builddir
-CSRC := $(filter-out $(libc_a_CSRC) $(libc_a_SSRC:.S=.c),$(CSRC))
+CSRC := $(filter-out $(libc_a_CSRC) $(notdir $(libpthread_libc_OBJS:.o=.c)),$(CSRC))
+SSRC := $(filter-out $(libc_a_SSRC) $(notdir $(libpthread_libc_OBJS:.o=.S)),$(SSRC))
# fails for some reason
ifneq ($(strip $(ARCH_OBJS)),)
diff --git a/libpthread/nptl/.gitignore b/libpthread/nptl/.gitignore
index c7ded8eb2..ac44e0c5d 100644
--- a/libpthread/nptl/.gitignore
+++ b/libpthread/nptl/.gitignore
@@ -2,20 +2,25 @@
# Never ignore these
#
!.gitignore
-
#
# Generated files
#
-gen_l*
-pthread-errnos.[hcs]
-tcb-offsets.[hcs]
-lowlevelbarrier.h
-lowlevelcond.h
-lowlevelrwlock.h
-lowlevelrobustlock.h
-unwindbuf.h
-structsem.h
-pthread-pi-defines.h
+/pthread-errnos.h
+/gen_pthread-errnos.[cs]
+!sysdeps/pthread/tcb-offsets.h
+sysdeps/*/tcb-offsets.h
+sysdeps/*/gen_tcb-offsets.[cs]
+sysdeps/unix/sysv/linux/gen_*.[cs]
+sysdeps/unix/sysv/linux/lowlevelbarrier.h
+sysdeps/unix/sysv/linux/lowlevelcond.h
+sysdeps/unix/sysv/linux/lowlevelrwlock.h
+sysdeps/unix/sysv/linux/lowlevelrobustlock.h
+sysdeps/unix/sysv/linux/structsem.h
+sysdeps/unix/sysv/linux/unwindbuf.h
+sysdeps/unix/sysv/linux/pthread-pi-defines.h
+#
+# symlinks
+#
sysdeps/pthread/pt-sigaction.c
sysdeps/pthread/pt-sigfillset.c
sysdeps/pthread/pt-sigprocmask.c
diff --git a/libpthread/nptl/Makefile.in b/libpthread/nptl/Makefile.in
index e015807b9..7f2070529 100644
--- a/libpthread/nptl/Makefile.in
+++ b/libpthread/nptl/Makefile.in
@@ -7,107 +7,147 @@
subdirs += libpthread/nptl
-libpthread-routines-y = init vars events version \
- pthread_create pthread_exit pthread_detach \
- pthread_join pthread_tryjoin pthread_timedjoin \
- pthread_self pthread_equal pthread_yield \
- pthread_getconcurrency pthread_setconcurrency \
- pthread_getschedparam pthread_setschedparam \
- pthread_setschedprio \
- pthread_attr_init pthread_attr_destroy \
- pthread_attr_getdetachstate pthread_attr_setdetachstate \
- pthread_attr_getguardsize pthread_attr_setguardsize \
- pthread_attr_getschedparam pthread_attr_setschedparam \
- pthread_attr_getschedpolicy pthread_attr_setschedpolicy \
- pthread_attr_getinheritsched \
- pthread_attr_setinheritsched \
- pthread_attr_getscope pthread_attr_setscope \
- pthread_attr_getstackaddr pthread_attr_setstackaddr \
- pthread_attr_getstacksize pthread_attr_setstacksize \
- pthread_attr_getstack pthread_attr_setstack \
- pthread_getattr_np \
- pthread_mutex_init pthread_mutex_destroy \
- pthread_mutex_lock pthread_mutex_trylock \
- pthread_mutex_timedlock pthread_mutex_unlock \
- pthread_mutex_consistent \
- pthread_mutexattr_init pthread_mutexattr_destroy \
- pthread_mutexattr_getpshared \
- pthread_mutexattr_setpshared \
- pthread_mutexattr_getrobust \
- pthread_mutexattr_setrobust \
- pthread_mutexattr_getprotocol \
- pthread_mutexattr_setprotocol \
- pthread_mutexattr_getprioceiling \
- pthread_mutexattr_setprioceiling \
- pthread_mutexattr_gettype pthread_mutexattr_settype \
- pthread_rwlock_init pthread_rwlock_destroy \
- pthread_rwlock_rdlock pthread_rwlock_timedrdlock \
- pthread_rwlock_wrlock pthread_rwlock_timedwrlock \
- pthread_rwlock_tryrdlock pthread_rwlock_trywrlock \
- pthread_rwlock_unlock \
- pthread_rwlockattr_init pthread_rwlockattr_destroy \
- pthread_rwlockattr_getpshared \
- pthread_rwlockattr_setpshared \
- pthread_rwlockattr_getkind_np \
- pthread_rwlockattr_setkind_np \
- pthread_cond_init pthread_cond_destroy \
- pthread_cond_wait pthread_cond_timedwait \
- pthread_cond_signal pthread_cond_broadcast \
- pthread_condattr_init pthread_condattr_destroy \
- pthread_condattr_getpshared pthread_condattr_setpshared \
- pthread_condattr_getclock pthread_condattr_setclock \
- pthread_spin_init pthread_spin_destroy \
- pthread_spin_lock pthread_spin_trylock \
- pthread_spin_unlock \
- pthread_barrier_init pthread_barrier_destroy \
- pthread_barrier_wait \
- pthread_barrierattr_init pthread_barrierattr_destroy \
- pthread_barrierattr_getpshared \
- pthread_barrierattr_setpshared \
- pthread_key_create pthread_key_delete \
- pthread_getspecific pthread_setspecific \
- pthread_sigmask pthread_kill \
- pthread_cancel pthread_testcancel \
- pthread_setcancelstate pthread_setcanceltype \
- pthread_once \
- pthread_atfork \
- pthread_getcpuclockid \
- pthread_clock_gettime pthread_clock_settime \
- sem_init sem_destroy \
- sem_open sem_close sem_unlink \
- sem_getvalue \
- sem_wait sem_trywait sem_timedwait sem_post \
- cleanup cleanup_defer cleanup_compat \
- cleanup_defer_compat unwind \
- pt-longjmp pt-cleanup\
- cancellation \
- lowlevellock \
- pt-vfork \
- ptw-write ptw-read ptw-close ptw-fcntl ptw-accept \
- ptw-connect ptw-recv ptw-recvfrom ptw-recvmsg ptw-send \
- ptw-sendmsg ptw-sendto ptw-fsync ptw-lseek ptw-llseek \
- ptw-msync ptw-nanosleep ptw-open ptw-open64 ptw-pause \
- ptw-pread ptw-pread64 ptw-pwrite ptw-pwrite64 \
- ptw-tcdrain ptw-wait ptw-waitpid ptw-msgrcv ptw-msgsnd \
- ptw-sigwait \
- pt-raise pt-system \
- flockfile ftrylockfile funlockfile \
- sigaction \
- errno_location \
- herrno \
- pthread_kill_other_threads \
- pthread_getaffinity pthread_setaffinity \
- pthread_attr_getaffinity pthread_attr_setaffinity \
- cleanup_routine unwind-forcedunwind
-libpthread-routines-$(findstring y,$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) += res
-
-libpthread-shared-only-routines = version pt-allocrtsig unwind-forcedunwind
-
-ifeq ($(TARGET_ARCH),x86_64)
-libpthread-routines-y := $(filter-out cancellation,$(libpthread-routines-y))
+libpthread_DIR = $(top_srcdir)libpthread/nptl
+libpthread_OUT = $(top_builddir)libpthread/nptl
+
+include $(libpthread_DIR)/sysdeps/Makefile.in
+
+libc-shared-routines-y = forward.c libc-cancellation.c
+libc-static-routines-y = alloca_cutoff.c libc-cancellation.c
+libpthread-shared-only-routines-y = version.c #pt-allocrtsig unwind-forcedunwind
+libpthread-static-only-routines-y = pthread_atfork.c
+libpthread-routines- += $(notdir $(wildcard $(libpthread_DIR)/gen_*.c)) # dummy generated files
+libpthread-routines- += allocatestack.c # dummy included by pthread_create.c
+libpthread-routines- += pthread_mutex_getprioceiling.c pthread_mutex_setprioceiling.c # XXX: delete those or use them!
+libpthread-routines-$(findstring y,$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) += res.c
+libpthread-routines-$(UCLIBC_SUSV4_LEGACY) += pthread_getconcurrency.c \
+ pthread_setconcurrency
+libpthread_CSRC = $(filter-out $(libpthread-routines-) \
+ $(libc-shared-routines-y) \
+ $(libc-static-routines-y) \
+ $(libpthread-shared-only-routines-y) \
+ $(libpthread-static-only-routines-y) \
+ $(notdir $(libpthread_OBJS:.o=.c)), \
+ $(notdir $(wildcard $(libpthread_DIR)/*.c)))
+
+libpthread_OBJS += $(addprefix $(libpthread_OUT)/,$(libpthread_CSRC:.c=.o))
+libpthread-so-y += $(addprefix $(libpthread_OUT)/,$(libpthread-shared-only-routines-y:.c=.oS))
+libpthread-so-y += $(libpthread_OBJS:.o=.oS)
+libpthread-nonshared-y := $(addprefix $(libpthread_OUT)/,$(libpthread-static-only-routines-y:.c=.oS))
+libpthread-static-y := $(addprefix $(libpthread_OUT)/,$(libpthread-static-only-routines-y:.c=.o))
+libpthread-static-y += $(libpthread_OBJS)
+ifeq ($(DOPIC),y)
+libpthread-a-y := $(libpthread-static-y:.o=.os)
+else
+libpthread-a-y := $(libpthread-static-y)
+endif
+
+libc-shared-routines-y := $(filter-out $(notdir $(libpthread_libc_OBJS:.o=.c)), $(libc-shared-routines-y))
+libc-static-routines-y := $(filter-out $(notdir $(libpthread_libc_OBJS:.o=.c)), $(libc-static-routines-y))
+libc-shared-routines-y := $(addprefix $(libpthread_OUT)/,$(libc-shared-routines-y:.c=.oS))
+libc-static-routines-y := $(addprefix $(libpthread_OUT)/,$(libc-static-routines-y:.c=.o))
+libc-shared-y += $(libc-shared-routines-y) $(libpthread_libc_OBJS:.o=.oS)
+ifeq ($(DOPIC),y)
+libc-static-y += $(libc-static-routines-y:.o=.os) $(libpthread_libc_a_OBJS:.o=.os) # $(libpthread_ld_tls_COBJ:.o=.os)
+else
+libc-static-y += $(libc-static-routines-y) $(libpthread_libc_a_OBJS) # $(libpthread_ld_tls_COBJ)
+endif
+
+librt-pt-routines-y := $(patsubst %.c,$(libpthread_pthread_OUT)/%.o,$(filter-out $(notdir $(libpthread_librt_OBJS:.o=.c)), $(librt-pt-routines-y)))
+librt-pt-shared-only-routines-y := $(patsubst %.c,$(libpthread_pthread_OUT)/%.o,$(filter-out $(notdir $(libpthread_librt_OBJS:.o=.c)), $(librt-pt-shared-only-routines-y)))
+librt_OBJS = $(libpthread_librt_OBJS) $(librt-pt-routines-y)
+ifeq ($(DOPIC),y)
+librt-a-y += $(librt_OBJS:.o=.os)
+else
+librt-a-y += $(librt_OBJS)
+endif
+librt-so-y += $(librt_OBJS:.o=.oS) $(librt-pt-shared-only-routines-y:.o=.oS)
+
+ifneq ($(UCLIBC_CTOR_DTOR),y)
+START_FILE-libpthread.so := $(top_builddir)/libpthread/nptl/sysdeps/pthread/crti.o $(SHARED_START_FILES)
+END_FILE-libpthread.so := $(SHARED_END_FILES) $(top_builddir)/libpthread/nptl/sysdeps/pthread/crtn.o
+endif
+
+libpthread_FULL_NAME := libpthread-$(VERSION).so
+lib-a-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.a
+lib-so-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.so
+
+$(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread_so.a $(libc.depend) $(libdl.depend) $(top_builddir)lib/libpthread_nonshared.a
+ $(call link.so,$(libpthread_FULL_NAME),$(ABI_VERSION))
+ $(Q)cat $(top_srcdir)extra/scripts/format.lds > $@.tmp
+ $(Q)echo "GROUP ( $(notdir $@).$(ABI_VERSION) libpthread_nonshared.a )" >> $@.tmp
+ $(Q)mv $@.tmp $@
+
+ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
+$(libpthread_OUT)/libpthread_so.a: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug)
+endif
+$(libpthread_OUT)/libpthread_so.a: $(libpthread-so-y)
+ $(Q)$(RM) $@
+ $(do_ar)
+
+$(top_builddir)lib/libpthread.a: $(libpthread-a-y)
+ $(Q)$(INSTALL) -d $(dir $@)
+ $(Q)$(RM) $@
+ $(do_ar)
+
+#
+# Create 'pthread-errnos.h' header file.
+#
+CFLAGS-gen_pthread-errnos.c = -S
+
+$(libpthread_OUT)/gen_pthread-errnos.c: $(libpthread_DIR)/pthread-errnos.sym | $(libpthread_OUT)
+ $(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
+
+$(libpthread_OUT)/gen_pthread-errnos.s: $(libpthread_OUT)/gen_pthread-errnos.c | headers
+ $(compile.c)
+libpthread-generated-y += $(libpthread_OUT)/gen_pthread-errnos.s
+$(libpthread_OUT)/pthread-errnos.h: $(libpthread_OUT)/gen_pthread-errnos.s
+ $(do_sed) $(PTHREAD_GENERATE_MANGLE) $< > $@
+ @if test ! -s $@ ; then rm -f $@ ; false ; fi
+
+pregen-headers-$(UCLIBC_HAS_THREADS_NATIVE) += $(libpthread_OUT)/pthread-errnos.h
+
+headers-$(UCLIBC_HAS_THREADS_NATIVE) += $(nptl_headers_bootstrap)
+
+libpthread_H := $(addprefix $(top_builddir)include/,semaphore.h)
+libpthread_include_H := $(addprefix $(top_builddir)include/,pthread.h)
+libpthread_include_BITS_H := $(addprefix $(top_builddir)include/bits/,libc-lock.h stdio-lock.h)
+libpthread_include_STD_IMPL_OS_ARCH_BITS_H := $(addprefix $(top_builddir)include/bits/,pthreadtypes.h semaphore.h)
+
+$(libpthread_include_STD_IMPL_OS_ARCH_BITS_H): $(top_builddir)include/bits/%:
+ $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/bits/$(@F) $@
+$(libpthread_include_BITS_H): $(top_builddir)include/bits/%:
+ $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/bits/$(@F) $@
+$(libpthread_include_H): $(top_builddir)include/%:
+ $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/$(@F) $@
+$(libpthread_H): $(top_builddir)include/%:
+ $(do_ln) $(call rel_srcdir)$(PTDIR)/$(@F) $@
+
+nptl_headers_bootstrap = $(libpthread_H) $(libpthread_include_H) $(libpthread_include_BITS_H) $(libpthread_include_STD_IMPL_OS_ARCH_BITS_H)
+
+objclean-y += CLEAN_libpthread/nptl
+headers_clean-y += HEADERCLEAN_libpthread/nptl
+
+HEADERCLEAN_libpthread/nptl:
+ $(do_rm) $(nptl_headers_bootstrap) \
+ $(addprefix $(libpthread_OUT)/gen_pthread-errnos., c s) \
+ $(libpthread_OUT)/pthread-errnos.h
+
+CLEAN_libpthread/nptl:
+ $(do_rm) $(addprefix $(libpthread_OUT)/*., o os oS a)
+
+ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
+LDFLAGS-libpthread.so := $(LDFLAGS_NOSTRIP) -Wl,-z,defs
+else
+LDFLAGS-libpthread.so := $(LDFLAGS)
endif
-CFLAGS-pthread_atfork.c = -DNOT_IN_libc
+LDFLAGS-libpthread.so += $(top_builddir)lib/$(UCLIBC_LDSO_NAME)-$(VERSION).so $(top_builddir)lib/libdl-$(VERSION).so \
+ -Wl,-z,nodelete,-z,initfirst,-init=__pthread_initialize_minimal_internal
+
+LIBS-libpthread.so := $(LIBS)
+
+CFLAGS-nptl = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 $(SSP_ALL_CFLAGS)
# Since cancellation handling is in large parts handled using exceptions
# we have to compile some files with exception handling enabled, some
@@ -165,7 +205,7 @@ CFLAGS-msgrcv.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-msgsnd.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-tcdrain.c = -fexceptions -fasynchronous-unwind-tables
-CFLAGS-pt-system.c = -fexceptions -I./libc/stdlib
+CFLAGS-pt-system.c = -fexceptions -I$(top_srcdir)libc/stdlib
#
# The rest of this file is uClibc specific.
@@ -178,167 +218,7 @@ CFLAGS-pthread_barrierattr_getpshared.c = -D_GNU_SOURCE
CFLAGS-pthread_barrierattr_setpshared.c = -D_GNU_SOURCE
CFLAGS-sem_open.c = -D_GNU_SOURCE
-CFLAGS-nptl = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 $(SSP_ALL_CFLAGS)
-
-CFLAGS-OMIT-alloca_cutoff.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
-CFLAGS-OMIT-forward.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
-CFLAGS-OMIT-libc-lowlevelock.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
-CFLAGS-OMIT-libc-cancellation.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
-
-libpthread-os-routines = pthread_yield
-libpthread-misc-routines = pthread_rwlock_rdlock pthread_rwlock_timedrdlock \
- pthread_rwlock_wrlock pthread_rwlock_timedwrlock \
- pthread_rwlock_unlock pthread_cond_wait \
- pthread_cond_timedwait pthread_cond_signal \
- pthread_cond_broadcast pthread_spin_init \
- pthread_spin_destroy pthread_spin_lock \
- pthread_spin_trylock pthread_spin_unlock \
- pthread_barrier_init pthread_barrier_destroy \
- pthread_barrier_wait pthread_sigmask \
- pthread_kill pthread_once \
- pthread_getcpuclockid sem_wait \
- sem_trywait sem_timedwait \
- sem_post pt-longjmp \
- lowlevellock pt-vfork \
- ptw-close ptw-read ptw-write \
- ptw-fcntl ptw-accept ptw-connect \
- ptw-recv ptw-recvfrom ptw-recvmsg \
- ptw-send ptw-sendmsg ptw-sendto \
- ptw-fsync ptw-lseek ptw-llseek \
- ptw-msync ptw-nanosleep ptw-open \
- ptw-open64 ptw-pause ptw-pread \
- ptw-pread64 ptw-pwrite ptw-pwrite64 \
- ptw-tcdrain ptw-wait ptw-waitpid \
- ptw-msgrcv ptw-msgsnd ptw-sigwait \
- pt-raise flockfile ftrylockfile \
- funlockfile sigaction \
- pthread_getaffinity \
- pthread_setaffinity \
- pthread_attr_getaffinity \
- pthread_attr_setaffinity \
- unwind-forcedunwind
-
-ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
-LDFLAGS-libpthread.so := $(LDFLAGS_NOSTRIP) -Wl,-z,defs
-else
-LDFLAGS-libpthread.so := $(LDFLAGS)
-endif
-
-LDFLAGS-libpthread.so += $(top_builddir)lib/$(UCLIBC_LDSO_NAME)-$(VERSION).so $(top_builddir)lib/libdl-$(VERSION).so -Wl,-z,nodelete,-z,initfirst,-init=__pthread_initialize_minimal_internal
-
-LIBS-libpthread.so := $(LIBS)
-
-ifneq ($(UCLIBC_CTOR_DTOR),y)
-START_FILE-libpthread.so := $(top_builddir)/libpthread/nptl/sysdeps/pthread/crti.o $(SHARED_START_FILES)
-END_FILE-libpthread.so := $(SHARED_END_FILES) $(top_builddir)/libpthread/nptl/sysdeps/pthread/crtn.o
-endif
-
-libpthread_FULL_NAME := libpthread-$(VERSION).so
-
-PTHREAD_DIR := $(top_srcdir)libpthread/nptl
-PTHREAD_OUT := $(top_builddir)libpthread/nptl
-
-libpthread_static_SRC := pthread_atfork
-
-libpthread_a_SRC = $(patsubst %, $(PTHREAD_DIR)/%.c, \
- $(filter-out $(libpthread-os-routines) \
- $(libpthread-misc-routines) \
- $(libpthread-shared-only-routines), \
- $(libpthread-routines-y)))
-libpthread_so_SRC = $(patsubst %, $(PTHREAD_DIR)/%.c, \
- $(filter-out $(libpthread-os-routines) \
- $(libpthread-misc-routines), $(libpthread-routines-y)))
-
-ifeq ($(TARGET_ARCH),x86_64)
-libc-static-y += $(patsubst %.c, $(PTHREAD_OUT)/%.o, alloca_cutoff.c)
-libc-shared-y += $(patsubst %.c, $(PTHREAD_OUT)/%.oS, forward.c)
-else
-libc-static-y += $(patsubst %.c, $(PTHREAD_OUT)/%.o, alloca_cutoff.c \
- libc-cancellation.c)
-libc-shared-y += $(patsubst %.c, $(PTHREAD_OUT)/%.oS, forward.c \
- libc-cancellation.c)
-endif
-
-libpthread-nonshared-y += $(patsubst %,$(PTHREAD_OUT)/%.oS,$(libpthread_static_SRC))
-
-
-ifeq ($(DOPIC),y)
-libpthread-a-y := $(patsubst $(PTHREAD_DIR)/%.c,$(PTHREAD_OUT)/%.os,$(libpthread_a_SRC))
-else
-libpthread-a-y := $(patsubst $(PTHREAD_DIR)/%.c,$(PTHREAD_OUT)/%.o,$(libpthread_a_SRC))
-endif
-
-libpthread-so-y := $(patsubst $(PTHREAD_DIR)/%.c,$(PTHREAD_OUT)/%.oS,$(libpthread_so_SRC))
-libpthread-static-y += $(patsubst $(PTHREAD_DIR)/%.c,$(PTHREAD_OUT)/%.o,$(libpthread_a_SRC) $(libpthread_static_SRC))
-
-objclean-y += CLEAN_libpthread/nptl
-headers_clean-y += HEADERCLEAN_libpthread/nptl
-
--include $(PTHREAD_DIR)/sysdeps/generic/Makefile.in
--include $(PTHREAD_DIR)/sysdeps/pthread/Makefile.in
--include $(PTHREAD_DIR)/sysdeps/$(TARGET_ARCH)/Makefile.arch
--include $(PTHREAD_DIR)/sysdeps/Makefile.commonarch
--include $(PTHREAD_DIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/Makefile.arch
--include $(PTHREAD_DIR)/sysdeps/unix/sysv/linux/Makefile.commonarch
-
-lib-a-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.a
-lib-so-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.so
-
-$(top_builddir)lib/libpthread.so: $(PTHREAD_OUT)/libpthread_so.a $(libc.depend) $(libdl.depend) $(top_builddir)lib/libpthread_nonshared.a
- $(call link.so,$(libpthread_FULL_NAME),$(ABI_VERSION))
- $(Q)cat $(top_srcdir)extra/scripts/format.lds > $@.tmp
- $(Q)echo "GROUP ( $(notdir $@).$(ABI_VERSION) libpthread_nonshared.a )" >> $@.tmp
- $(Q)mv $@.tmp $@
-
-ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
-$(PTHREAD_OUT)/libpthread_so.a: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug)
-endif
-$(PTHREAD_OUT)/libpthread_so.a: $(libpthread-so-y)
- $(Q)$(RM) $@
- $(do_ar)
-
-$(top_builddir)lib/libpthread.a: $(libpthread-a-y)
- $(Q)$(INSTALL) -d $(dir $@)
- $(Q)$(RM) $@
- $(do_ar)
-
-#
-# Create 'pthread-errnos.h' header file.
-#
-CFLAGS-pthread-errnos.c = -S
-
-$(PTHREAD_OUT)/pthread-errnos.c: $(PTHREAD_DIR)/pthread-errnos.sym
- $(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
-
-$(PTHREAD_OUT)/pthread-errnos.s: $(PTHREAD_OUT)/pthread-errnos.c
- $(compile.c)
-
-$(PTHREAD_OUT)/pthread-errnos.h: $(PTHREAD_OUT)/pthread-errnos.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_OUT)/pthread-errnos.h
-
-headers-$(UCLIBC_HAS_THREADS_NATIVE) += $(nptl_headers_bootstrap)
-
-LIBPTHREAD_H := $(addprefix $(top_builddir)include/,semaphore.h)
-LIBPTHREAD_INCLUDE_H := $(addprefix $(top_builddir)include/,pthread.h)
-LIBPTHREAD_INCLUDE_BITS_H := $(addprefix $(top_builddir)include/bits/,libc-lock.h stdio-lock.h)
-LIBPTHREAD_INCLUDE_STD_IMPL_OS_ARCH_BITS_H := $(addprefix $(top_builddir)include/bits/,pthreadtypes.h semaphore.h)
-
-$(LIBPTHREAD_INCLUDE_STD_IMPL_OS_ARCH_BITS_H): $(top_builddir)include/bits/%: | $(top_builddir)include/bits
- $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/bits/$(@F) $@
-$(LIBPTHREAD_INCLUDE_BITS_H): $(top_builddir)include/bits/%: | $(top_builddir)include/bits
- $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/bits/$(@F) $@
-$(LIBPTHREAD_INCLUDE_H): $(top_builddir)include/%: | $(top_builddir)include
- $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/$(@F) $@
-$(LIBPTHREAD_H): $(top_builddir)include/%: | $(top_builddir)include
- $(do_ln) $(call rel_srcdir)$(PTDIR)/$(@F) $@
-
-nptl_headers_bootstrap = $(LIBPTHREAD_H) $(LIBPTHREAD_INCLUDE_H) $(LIBPTHREAD_INCLUDE_BITS_H) $(LIBPTHREAD_INCLUDE_STD_IMPL_OS_ARCH_BITS_H)
-
-HEADERCLEAN_libpthread/nptl:
- $(do_rm) $(nptl_headers_bootstrap) \
- $(addprefix $(PTHREAD_OUT)/pthread-errnos., c h s)
-
-CLEAN_libpthread/nptl:
- $(do_rm) $(addprefix $(PTHREAD_OUT)/*., o os oS a)
+CFLAGS-OMIT-alloca_cutoff.c = $(CFLAGS-nptl)
+CFLAGS-OMIT-forward.c = $(CFLAGS-nptl)
+CFLAGS-OMIT-libc-lowlevelock.c = $(CFLAGS-nptl)
+CFLAGS-OMIT-libc-cancellation.c = $(CFLAGS-nptl)
diff --git a/libpthread/nptl/sysdeps/Makefile b/libpthread/nptl/sysdeps/Makefile
index 1fea63600..4a8f4a072 100644
--- a/libpthread/nptl/sysdeps/Makefile
+++ b/libpthread/nptl/sysdeps/Makefile
@@ -5,9 +5,9 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-top_srcdir:=../../../
-top_builddir:=../../../
+top_srcdir=../../../
+top_builddir=../../../
all: objs
include $(top_builddir)Rules.mak
-include ./Makefile.commonarch
+include Makefile.in
include $(top_srcdir)Makerules
diff --git a/libpthread/nptl/sysdeps/Makefile.commonarch b/libpthread/nptl/sysdeps/Makefile.commonarch
index 32fb99884..a7080c088 100644
--- a/libpthread/nptl/sysdeps/Makefile.commonarch
+++ b/libpthread/nptl/sysdeps/Makefile.commonarch
@@ -4,59 +4,64 @@
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-subdirs += libpthread/nptl/sysdeps \
- libpthread/nptl/sysdeps/$(TARGET_ARCH)
+subdirs += libpthread/nptl/sysdeps/$(TARGET_ARCH)
+libpthread_arch_DIR := $(top_srcdir)libpthread/nptl/sysdeps/$(TARGET_ARCH)
+libpthread_arch_OUT := $(top_builddir)libpthread/nptl/sysdeps/$(TARGET_ARCH)
+
ifneq ($(abspath libpthread/nptl/sysdeps/$(TARGET_ARCH)),$(abspath libpthread/nptl/sysdeps/$(TARGET_ARCH)/$(TARGET_SUBARCH)))
subdirs += libpthread/nptl/sysdeps/$(TARGET_ARCH)/$(TARGET_SUBARCH)
+libpthread_subarch_DIR := $(libpthread_arch_DIR)/$(TARGET_SUBARCH)
+libpthread_subarch_OUT := $(libpthread_arch_OUT)/$(TARGET_SUBARCH)
endif
-PTHREAD_ARCH_DIR := $(top_srcdir)libpthread/nptl/sysdeps/$(TARGET_ARCH)
-PTHREAD_ARCH_OUT := $(top_builddir)libpthread/nptl/sysdeps/$(TARGET_ARCH)
-
-PTHREAD_ARCH_CSRC := $(patsubst %.c,$(PTHREAD_ARCH_DIR)/%.c,$(libpthread_CSRC))
-PTHREAD_ARCH_COBJ := $(patsubst %.c,$(PTHREAD_ARCH_OUT)/%.o,$(libpthread_CSRC))
-PTHREAD_ARCH_SSRC := $(patsubst %.s,$(PTHREAD_ARCH_DIR)/%.s,$(patsubst %.S,$(PTHREAD_ARCH_DIR)/%.S,$(libpthread_SSRC)))
-PTHREAD_ARCH_SOBJ := $(patsubst %.s,$(PTHREAD_ARCH_OUT)/%.o,$(patsubst %.S,$(PTHREAD_ARCH_OUT)/%.o,$(libpthread_SSRC)))
-PTHREAD_ARCH_OBJS := $(PTHREAD_ARCH_COBJ) $(PTHREAD_ARCH_SOBJ)
-
-LIBRT_ARCH_COBJ := $(patsubst %.c,$(PTHREAD_ARCH_OUT)/%.o,$(librt_CSRC))
-LIBRT_ARCH_SOBJ := $(patsubst %.S,$(PTHREAD_ARCH_OUT)/%.o,$(librt_SSRC))
-LIBRT_ARCH_OBJS := $(LIBRT_ARCH_COBJ) $(LIBRT_ARCH_SOBJ)
-
-LIBC_ARCH_COBJ := $(patsubst %.c,$(PTHREAD_ARCH_OUT)/%.o,$(libc_a_CSRC))
-LIBC_ARCH_SOBJ := $(patsubst %.c,$(PTHREAD_ARCH_OUT)/%.o,$(libc_a_SSRC))
-LIBC_ARCH_OBJS := $(LIBC_ARCH_COBJ) $(LIBC_ARCH_SOBJ)
-
-PTHREAD_LIBC_TLS_CSRC := $(filter-out $(notdir $(PTHREAD_ARCH_OBJS:.o=.c)),$(notdir $(PTHREAD_LIBC_TLS_CSRC)))
-PTHREAD_OBJS := $(PTHREAD_ARCH_OBJS)
+-include $(libpthread_arch_DIR)/Makefile.arch
+libpthread_arch_SSRC := $(filter-out librt-%,$(filter-out libc-%,$(notdir $(wildcard $(libpthread_arch_DIR)/*.S))))
+libpthread_arch_CSRC := $(filter-out librt-%,$(filter-out libc-%,$(notdir $(wildcard $(libpthread_arch_DIR)/*.c))))
+ifneq ($(TARGET_SUBARCH),)
+libpthread_subarch_SSRC := $(notdir $(wildcard $(libpthread_subarch_DIR)/*.S))
+libpthread_arch_SSRC := $(filter-out $(libpthread_subarch_SSRC),$(libpthread_arch_SSRC))
+libpthread_arch_CSRC := $(filter-out $(libpthread_subarch_SSRC:.S=.c),$(libpthread_arch_CSRC))
+libpthread_subarch_OBJS := $(patsubst %.S,$(libpthread_subarch_OUT)/%.o,$(libpthread_subarch_SSRC))
+endif
-libpthread-a-y += $(if $(DOPIC),$(PTHREAD_OBJS:.o=.os),$(PTHREAD_OBJS))
-libpthread-so-y += $(PTHREAD_OBJS:.o=.oS)
+libpthread_arch_COBJ = $(patsubst %.c,$(libpthread_arch_OUT)/%.o,$(libpthread_arch_CSRC))
+libpthread_arch_SOBJ = $(patsubst %.S,$(libpthread_arch_OUT)/%.o,$(libpthread_arch_SSRC))
+libpthread_arch_OBJS = $(libpthread_subarch_OBJS) $(libpthread_arch_COBJ) $(libpthread_arch_SOBJ)
-librt-a-y += $(LIBRT_ARCH_OBJS)
-librt-so-y += $(LIBRT_ARCH_OBJS:.o=.oS)
+libc_arch_COBJ = $(patsubst %.c,$(libpthread_arch_OUT)/%.o,$(libc_arch_CSRC))
+libc_arch_SOBJ = $(patsubst %.c,$(libpthread_arch_OUT)/%.o,$(libc_arch_SSRC))
+libc_arch_OBJS = $(libc_arch_COBJ) $(libc_arch_SOBJ)
+libc_arch_a_COBJ = $(patsubst %.c,$(libpthread_arch_OUT)/%.o,$(libc_arch_a_CSRC))
+libc_arch_a_OBJS = $(libc_arch_a_COBJ)
-libc-static-y += $(LIBC_ARCH_OBJS) $(PTHREAD_LIBC_TLS_OBJS)
+librt_arch_COBJ = $(patsubst %.c,$(libpthread_arch_OUT)/%.o,$(librt_arch_CSRC))
+librt_arch_SOBJ = $(patsubst %.S,$(libpthread_arch_OUT)/%.o,$(librt_arch_SSRC))
+librt_arch_OBJS = $(librt_arch_COBJ) $(librt_arch_SOBJ)
-CFLAGS-tcb-offsets.c = -S
-$(PTHREAD_ARCH_OUT)/tcb-offsets.c: $(PTHREAD_ARCH_DIR)/tcb-offsets.sym | $(PTHREAD_ARCH_OUT)
+CFLAGS-gen_tcb-offsets.c = -S
+$(libpthread_arch_OUT)/gen_tcb-offsets.c: $(libpthread_arch_DIR)/tcb-offsets.sym | $(libpthread_arch_OUT)
$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
-$(PTHREAD_ARCH_OUT)/tcb-offsets.s: $(PTHREAD_ARCH_OUT)/tcb-offsets.c
+$(libpthread_arch_OUT)/gen_tcb-offsets.s: $(libpthread_arch_OUT)/gen_tcb-offsets.c | headers
$(compile.c)
-
+libpthread-generated-y += $(libpthread_arch_OUT)/gen_tcb-offsets.s
PTHREAD_TCB_OFFSET_MANGLE ?= -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*\$$/\#define \1 \2/p"
-$(PTHREAD_ARCH_OUT)/tcb-offsets.h: $(PTHREAD_ARCH_OUT)/tcb-offsets.s
+$(libpthread_arch_OUT)/tcb-offsets.h: $(libpthread_arch_OUT)/gen_tcb-offsets.s
$(do_sed) $(PTHREAD_TCB_OFFSET_MANGLE) $< > $@
@if test ! -s $@ ; then rm -f $@ ; false ; fi
-pregen-headers-$(UCLIBC_HAS_THREADS_NATIVE) += $(PTHREAD_ARCH_OUT)/tcb-offsets.h
+pregen-headers-$(UCLIBC_HAS_THREADS_NATIVE) += $(libpthread_arch_OUT)/tcb-offsets.h
-objclean-y += CLEAN_$(subst $(top_builddir),,$(PTHREAD_ARCH_OUT))
-headers_clean-y+= HEADERCLEAN_$(subst $(top_builddir),,$(PTHREAD_ARCH_OUT))
-
-CLEAN_$(subst $(top_builddir),,$(PTHREAD_ARCH_OUT)):
- $(do_rm) $(addprefix $(PTHREAD_ARCH_OUT)/*., o os oS)
-HEADERCLEAN_$(subst $(top_builddir),,$(PTHREAD_ARCH_OUT)):
- $(do_rm) $(addprefix $(PTHREAD_ARCH_OUT)/tcb-offsets., c h s)
+objclean-y += CLEAN_$(subst $(top_builddir),,$(libpthread_arch_OUT))
+headers_clean-y+= HEADERCLEAN_$(subst $(top_builddir),,$(libpthread_arch_OUT))
+CLEAN_$(subst $(top_builddir),,$(libpthread_arch_OUT)):
+ $(do_rm) $(addprefix $(libpthread_arch_OUT)/*., o os oS)
+HEADERCLEAN_$(subst $(top_builddir),,$(libpthread_arch_OUT)):
+ $(do_rm) $(libpthread_arch_OUT)/tcb-offsets.h \
+ $(addprefix $(libpthread_arch_OUT)/gen_tcb-offsets., c h s)
+ifneq ($(TARGET_SUBARCH),)
+objclean-y += CLEAN_$(subst $(top_builddir),,$(libpthread_subarch_OUT))
+CLEAN_$(subst $(top_builddir),,$(libpthread_subarch_OUT)):
+ $(do_rm) $(addprefix $(libpthread_subarch_OUT)/*., o os oS)
+endif
diff --git a/libpthread/nptl/sysdeps/Makefile.in b/libpthread/nptl/sysdeps/Makefile.in
new file mode 100644
index 000000000..5296f4a7b
--- /dev/null
+++ b/libpthread/nptl/sysdeps/Makefile.in
@@ -0,0 +1,29 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+subdirs += libpthread/nptl/sysdeps
+
+define arch_and_subarch
+ $(addprefix $(1)/,$(notdir $(2))) $(if $(TARGET_SUBARCH),$(addprefix $(1)/$(TARGET_SUBARCH)/,$(notdir $(2))))
+endef
+define base_and_arch_and_subarch
+ $(addprefix $(1)/,$(notdir $(2))) $(addprefix $(1)/$(TARGET_ARCH)/,$(notdir $(2))) $(if $(TARGET_SUBARCH),$(addprefix $(1)/$(TARGET_ARCH)/$(TARGET_SUBARCH)/,$(notdir $(2))))
+endef
+
+include $(libpthread_DIR)/sysdeps/unix/sysv/linux/Makefile.commonarch
+include $(libpthread_DIR)/sysdeps/generic/Makefile.in
+include $(libpthread_DIR)/sysdeps/Makefile.commonarch
+libpthread_generic_libc_a_CSRC := $(filter-out $(notdir $(libc_arch_a_OBJS:.o=.c)),$(libpthread_generic_libc_a_CSRC))
+libpthread_arch_OBJS := $(filter-out $(call base_and_arch_and_subarch,$(libpthread_arch_OUT),$(libpthread_linux_OBJS)),$(libpthread_arch_OBJS))
+include $(libpthread_DIR)/sysdeps/pthread/Makefile.in
+libpthread_pthread_CSRC := $(filter-out $(notdir $(libpthread_linux_OBJS:.o=.c) $(libpthread_arch_OBJS:.o=.c)),$(libpthread_pthread_CSRC))
+libpthread-so-y := $(filter-out $(call base_and_arch_and_subarch,$(libpthread_pthread_OUT),$(libpthread_linux_OBJS) $(libpthread_arch_OBJS)),$(libpthread-so-y))
+
+libpthread_OBJS := $(libpthread_linux_OBJS) $(libpthread_arch_OBJS) $(libpthread_pthread_COBJ)
+libpthread_libc_OBJS = $(libc_linux_OBJS) $(libc_arch_OBJS)
+libpthread_libc_a_OBJS = $(libc_arch_a_OBJS) $(libpthread_generic_libc_a_OBJS)
+libpthread_librt_OBJS = $(librt_linux_OBJS) $(librt_arch_OBJS)
diff --git a/libpthread/nptl/sysdeps/arm/Makefile.arch b/libpthread/nptl/sysdeps/arm/Makefile.arch
index 87e81896a..071651297 100644
--- a/libpthread/nptl/sysdeps/arm/Makefile.arch
+++ b/libpthread/nptl/sysdeps/arm/Makefile.arch
@@ -6,14 +6,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-libpthread_SSRC = pthread_spin_lock.S pthread_spin_trylock.S aeabi_read_tp.S \
- thumb_atomics.S
-libpthread_CSRC = aeabi_unwind_cpp_pr1.c
-
-librt_SSRC = aeabi_read_tp.S thumb_atomics.S
-librt_CSRC = aeabi_unwind_cpp_pr1.c
-
-libc_a_CSRC =
+librt_arch_SSRC = aeabi_read_tp.S thumb_atomics.S
+librt_arch_CSRC = aeabi_unwind_cpp_pr1.c
CFLAGS-pt-raise.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
diff --git a/libpthread/nptl/sysdeps/generic/Makefile.in b/libpthread/nptl/sysdeps/generic/Makefile.in
index 03b2aa175..890fe050d 100644
--- a/libpthread/nptl/sysdeps/generic/Makefile.in
+++ b/libpthread/nptl/sysdeps/generic/Makefile.in
@@ -10,16 +10,18 @@ subdirs += libpthread/nptl/sysdeps/generic
# their architecture specific directory which will override
# the one here.
#
+libpthread_generic_DIR := $(top_srcdir)libpthread/nptl/sysdeps/generic
+libpthread_generic_OUT := $(top_builddir)libpthread/nptl/sysdeps/generic
-PTHREAD_LIBC_TLS_DIR := $(top_srcdir)libpthread/nptl/sysdeps/generic
-PTHREAD_LIBC_TLS_OUT := $(top_builddir)libpthread/nptl/sysdeps/generic
-
-PTHREAD_LIBC_TLS_CSRC = dl-tls.c libc-tls.c
-PTHREAD_LIBC_TLS_OBJS = $(patsubst %.c,$(PTHREAD_LIBC_TLS_OUT)/%.o,$(PTHREAD_LIBC_TLS_CSRC))
+libpthread_generic_libc_a_CSRC = libc-tls.c
+libpthread_generic_libc_a_COBJ = $(patsubst %.c,$(libpthread_generic_OUT)/%.o,$(libpthread_generic_libc_a_CSRC))
+libpthread_generic_libc_a_OBJS = $(libpthread_generic_libc_a_COBJ)
+libpthread_ld_tls_CSRC = dl-tls.c
+libpthread_ld_tls_COBJ = $(patsubst %.c,$(libpthread_generic_OUT)/%.o,$(libpthread_ld_tls_CSRC))
CFLAGS-generic = $(SSP_ALL_CFLAGS)
objclean-y += CLEAN_libpthread/nptl/sysdeps/generic
CLEAN_libpthread/nptl/sysdeps/generic:
- $(do_rm) $(addprefix $(PTHREAD_LIBC_TLS_OUT)/*., o os oS)
+ $(do_rm) $(addprefix $(libpthread_generic_OUT)/*., o os oS)
diff --git a/libpthread/nptl/sysdeps/generic/dl-tls.c b/libpthread/nptl/sysdeps/generic/dl-tls.c
index b65608f80..4acfa4ba7 100644
--- a/libpthread/nptl/sysdeps/generic/dl-tls.c
+++ b/libpthread/nptl/sysdeps/generic/dl-tls.c
@@ -17,6 +17,9 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#if defined SHARED || defined NOT_IN_libc
+# error in buildsystem: This file is for libc.a
+#endif
#include <libintl.h>
#include <signal.h>
#include <stdlib.h>
diff --git a/libpthread/nptl/sysdeps/i386/Makefile.arch b/libpthread/nptl/sysdeps/i386/Makefile.arch
index 03b9972eb..89962f743 100644
--- a/libpthread/nptl/sysdeps/i386/Makefile.arch
+++ b/libpthread/nptl/sysdeps/i386/Makefile.arch
@@ -5,9 +5,7 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-libpthread_CSRC = pthread_spin_lock.c
-libpthread_SSRC = i486/pthread_spin_trylock.S
-
CFLAGS-pthread_spin_lock.c += -D_GNU_SOURCE
+CFLAGS-pthread_create.c += -mpreferred-stack-boundary=4
CFLAGS-i386 = $(SSP_ALL_CFLAGS)
diff --git a/libpthread/nptl/sysdeps/mips/Makefile.arch b/libpthread/nptl/sysdeps/mips/Makefile.arch
index 7b6bfd48e..799d2c3d3 100644
--- a/libpthread/nptl/sysdeps/mips/Makefile.arch
+++ b/libpthread/nptl/sysdeps/mips/Makefile.arch
@@ -5,11 +5,6 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-libpthread_SSRC = pthread_spin_lock.S pthread_spin_trylock.S \
- nptl-sysdep.S
-
-libc_a_CSRC = libc-tls.c
-
CFLAGS-pt-raise.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
ASFLAGS-pthread_spin_lock.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
@@ -18,5 +13,6 @@ ASFLAGS-nptl-sysdep.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 \
-D_LIBC_REENTRANT \
-I$(top_srcdir)libc/sysdeps/linux/mips
-CFLAGS-mips = $(SSP_ALL_CFLAGS)
+libc_arch_a_CSRC = libc-tls.c
+CFLAGS-mips = $(SSP_ALL_CFLAGS)
diff --git a/libpthread/nptl/sysdeps/powerpc/Makefile.arch b/libpthread/nptl/sysdeps/powerpc/Makefile.arch
index 48a54cc73..edf3f4b44 100644
--- a/libpthread/nptl/sysdeps/powerpc/Makefile.arch
+++ b/libpthread/nptl/sysdeps/powerpc/Makefile.arch
@@ -5,7 +5,4 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-libpthread_SSRC =
-libpthread_CSRC = pthread_spin_lock.c pthread_spin_trylock.c
-
CFLAGS-powerpc = $(SSP_ALL_CFLAGS)
diff --git a/libpthread/nptl/sysdeps/pthread/Makefile.in b/libpthread/nptl/sysdeps/pthread/Makefile.in
index a8e27f5cb..030a2b681 100644
--- a/libpthread/nptl/sysdeps/pthread/Makefile.in
+++ b/libpthread/nptl/sysdeps/pthread/Makefile.in
@@ -11,165 +11,95 @@ subdirs += libpthread/nptl/sysdeps/pthread
# pt-longjmp.c in libc and libpthread. For uClibc, they are
# in libc only.
#
-libpthread_CSRC = pthread_barrier_init.c pthread_barrier_destroy.c \
- pthread_barrier_wait.c pthread_cond_broadcast.c \
- pthread_cond_signal.c pthread_cond_timedwait.c \
- pthread_cond_wait.c pthread_rwlock_rdlock.c \
- pthread_rwlock_timedrdlock.c \
- pthread_rwlock_timedwrlock.c pthread_rwlock_unlock.c \
- pthread_rwlock_wrlock.c pthread_sigmask.c \
- pthread_spin_destroy.c pthread_spin_init.c \
- pthread_spin_unlock.c pt-sigfillset.c \
- pt-longjmp.c tpp.c
-
-
-ifeq ($(TARGET_ARCH),i386)
-X86_PTHREAD_EXCLUDE_LIST = pthread_spin_unlock.c pthread_spin_init.c \
- pthread_barrier_wait.c pthread_cond_broadcast.c \
- pthread_cond_signal.c pthread_rwlock_timedrdlock.c \
- pthread_rwlock_timedwrlock.c pthread_rwlock_unlock.c pthread_rwlock_wrlock.c \
- pthread_rwlock_rdlock.c
-
-libpthread_CSRC := $(filter-out $(X86_PTHREAD_EXCLUDE_LIST),$(libpthread_CSRC))
-endif
-
-ifeq ($(TARGET_ARCH),sh)
-SH_PTHREAD_EXCLUDE_LIST = pthread_spin_unlock.c pthread_spin_init.c \
- pthread_rwlock_wrlock.c pthread_rwlock_rdlock.c \
- pthread_rwlock_unlock.c pt-longjmp.c \
- pthread_barrier_wait.c pthread_cond_broadcast.c \
- pthread_cond_signal.c \
- pthread_rwlock_timedrdlock.c \
- pthread_rwlock_timedwrlock.c
-
-libpthread_CSRC := $(filter-out $(SH_PTHREAD_EXCLUDE_LIST),$(libpthread_CSRC))
-endif
-ifeq ($(TARGET_ARCH),powerpc)
-#EXCLUDE_LIST := pthread_cond_broadcast.c \
-# pthread_cond_signal.c pthread_cond_timedwait.c \
-# pthread_cond_wait.c \
-# pthread_spin_init.c \
-# pthread_spin_unlock.c pt-sigfillset.c \
-# pt-longjmp.c
-#
-#libpthread_CSRC := $(filter-out $(EXCLUDE_LIST),$(libpthread_CSRC))
-endif
-
-
-ifeq ($(TARGET_ARCH),sparc)
-SPARC_PTHREAD_EXCLUDE_LIST = pthread_barrier_init.c pthread_barrier_wait.c \
- pthread_barrier_destroy.c
-
-libpthread_CSRC := $(filter-out $(SPARC_PTHREAD_EXCLUDE_LIST),$(libpthread_CSRC))
-endif
-
-ifeq ($(TARGET_ARCH),x86_64)
-X64_PTHREAD_EXCLUDE_LIST = pthread_spin_unlock.c pthread_spin_init.c \
- pthread_barrier_wait.c pthread_cond_broadcast.c \
- pthread_cond_signal.c pthread_rwlock_timedrdlock.c \
- pthread_rwlock_timedwrlock.c pthread_rwlock_unlock.c pthread_rwlock_wrlock.c \
- pthread_rwlock_rdlock.c pthread_cond_timedwait.c pthread_cond_wait.c
-
-libpthread_CSRC := $(filter-out $(X64_PTHREAD_EXCLUDE_LIST),$(libpthread_CSRC))
-endif
-
-
-
-CFLAGS-pt-common = -DNOT_IN_libc=1 $(SSP_ALL_CFLAGS)
-CFLAGS-pthread_barrier_init.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
-CFLAGS-pthread_barrier_destroy.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
-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
-CFLAGS-pthread_cond_signal.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
-CFLAGS-pthread_cond_timedwait.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
-CFLAGS-pthread_cond_wait.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
-CFLAGS-pthread_rwlock_rdlock.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
-CFLAGS-pthread_rwlock_timedrdlock.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
-CFLAGS-pthread_rwlock_timedwrlock.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
-CFLAGS-pthread_rwlock_unlock.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
-CFLAGS-pthread_rwlock_wrlock.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
-CFLAGS-pthread_sigmask.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
-CFLAGS-pthread_spin_destroy.c = -D_GNU_SOURCE $(CFLAGS-pt-common) \
- -DIS_IN_libpthread=1
-CFLAGS-pthread_spin_init.c = -D_GNU_SOURCE $(CFLAGS-pt-common) \
- -DIS_IN_libpthread=1
-CFLAGS-pthread_spin_unlock.c = -D_GNU_SOURCE $(CFLAGS-pt-common) \
- -DIS_IN_libpthread=1
-CFLAGS-pt-sigaction.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 \
- -I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH) \
- -I$(top_srcdir)libc/signal
-CFLAGS-pt-sigfillset.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 \
- -I$(top_srcdir)libc/signal
-CFLAGS-pt-sigprocmask.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 \
- -I$(top_srcdir)libc/sysdeps/linux/common
-CFLAGS-unwind-forcedunwind.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 -fexceptions -fasynchronous-unwind-tables
-CFLAGS-librt-cancellation.c = -DIS_IN_librt=1 $(CFLAGS-pt-common) \
+libpthread_pthread_DIR = $(top_srcdir)libpthread/nptl/sysdeps/pthread
+libpthread_pthread_OUT = $(top_builddir)libpthread/nptl/sysdeps/pthread
+
+libpthread_pthread_COBJ = $(patsubst %.c,$(libpthread_pthread_OUT)/%.o,$(libpthread_pthread_CSRC))
+libpthread_pthread_CSRC = \
+ pthread_barrier_destroy.c \
+ pthread_barrier_init.c \
+ pthread_barrier_wait.c \
+ pthread_cond_broadcast.c \
+ pthread_cond_signal.c \
+ pthread_cond_timedwait.c \
+ pthread_cond_wait.c \
+ pthread_rwlock_rdlock.c \
+ pthread_rwlock_timedrdlock.c \
+ pthread_rwlock_timedwrlock.c \
+ pthread_rwlock_unlock.c \
+ pthread_rwlock_wrlock.c \
+ pthread_sigmask.c \
+ pthread_spin_destroy.c \
+ pthread_spin_init.c \
+ pthread_spin_unlock.c \
+ pt-longjmp.c \
+ pt-sigaction.c \
+ pt-sigfillset.c \
+ pt-sigprocmask.c \
+ tpp.c
+CFLAGS-pthread = $(SSP_ALL_CFLAGS) -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-pthread_barrier_wait.c = -D_GNU_SOURCE
+CFLAGS-pthread_spin_destroy.c = -D_GNU_SOURCE
+CFLAGS-pthread_spin_init.c = -D_GNU_SOURCE
+CFLAGS-pthread_spin_unlock.c = -D_GNU_SOURCE
+CFLAGS-pt-sigaction.c = -I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH) \
+ -I$(top_srcdir)libc/signal
+CFLAGS-pt-sigfillset.c = -I$(top_srcdir)libc/signal
+CFLAGS-pt-sigprocmask.c = -I$(top_srcdir)libc/sysdeps/linux/common
+CFLAGS-unwind-forcedunwind.c = -fexceptions -fasynchronous-unwind-tables
+
+CFLAGS-OMIT-librt-cancellation.c = -DIS_IN_libpthread=1
+CFLAGS-OMIT-rt-unwind-resume.c = -DIS_IN_libpthread=1
+CFLAGS-librt-cancellation.c = -DIS_IN_librt=1 \
-fexceptions -fasynchronous-unwind-tables
-CFLAGS-rt-unwind-resume.c = -DIS_IN_librt=1 $(CFLAGS-pt-common) \
+CFLAGS-rt-unwind-resume.c = -DIS_IN_librt=1 \
-fexceptions -fasynchronous-unwind-tables
-CFLAGS-tpp.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
-#CFLAGS:=$(CFLAGS:-O1=-O2)
-
-pthread_DIR := $(top_srcdir)libpthread/nptl/sysdeps/pthread
-pthread_OUT := $(top_builddir)libpthread/nptl/sysdeps/pthread
-
-pthread_SRC = $(patsubst %.c, $(pthread_DIR)/%.c, $(libpthread_CSRC))
-pthread_OBJ = $(patsubst %.c, $(pthread_OUT)/%.o, $(libpthread_CSRC))
-
-ifeq ($(DOPIC),y)
-libpthread-a-y += $(pthread_OBJ:.o=.os)
-else
-libpthread-a-y += $(pthread_OBJ)
-endif
-libpthread-so-y += $(pthread_OBJ:.o=.oS)
-libpthread-so-y += $(pthread_OUT)/pt-sigaction.oS $(pthread_OUT)/pt-sigprocmask.oS \
- $(pthread_OUT)/unwind-forcedunwind.oS
+libpthread-so-y += $(patsubst %,$(libpthread_pthread_OUT)/%.oS, \
+ pt-sigaction pt-sigprocmask unwind-forcedunwind)
+CFLAGS-OMIT-sigaction.c = $(CFLAGS-pthread)
CFLAGS-sigaction.c = -I$(top_srcdir)libc/signal
-libc-y += $(pthread_OUT)/sigaction.o
+libc-y += $(libpthread_pthread_OUT)/sigaction.o
-librt-a-y += $(pthread_OUT)/librt-cancellation.o
-librt-so-y += $(pthread_OUT)/librt-cancellation.oS \
- $(pthread_OUT)/rt-unwind-resume.oS
+librt-pt-routines-y = librt-cancellation.c
+librt-pt-shared-only-routines-y = rt-unwind-resume.c
ifeq ($(UCLIBC_CTOR_DTOR),y)
+CFLAGS-OMIT-pt-initfini.c = $(CFLAGS-pthread)
CFLAGS-pt-initfini.c = -S -g0 -fPIC -fno-inline-functions \
- $(call check_gcc,-fno-unit-at-a-time,) \
- -finhibit-size-directive \
- $(patsubst -f%,-fno-%,$(call check_gcc,-fexceptions,))
+ $(call check_gcc,-fno-unit-at-a-time,) \
+ -finhibit-size-directive \
+ $(patsubst -f%,-fno-%,$(call check_gcc,-fexceptions,))
ASFLAGS-crti.S = -g0
ASFLAGS-crtn.S = -g0
-$(pthread_OUT)/pt-initfini.s: $(pthread_DIR)/pt-initfini.c
+$(libpthread_pthread_OUT)/pt-initfini.s: $(libpthread_pthread_DIR)/pt-initfini.c
$(compile.c)
$(do_sed) '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
- $(AWK) -f $(pthread_DIR)/defs.awk > $(pthread_OUT)/defs.h
+ $(do_awk) $(libpthread_pthread_DIR)/defs.awk > $(libpthread_pthread_OUT)/defs.h
-$(pthread_OUT)/crti.S: $(pthread_OUT)/pt-initfini.s
+$(libpthread_pthread_OUT)/crti.S $(libpthread_pthread_OUT)/crtn.S: $(libpthread_pthread_OUT)/pt-initfini.s
$(do_sed) -e '1,/@HEADER_ENDS/p' \
- -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
- -e '/@TRAILER_BEGINS/,$$p' $< > $@
-
-$(pthread_OUT)/crtn.S: $(pthread_OUT)/pt-initfini.s
- $(do_sed) -e '1,/@HEADER_ENDS/p' \
- -e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \
- -e '/@TRAILER_BEGINS/,$$p' $< > $@
+ -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
+ -e '/@TRAILER_BEGINS/,$$p' $< > $@
endif
-
-$(pthread_DIR)/pt-sigaction.c:
- $(LN) -s sigaction.c $@
-
-$(pthread_DIR)/pt-sigfillset.c:
- $(LN) -s sigfillset.c $@
-
-$(pthread_DIR)/pt-sigprocmask.c:
- $(LN) -s sigprocmask.c $@
+# It would have been easier to just add dummy files that include the real
+# impl, but ok.
+# Special rules needed since we do objdir->objdir compilation for these 3.
+# First symlink them, then build them. Rob would freak out on these. Sheesh! ;)
+pthread-lc-fwd = sigaction sigfillset sigprocmask
+$(patsubst %,$(libpthread_pthread_OUT)/pt-%.c,$(pthread-lc-fwd)): | $(libpthread_pthread_OUT)
+ $(do_ln) $(call rel_srcdir)$(patsubst pt-%,$(libpthread_pthread_DIR)/%,$(@F)) $@
+$(patsubst %,$(libpthread_pthread_OUT)/pt-%.oS,$(pthread-lc-fwd)): $(libpthread_pthread_OUT)/pt-%.oS: $(libpthread_pthread_OUT)/pt-%.c
+ $(compile.c)
+$(patsubst %,$(libpthread_pthread_OUT)/pt-%.o,$(pthread-lc-fwd)): $(libpthread_pthread_OUT)/pt-%.o: $(libpthread_pthread_OUT)/pt-%.c
+ $(compile.c)
objclean-y += CLEAN_libpthread/nptl/sysdeps/pthread
CLEAN_libpthread/nptl/sysdeps/pthread:
- $(do_rm) $(addprefix $(pthread_OUT)/*., o os oS s S) $(pthread_OUT)/defs.h \
- $(pthread_DIR)/pt-sigaction.c $(pthread_DIR)/pt-sigfillset.c \
- $(pthread_DIR)/pt-sigprocmask.c
+ $(do_rm) $(addprefix $(libpthread_pthread_OUT)/*., o os oS s S) \
+ $(libpthread_pthread_OUT)/defs.h \
+ $(addprefix $(libpthread_pthread_DIR)/,pt-sigaction.c \
+ pt-sigfillset.c pt-sigprocmask.c)
diff --git a/libpthread/nptl/sysdeps/sh/Makefile.arch b/libpthread/nptl/sysdeps/sh/Makefile.arch
index 15830f55c..d72fe11e0 100644
--- a/libpthread/nptl/sysdeps/sh/Makefile.arch
+++ b/libpthread/nptl/sysdeps/sh/Makefile.arch
@@ -5,9 +5,6 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-libpthread_SSRC = pthread_spin_unlock.S pthread_spin_trylock.S
-libpthread_CSRC = pthread_spin_lock.c pthread_spin_init.c
-
ASFLAGS-pthread_spin_unlock.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
ASFLAGS-pthread_spin_trylock.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
diff --git a/libpthread/nptl/sysdeps/sparc/Makefile.arch b/libpthread/nptl/sysdeps/sparc/Makefile.arch
index d657cedd5..449493535 100644
--- a/libpthread/nptl/sysdeps/sparc/Makefile.arch
+++ b/libpthread/nptl/sysdeps/sparc/Makefile.arch
@@ -5,8 +5,6 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
subdirs += libpthread/nptl/sysdeps/$(TARGET_ARCH)/$(TARGET_SUBARCH)/sparv9
-libpthread_CSRC = sparc32/pthread_spin_lock.c \
- sparc32/pthread_spin_trylock.c
CFLAGS-pthread_spin_lock.c += -D_GNU_SOURCE
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
diff --git a/libpthread/nptl/sysdeps/x86_64/Makefile.arch b/libpthread/nptl/sysdeps/x86_64/Makefile.arch
index 5a3c4a2fc..7a955ff61 100644
--- a/libpthread/nptl/sysdeps/x86_64/Makefile.arch
+++ b/libpthread/nptl/sysdeps/x86_64/Makefile.arch
@@ -5,9 +5,6 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-libpthread_CSRC = pthread_spin_lock.c
-libpthread_SSRC = pthread_spin_trylock.S
-
CFLAGS-pthread_spin_lock.c += -D_GNU_SOURCE
CFLAGS-x86_64 = $(SSP_ALL_CFLAGS)