summaryrefslogtreecommitdiffstats
path: root/libpthread/nptl
diff options
context:
space:
mode:
Diffstat (limited to 'libpthread/nptl')
-rw-r--r--libpthread/nptl/Makefile300
-rw-r--r--libpthread/nptl/Rules.mak10
-rw-r--r--libpthread/nptl/sysdeps/mips/Makefile46
-rw-r--r--libpthread/nptl/sysdeps/pthread/Makefile102
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/Makefile118
5 files changed, 441 insertions, 135 deletions
diff --git a/libpthread/nptl/Makefile b/libpthread/nptl/Makefile
index 668fad09c..fec473cde 100644
--- a/libpthread/nptl/Makefile
+++ b/libpthread/nptl/Makefile
@@ -1,7 +1,6 @@
-# Makefile for uClibc's pthread library
+# Makefile for uClibc's NPTL pthread library (Portions stolen from glibc.)
#
-# Copyright (C) 2002 Erik Andersen <andersen@uclibc.org>
-# Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org>
+# Copyright (C) 2005 Steven J. Hill <sjhill@realitydiluted.com>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Library General Public License as published by the Free
@@ -20,67 +19,280 @@
TOPDIR=../../
include $(TOPDIR)Rules.mak
+include Rules.mak
-# As long as there is only one subdir, we don't
-# have to worry about race conditions with multiple
-# $(AR)'s in subdirs running on linuxthreads.a.
-DIRS = sysdeps
+routines = alloca_cutoff forward libc-lowlevellock libc-cancellation
+shared-only-routines = forward
-#Adjust the soname version to avoid namespace collisions with glibc's libpthread
-LIBPTHREAD:=../libpthread.a
-ifeq ($(strip $(TARGET_ARCH)),sparc)
-SYSDEPS_DIR:=$(TARGET_ARCH)/sparc32
-else
-SYSDEPS_DIR:=$(TARGET_ARCH)
-endif
-#This stuff will not compile without at least -O1
-CFLAGS :=$(CFLAGS:-O0=-O1)
+libpthread-routines = 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_mutexattr_init pthread_mutexattr_destroy \
+ pthread_mutexattr_getpshared \
+ pthread_mutexattr_setpshared \
+ 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 \
+ old_pthread_cond_init old_pthread_cond_destroy \
+ old_pthread_cond_wait old_pthread_cond_timedwait \
+ old_pthread_cond_signal old_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 \
+ old_pthread_atfork 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 \
+ herrno res pt-allocrtsig \
+ pthread_kill_other_threads \
+ pthread_getaffinity pthread_setaffinity \
+ pthread_attr_getaffinity pthread_attr_setaffinity \
+ cleanup_routine unwind-forcedunwind
+# pthread_setuid pthread_seteuid pthread_setreuid \
+# pthread_setresuid \
+# pthread_setgid pthread_setegid pthread_setregid \
+# pthread_setresgid
+
+libpthread-shared-only-routines = version pt-allocrtsig unwind-forcedunwind
+libpthread-static-only-routines = pthread_atfork
+
+CFLAGS-pthread_atfork.c = -DNOT_IN_libc
+
+# Since cancellation handling is in large parts handled using exceptions
+# we have to compile some files with exception handling enabled, some
+# even with asynchronous unwind tables.
+
+# init.c contains sigcancel_handler().
+CFLAGS-init.c = -fexceptions -fasynchronous-unwind-tables
+# The unwind code itself,
+CFLAGS-unwind.c = -fexceptions
+CFLAGS-unwind-forcedunwind.c = -fexceptions -fasynchronous-unwind-tables
+
+# The following three functions must be async-cancel safe.
+CFLAGS-pthread_cancel.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-pthread_setcancelstate.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-pthread_setcanceltype.c = -fexceptions -fasynchronous-unwind-tables
+
+# These are internal functions which similar functionality as setcancelstate
+# and setcanceltype.
+CFLAGS-cancellation.c = -fasynchronous-unwind-tables
+CFLAGS-libc-cancellation.c = -fasynchronous-unwind-tables
+
+# Calling pthread_exit() must cause the registered cancel handlers to
+# be executed. Therefore exceptions have to be thrown through this
+# function.
+CFLAGS-pthread_exit.c = -fexceptions
+
+# Among others, __pthread_unwind is forwarded. This function must handle
+# exceptions.
+CFLAGS-forward.c = -fexceptions
+
+# The following are cancellation points. Some of the functions can
+# block and therefore temporarily enable asynchronous cancellation.
+# Those must be compiled asynchronous unwind tables.
+CFLAGS-pthread_testcancel.c = -fexceptions
+CFLAGS-pthread_join.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-pthread_timedjoin.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-pthread_once.c = $(uses-callbacks) -fexceptions \
+ -fasynchronous-unwind-tables
+CFLAGS-pthread_cond_wait.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-pthread_cond_timedwait.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-sem_wait.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-sem_timedwait.c = -fexceptions -fasynchronous-unwind-tables
+
+# These are the function wrappers we have to duplicate here.
+CFLAGS-fcntl.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-lockf.c = -fexceptions
+CFLAGS-pread.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-pread64.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-pwrite.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-pwrite64.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-wait.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-waitpid.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-sigwait.c = -fexceptions -fasynchronous-unwind-tables
+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
+#
+# The rest of this file is uClibc specific.
+#
+
+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_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_kill_other_threads \
+ pthread_getaffinity \
+ pthread_setaffinity \
+ pthread_attr_getaffinity \
+ pthread_attr_setaffinity \
+ unwind-forcedunwind
+
+DIRS := sysdeps/pthread sysdeps/$(TARGET_ARCH) sysdeps/unix/sysv/linux \
+ sysdeps/unix/sysv/linux/$(TARGET_ARCH)
-# set up system dependencies include dirs (NOTE: order matters!)
-PTDIR = $(TOPDIR)libpthread/nptl/
-SYSDEPINC = -I$(PTDIR)sysdeps/unix \
- -I$(PTDIR)sysdeps/unix/sysv/linux \
- -I$(PTDIR)sysdeps/unix/sysv/linux/$(TARGET_ARCH) \
- -I$(PTDIR)sysdeps/$(TARGET_ARCH) \
- -I$(PTDIR)sysdeps/pthread \
- -I$(PTDIR)sysdeps \
- -I$(TOPDIR)libc/sysdeps/linux/$(TARGET_ARCH) \
- -I$(TOPDIR)ldso/include
-CFLAGS += $(SYSDEPINC)
+CSRC-LIBP-ST = $(patsubst %, %.c, $(filter-out $(libpthread-os-routines) \
+ $(libpthread-misc-routines) \
+ $(libpthread-shared-only-routines), \
+ $(libpthread-routines)))
-CSRC=init.c vars.c events.c pthread_create.c pthread_exit.c
+CSRC-LIBP-SH = $(patsubst %, %.c, $(filter-out $(libpthread-os-routines) \
+ $(libpthread-misc-routines) \
+ $(libpthread-static-only-routines) pt-allocrtsig, \
+ $(libpthread-routines)))
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-OBJS=$(COBJS)
+CSRC-LIBC-ST = $(patsubst %, %.c, $(filter-out $(shared-only-routines) \
+ libc-lowlevellock, $(routines)))
-# We need to make sure that we put all the top-level $(OBJS) into
-# our archive before executing subdirs. That way, when $(AR) is
-# run in the subdirs, it'll bump the generic top-level objects
-# out of our archive in favor of the machine-specific ones.
-all: version.h $(LIBPTHREAD) subdirs
+CSRC-LIBC-SH = $(patsubst %, %.c, $(filter-out libc-lowlevellock, $(routines)))
+
+COBJ-LIBP-ST = $(patsubst %.c, %.o, $(CSRC-LIBP-ST))
+COBJ-LIBP-SH = $(patsubst %.c, %.os, $(CSRC-LIBP-SH))
+COBJ-LIBC-ST = $(patsubst %.c, %.o, $(CSRC-LIBC-ST))
+COBJ-LIBC-SH = $(patsubst %.c, %.os, $(CSRC-LIBC-SH))
+
+ar-target all: version.h banner.h $(COBJ-LIBP-ST) $(COBJ-LIBP-SH) subdirs
+ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
+ $(STRIPTOOL) -X --strip-debug -R .note -R .comment \
+ $(COBJ-LIBP-ST) $(COBJ-LIBP-SH)
+else
+ $(STRIPTOOL) -x -R .note -R .comment \
+ $(COBJ-LIBP-ST) $(COBJ-LIBP-SH)
+endif
+ $(AR) $(ARFLAGS) $(PTDIR)../$(LIBPTHREAD_STATIC_ARCHIVE) $(COBJ-LIBP-ST)
+ $(AR) $(ARFLAGS) $(PTDIR)../$(LIBPTHREAD_SHARED_ARCHIVE) $(COBJ-LIBP-SH)
version.h:
- @echo "#define VERSION \""$(VERSION)"\"" > version.h
+ @echo "#define VERSION \""$(VERSION)"\"" > $@
+
+banner.h: Banner
+ sed 's/\(.*\)/"\1\\n"/' $< > $@
+
+$(COBJ-LIBP-ST): %.o : %.c
+ $(CC) $(CFLAGS-$<) $(CFLAGS-LIBP) -c $< -o $@
+
+$(COBJ-LIBP-SH): %.os : %.c
+ $(CC) $(CFLAGS-$<) $(CFLAGS-LIBP) -DSHARED -c $< -o $@
+
+$(COBJ-LIBC-ST): %.o : %.c
+ $(CC) $(CFLAGS-$<) $(CFLAGS-LIBC) -c $< -o $@
-$(LIBPTHREAD) ar-target: $(OBJS)
- $(AR) $(ARFLAGS) $(LIBPTHREAD) $(OBJS)
+$(COBJ-LIBC-SH): %.os : %.c
+ $(CC) $(CFLAGS-$<) $(CFLAGS-LIBC) -DSHARED -c $< -o $@
-$(COBJS): %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
+objs-pthread-libc: $(COBJ-LIBC-ST) $(COBJ-LIBC-SH)
ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
- $(STRIPTOOL) -X --strip-debug -R .note -R .comment $*.o
+ $(STRIPTOOL) -X --strip-debug -R .note -R .comment \
+ $(COBJ-LIBC-ST) $(COBJ-LIBC-SH)
else
- $(STRIPTOOL) -x -R .note -R .comment $*.o
+ $(STRIPTOOL) -x -R .note -R .comment \
+ $(COBJ-LIBC-ST) $(COBJ-LIBC-SH)
endif
+ @for objfile in $(COBJ-LIBC-ST); do \
+ echo ../libpthread/nptl/$$objfile >> $(PTCOBJST); \
+ done
+ @for objfile in $(COBJ-LIBC-SH); do \
+ echo ../libpthread/nptl/$$objfile >> $(PTCOBJSH); \
+ done
+ $(MAKE) -C sysdeps/$(TARGET_ARCH) $@
+ $(MAKE) -C sysdeps/unix/sysv/linux $@
+ $(MAKE) -C sysdeps/unix/sysv/linux/$(TARGET_ARCH) $@
clean: subdirs_clean
- $(RM) *.[oa] *~ core version.h
+ $(RM) *.o *.os *~ core banner.h version.h
subdirs: $(patsubst %, _dir_%, $(DIRS))
subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS))
-$(patsubst %, _dir_%, $(DIRS)): $(LIBPTHREAD)
+$(patsubst %, _dir_%, $(DIRS)):
$(MAKE) -C $(patsubst _dir_%, %, $@)
$(patsubst %, _dirclean_%, $(DIRS)):
diff --git a/libpthread/nptl/Rules.mak b/libpthread/nptl/Rules.mak
index c3970d235..9fbad743b 100644
--- a/libpthread/nptl/Rules.mak
+++ b/libpthread/nptl/Rules.mak
@@ -5,9 +5,9 @@
LIBPTHREAD_STATIC_ARCHIVE := libpthread.a
LIBPTHREAD_SHARED_ARCHIVE := libpthread-shared.a
-CFLAGS-NPTL := $(CFLAGS:-O0=-O2) \
- -I$(PTDIR) \
- -I$(TOPDIR)ldso/include \
- -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -std=gnu99
+CFLAGS-LIBC := $(CFLAGS:-O0=-O2) -I$(PTDIR) -I$(TOPDIR)ldso/include \
+ -std=gnu99
+ASFLAGS-LIBC := $(filter-out -std=gnu99, $(CFLAGS-LIBC)) -D__ASSEMBLER__
-ASFLAGS-NPTL := $(filter-out -std=gnu99, $(CFLAGS-NPTL)) -D__ASSEMBLER__
+CFLAGS-LIBP := $(CFLAGS-LIBC) -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+ASFLAGS-LIBP := $(filter-out -std=gnu99, $(CFLAGS-LIBP)) -D__ASSEMBLER__
diff --git a/libpthread/nptl/sysdeps/mips/Makefile b/libpthread/nptl/sysdeps/mips/Makefile
index 29ee02c5a..2528194f3 100644
--- a/libpthread/nptl/sysdeps/mips/Makefile
+++ b/libpthread/nptl/sysdeps/mips/Makefile
@@ -1,4 +1,4 @@
-# Makefile for uClibc's NPTL pthread library
+# Makefile for uClibc NPTL pthread library (MIPS)
#
# Copyright (C) 2005 Steven J. Hill <sjhill@realitydiluted.com>
#
@@ -19,21 +19,41 @@
TOPDIR=../../../../
include $(TOPDIR)Rules.mak
+include ../../Rules.mak
-#
-# FIX ME: We should probably be including 'nptl-sysdep.S' which needs
-# the new '__syscall_error' function for per-thread 'errno'. Maybe
-# this work and maybe it will not.
-#
-SOBJS = $(patsubst %.S,%.o, $(filter-out nptl-sysdep.S, $(wildcard *.S)))
+COBJ-LIBC-ST = $(patsubst %.c, %.o, $(wildcard *.c))
+
+AOBJ-LIBP-ST = $(patsubst %.S, %.o, $(wildcard *.S))
+AOBJ-LIBP-SH = $(patsubst %.S, %.os, $(wildcard *.S))
+
+ar-target all: $(AOBJ-LIBP-ST) $(AOBJ-LIBP-SH)
+ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
+ $(STRIPTOOL) -X --strip-debug -R .note -R .comment \
+ $(AOBJ-LIBP-ST) $(AOBJ-LIBP-SH)
+else
+ $(STRIPTOOL) -x -R .note -R .comment $(AOBJ-LIBP-ST) $(AOBJ-LIBP-SH)
+endif
+ $(AR) $(ARFLAGS) $(PTDIR)../$(LIBPTHREAD_STATIC_ARCHIVE) $(AOBJ-LIBP-ST)
+ $(AR) $(ARFLAGS) $(PTDIR)../$(LIBPTHREAD_SHARED_ARCHIVE) $(AOBJ-LIBP-SH)
+
+$(AOBJ-LIBP-ST): %.o : %.S
+ $(CC) $(ASFLAGS) $(ASFLAGS-NPTL) -c $< -o $@
-OBJS = $(SOBJS)
+$(AOBJ-LIBP-SH): %.os : %.S
+ $(CC) $(ASFLAGS) $(ASFLAGS-NPTL) -DSHARED -c $< -o $@
-all: $(OBJS)
+$(COBJ-LIBC-ST): %.o : %.c
+ $(CC) $(CFLAGS-LIBC) -c $< -o $@
-$(SOBJS): %.o : %.S
- echo $(PTDIR)
- $(CC) $(ASFLAGS) -c $< -o $@
+objs-pthread-libc: $(COBJ-LIBC-ST)
+ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
+ $(STRIPTOOL) -X --strip-debug -R .note -R .comment $(COBJ-LIBC-ST)
+else
+ $(STRIPTOOL) -x -R .note -R .comment $(COBJ-LIBC-ST)
+endif
+ @for objfile in $(COBJ-LIBC-ST); do \
+ echo ../libpthread/nptl/sysdeps/mips/$$objfile >> $(PTCOBJST); \
+ done
clean:
- $(RM) *.[oa] *~ core
+ $(RM) *.o *.os *~ core
diff --git a/libpthread/nptl/sysdeps/pthread/Makefile b/libpthread/nptl/sysdeps/pthread/Makefile
index 207e10fad..0bd102d6e 100644
--- a/libpthread/nptl/sysdeps/pthread/Makefile
+++ b/libpthread/nptl/sysdeps/pthread/Makefile
@@ -1,52 +1,58 @@
-# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
-# This file is part of the GNU C Library.
-# Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
-# 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.
-
-ifeq ($(subdir),csu)
-CFLAGS-libc-start.c += -I../nptl
-routines += unwind-resume
-shared-only-routines += unwind-resume
-CFLAGS-unwind-resume.c += -fexceptions -fasynchronous-unwind-tables
-endif
-
-ifeq ($(subdir),nptl)
-libpthread-sysdep_routines += errno-loc
-endif
-
-ifeq ($(subdir),rt)
-librt-sysdep_routines += timer_routines librt-cancellation rt-unwind-resume
-librt-shared-only-routines += rt-unwind-resume
-CPPFLAGS-timer_routines.c = -I../nptl
-CFLAGS-librt-cancellation.c += -fexceptions -fasynchronous-unwind-tables
-CFLAGS-rt-unwind-resume.c += -fexceptions -fasynchronous-unwind-tables
-
-ifeq (yes,$(build-shared))
-$(objpfx)tst-timer: $(objpfx)librt.so $(shared-thread-library)
+# Makefile for uClibc NPTL pthread library (pthread)
+#
+# Copyright (C) 2005 Steven J. Hill <sjhill@realitydiluted.com>
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Library General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option) any
+# later version.
+#
+# This program 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 Library General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Library General Public License
+# along with this program; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Makefile for uClibc
+
+TOPDIR=../../../../
+include $(TOPDIR)Rules.mak
+include ../../Rules.mak
+
+#
+# NOTE: glibc puts flockfile.c, ftrylockfile.c, funlockfile.c, and
+# pt-longjmp.c in libc and libpthread. For uClibc, they are
+# in libc only.
+#
+CSRC = pthread_barrier_wait.c pthread_cond_broadcast.c pthread_cond_signal.c \
+ pthread_cond_timedwait.c pthread_cond_wait.c pthread_getcpuclockid.c \
+ pthread_once.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 sigaction.c \
+ unwind-forcedunwind.c
+
+COBJ-LIBP-ST = $(patsubst %.c, %.o, $(CSRC))
+COBJ-LIBP-SH = $(patsubst %.c, %.os, $(CSRC))
+
+ar-target all: $(COBJ-LIBP-ST) $(COBJ-LIBP-SH)
+ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
+ $(STRIPTOOL) -X --strip-debug -R .note -R .comment \
+ $(COBJ-LIBP-ST) $(COBJ-LIBP-SH)
else
-$(objpfx)tst-timer: $(objpfx)librt.a $(static-thread-library)
+ $(STRIPTOOL) -x -R .note -R .comment \
+ $(COBJ-LIBP-ST) $(COBJ-LIBP-SH)
endif
+ $(AR) $(ARFLAGS) $(PTDIR)../$(LIBPTHREAD_STATIC_ARCHIVE) $(COBJ-LIBP-ST)
+ $(AR) $(ARFLAGS) $(PTDIR)../$(LIBPTHREAD_SHARED_ARCHIVE) $(COBJ-LIBP-SH)
-ifeq ($(have-forced-unwind),yes)
-tests += tst-mqueue8x
-CFLAGS-tst-mqueue8x.c += -fexceptions
-endif
-endif
+$(COBJ-LIBP-ST): %.o : %.c
+ $(CC) $(CFLAGS-LIBP) -c $< -o $@
-ifeq ($(subdir),posix)
-CFLAGS-confstr.c += -DLIBPTHREAD_VERSION='"NPTL $(version)"'
-endif
+$(COBJ-LIBP-SH): %.os : %.c
+ $(CC) $(CFLAGS-LIBP) -DSHARED -c $< -o $@
+
+clean:
+ $(RM) *.o *.os *~ core
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile
index 991398242..e29cf113b 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile
@@ -1,34 +1,102 @@
-# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
-# This file is part of the GNU C Library.
-# Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+# Makefile for uClibc NPTL pthread library (Linux files)
+#
+# Copyright (C) 2005 Steven J. Hill <sjhill@realitydiluted.com>
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Library General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option) any
+# later version.
+#
+# This program 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 Library General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Library General Public License
+# along with this program; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Makefile for uClibc
-# 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.
+TOPDIR=../../../../../../
+include $(TOPDIR)Rules.mak
+include ../../../../Rules.mak
-# 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.
+CSRC-LIBP-ST = pt-raise.c 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 \
+ sem_trywait.c sem_wait.c pt-fork.c
-# 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. */
+CSRC-LIBP-SH = $(CSRC-LIBP-ST)
-ifeq ($(subdir),nptl)
-sysdep_routines += register-atfork unregister-atfork libc_pthread_init \
- libc_multiple_threads
+CSRC-LIBC-ST = libc_pthread_init.c libc_multiple_threads.c \
+ register-atfork.c unregister-atfork.c
-libpthread-sysdep_routines += pt-fork pthread_mutex_cond_lock
+CSRC-LIBC-SH = $(CSRC-LIBC-ST)
-gen-as-const-headers += lowlevelcond.sym lowlevelrwlock.sym \
- lowlevelbarrier.sym unwindbuf.sym
+ifeq ($(strip $(TARGET_ARCH)),alpha)
+CSRC-LIBC-ST += libc-lowlevellock.c
+CSRC-LIBP-ST += rtld-libc-lowlevellock.c
endif
+ifeq ($(strip $(TARGET_ARCH)),mips)
+CSRC-LIBC-ST += libc-lowlevellock.c
+CSRC-LIBP-ST += rtld-libc-lowlevellock.c
+endif
+ifeq ($(strip $(TARGET_ARCH)),powerpc)
+CSRC-LIBC-ST += libc-lowlevellock.c
+CSRC-LIBP-ST += rtld-libc-lowlevellock.c
+endif
+ifeq ($(strip $(TARGET_ARCH)),sparc)
+CSRC-LIBC-ST += libc-lowlevellock.c
+CSRC-LIBP-ST += rtld-libc-lowlevellock.c
+endif
+
+COBJ-LIBP-ST = $(patsubst %.c, %.o, $(CSRC-LIBP-ST))
+COBJ-LIBP-SH = $(patsubst %.c, %.os, $(CSRC-LIBP-SH))
+COBJ-LIBC-ST = $(patsubst %.c, %.o, $(CSRC-LIBC-ST))
+COBJ-LIBC-SH = $(patsubst %.c, %.os, $(CSRC-LIBC-SH))
+
+ar-target all: $(COBJ-LIBP-ST) $(COBJ-LIBP-SH)
+ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
+ $(STRIPTOOL) -X --strip-debug -R .note -R .comment \
+ $(COBJ-LIBP-ST) $(COBJ-LIBP-SH)
+else
+ $(STRIPTOOL) -x -R .note -R .comment \
+ $(COBJ-LIBP-ST) $(COBJ-LIBP-SH)
+endif
+ $(AR) $(ARFLAGS) $(PTDIR)../$(LIBPTHREAD_STATIC_ARCHIVE) $(COBJ-LIBP-ST)
+ $(AR) $(ARFLAGS) $(PTDIR)../$(LIBPTHREAD_SHARED_ARCHIVE) $(COBJ-LIBP-SH)
-ifeq ($(subdir),posix)
-CFLAGS-fork.c = -D_IO_MTSAFE_IO
-CFLAGS-getpid.o = -fomit-frame-pointer
-CFLAGS-getpid.os = -fomit-frame-pointer
+$(COBJ-LIBP-ST): %.o : %.c
+ $(CC) $(CFLAGS-LIBP) -c $< -o $@
+
+$(COBJ-LIBP-SH): %.os : %.c
+ $(CC) $(CFLAGS-LIBP) -DSHARED -c $< -o $@
+
+$(COBJ-LIBC-ST): %.o : %.c
+ $(CC) $(CFLAGS-LIBC) -c $< -o $@
+
+$(COBJ-LIBC-SH): %.os : %.c
+ $(CC) $(CFLAGS-LIBC) -DSHARED -c $< -o $@
+
+objs-pthread-libc: $(COBJ-LIBC-ST) $(COBJ-LIBC-SH)
+ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
+ $(STRIPTOOL) -X --strip-debug -R .note -R .comment \
+ $(COBJ-LIBC-ST) $(COBJ-LIBC-SH)
+else
+ $(STRIPTOOL) -x -R .note -R .comment \
+ $(COBJ-LIBC-ST) $(COBJ-LIBC-SH)
endif
+ @for objfile in $(COBJ-LIBC-ST); do \
+ echo ../libpthread/nptl/sysdeps/unix/sysv/linux/$$objfile >> $(PTCOBJST); \
+ done
+ @for objfile in $(COBJ-LIBC-SH); do \
+ echo ../libpthread/nptl/sysdeps/unix/sysv/linux/$$objfile >> $(PTCOBJSH); \
+ done
+
+rtld-libc-lowlevellock.c: libc-lowlevellock.c
+ $(LN) -fs $< $@
+
+clean:
+ $(RM) *.o *.os *~ core rtld-libc-lowlevellock.c