Switch to UTF-8 for INSTALL
[glibc.git] / sysdeps / pthread / Makefile
blob32cf4eb119c09676c9e6399a98994403b2dd4769
1 # sysdeps makefile fragment for all pthread-supporting configurations.
2 # Copyright (C) 2014-2023 Free Software Foundation, Inc.
3 # This file is part of the GNU C Library.
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.
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.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with the GNU C Library; if not, see
17 # <https://www.gnu.org/licenses/>.
19 ifeq ($(subdir),rt)
20 $(objpfx)tst-timer: $(librt)
21 endif
23 ifneq (,$(filter $(subdir),htl nptl))
24 headers += \
25 threads.h \
26 # headers
28 routines += \
29 pthread_atfork \
30 thrd_current \
31 thrd_equal \
32 thrd_sleep \
33 thrd_yield \
34 # routines
36 $(libpthread-routines-var) += \
37 call_once \
38 cnd_broadcast \
39 cnd_destroy \
40 cnd_init \
41 cnd_signal \
42 cnd_timedwait \
43 cnd_wait \
44 mtx_destroy \
45 mtx_init \
46 mtx_lock \
47 mtx_timedlock \
48 mtx_trylock \
49 mtx_unlock \
50 pthread_atfork_compat \
51 thrd_create \
52 thrd_detach \
53 thrd_exit \
54 thrd_join \
55 tss_create \
56 tss_delete \
57 tss_get \
58 tss_set \
59 # $(libpthread-routines-var)
61 tests += \
62 tst-abstime \
63 tst-atfork1 \
64 tst-attr1 \
65 tst-backtrace1 \
66 tst-bad-schedattr \
67 tst-barrier1 \
68 tst-barrier2 \
69 tst-barrier3 \
70 tst-barrier4 \
71 tst-basic1 \
72 tst-basic2 \
73 tst-basic3 \
74 tst-basic4 \
75 tst-basic5 \
76 tst-basic6 \
77 tst-basic7 \
78 tst-call-once \
79 tst-cancel-self \
80 tst-cancel-self-cancelstate \
81 tst-cancel-self-canceltype \
82 tst-cancel-self-testcancel \
83 tst-cancel1 \
84 tst-cancel2 \
85 tst-cancel3 \
86 tst-cancel4 \
87 tst-cancel5 \
88 tst-cancel6 \
89 tst-cancel8 \
90 tst-cancel9 \
91 tst-cancel10 \
92 tst-cancel11 \
93 tst-cancel12 \
94 tst-cancel13 \
95 tst-cancel14 \
96 tst-cancel15 \
97 tst-cancel16 \
98 tst-cancel18 \
99 tst-cancel19 \
100 tst-cancel20 \
101 tst-cancel21 \
102 tst-cancel22 \
103 tst-cancel23 \
104 tst-cancel26 \
105 tst-cancel27 \
106 tst-cancel28 \
107 tst-cancel29 \
108 tst-cancel30 \
109 tst-cleanup0 \
110 tst-cleanup1 \
111 tst-cleanup2 \
112 tst-cleanup3 \
113 tst-clock1 \
114 tst-cnd-basic \
115 tst-cnd-broadcast \
116 tst-cnd-timedwait \
117 tst-cond-except \
118 tst-cond1 \
119 tst-cond2 \
120 tst-cond3 \
121 tst-cond4 \
122 tst-cond5 \
123 tst-cond6 \
124 tst-cond7 \
125 tst-cond8 \
126 tst-cond9 \
127 tst-cond10 \
128 tst-cond11 \
129 tst-cond12 \
130 tst-cond13 \
131 tst-cond14 \
132 tst-cond15 \
133 tst-cond16 \
134 tst-cond17 \
135 tst-cond18 \
136 tst-cond19 \
137 tst-cond20 \
138 tst-cond21 \
139 tst-cond23 \
140 tst-cond24 \
141 tst-cond25 \
142 tst-cond27 \
143 tst-create-detached \
144 tst-detach1 \
145 tst-eintr2 \
146 tst-eintr3 \
147 tst-eintr4 \
148 tst-eintr5 \
149 tst-exec1 \
150 tst-exec2 \
151 tst-exec3 \
152 tst-exit1 \
153 tst-exit2 \
154 tst-exit3 \
155 tst-flock1 \
156 tst-flock2 \
157 tst-fork1 \
158 tst-fork2 \
159 tst-fork3 \
160 tst-fork4 \
161 tst-getpid3 \
162 tst-join1 \
163 tst-join2 \
164 tst-join3 \
165 tst-join4 \
166 tst-join5 \
167 tst-join6 \
168 tst-join7 \
169 tst-join8 \
170 tst-join9 \
171 tst-join10 \
172 tst-join11 \
173 tst-join12 \
174 tst-join13 \
175 tst-join14 \
176 tst-join15 \
177 tst-key1 \
178 tst-key2 \
179 tst-key3 \
180 tst-key4 \
181 tst-kill1 \
182 tst-kill2 \
183 tst-kill3 \
184 tst-kill5 \
185 tst-kill6 \
186 tst-locale1 \
187 tst-locale2 \
188 tst-memstream \
189 tst-mtx-basic \
190 tst-mtx-recursive \
191 tst-mtx-timedlock \
192 tst-mtx-trylock \
193 tst-mutex-errorcheck \
194 tst-mutex1 \
195 tst-mutex2 \
196 tst-mutex3 \
197 tst-mutex4 \
198 tst-mutex5 \
199 tst-mutex6 \
200 tst-mutex7 \
201 tst-mutex9 \
202 tst-mutex10 \
203 tst-mutex11 \
204 tst-once1 \
205 tst-once2 \
206 tst-once3 \
207 tst-once4 \
208 tst-pt-align \
209 tst-pt-align3 \
210 tst-pt-popen1 \
211 tst-pt-sysconf \
212 tst-pt-tls1 \
213 tst-pt-tls2 \
214 tst-pt-vfork1 \
215 tst-pt-vfork2 \
216 tst-pthread-exit-signal \
217 tst-pthread-mutexattr \
218 tst-pthread-raise-blocked-self \
219 tst-pthread-setuid-loop \
220 tst-pthread_cancel-exited \
221 tst-pthread_cancel-select-loop \
222 tst-pthread_kill-exited \
223 tst-pthread_kill-exiting \
224 tst-raise1 \
225 tst-robust1 \
226 tst-robust2 \
227 tst-robust3 \
228 tst-robust4 \
229 tst-robust5 \
230 tst-robust6 \
231 tst-robust7 \
232 tst-robust9 \
233 tst-robust10 \
234 tst-robust11 \
235 tst-rwlock-tryrdlock-stall \
236 tst-rwlock-trywrlock-stall \
237 tst-rwlock1 \
238 tst-rwlock4 \
239 tst-rwlock5 \
240 tst-rwlock12 \
241 tst-rwlock13 \
242 tst-rwlock14 \
243 tst-rwlock16 \
244 tst-sem1 \
245 tst-sem2 \
246 tst-sem3 \
247 tst-sem4 \
248 tst-sem5 \
249 tst-sem6 \
250 tst-sem7 \
251 tst-sem8 \
252 tst-sem9 \
253 tst-sem10 \
254 tst-sem14 \
255 tst-sem15 \
256 tst-sem16 \
257 tst-setuid3 \
258 tst-signal1 \
259 tst-signal2 \
260 tst-signal4 \
261 tst-signal5 \
262 tst-signal6 \
263 tst-signal8 \
264 tst-spin1 \
265 tst-spin2 \
266 tst-spin3 \
267 tst-spin4 \
268 tst-stack1 \
269 tst-stdio1 \
270 tst-stdio2 \
271 tst-thrd-detach \
272 tst-thrd-sleep \
273 tst-tsd1 \
274 tst-tsd2 \
275 tst-tsd5 \
276 tst-tsd6 \
277 tst-tss-basic \
278 tst-umask1 \
279 tst-unload \
280 tst-unwind-thread \
281 tst-vfork1x \
282 tst-vfork2x \
283 # tests
285 tests-time64 += \
286 tst-abstime-time64 \
287 tst-cnd-timedwait-time64 \
288 tst-cond11-time64 \
289 tst-join14-time64 \
290 tst-mtx-timedlock-time64 \
291 tst-rwlock14-time64 \
292 tst-sem5-time64 \
293 tst-thrd-sleep-time64 \
294 # tests-time64
296 static-only-routines = pthread_atfork
298 # Files which must not be linked with libpthread.
299 tests-nolibpthread += \
300 tst-unload \
301 # tests-nolibpthread
303 # GCC-4.9 compiles 'sprintf(NULL, ...)' into UD2 on x86_64 without -fno-builtin
304 CFLAGS-tst-cleanup2.c += -fno-builtin
305 CFLAGS-tst-cleanupx2.c += -fno-builtin
307 tests += \
308 tst-cancelx2 \
309 tst-cancelx3 \
310 tst-cancelx4 \
311 tst-cancelx5 \
312 tst-cancelx6 \
313 tst-cancelx8 \
314 tst-cancelx9 \
315 tst-cancelx10 \
316 tst-cancelx11 \
317 tst-cancelx12 \
318 tst-cancelx13 \
319 tst-cancelx14 \
320 tst-cancelx15 \
321 tst-cancelx16 \
322 tst-cancelx18 \
323 tst-cancelx20 \
324 tst-cancelx21 \
325 tst-cleanupx0 \
326 tst-cleanupx1 \
327 tst-cleanupx2 \
328 tst-cleanupx3 \
329 # tests
331 ifeq ($(build-shared),yes)
332 tests += \
333 tst-_res1 \
334 tst-atfork2 \
335 tst-atfork3 \
336 tst-atfork4 \
337 tst-create1 \
338 tst-fini1 \
339 tst-pt-tls4 \
340 # tests
342 tests-nolibpthread += \
343 tst-fini1 \
344 # tests-nolibpthread
345 endif
347 modules-names += \
348 tst-_res1mod1 \
349 tst-_res1mod2 \
350 tst-atfork2mod \
351 tst-atfork3mod \
352 tst-atfork4mod \
353 tst-create1mod \
354 tst-fini1mod \
355 tst-tls4moda \
356 tst-tls4modb \
357 # modules-names
359 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names)))
361 tst-atfork2mod.so-no-z-defs = yes
362 tst-atfork3mod.so-no-z-defs = yes
363 tst-atfork4mod.so-no-z-defs = yes
364 tst-create1mod.so-no-z-defs = yes
366 ifeq ($(build-shared),yes)
367 # Build all the modules even when not actually running test programs.
368 tests: $(test-modules)
369 endif
371 tests-static += \
372 tst-cancel21-static \
373 tst-locale1 \
374 tst-locale2 \
375 # tests-static
377 tests += \
378 tst-cancel21-static \
379 tst-cond11-static \
380 # tests
382 # These tests are linked with libc before libpthread
383 tests-reverse += \
384 tst-cancel5 \
385 tst-cancel23 \
386 tst-vfork1x \
387 tst-vfork2x \
388 # tests-reverse
390 ifeq ($(run-built-tests),yes)
391 ifeq ($(build-shared),yes)
392 tests-special += \
393 $(objpfx)tst-cleanup0-cmp.out \
394 # tests-special
395 endif
396 endif
398 # The sigmask macro is deprecated and triggers are compiler warning
399 # which cannot be suppressed (as of GCC 9).
400 CFLAGS-tst-cancel4.c += -Wno-error
401 CFLAGS-tst-cancel5.c += -Wno-error
402 CFLAGS-tst-cancelx4.c += -Wno-error
403 CFLAGS-tst-cancelx5.c += -Wno-error
405 # Run the cancellation and cleanup tests also for the modern, exception-based
406 # implementation. For this we have to pass the -fexceptions parameter.
407 CFLAGS-tst-cancelx2.c += -fexceptions
408 CFLAGS-tst-cancelx3.c += -fexceptions
409 CFLAGS-tst-cancelx4.c += -fexceptions
410 CFLAGS-tst-cancelx5.c += -fexceptions
411 CFLAGS-tst-cancelx6.c += -fexceptions
412 CFLAGS-tst-cancelx8.c += -fexceptions
413 CFLAGS-tst-cancelx9.c += -fexceptions
414 CFLAGS-tst-cancelx10.c += -fexceptions
415 CFLAGS-tst-cancelx11.c += -fexceptions
416 CFLAGS-tst-cancelx12.c += -fexceptions
417 CFLAGS-tst-cancelx13.c += -fexceptions
418 CFLAGS-tst-cancelx14.c += -fexceptions
419 CFLAGS-tst-cancelx15.c += -fexceptions
420 CFLAGS-tst-cancelx16.c += -fexceptions
421 CFLAGS-tst-cancelx18.c += -fexceptions
422 CFLAGS-tst-cancelx20.c += -fexceptions -fasynchronous-unwind-tables
423 CFLAGS-tst-cancelx21.c += -fexceptions -fasynchronous-unwind-tables
424 CFLAGS-tst-cleanupx0.c += -fexceptions -fasynchronous-unwind-tables
425 CFLAGS-tst-cleanupx1.c += -fexceptions -fasynchronous-unwind-tables
426 CFLAGS-tst-cleanupx2.c += -fexceptions
427 CFLAGS-tst-cleanupx3.c += -fexceptions
428 CFLAGS-tst-pt-align.c += $(stack-align-test-flags)
429 CFLAGS-tst-pt-align3.c += $(stack-align-test-flags)
431 tst-umask1-ARGS = $(objpfx)tst-umask1.temp
433 $(objpfx)tst-atfork2: $(shared-thread-library)
434 LDFLAGS-tst-atfork2 = -rdynamic
435 tst-atfork2-ENV = MALLOC_TRACE=$(objpfx)tst-atfork2.mtrace \
436 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
437 $(objpfx)tst-atfork2mod.so: $(shared-thread-library)
439 $(objpfx)tst-atfork3: $(shared-thread-library)
440 LDFLAGS-tst-atfork3 = -rdynamic
441 $(objpfx)tst-atfork3mod.so: $(shared-thread-library)
443 $(objpfx)tst-atfork4: $(shared-thread-library)
444 LDFLAGS-tst-atfork4 = -rdynamic
445 $(objpfx)tst-atfork4mod.so: $(shared-thread-library)
447 ifeq ($(build-shared),yes)
448 $(objpfx)tst-atfork2.out: $(objpfx)tst-atfork2mod.so
449 $(objpfx)tst-atfork3.out: $(objpfx)tst-atfork3mod.so
450 $(objpfx)tst-atfork4.out: $(objpfx)tst-atfork4mod.so
451 endif
453 ifeq ($(build-shared),yes)
454 $(objpfx)tst-cleanup0.out: /dev/null $(objpfx)tst-cleanup0
455 $(make-test-out) > $@ 2>&1; \
456 $(evaluate-test)
458 $(objpfx)tst-cleanup0-cmp.out: $(..)sysdeps/pthread/tst-cleanup0.expect $(objpfx)tst-cleanup0.out
459 cmp $^ > $@; \
460 $(evaluate-test)
461 endif
463 $(objpfx)tst-cancel28: $(librt)
465 $(objpfx)tst-fini1: $(shared-thread-library) $(objpfx)tst-fini1mod.so
467 $(objpfx)tst-fini1mod.so: $(libsupport) $(shared-thread-library)
469 $(objpfx)tst-_res1mod2.so: $(objpfx)tst-_res1mod1.so
470 LDFLAGS-tst-_res1mod1.so = -Wl,-soname,tst-_res1mod1.so
471 LDFLAGS-tst-_res1mod2.so = -Wl,-soname,tst-_res1mod2.so
472 $(objpfx)tst-_res1: $(objpfx)tst-_res1mod1.so $(objpfx)tst-_res1mod2.so \
473 $(shared-thread-library)
475 $(objpfx)tst-pt-tls4: $(shared-thread-library)
476 $(objpfx)tst-pt-tls4.out: $(objpfx)tst-tls4moda.so $(objpfx)tst-tls4modb.so
478 generated += \
479 tst-atfork2.mtrace \
480 # generated
482 generated += \
483 $(addsuffix .so,$(strip $(modules-names))) \
484 $(objpfx)tst-atfork2.mtrace \
485 # generated
487 tests-internal += \
488 tst-cancel25 \
489 tst-robust8 \
490 # tests-internal
492 tests += \
493 tst-oncex3 \
494 tst-oncex4 \
495 tst-oncey3 \
496 tst-oncey4 \
497 # tests
499 modules-names += \
500 tst-join7mod \
501 # modules-names
503 ifeq ($(build-shared),yes)
504 tests-static += \
505 tst-cond8-static \
506 # tests-static
507 tests += \
508 tst-cond8-static \
509 # tests
510 endif
512 CFLAGS-tst-oncex3.c += -fexceptions
513 CFLAGS-tst-oncex4.c += -fexceptions
514 CFLAGS-tst-oncey3.c += -fno-exceptions -fno-asynchronous-unwind-tables
515 CFLAGS-tst-oncey4.c += -fno-exceptions -fno-asynchronous-unwind-tables
517 $(objpfx)tst-join7: $(shared-thread-library)
518 $(objpfx)tst-join7.out: $(objpfx)tst-join7mod.so
519 $(objpfx)tst-join7mod.so: $(shared-thread-library)
520 LDFLAGS-tst-join7mod.so = -Wl,-soname,tst-join7mod.so
522 CFLAGS-tst-unwind-thread.c += -funwind-tables
524 LDFLAGS-tst-create1 = -Wl,-export-dynamic
525 $(objpfx)tst-create1: $(shared-thread-library)
526 $(objpfx)tst-create1.out: $(objpfx)tst-create1mod.so
528 endif