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