Add tst-cancel21-static.c
[platform/upstream/glibc.git] / nptl / Makefile
index d0f8286..ad7ac05 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2002,2003,2004,2005,2006 Free Software Foundation, Inc.
+# Copyright (C) 2002-2008,2009,2010,2012 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -12,9 +12,8 @@
 # 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.
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
 
 #
 #      Sub-makefile for NPTL portion of the library.
@@ -27,10 +26,11 @@ extra-libs := libpthread
 extra-libs-others := $(extra-libs)
 install-lib-ldscripts := libpthread.so
 
-routines = alloca_cutoff forward libc-lowlevellock libc-cancellation
+routines = alloca_cutoff forward libc-lowlevellock libc-cancellation \
+          libc-cleanup
 shared-only-routines = forward
 
-libpthread-routines = init vars events version \
+libpthread-routines = nptl-init vars events version \
                      pthread_create pthread_exit pthread_detach \
                      pthread_join pthread_tryjoin pthread_timedjoin \
                      pthread_self pthread_equal pthread_yield \
@@ -85,7 +85,7 @@ libpthread-routines = init vars events version \
                      pthread_barrierattr_setpshared \
                      pthread_key_create pthread_key_delete \
                      pthread_getspecific pthread_setspecific \
-                     pthread_sigmask pthread_kill \
+                     pthread_sigmask pthread_kill pthread_sigqueue \
                      pthread_cancel pthread_testcancel \
                      pthread_setcancelstate pthread_setcanceltype \
                      pthread_once \
@@ -122,8 +122,10 @@ libpthread-routines = init vars events version \
                      pthread_mutexattr_getprotocol \
                      pthread_mutexattr_setprotocol \
                      pthread_mutexattr_getprioceiling \
-                     pthread_mutexattr_setprioceiling \
-                     pthread_mutex_getprioceiling pthread_mutex_setprioceiling
+                     pthread_mutexattr_setprioceiling tpp \
+                     pthread_mutex_getprioceiling \
+                     pthread_mutex_setprioceiling \
+                     pthread_setname pthread_getname
 #                    pthread_setuid pthread_seteuid pthread_setreuid \
 #                    pthread_setresuid \
 #                    pthread_setgid pthread_setegid pthread_setregid \
@@ -138,8 +140,8 @@ CFLAGS-pthread_atfork.c = -DNOT_IN_libc
 # 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
+# nptl-init.c contains sigcancel_handler().
+CFLAGS-nptl-init.c = -fexceptions -fasynchronous-unwind-tables
 # The unwind code itself,
 CFLAGS-unwind.c = -fexceptions
 CFLAGS-unwind-forcedunwind.c = -fexceptions -fasynchronous-unwind-tables
@@ -192,9 +194,6 @@ CFLAGS-tcdrain.c = -fexceptions -fasynchronous-unwind-tables
 
 CFLAGS-pt-system.c = -fexceptions
 
-# Don't generate deps for calls with no sources.  See sysdeps/unix/Makefile.
-omit-deps = $(unix-syscalls:%=ptw-%)
-
 
 tests = tst-typesizes \
        tst-attr1 tst-attr2 tst-attr3 \
@@ -207,27 +206,28 @@ tests = tst-typesizes \
        tst-cond1 tst-cond2 tst-cond3 tst-cond4 tst-cond5 tst-cond6 tst-cond7 \
        tst-cond8 tst-cond9 tst-cond10 tst-cond11 tst-cond12 tst-cond13 \
        tst-cond14 tst-cond15 tst-cond16 tst-cond17 tst-cond18 tst-cond19 \
-       tst-cond20 tst-cond21 \
+       tst-cond20 tst-cond21 tst-cond22 tst-cond23 \
        tst-robust1 tst-robust2 tst-robust3 tst-robust4 tst-robust5 \
-       tst-robust6 tst-robust7 tst-robust8 \
-       tst-robustpi1 tst-robustpi2 tst-robustpi3 tst-robustpi4 \
-       tst-robustpi5 tst-robustpi6 tst-robustpi7 tst-robustpi8 \
-       tst-rwlock1 tst-rwlock2 tst-rwlock3 tst-rwlock4 tst-rwlock5 \
-       tst-rwlock6 tst-rwlock7 tst-rwlock8 tst-rwlock9 tst-rwlock10 \
-       tst-rwlock11 tst-rwlock12 tst-rwlock13 tst-rwlock14 \
+       tst-robust6 tst-robust7 tst-robust8 tst-robust9 \
+       tst-robustpi1 tst-robustpi2 tst-robustpi3 tst-robustpi4 tst-robustpi5 \
+       tst-robustpi6 tst-robustpi7 tst-robustpi8 tst-robustpi9 \
+       tst-rwlock1 tst-rwlock2 tst-rwlock2a tst-rwlock3 tst-rwlock4 \
+       tst-rwlock5 tst-rwlock6 tst-rwlock7 tst-rwlock8 tst-rwlock9 \
+       tst-rwlock10 tst-rwlock11 tst-rwlock12 tst-rwlock13 tst-rwlock14 \
        tst-once1 tst-once2 tst-once3 tst-once4 \
        tst-key1 tst-key2 tst-key3 tst-key4 \
        tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 tst-sem7 \
-       tst-sem8 tst-sem9 \
+       tst-sem8 tst-sem9 tst-sem10 tst-sem11 tst-sem12 tst-sem13 tst-sem14 \
        tst-barrier1 tst-barrier2 tst-barrier3 tst-barrier4 \
        tst-align tst-align2 tst-align3 \
        tst-basic1 tst-basic2 tst-basic3 tst-basic4 tst-basic5 tst-basic6 \
+       tst-basic7 \
        tst-kill1 tst-kill2 tst-kill3 tst-kill4 tst-kill5 tst-kill6 \
        tst-raise1 \
-       tst-join1 tst-join2 tst-join3 tst-join4 tst-join5 \
+       tst-join1 tst-join2 tst-join3 tst-join4 tst-join5 tst-join6 \
        tst-detach1 \
        tst-eintr1 tst-eintr2 tst-eintr3 tst-eintr4 tst-eintr5 \
-       tst-tsd1 tst-tsd2 tst-tsd3 tst-tsd4 tst-tsd5 \
+       tst-tsd1 tst-tsd2 tst-tsd3 tst-tsd4 tst-tsd5 tst-tsd6 \
        tst-tls1 tst-tls2 \
        tst-fork1 tst-fork2 tst-fork3 tst-fork4 \
        tst-atfork1 \
@@ -235,7 +235,9 @@ tests = tst-typesizes \
        tst-cancel6 tst-cancel7 tst-cancel8 tst-cancel9 tst-cancel10 \
        tst-cancel11 tst-cancel12 tst-cancel13 tst-cancel14 tst-cancel15 \
        tst-cancel16 tst-cancel17 tst-cancel18 tst-cancel19 tst-cancel20 \
-       tst-cancel21 tst-cancel22 tst-cancel23 tst-cancel24 \
+       tst-cancel21 tst-cancel22 tst-cancel23 tst-cancel24 tst-cancel25 \
+       tst-cancel-self tst-cancel-self-cancelstate \
+       tst-cancel-self-canceltype tst-cancel-self-testcancel \
        tst-cleanup0 tst-cleanup1 tst-cleanup2 tst-cleanup3 tst-cleanup4 \
        tst-flock1 tst-flock2 \
        tst-signal1 tst-signal2 tst-signal3 tst-signal4 tst-signal5 \
@@ -243,7 +245,7 @@ tests = tst-typesizes \
        tst-exec1 tst-exec2 tst-exec3 tst-exec4 \
        tst-exit1 tst-exit2 tst-exit3 \
        tst-stdio1 tst-stdio2 \
-       tst-stack1 tst-stack2 tst-stack3 \
+       tst-stack1 tst-stack2 tst-stack3 tst-pthread-getattr \
        tst-unload \
        tst-dlsym1 \
        tst-sysconf \
@@ -255,10 +257,11 @@ tests = tst-typesizes \
        tst-sched1 \
        tst-backtrace1 \
        tst-oddstacklimit \
+       tst-abstime \
        tst-vfork1 tst-vfork2 tst-vfork1x tst-vfork2x \
        tst-getpid1 tst-getpid2 tst-getpid3 \
        tst-initializers1 $(patsubst %,tst-initializers1-%,c89 gnu89 c99 gnu99)
-xtests = tst-setuid1 tst-setuid1-static
+xtests = tst-setuid1 tst-setuid1-static tst-mutexpp1 tst-mutexpp6 tst-mutexpp10
 
 # Files which must not be linked with libpthread.
 tests-nolibpthread = tst-unload
@@ -267,8 +270,6 @@ tests-nolibpthread = tst-unload
 # of the page size since every architecture's page size is > 1k.
 tst-oddstacklimit-ENV = ; ulimit -s 1023;
 
-distribute = eintr.c tst-cleanup4aux.c
-
 gen-as-const-headers = pthread-errnos.sym
 
 LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
@@ -297,8 +298,8 @@ modules-names = tst-atfork2mod tst-tls3mod tst-tls4moda tst-tls4modb \
                tst-tls5mod tst-tls5moda tst-tls5modb tst-tls5modc \
                tst-tls5modd tst-tls5mode tst-tls5modf \
                tst-_res1mod1 tst-_res1mod2 tst-execstack-mod tst-fini1mod
-extra-objs += $(addsuffix .os,$(strip $(modules-names))) tst-cleanup4aux.o
-test-extras += $(modules-names)
+extra-test-objs += $(addsuffix .os,$(strip $(modules-names))) tst-cleanup4aux.o
+test-extras += $(modules-names) tst-cleanup4aux
 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names)))
 
 tst-atfork2mod.so-no-z-defs = yes
@@ -333,28 +334,25 @@ ifneq (,$(patsubst .,,$(multidir)))
 generated-dirs := $(firstword $(subst /, , $(multidir)))
 crti-objs += $(multidir)/crti.o
 crtn-objs += $(multidir)/crtn.o
-omit-deps += $(multidir)/crti $(multidir)/crtn
 $(objpfx)$(multidir):
        mkdir -p $@
 endif
 extra-objs += $(crti-objs) $(crtn-objs)
-omit-deps += crti crtn
-
-CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions $(fno-unit-at-a-time)
+extra-objs += pt-crti.o
 endif
 
-CFLAGS-flockfile.c = -D_IO_MTSAFE_IO
-CFLAGS-ftrylockfile.c = -D_IO_MTSAFE_IO
-CFLAGS-funlockfile.c = -D_IO_MTSAFE_IO
+CFLAGS-flockfile.c = $(libio-mtsafe)
+CFLAGS-ftrylockfile.c = $(libio-mtsafe)
+CFLAGS-funlockfile.c = $(libio-mtsafe)
 
 link-libc-static := $(common-objpfx)libc.a $(static-gnulib) \
                    $(common-objpfx)libc.a
 
-ifeq ($(build-static),yes)
-tests-static += tst-locale1 tst-locale2 tst-stackguard1-static
-tests += tst-stackguard1-static
+tests-static += tst-locale1 tst-locale2 tst-stackguard1-static \
+               tst-cancel21-static
+tests += tst-stackguard1-static tst-cancel21-static
 xtests-static += tst-setuid1-static
-endif
+
 # These tests are linked with libc before libpthread
 tests-reverse += tst-cancel5 tst-cancel23 tst-vfork1x tst-vfork2x
 
@@ -443,7 +441,9 @@ LDFLAGS-tst-atfork2 = -rdynamic
 tst-atfork2-ENV = MALLOC_TRACE=$(objpfx)tst-atfork2.mtrace
 $(objpfx)tst-atfork2mod.so: $(shared-thread-library)
 
+ifeq ($(cross-compiling),no)
 tests: $(objpfx)tst-stack3-mem
+endif
 tst-stack3-ENV = MALLOC_TRACE=$(objpfx)tst-stack3.mtrace
 $(objpfx)tst-stack3-mem: $(objpfx)tst-stack3.out
        $(common-objpfx)malloc/mtrace $(objpfx)tst-stack3.mtrace > $@
@@ -461,10 +461,13 @@ $(objpfx)tst-tls4: $(libdl) $(shared-thread-library)
 $(objpfx)tst-tls4.out: $(objpfx)tst-tls4moda.so $(objpfx)tst-tls4modb.so
 
 $(objpfx)tst-tls5: $(objpfx)tst-tls5mod.so $(shared-thread-library)
+LDFLAGS-tst-tls5 = $(no-as-needed)
 LDFLAGS-tst-tls5mod.so = -Wl,-soname,tst-tls5mod.so
 
 ifeq ($(build-shared),yes)
+ifeq ($(cross-compiling),no)
 tests: $(objpfx)tst-tls6.out
+endif
 $(objpfx)tst-tls6.out: tst-tls6.sh $(objpfx)tst-tls5 \
                       $(objpfx)tst-tls5moda.so $(objpfx)tst-tls5modb.so \
                       $(objpfx)tst-tls5modc.so $(objpfx)tst-tls5modd.so \
@@ -480,6 +483,7 @@ $(objpfx)tst-fini1: $(shared-thread-library) $(objpfx)tst-fini1mod.so
 ifeq (yes,$(build-shared))
 $(objpfx)tst-cond11: $(common-objpfx)rt/librt.so
 $(objpfx)tst-cond19: $(common-objpfx)rt/librt.so
+$(objpfx)tst-sem5: $(common-objpfx)rt/librt.so
 $(objpfx)tst-cancel17: $(common-objpfx)rt/librt.so
 $(objpfx)tst-cancelx17: $(common-objpfx)rt/librt.so
 $(objpfx)tst-cancel18: $(common-objpfx)rt/librt.so
@@ -489,10 +493,12 @@ $(objpfx)tst-rwlock14: $(common-objpfx)rt/librt.so
 $(objpfx)tst-_res1mod2.so: $(objpfx)tst-_res1mod1.so
 LDFLAGS-tst-_res1mod1.so = -Wl,-soname,tst-_res1mod1.so
 LDFLAGS-tst-_res1mod2.so = -Wl,-soname,tst-_res1mod2.so
-$(objpfx)tst-_res1: $(objpfx)tst-_res1mod2.so $(shared-thread-library)
+$(objpfx)tst-_res1: $(objpfx)tst-_res1mod1.so $(objpfx)tst-_res1mod2.so \
+                   $(shared-thread-library)
 else
 $(objpfx)tst-cond11: $(common-objpfx)rt/librt.a
 $(objpfx)tst-cond19: $(common-objpfx)rt/librt.a
+$(objpfx)tst-sem5: $(common-objpfx)rt/librt.a
 $(objpfx)tst-cancel17: $(common-objpfx)rt/librt.a
 $(objpfx)tst-cancelx17: $(common-objpfx)rt/librt.a
 $(objpfx)tst-cancel18: $(common-objpfx)rt/librt.a
@@ -501,7 +507,7 @@ $(objpfx)tst-clock2: $(common-objpfx)rt/librt.a
 $(objpfx)tst-rwlock14: $(common-objpfx)rt/librt.a
 endif
 
-LDFLAGS-tst-cancel24 = -lstdc++
+LDFLAGS-tst-cancel24 = $(no-as-needed) -lstdc++
 
 extra-B-pthread.so = -B$(common-objpfx)nptl/
 $(objpfx)libpthread.so: $(addprefix $(objpfx),$(crti-objs) $(crtn-objs))
@@ -514,7 +520,7 @@ $(objpfx)libpthread.so: +postinit += $(addprefix $(objpfx),$(crtn-objs))
 # Depend on ld.so too to get proper versions of ld.so symbols.
 $(objpfx)libpthread.so: $(common-objpfx)libc.so \
                        $(common-objpfx)libc_nonshared.a \
-                       $(if $(filter yes,$(elf)), $(elfobjdir)/ld.so)
+                       $(elfobjdir)/ld.so
 
 # Make sure we link with the thread library.
 ifeq ($(build-shared),yes)
@@ -538,35 +544,12 @@ $(addprefix $(objpfx),$(tests) $(test-srcs)): $(objpfx)libpthread.a
 endif
 
 ifeq ($(build-shared),yes)
-vpath pt-initfini.c $(sysdirs)
-
-$(objpfx)pt-initfini.s: pt-initfini.c
-       $(compile.c) -S $(CFLAGS-pt-initfini.s) -finhibit-size-directive \
-               $(patsubst -f%,-fno-%,$(exceptions)) -o $@
 
 $(objpfx)tst-cleanup0.out: /dev/null $(objpfx)tst-cleanup0
-       $(make-test-out) 2>&1 | cmp - tst-cleanup0.expect >& $@
-
-# We only have one kind of startup code files.  Static binaries and
-# shared libraries are build using the PIC version.
-$(objpfx)crti.S: $(objpfx)pt-initfini.s
-       sed -n -e '1,/@HEADER_ENDS/p' \
-              -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
-              -e '/@TRAILER_BEGINS/,$$p' $< > $@
-$(objpfx)crtn.S: $(objpfx)pt-initfini.s
-       sed -n -e '1,/@HEADER_ENDS/p' \
-              -e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \
-              -e '/@TRAILER_BEGINS/,$$p' $< > $@
+       $(make-test-out) 2>&1 | cmp - tst-cleanup0.expect > $@
 
-$(objpfx)defs.h: $(objpfx)pt-initfini.s
-       sed -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
-               $(AWK) -f ../csu/defs.awk > $@
-
-$(objpfx)crti.o: $(objpfx)crti.S $(objpfx)defs.h
-       $(compile.S) -g0 $(ASFLAGS-.os) -o $@
-
-$(objpfx)crtn.o: $(objpfx)crtn.S $(objpfx)defs.h
-       $(compile.S) -g0 $(ASFLAGS-.os) -o $@
+$(objpfx)crti.o: $(objpfx)pt-crti.o
+       ln -f $< $@
 
 ifneq ($(multidir),.)
 $(objpfx)$(multidir)/crti.o: $(objpfx)crti.o $(objpfx)$(multidir)/
@@ -576,7 +559,7 @@ $(objpfx)$(multidir)/crtn.o: $(objpfx)crtn.o $(objpfx)$(multidir)/
        ln -f $< $@
 endif
 
-generated += crti.S crtn.S defs.h pt-initfini.s  libpthread_nonshared.a \
+generated += libpthread_nonshared.a \
             multidir.mk tst-atfork2.mtrace tst-cancel-wrappers.out \
             tst-tls6.out