]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/pthread/Makefile
Add pthread-in-libc, libpthread-routines-var, librt-routines-var
[thirdparty/glibc.git] / sysdeps / pthread / Makefile
CommitLineData
463dc947 1# sysdeps makefile fragment for all pthread-supporting configurations.
2b778ceb 2# Copyright (C) 2014-2021 Free Software Foundation, Inc.
76a50749 3# This file is part of the GNU C Library.
76a50749
UD
4
5# The GNU C Library is free software; you can redistribute it and/or
6# modify it under the terms of the GNU Lesser General Public
7# License as published by the Free Software Foundation; either
8# version 2.1 of the License, or (at your option) any later version.
9
10# The GNU C Library is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# Lesser General Public License for more details.
14
15# You should have received a copy of the GNU Lesser General Public
59ba27a6 16# License along with the GNU C Library; if not, see
5a82c748 17# <https://www.gnu.org/licenses/>.
76a50749 18
38851324
SP
19ifeq ($(subdir),rt)
20
76a50749
UD
21ifeq (yes,$(build-shared))
22$(objpfx)tst-timer: $(objpfx)librt.so $(shared-thread-library)
23else
24$(objpfx)tst-timer: $(objpfx)librt.a $(static-thread-library)
25endif
38851324
SP
26
27endif
b05de104
ST
28
29ifneq (,$(filter $(subdir),htl nptl))
30headers += threads.h
31
32routines += thrd_current thrd_equal thrd_sleep thrd_yield
33
34libpthread-routines += thrd_create thrd_detach thrd_exit thrd_join \
35 call_once \
36 mtx_destroy mtx_init mtx_lock mtx_timedlock \
37 mtx_trylock mtx_unlock \
38 cnd_broadcast \
39 cnd_destroy cnd_init cnd_signal cnd_timedwait cnd_wait \
40 tss_create tss_delete tss_get tss_set
41
ad201afe
FW
42$(libpthread-routines-var) += \
43
44
b05de104
ST
45tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
46 tst-cnd-timedwait tst-thrd-detach tst-mtx-basic tst-thrd-sleep \
cca76b6d 47 tst-mtx-recursive tst-tss-basic tst-call-once tst-mtx-timedlock \
d6d74ec1
ST
48 \
49 tst-abstime \
50 tst-pt-align tst-pt-align3 \
44a41fc2 51 tst-attr1 \
d6d74ec1
ST
52 tst-backtrace1 \
53 tst-bad-schedattr \
6acd7722 54 tst-barrier1 tst-barrier2 tst-barrier3 tst-barrier4 \
cca76b6d
ST
55 tst-basic1 tst-basic2 tst-basic3 tst-basic4 tst-basic5 tst-basic6 \
56 tst-basic7 \
45fce058 57 tst-cancel-self tst-cancel-self-cancelstate \
d6d74ec1 58 tst-cancel-self-canceltype tst-cancel-self-testcancel \
62d97c34 59 tst-cancel1 tst-cancel2 tst-cancel3 \
ac54c335 60 tst-cancel4 tst-cancel5 \
45fce058 61 tst-cancel6 tst-cancel8 tst-cancel9 tst-cancel10 tst-cancel11 \
269e4c17
ST
62 tst-cancel12 tst-cancel13 tst-cancel14 tst-cancel15 tst-cancel16 \
63 tst-cancel18 tst-cancel19 tst-cancel20 tst-cancel21 \
d6d74ec1
ST
64 tst-cancel22 tst-cancel23 tst-cancel26 tst-cancel27 tst-cancel28 \
65 tst-cleanup0 tst-cleanup1 tst-cleanup2 tst-cleanup3 \
66 tst-clock1 \
67 tst-cond-except \
d8f1f2d9 68 tst-cond1 tst-cond2 tst-cond3 tst-cond4 tst-cond5 tst-cond6 tst-cond7 \
a3e589d1 69 tst-cond8 tst-cond9 tst-cond10 tst-cond11 tst-cond12 tst-cond13 \
d8f1f2d9 70 tst-cond14 tst-cond15 tst-cond16 tst-cond17 tst-cond18 tst-cond19 \
80817024 71 tst-cond20 tst-cond21 tst-cond23 tst-cond24 tst-cond25 tst-cond27 \
d6d74ec1
ST
72 tst-create-detached \
73 tst-detach1 \
74 tst-eintr2 tst-eintr3 tst-eintr4 tst-eintr5 \
75 tst-exec1 tst-exec2 tst-exec3 \
76 tst-exit1 tst-exit2 tst-exit3 \
4bab9ad8 77 tst-flock1 tst-flock2 \
d6d74ec1
ST
78 tst-fork1 tst-fork2 tst-fork3 tst-fork4 \
79 tst-atfork1 \
80 tst-getpid3 \
28cada04
ST
81 tst-join1 tst-join2 tst-join3 tst-join4 tst-join5 tst-join6 tst-join7 \
82 tst-join8 tst-join9 tst-join10 tst-join11 tst-join12 tst-join13 \
b4c34468 83 tst-join14 tst-join15 \
819bb5e6 84 tst-key1 tst-key2 tst-key3 tst-key4 \
d6d74ec1
ST
85 tst-kill1 tst-kill2 tst-kill3 tst-kill4 tst-kill5 tst-kill6 \
86 tst-locale1 tst-locale2 \
87 tst-memstream \
28cada04
ST
88 tst-mutex-errorcheck tst-mutex1 tst-mutex2 tst-mutex3 tst-mutex4 \
89 tst-mutex5 tst-mutex6 tst-mutex7 tst-mutex7robust tst-mutex9 \
90 tst-mutex10 tst-mutex11 tst-pthread-mutexattr \
28c30a62 91 tst-once1 tst-once2 tst-once3 tst-once4 \
d6d74ec1
ST
92 tst-pt-popen1 \
93 tst-raise1 \
a25077a4 94 tst-robust1 tst-robust2 tst-robust3 tst-robust4 tst-robust5 \
0cbc855a 95 tst-robust6 tst-robust7 tst-robust9 tst-robust10 \
28cada04
ST
96 tst-rwlock1 tst-rwlock4 tst-rwlock5 tst-rwlock12 \
97 tst-rwlock13 tst-rwlock14 tst-rwlock16 \
d5ec049d 98 tst-rwlock-tryrdlock-stall tst-rwlock-trywrlock-stall \
be22a151 99 tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 tst-sem7 \
8a195ec8 100 tst-sem8 tst-sem9 tst-sem10 tst-sem14 tst-sem15 tst-sem16 \
d6d74ec1 101 tst-setuid3 \
4bab9ad8 102 tst-signal1 tst-signal2 \
d6d74ec1 103 tst-signal4 tst-signal5 tst-signal6 tst-signal8 \
28cada04 104 tst-spin1 tst-spin2 tst-spin3 tst-spin4 \
d6d74ec1
ST
105 tst-stack1 \
106 tst-stdio1 tst-stdio2 \
107 tst-pt-sysconf \
108 tst-pt-tls1 tst-pt-tls2 \
109 tst-tsd1 tst-tsd2 tst-tsd5 tst-tsd6 \
110 tst-umask1 \
111 tst-unload \
112 tst-unwind-thread \
113 tst-pt-vfork1 tst-pt-vfork2 tst-vfork1x tst-vfork2x \
114
115
116# Files which must not be linked with libpthread.
c62cef02 117tests-nolibpthread += tst-unload
d6d74ec1
ST
118
119# GCC-4.9 compiles 'sprintf(NULL, ...)' into UD2 on x86_64 without -fno-builtin
120CFLAGS-tst-cleanup2.c += -fno-builtin
121CFLAGS-tst-cleanupx2.c += -fno-builtin
122
45fce058 123tests += tst-cancelx2 tst-cancelx3 tst-cancelx6 tst-cancelx8 tst-cancelx9 \
ac54c335 124 tst-cancelx4 tst-cancelx5 \
eca16db0 125 tst-cancelx10 tst-cancelx11 tst-cancelx12 tst-cancelx13 tst-cancelx14 \
269e4c17 126 tst-cancelx15 tst-cancelx16 tst-cancelx18 tst-cancelx20 tst-cancelx21 \
d6d74ec1
ST
127 tst-cleanupx0 tst-cleanupx1 tst-cleanupx2 tst-cleanupx3
128
314a431d
ST
129ifeq ($(build-shared),yes)
130tests += tst-atfork2 tst-pt-tls4 tst-_res1 tst-fini1
131tests-nolibpthread += tst-fini1
132endif
133
134modules-names += tst-atfork2mod tst-tls4moda tst-tls4modb \
135 tst-_res1mod1 tst-_res1mod2 tst-fini1mod
136test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names)))
137
138tst-atfork2mod.so-no-z-defs = yes
139
140ifeq ($(build-shared),yes)
141# Build all the modules even when not actually running test programs.
142tests: $(test-modules)
143endif
144
269e4c17
ST
145
146tests-static += tst-locale1 tst-locale2 tst-cancel21-static
d6d74ec1 147
62d97c34 148tests += tst-cancel21-static tst-cond11-static
d6d74ec1
ST
149
150# These tests are linked with libc before libpthread
ac54c335 151tests-reverse += tst-cancel5 tst-cancel23 tst-vfork1x tst-vfork2x
d6d74ec1
ST
152
153ifeq ($(run-built-tests),yes)
154ifeq ($(build-shared),yes)
155tests-special += $(objpfx)tst-cleanup0-cmp.out
156endif
157endif
158
ac54c335
ST
159# The sigmask macro is deprecated and triggers are compiler warning
160# which cannot be suppressed (as of GCC 9).
161CFLAGS-tst-cancel4.c += -Wno-error
162CFLAGS-tst-cancel5.c += -Wno-error
163CFLAGS-tst-cancelx4.c += -Wno-error
164CFLAGS-tst-cancelx5.c += -Wno-error
165
d6d74ec1
ST
166# Run the cancellation and cleanup tests also for the modern, exception-based
167# implementation. For this we have to pass the -fexceptions parameter.
168CFLAGS-tst-cancelx2.c += -fexceptions
169CFLAGS-tst-cancelx3.c += -fexceptions
ac54c335
ST
170CFLAGS-tst-cancelx4.c += -fexceptions
171CFLAGS-tst-cancelx5.c += -fexceptions
62d97c34 172CFLAGS-tst-cancelx6.c += -fexceptions
d6d74ec1 173CFLAGS-tst-cancelx8.c += -fexceptions
45fce058 174CFLAGS-tst-cancelx9.c += -fexceptions
d6d74ec1 175CFLAGS-tst-cancelx10.c += -fexceptions
62d97c34 176CFLAGS-tst-cancelx11.c += -fexceptions
d6d74ec1 177CFLAGS-tst-cancelx12.c += -fexceptions
eca16db0 178CFLAGS-tst-cancelx13.c += -fexceptions
d6d74ec1
ST
179CFLAGS-tst-cancelx14.c += -fexceptions
180CFLAGS-tst-cancelx15.c += -fexceptions
269e4c17 181CFLAGS-tst-cancelx16.c += -fexceptions
d6d74ec1 182CFLAGS-tst-cancelx18.c += -fexceptions
269e4c17 183CFLAGS-tst-cancelx20.c += -fexceptions -fasynchronous-unwind-tables
62d97c34 184CFLAGS-tst-cancelx21.c += -fexceptions -fasynchronous-unwind-tables
d6d74ec1
ST
185CFLAGS-tst-cleanupx0.c += -fexceptions -fasynchronous-unwind-tables
186CFLAGS-tst-cleanupx1.c += -fexceptions -fasynchronous-unwind-tables
187CFLAGS-tst-cleanupx2.c += -fexceptions
188CFLAGS-tst-cleanupx3.c += -fexceptions
189CFLAGS-tst-pt-align.c += $(stack-align-test-flags)
190CFLAGS-tst-pt-align3.c += $(stack-align-test-flags)
191
192tst-umask1-ARGS = $(objpfx)tst-umask1.temp
193
314a431d
ST
194$(objpfx)tst-atfork2: $(libdl) $(shared-thread-library)
195LDFLAGS-tst-atfork2 = -rdynamic
196tst-atfork2-ENV = MALLOC_TRACE=$(objpfx)tst-atfork2.mtrace
197$(objpfx)tst-atfork2mod.so: $(shared-thread-library)
198
199ifeq ($(build-shared),yes)
200$(objpfx)tst-atfork2.out: $(objpfx)tst-atfork2mod.so
201endif
202
d6d74ec1
ST
203ifeq ($(build-shared),yes)
204$(objpfx)tst-cleanup0.out: /dev/null $(objpfx)tst-cleanup0
205 $(make-test-out) > $@ 2>&1; \
206 $(evaluate-test)
207
208$(objpfx)tst-cleanup0-cmp.out: $(..)sysdeps/pthread/tst-cleanup0.expect $(objpfx)tst-cleanup0.out
209 cmp $^ > $@; \
210 $(evaluate-test)
211
212$(objpfx)tst-cancel28: $(common-objpfx)rt/librt.so
213else
214$(objpfx)tst-cancel28: $(common-objpfx)rt/librt.a
215endif
216
314a431d
ST
217$(objpfx)tst-fini1: $(shared-thread-library) $(objpfx)tst-fini1mod.so
218
219$(objpfx)tst-fini1mod.so: $(shared-thread-library)
220
221$(objpfx)tst-_res1mod2.so: $(objpfx)tst-_res1mod1.so
222LDFLAGS-tst-_res1mod1.so = -Wl,-soname,tst-_res1mod1.so
223LDFLAGS-tst-_res1mod2.so = -Wl,-soname,tst-_res1mod2.so
224$(objpfx)tst-_res1: $(objpfx)tst-_res1mod1.so $(objpfx)tst-_res1mod2.so \
225 $(shared-thread-library)
226
227$(objpfx)tst-pt-tls4: $(libdl) $(shared-thread-library)
228$(objpfx)tst-pt-tls4.out: $(objpfx)tst-tls4moda.so $(objpfx)tst-tls4modb.so
229
230generated += tst-atfork2.mtrace
d6d74ec1 231
314a431d
ST
232generated += $(objpfx)tst-atfork2.mtrace \
233 $(addsuffix .so,$(strip $(modules-names)))
cca76b6d 234
9f6e508b 235tests-internal += tst-cancel25 tst-robust8
0cbc855a 236
f0419e6a 237tests += tst-oncex3 tst-oncex4 tst-oncey3 tst-oncey4
28c30a62 238
c0463e8b
ST
239modules-names += tst-join7mod
240
d8f1f2d9
ST
241ifeq ($(build-shared),yes)
242tests-static += tst-cond8-static
243tests += tst-cond8-static
244endif
245
28c30a62
ST
246CFLAGS-tst-oncex3.c += -fexceptions
247CFLAGS-tst-oncex4.c += -fexceptions
f0419e6a
JJ
248CFLAGS-tst-oncey3.c += -fno-exceptions -fno-asynchronous-unwind-tables
249CFLAGS-tst-oncey4.c += -fno-exceptions -fno-asynchronous-unwind-tables
28c30a62 250
c0463e8b
ST
251$(objpfx)tst-join7: $(libdl) $(shared-thread-library)
252$(objpfx)tst-join7.out: $(objpfx)tst-join7mod.so
253$(objpfx)tst-join7mod.so: $(shared-thread-library)
254LDFLAGS-tst-join7mod.so = -Wl,-soname,tst-join7mod.so
255
d6d74ec1
ST
256CFLAGS-tst-unwind-thread.c += -funwind-tables
257
b05de104 258endif