]>
Commit | Line | Data |
---|---|---|
1 | # Copyright (C) 2002-2025 Free Software Foundation, Inc. | |
2 | # This file is part of the GNU C Library. | |
3 | ||
4 | # The GNU C Library is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU Lesser General Public | |
6 | # License as published by the Free Software Foundation; either | |
7 | # version 2.1 of the License, or (at your option) any later version. | |
8 | ||
9 | # The GNU C Library is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | # Lesser General Public License for more details. | |
13 | ||
14 | # You should have received a copy of the GNU Lesser General Public | |
15 | # License along with the GNU C Library; if not, see | |
16 | # <https://www.gnu.org/licenses/>. | |
17 | ||
18 | # | |
19 | # Sub-makefile for NPTL portion of the library. | |
20 | # | |
21 | subdir := nptl | |
22 | ||
23 | include ../Makeconfig | |
24 | ||
25 | headers := \ | |
26 | bits/atomic_wide_counter.h \ | |
27 | bits/semaphore.h \ | |
28 | bits/struct_mutex.h \ | |
29 | bits/struct_rwlock.h \ | |
30 | pthread.h \ | |
31 | semaphore.h \ | |
32 | # headers | |
33 | ||
34 | extra-libs := libpthread | |
35 | extra-libs-others := $(extra-libs) | |
36 | ||
37 | routines = \ | |
38 | alloca_cutoff \ | |
39 | cancellation \ | |
40 | cleanup \ | |
41 | cleanup_compat \ | |
42 | cleanup_defer \ | |
43 | cleanup_defer_compat \ | |
44 | cleanup_routine \ | |
45 | elision-conf \ | |
46 | elision-lock \ | |
47 | elision-timed \ | |
48 | elision-trylock \ | |
49 | elision-unlock \ | |
50 | events \ | |
51 | futex-internal \ | |
52 | libc-cleanup \ | |
53 | lowlevellock \ | |
54 | nptl-stack \ | |
55 | nptl_deallocate_tsd \ | |
56 | nptl_free_tcb \ | |
57 | nptl_nthreads \ | |
58 | nptl_setxid \ | |
59 | nptlfreeres \ | |
60 | old_pthread_cond_broadcast \ | |
61 | old_pthread_cond_destroy \ | |
62 | old_pthread_cond_init \ | |
63 | old_pthread_cond_signal \ | |
64 | old_pthread_cond_timedwait \ | |
65 | old_pthread_cond_wait \ | |
66 | pthread_attr_copy \ | |
67 | pthread_attr_destroy \ | |
68 | pthread_attr_extension \ | |
69 | pthread_attr_getaffinity \ | |
70 | pthread_attr_getdetachstate \ | |
71 | pthread_attr_getguardsize \ | |
72 | pthread_attr_getinheritsched \ | |
73 | pthread_attr_getschedparam \ | |
74 | pthread_attr_getschedpolicy \ | |
75 | pthread_attr_getscope \ | |
76 | pthread_attr_getsigmask \ | |
77 | pthread_attr_getstack \ | |
78 | pthread_attr_getstackaddr \ | |
79 | pthread_attr_getstacksize \ | |
80 | pthread_attr_init \ | |
81 | pthread_attr_setaffinity \ | |
82 | pthread_attr_setdetachstate \ | |
83 | pthread_attr_setguardsize \ | |
84 | pthread_attr_setinheritsched \ | |
85 | pthread_attr_setschedparam \ | |
86 | pthread_attr_setschedpolicy \ | |
87 | pthread_attr_setscope \ | |
88 | pthread_attr_setsigmask \ | |
89 | pthread_attr_setsigmask_internal \ | |
90 | pthread_attr_setstack \ | |
91 | pthread_attr_setstackaddr \ | |
92 | pthread_attr_setstacksize \ | |
93 | pthread_barrier_destroy \ | |
94 | pthread_barrier_init \ | |
95 | pthread_barrier_wait \ | |
96 | pthread_barrierattr_destroy \ | |
97 | pthread_barrierattr_getpshared \ | |
98 | pthread_barrierattr_init \ | |
99 | pthread_barrierattr_setpshared \ | |
100 | pthread_cancel \ | |
101 | pthread_cleanup_upto \ | |
102 | pthread_clockjoin \ | |
103 | pthread_cond_broadcast \ | |
104 | pthread_cond_destroy \ | |
105 | pthread_cond_init \ | |
106 | pthread_cond_signal \ | |
107 | pthread_cond_wait \ | |
108 | pthread_condattr_destroy \ | |
109 | pthread_condattr_getclock \ | |
110 | pthread_condattr_getpshared \ | |
111 | pthread_condattr_init \ | |
112 | pthread_condattr_setclock \ | |
113 | pthread_condattr_setpshared \ | |
114 | pthread_create \ | |
115 | pthread_detach \ | |
116 | pthread_equal \ | |
117 | pthread_exit \ | |
118 | pthread_getaffinity \ | |
119 | pthread_getattr_default_np \ | |
120 | pthread_getattr_np \ | |
121 | pthread_getconcurrency \ | |
122 | pthread_getcpuclockid \ | |
123 | pthread_getname \ | |
124 | pthread_getschedparam \ | |
125 | pthread_getspecific \ | |
126 | pthread_gettid_np \ | |
127 | pthread_join \ | |
128 | pthread_join_common \ | |
129 | pthread_key_create \ | |
130 | pthread_key_delete \ | |
131 | pthread_keys \ | |
132 | pthread_kill \ | |
133 | pthread_kill_other_threads \ | |
134 | pthread_mutex_cond_lock \ | |
135 | pthread_mutex_conf \ | |
136 | pthread_mutex_consistent \ | |
137 | pthread_mutex_destroy \ | |
138 | pthread_mutex_getprioceiling \ | |
139 | pthread_mutex_init \ | |
140 | pthread_mutex_lock \ | |
141 | pthread_mutex_setprioceiling \ | |
142 | pthread_mutex_timedlock \ | |
143 | pthread_mutex_trylock \ | |
144 | pthread_mutex_unlock \ | |
145 | pthread_mutexattr_destroy \ | |
146 | pthread_mutexattr_getprioceiling \ | |
147 | pthread_mutexattr_getprotocol \ | |
148 | pthread_mutexattr_getpshared \ | |
149 | pthread_mutexattr_getrobust \ | |
150 | pthread_mutexattr_gettype \ | |
151 | pthread_mutexattr_init \ | |
152 | pthread_mutexattr_setprioceiling \ | |
153 | pthread_mutexattr_setprotocol \ | |
154 | pthread_mutexattr_setpshared \ | |
155 | pthread_mutexattr_setrobust \ | |
156 | pthread_mutexattr_settype \ | |
157 | pthread_once \ | |
158 | pthread_rwlock_clockrdlock \ | |
159 | pthread_rwlock_clockwrlock \ | |
160 | pthread_rwlock_destroy \ | |
161 | pthread_rwlock_init \ | |
162 | pthread_rwlock_rdlock \ | |
163 | pthread_rwlock_timedrdlock \ | |
164 | pthread_rwlock_timedwrlock \ | |
165 | pthread_rwlock_tryrdlock \ | |
166 | pthread_rwlock_trywrlock \ | |
167 | pthread_rwlock_unlock \ | |
168 | pthread_rwlock_wrlock \ | |
169 | pthread_rwlockattr_destroy \ | |
170 | pthread_rwlockattr_getkind_np \ | |
171 | pthread_rwlockattr_getpshared \ | |
172 | pthread_rwlockattr_init \ | |
173 | pthread_rwlockattr_setkind_np \ | |
174 | pthread_rwlockattr_setpshared \ | |
175 | pthread_self \ | |
176 | pthread_setaffinity \ | |
177 | pthread_setattr_default_np \ | |
178 | pthread_setcancelstate \ | |
179 | pthread_setcanceltype \ | |
180 | pthread_setconcurrency \ | |
181 | pthread_setname \ | |
182 | pthread_setschedparam \ | |
183 | pthread_setschedprio \ | |
184 | pthread_setspecific \ | |
185 | pthread_sigmask \ | |
186 | pthread_sigqueue \ | |
187 | pthread_spin_destroy \ | |
188 | pthread_spin_init \ | |
189 | pthread_spin_lock \ | |
190 | pthread_spin_trylock \ | |
191 | pthread_spin_unlock \ | |
192 | pthread_testcancel \ | |
193 | pthread_timedjoin \ | |
194 | pthread_tryjoin \ | |
195 | pthread_yield \ | |
196 | sem_clockwait \ | |
197 | sem_close \ | |
198 | sem_destroy \ | |
199 | sem_getvalue \ | |
200 | sem_init \ | |
201 | sem_open \ | |
202 | sem_post \ | |
203 | sem_routines \ | |
204 | sem_timedwait \ | |
205 | sem_unlink \ | |
206 | sem_wait \ | |
207 | syscall_cancel \ | |
208 | tpp \ | |
209 | unwind \ | |
210 | vars \ | |
211 | # routines | |
212 | ||
213 | libpthread-routines = libpthread-compat | |
214 | libpthread-shared-only-routines = libpthread-compat | |
215 | ||
216 | # Pretend that libpthread.so is a linker script, so that the symbolic | |
217 | # link is not installed. | |
218 | install-lib-ldscripts = libpthread.so | |
219 | $(inst_libdir)/libpthread.so: | |
220 | ||
221 | # Since cancellation handling is in large parts handled using exceptions | |
222 | # we have to compile some files with exception handling enabled, some | |
223 | # even with asynchronous unwind tables. | |
224 | ||
225 | # nptl-init.c contains sigcancel_handler(). | |
226 | CFLAGS-nptl-init.c += -fexceptions -fasynchronous-unwind-tables | |
227 | # The unwind code itself, | |
228 | CFLAGS-unwind.c += -fexceptions | |
229 | CFLAGS-unwind-forcedunwind.c += -fexceptions -fasynchronous-unwind-tables | |
230 | ||
231 | # The following three functions must be async-cancel safe. | |
232 | CFLAGS-pthread_cancel.c += -fexceptions -fasynchronous-unwind-tables | |
233 | CFLAGS-pthread_setcancelstate.c += -fexceptions -fasynchronous-unwind-tables | |
234 | CFLAGS-pthread_setcanceltype.c += -fexceptions -fasynchronous-unwind-tables | |
235 | ||
236 | # These are internal functions which similar functionality as setcancelstate | |
237 | # and setcanceltype. | |
238 | CFLAGS-cancellation.c += -fexceptions -fasynchronous-unwind-tables | |
239 | CFLAGS-syscall_cancel.c += -fexceptions -fasynchronous-unwind-tables | |
240 | ||
241 | # Calling pthread_exit() must cause the registered cancel handlers to | |
242 | # be executed. Therefore exceptions have to be thrown through this | |
243 | # function. | |
244 | CFLAGS-pthread_exit.c += -fexceptions | |
245 | ||
246 | # Among others, __pthread_unwind is forwarded. This function must handle | |
247 | # exceptions. | |
248 | CFLAGS-forward.c += -fexceptions | |
249 | ||
250 | # The following are cancellation points. Some of the functions can | |
251 | # block and therefore temporarily enable asynchronous cancellation. | |
252 | # Those must be compiled asynchronous unwind tables. | |
253 | CFLAGS-pthread_testcancel.c += -fexceptions | |
254 | CFLAGS-pthread_join.c += -fexceptions -fasynchronous-unwind-tables | |
255 | CFLAGS-pthread_timedjoin.c += -fexceptions -fasynchronous-unwind-tables | |
256 | CFLAGS-pthread_clockjoin.c += -fexceptions -fasynchronous-unwind-tables | |
257 | CFLAGS-pthread_once.c += $(uses-callbacks) -fexceptions \ | |
258 | -fasynchronous-unwind-tables | |
259 | CFLAGS-pthread_cond_wait.c += -fexceptions -fasynchronous-unwind-tables | |
260 | CFLAGS-pthread_kill.c = -fexceptions -fasynchronous-unwind-tables | |
261 | CFLAGS-sem_wait.c += -fexceptions -fasynchronous-unwind-tables | |
262 | CFLAGS-sem_timedwait.c += -fexceptions -fasynchronous-unwind-tables | |
263 | CFLAGS-sem_clockwait.c = -fexceptions -fasynchronous-unwind-tables | |
264 | ||
265 | CFLAGS-futex-internal.c += -fexceptions -fasynchronous-unwind-tables | |
266 | ||
267 | LDLIBS-tst-once5 = -lstdc++ | |
268 | CFLAGS-tst-thread_local1.o = -std=gnu++11 | |
269 | LDLIBS-tst-thread_local1 = -lstdc++ | |
270 | CFLAGS-tst-thread-exit-clobber.o = -std=gnu++11 | |
271 | LDLIBS-tst-thread-exit-clobber = -lstdc++ | |
272 | CFLAGS-tst-minstack-throw.o = -std=gnu++11 | |
273 | LDLIBS-tst-minstack-throw = -lstdc++ | |
274 | ||
275 | tests = \ | |
276 | tst-attr2 \ | |
277 | tst-attr3 \ | |
278 | tst-attr4 \ | |
279 | tst-cancel4_1 \ | |
280 | tst-cancel4_2 \ | |
281 | tst-cancel7 \ | |
282 | tst-cancel17 \ | |
283 | tst-cancel24 \ | |
284 | tst-cancel31 \ | |
285 | tst-cond26 \ | |
286 | tst-context1 \ | |
287 | tst-default-attr \ | |
288 | tst-dlsym1 \ | |
289 | tst-exec4 \ | |
290 | tst-exec5 \ | |
291 | tst-guard1 \ | |
292 | tst-initializers1 \ | |
293 | tst-initializers1-c11 \ | |
294 | tst-initializers1-c89 \ | |
295 | tst-initializers1-c99 \ | |
296 | tst-initializers1-gnu11 \ | |
297 | tst-initializers1-gnu89 \ | |
298 | tst-initializers1-gnu99 \ | |
299 | tst-minstack-cancel \ | |
300 | tst-minstack-exit \ | |
301 | tst-minstack-throw \ | |
302 | tst-mutex5a \ | |
303 | tst-mutex7a \ | |
304 | tst-mutexpi1 \ | |
305 | tst-mutexpi2 \ | |
306 | tst-mutexpi3 \ | |
307 | tst-mutexpi4 \ | |
308 | tst-mutexpi5 \ | |
309 | tst-mutexpi6 \ | |
310 | tst-mutexpi7 \ | |
311 | tst-mutexpi9 \ | |
312 | tst-mutexpi10 \ | |
313 | tst-mutexpi11 \ | |
314 | tst-mutexpi12 \ | |
315 | tst-once5 \ | |
316 | tst-pthread-affinity-inheritance \ | |
317 | tst-pthread-attr-affinity \ | |
318 | tst-pthread-attr-affinity-fail \ | |
319 | tst-pthread-attr-sigmask \ | |
320 | tst-pthread-defaultattr-free \ | |
321 | tst-pthread-gdb-attach \ | |
322 | tst-pthread-gdb-attach-static \ | |
323 | tst-pthread-getcpuclockid-invalid \ | |
324 | tst-pthread-key1-static \ | |
325 | tst-pthread-timedlock-lockloop \ | |
326 | tst-pthread_exit-nothreads \ | |
327 | tst-pthread_exit-nothreads-static \ | |
328 | tst-pthread_gettid_np \ | |
329 | tst-robust-fork \ | |
330 | tst-robustpi1 \ | |
331 | tst-robustpi2 \ | |
332 | tst-robustpi3 \ | |
333 | tst-robustpi4 \ | |
334 | tst-robustpi5 \ | |
335 | tst-robustpi6 \ | |
336 | tst-robustpi7 \ | |
337 | tst-robustpi9 \ | |
338 | tst-rwlock-pwn \ | |
339 | tst-rwlock2 \ | |
340 | tst-rwlock3 \ | |
341 | tst-rwlock6 \ | |
342 | tst-rwlock7 \ | |
343 | tst-rwlock8 \ | |
344 | tst-rwlock9 \ | |
345 | tst-rwlock10 \ | |
346 | tst-rwlock11 \ | |
347 | tst-rwlock15 \ | |
348 | tst-rwlock17 \ | |
349 | tst-rwlock18 \ | |
350 | tst-rwlock21 \ | |
351 | tst-rwlock22 \ | |
352 | tst-sched1 \ | |
353 | tst-sem17 \ | |
354 | tst-signal3 \ | |
355 | tst-stack2 \ | |
356 | tst-stack3 \ | |
357 | tst-stack4 \ | |
358 | tst-thread-affinity-pthread \ | |
359 | tst-thread-affinity-pthread2 \ | |
360 | tst-thread-affinity-sched \ | |
361 | tst-thread-exit-clobber \ | |
362 | tst-thread-setspecific \ | |
363 | tst-thread_local1 \ | |
364 | tst-tsd3 \ | |
365 | tst-tsd4 \ | |
366 | # tests | |
367 | ||
368 | tests-nolibpthread = \ | |
369 | tst-pthread_exit-nothreads \ | |
370 | tst-pthread_exit-nothreads-static \ | |
371 | # tests-nolibpthread | |
372 | ||
373 | tests-container = tst-pthread-getattr | |
374 | ||
375 | tests-internal := \ | |
376 | tst-barrier5 \ | |
377 | tst-cond22 \ | |
378 | tst-mutex8 \ | |
379 | tst-mutex8-static \ | |
380 | tst-mutexpi8 \ | |
381 | tst-mutexpi8-static \ | |
382 | tst-robustpi8 \ | |
383 | tst-rwlock19 \ | |
384 | tst-rwlock20 \ | |
385 | tst-sem11 \ | |
386 | tst-sem12 \ | |
387 | tst-sem13 \ | |
388 | tst-setgetname \ | |
389 | tst-signal7 \ | |
390 | # tests-internal | |
391 | ||
392 | xtests = \ | |
393 | tst-mutexpp1 \ | |
394 | tst-mutexpp5 \ | |
395 | tst-mutexpp6 \ | |
396 | tst-mutexpp9 \ | |
397 | tst-mutexpp10 \ | |
398 | tst-setgroups \ | |
399 | tst-setuid1 \ | |
400 | tst-setuid1-static \ | |
401 | tst-setuid2 \ | |
402 | # xtests | |
403 | ||
404 | tests-time64 := \ | |
405 | tst-cancel4_2-time64 | |
406 | # tests-time64 | |
407 | ||
408 | # This test can run into task limits because of a linux kernel bug | |
409 | # and then cause the make process to fail too, see bug 24537. | |
410 | xtests += tst-eintr1 | |
411 | ||
412 | test-srcs = tst-oddstacklimit | |
413 | ||
414 | gen-as-const-headers = \ | |
415 | descr-const.sym \ | |
416 | unwindbuf.sym \ | |
417 | # gen-as-const-headers | |
418 | ||
419 | gen-py-const-headers := nptl_lock_constants.pysym | |
420 | pretty-printers := nptl-printers.py | |
421 | tests-printers := \ | |
422 | test-cond-printers \ | |
423 | test-condattr-printers \ | |
424 | test-mutex-printers \ | |
425 | test-mutexattr-printers \ | |
426 | test-rwlock-printers \ | |
427 | test-rwlockattr-printers \ | |
428 | # tests-printers | |
429 | ||
430 | # We must specify both CFLAGS and CPPFLAGS to override any | |
431 | # compiler options the user might have provided that conflict | |
432 | # with what we need e.g. user specifies CPPFLAGS with -O2 and | |
433 | # we need -O0. | |
434 | CFLAGS-test-mutexattr-printers.c := $(CFLAGS-printers-tests) | |
435 | CFLAGS-test-mutex-printers.c := $(CFLAGS-printers-tests) | |
436 | CFLAGS-test-condattr-printers.c := $(CFLAGS-printers-tests) | |
437 | CFLAGS-test-cond-printers.c := $(CFLAGS-printers-tests) | |
438 | CFLAGS-test-rwlockattr-printers.c := $(CFLAGS-printers-tests) | |
439 | CFLAGS-test-rwlock-printers.c := $(CFLAGS-printers-tests) | |
440 | CPPFLAGS-test-mutexattr-printers.c := $(CFLAGS-printers-tests) | |
441 | CPPFLAGS-test-mutex-printers.c := $(CFLAGS-printers-tests) | |
442 | CPPFLAGS-test-condattr-printers.c := $(CFLAGS-printers-tests) | |
443 | CPPFLAGS-test-cond-printers.c := $(CFLAGS-printers-tests) | |
444 | CPPFLAGS-test-rwlockattr-printers.c := $(CFLAGS-printers-tests) | |
445 | CPPFLAGS-test-rwlock-printers.c := $(CFLAGS-printers-tests) | |
446 | ||
447 | # Reuse the CFLAGS setting for the GDB attaching test. It needs | |
448 | # debugging information. | |
449 | CFLAGS-tst-pthread-gdb-attach.c := $(CFLAGS-printers-tests) | |
450 | CPPFLAGS-tst-pthread-gdb-attach.c := $(CFLAGS-printers-tests) | |
451 | ifeq ($(build-shared)$(build-hardcoded-path-in-tests),yesno) | |
452 | CPPFLAGS-tst-pthread-gdb-attach.c += -DDO_ADD_SYMBOL_FILE=1 | |
453 | else | |
454 | CPPFLAGS-tst-pthread-gdb-attach.c += -DDO_ADD_SYMBOL_FILE=0 | |
455 | endif | |
456 | CFLAGS-tst-pthread-gdb-attach-static.c := $(CFLAGS-printers-tests) | |
457 | CPPFLAGS-tst-pthread-gdb-attach-static.c := \ | |
458 | $(CFLAGS-printers-tests) -DDO_ADD_SYMBOL_FILE=0 | |
459 | # As of version 9.2, GDB cannot attach properly to PIE programs that | |
460 | # were launched with an explicit ld.so invocation. | |
461 | tst-pthread-gdb-attach-no-pie = yes | |
462 | ||
463 | tests += \ | |
464 | tst-cancelx7 \ | |
465 | tst-cancelx17 \ | |
466 | # tests | |
467 | ||
468 | ifeq ($(build-shared),yes) | |
469 | tests += \ | |
470 | tst-audit-threads \ | |
471 | tst-compat-forwarder \ | |
472 | # tests | |
473 | tests-internal += \ | |
474 | tst-stackguard1 \ | |
475 | tst-tls3 \ | |
476 | tst-tls3-malloc \ | |
477 | tst-tls5 \ | |
478 | # tests-internal | |
479 | ifeq ($(have-z-execstack)$(have-test-cc-trampoline),yesyes) | |
480 | tests += tst-execstack-threads | |
481 | endif | |
482 | endif | |
483 | ||
484 | modules-names = \ | |
485 | tst-audit-threads-mod1 \ | |
486 | tst-audit-threads-mod2 \ | |
487 | tst-compat-forwarder-mod \ | |
488 | tst-stack4mod \ | |
489 | tst-tls3mod \ | |
490 | tst-tls5mod \ | |
491 | tst-tls5moda \ | |
492 | tst-tls5modb \ | |
493 | tst-tls5modc \ | |
494 | tst-tls5modd \ | |
495 | tst-tls5mode \ | |
496 | tst-tls5modf \ | |
497 | # modules-names | |
498 | extra-test-objs += \ | |
499 | $(addsuffix .os,$(strip $(modules-names))) \ | |
500 | tst-cleanup4aux.o \ | |
501 | tst-cleanupx4aux.o \ | |
502 | # extra-test-objs | |
503 | test-extras += \ | |
504 | tst-cleanup4aux \ | |
505 | tst-cleanupx4aux \ | |
506 | # test-extras | |
507 | ||
508 | ifneq ($(have-test-clang),yes) | |
509 | modules-names += \ | |
510 | tst-execstack-threads-mod \ | |
511 | # modules-names | |
512 | endif | |
513 | ||
514 | # This test exercises compat symbols removed in glibc 2.34. | |
515 | ifdef have-GLIBC_2.33 | |
516 | tests += tst-cleanup4 | |
517 | ifeq ($(build-shared),yes) | |
518 | tests += tst-cleanupx4 | |
519 | endif | |
520 | endif | |
521 | ||
522 | tst-tls3mod.so-no-z-defs = yes | |
523 | tst-tls5mod.so-no-z-defs = yes | |
524 | tst-tls5moda.so-no-z-defs = yes | |
525 | tst-tls5modb.so-no-z-defs = yes | |
526 | tst-tls5modc.so-no-z-defs = yes | |
527 | tst-tls5modd.so-no-z-defs = yes | |
528 | tst-tls5mode.so-no-z-defs = yes | |
529 | tst-tls5modf.so-no-z-defs = yes | |
530 | ||
531 | ifeq ($(build-shared),yes) | |
532 | ||
533 | # Set the `multidir' variable by grabbing the variable from the compiler. | |
534 | # We do it once and save the result in a generated makefile. | |
535 | -include $(objpfx)multidir.mk | |
536 | $(objpfx)multidir.mk: $(common-objpfx)config.make | |
537 | $(make-target-directory) | |
538 | dir=`$(CC) $(CFLAGS) $(CPPFLAGS) -print-multi-directory`; \ | |
539 | echo "multidir := $$dir" > $@T | |
540 | mv -f $@T $@ | |
541 | ||
542 | endif | |
543 | ||
544 | CFLAGS-ftrylockfile.c += $(libio-mtsafe) | |
545 | CFLAGS-funlockfile.c += $(libio-mtsafe) | |
546 | ||
547 | link-libc-static := $(common-objpfx)libc.a $(static-gnulib) \ | |
548 | $(common-objpfx)libc.a | |
549 | ||
550 | tests-static += \ | |
551 | tst-cancel24-static \ | |
552 | tst-mutex8-static \ | |
553 | tst-mutexpi8-static \ | |
554 | tst-pthread-gdb-attach-static \ | |
555 | tst-pthread-key1-static \ | |
556 | tst-pthread_exit-nothreads-static \ | |
557 | tst-sem11-static \ | |
558 | tst-sem12-static tst-cond11-static \ | |
559 | tst-stackguard1-static \ | |
560 | # tests-static | |
561 | ||
562 | tests += tst-cancel24-static | |
563 | ifeq ($(static-cxx-tests),no) | |
564 | tests-unsupported += tst-cancel24-static | |
565 | endif | |
566 | ||
567 | tests-internal += \ | |
568 | tst-sem11-static \ | |
569 | tst-sem12-static \ | |
570 | tst-stackguard1-static \ | |
571 | # tests-internal | |
572 | xtests-static += tst-setuid1-static | |
573 | ||
574 | ifeq ($(run-built-tests),yes) | |
575 | tests-special += \ | |
576 | $(objpfx)tst-oddstacklimit.out \ | |
577 | # tests-special | |
578 | ifeq ($(build-shared),yes) | |
579 | tests-special += $(objpfx)tst-tls6.out | |
580 | ifneq ($(PERL),no) | |
581 | tests-special += $(objpfx)tst-stack3-mem.out | |
582 | endif | |
583 | endif | |
584 | endif | |
585 | ||
586 | ifeq (,$(CXX)) | |
587 | # These tests require a C++ compiler and runtime. | |
588 | tests-unsupported += \ | |
589 | tst-cancel24 \ | |
590 | tst-cancel24-static \ | |
591 | tst-minstack-throw \ | |
592 | tst-once5 \ | |
593 | tst-thread-exit-clobber \ | |
594 | # tests-unsupported | |
595 | endif | |
596 | # These tests require a C++ compiler and runtime with thread_local support. | |
597 | ifneq ($(have-cxx-thread_local),yes) | |
598 | tests-unsupported += tst-thread_local1 | |
599 | endif | |
600 | ||
601 | include ../Rules | |
602 | ||
603 | ifeq (yes,$(build-shared)) | |
604 | # Make sure these things are built in the `make lib' pass so they can be used | |
605 | # to run programs during the `make others' pass. | |
606 | lib-noranlib: $(addprefix $(objpfx),$(extra-objs)) | |
607 | endif | |
608 | ||
609 | ||
610 | # 'pthread_self' is a simple memory or register load. Setting up the | |
611 | # stack frame is more work than the actual operation. Disable the | |
612 | # frame creation entirely. This will help applications which call the | |
613 | # function frequently to get a thread-specific handle. | |
614 | CFLAGS-pthread_self.os += -fomit-frame-pointer | |
615 | ||
616 | # Run the cancellation and cleanup tests also for the modern, exception-based | |
617 | # implementation. For this we have to pass the -fexceptions parameter. | |
618 | CFLAGS-tst-cancelx7.c += -fexceptions | |
619 | CFLAGS-tst-cancelx17.c += -fexceptions | |
620 | CFLAGS-tst-cleanupx4.c += -fexceptions | |
621 | CFLAGS-tst-cleanupx4aux.c += -fexceptions | |
622 | CFLAGS-tst-initializers1.c += -W -Wall -Werror | |
623 | CFLAGS-tst-initializers1-< = $(CFLAGS-tst-initializers1.c) \ | |
624 | $(patsubst tst-initializers1-%.c,-std=%,$<) | |
625 | CFLAGS-tst-initializers1-c89.c += $(CFLAGS-tst-initializers1-<) | |
626 | CFLAGS-tst-initializers1-c99.c += $(CFLAGS-tst-initializers1-<) | |
627 | CFLAGS-tst-initializers1-c11.c += $(CFLAGS-tst-initializers1-<) | |
628 | CFLAGS-tst-initializers1-gnu89.c += $(CFLAGS-tst-initializers1-<) | |
629 | CFLAGS-tst-initializers1-gnu99.c += $(CFLAGS-tst-initializers1-<) | |
630 | CFLAGS-tst-initializers1-gnu11.c += $(CFLAGS-tst-initializers1-<) | |
631 | ||
632 | tst-cancel7-ARGS = --command "exec $(host-test-program-cmd)" | |
633 | tst-cancelx7-ARGS = $(tst-cancel7-ARGS) | |
634 | ||
635 | tst-stack3-ENV = MALLOC_TRACE=$(objpfx)tst-stack3.mtrace \ | |
636 | LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so | |
637 | $(objpfx)tst-stack3-mem.out: $(objpfx)tst-stack3.out | |
638 | $(common-objpfx)malloc/mtrace $(objpfx)tst-stack3.mtrace > $@; \ | |
639 | $(evaluate-test) | |
640 | ||
641 | ifeq ($(run-built-tests),yes) | |
642 | ifeq (yes,$(build-shared)) | |
643 | ifneq ($(PERL),no) | |
644 | generated += \ | |
645 | tst-stack3-mem.out \ | |
646 | tst-stack3.mtrace \ | |
647 | # generated | |
648 | endif | |
649 | endif | |
650 | endif | |
651 | ||
652 | tst-stack4mod.sos=$(shell for i in 0 1 2 3 4 5 6 7 8 9 10 \ | |
653 | 11 12 13 14 15 16 17 18 19; do \ | |
654 | for j in 0 1 2 3 4 5 6 7 8 9 10 \ | |
655 | 11 12 13 14 15 16 17 18 19; do \ | |
656 | echo $(objpfx)tst-stack4mod-$$i-$$j.so; \ | |
657 | done; done) | |
658 | $(objpfx)tst-stack4.out: $(tst-stack4mod.sos) | |
659 | $(tst-stack4mod.sos): $(objpfx)tst-stack4mod.so | |
660 | cp -f $< $@ | |
661 | clean: | |
662 | rm -f $(tst-stack4mod.sos) | |
663 | ||
664 | $(objpfx)tst-cleanup4: $(objpfx)tst-cleanup4aux.o | |
665 | $(objpfx)tst-cleanupx4: $(objpfx)tst-cleanupx4aux.o | |
666 | ||
667 | LDFLAGS-tst-tls3 = -rdynamic | |
668 | LDFLAGS-tst-tls3mod.so = -Wl,-z,lazy | |
669 | $(objpfx)tst-tls3.out: $(objpfx)tst-tls3mod.so | |
670 | ||
671 | LDFLAGS-tst-tls3-malloc = -rdynamic | |
672 | $(objpfx)tst-tls3-malloc.out: $(objpfx)tst-tls3mod.so | |
673 | ||
674 | $(objpfx)tst-tls5: $(objpfx)tst-tls5mod.so | |
675 | LDFLAGS-tst-tls5 = -Wl,--no-as-needed | |
676 | LDFLAGS-tst-tls5mod.so = -Wl,-soname,tst-tls5mod.so | |
677 | ||
678 | ifeq ($(build-shared),yes) | |
679 | $(objpfx)tst-tls6.out: tst-tls6.sh $(objpfx)tst-tls5 \ | |
680 | $(objpfx)tst-tls5moda.so $(objpfx)tst-tls5modb.so \ | |
681 | $(objpfx)tst-tls5modc.so $(objpfx)tst-tls5modd.so \ | |
682 | $(objpfx)tst-tls5mode.so $(objpfx)tst-tls5modf.so | |
683 | $(BASH) $< $(common-objpfx) '$(test-via-rtld-prefix)' \ | |
684 | '$(test-wrapper-env)' '$(run-program-env)'; \ | |
685 | $(evaluate-test) | |
686 | endif | |
687 | ||
688 | LDLIBS-tst-cancel24 = -Wl,--no-as-needed -lstdc++ | |
689 | LDLIBS-tst-cancel24-static = $(LDLIBS-tst-cancel24) | |
690 | ||
691 | ifeq ($(build-shared),yes) | |
692 | ||
693 | generated += \ | |
694 | multidir.mk \ | |
695 | tst-tls6.out \ | |
696 | # generated | |
697 | endif | |
698 | ||
699 | tst-exec4-ARGS = $(host-test-program-cmd) | |
700 | ||
701 | $(objpfx)tst-execstack-threads.out: $(objpfx)tst-execstack-threads-mod.so | |
702 | LDFLAGS-tst-execstack-threads = -Wl,-z,noexecstack | |
703 | LDFLAGS-tst-execstack-threads-mod.so = -Wl,-z,execstack | |
704 | CFLAGS-tst-execstack-threads-mod.c += -Wno-trampolines | |
705 | ifeq ($(have-no-error-execstack),yes) | |
706 | LDFLAGS-tst-execstack-threads-mod.so += -Wl,--no-error-execstack | |
707 | endif | |
708 | ||
709 | tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child" | |
710 | tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child" | |
711 | ||
712 | ifeq ($(run-built-tests),yes) | |
713 | $(objpfx)tst-oddstacklimit.out: $(objpfx)tst-oddstacklimit $(objpfx)tst-basic1 | |
714 | $(test-program-prefix) $< --command '$(host-test-program-cmd)' > $@; \ | |
715 | $(evaluate-test) | |
716 | endif | |
717 | ||
718 | $(objpfx)tst-compat-forwarder: $(objpfx)tst-compat-forwarder-mod.so | |
719 | ||
720 | tst-mutex10-ENV = GLIBC_TUNABLES=glibc.elision.enable=1 | |
721 | ||
722 | # Protect against a build using -Wl,-z,now. | |
723 | LDFLAGS-tst-audit-threads-mod1.so = -Wl,-z,lazy | |
724 | LDFLAGS-tst-audit-threads-mod2.so = -Wl,-z,lazy | |
725 | LDFLAGS-tst-audit-threads = -Wl,-z,lazy | |
726 | $(objpfx)tst-audit-threads: $(objpfx)tst-audit-threads-mod2.so | |
727 | $(objpfx)tst-audit-threads.out: $(objpfx)tst-audit-threads-mod1.so | |
728 | tst-audit-threads-ENV = LD_AUDIT=$(objpfx)tst-audit-threads-mod1.so | |
729 | ||
730 | # The test uses dlopen indirectly and would otherwise load system | |
731 | # objects. | |
732 | tst-setuid1-static-ENV = \ | |
733 | LD_LIBRARY_PATH=$(ld-library-path):$(common-objpfx)elf:$(common-objpfx)nss | |
734 | ||
735 | tst-pthread-proc-maps-ENV = \ | |
736 | GLIBC_TUNABLES=glibc.malloc.arena_max=8:glibc.malloc.mmap_threshold=1024 | |
737 | tst-pthread-proc-maps-ARGS = 8 | |
738 | ||
739 | # The tests here better do not run in parallel. | |
740 | ifeq ($(run-built-tests),yes) | |
741 | ifneq ($(filter %tests,$(MAKECMDGOALS)),) | |
742 | .NOTPARALLEL: | |
743 | endif | |
744 | endif |