Debian Codegraph @

sysdeps/pthread/Makefile

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