]> git.ipfire.org Git - thirdparty/glibc.git/blame - nptl/Makefile
NEWS: Add new generic fma/fmaf note
[thirdparty/glibc.git] / nptl / Makefile
CommitLineData
26420023 1# Copyright (C) 2002-2025 Free Software Foundation, Inc.
76a50749
UD
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
59ba27a6 15# License along with the GNU C Library; if not, see
5a82c748 16# <https://www.gnu.org/licenses/>.
76a50749
UD
17
18#
19# Sub-makefile for NPTL portion of the library.
20#
21subdir := nptl
22
a5f891ac
JM
23include ../Makeconfig
24
8bd336a0
FW
25headers := \
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
76a50749
UD
33
34extra-libs := libpthread
35extra-libs-others := $(extra-libs)
36
8923b996
FW
37routines = \
38 alloca_cutoff \
ce0b7961 39 cancellation \
3ec8b1c7 40 cleanup \
1f2e5bfe 41 cleanup_compat \
c4c53e0f 42 cleanup_defer \
1f2e5bfe 43 cleanup_defer_compat \
5715c29e 44 cleanup_routine \
23ce1cf3 45 events \
b5be9ae7 46 futex-internal \
8923b996 47 libc-cleanup \
2f4019de 48 lowlevellock \
c79a31fb 49 nptl-stack \
2cfef0b0 50 nptl_deallocate_tsd \
8fbb33b3 51 nptl_free_tcb \
43fe356d 52 nptl_nthreads \
486010a3 53 nptl_setxid \
c79a31fb 54 nptlfreeres \
08129b15 55 old_pthread_cond_broadcast \
dc6cfdc9 56 old_pthread_cond_destroy \
ad96df2c 57 old_pthread_cond_init \
08129b15
FW
58 old_pthread_cond_signal \
59 old_pthread_cond_timedwait \
60 old_pthread_cond_wait \
331c6e8a 61 pthread_attr_copy \
8923b996 62 pthread_attr_destroy \
7538d461 63 pthread_attr_extension \
f5bc5f6e 64 pthread_attr_getaffinity \
8923b996 65 pthread_attr_getdetachstate \
b5668f08 66 pthread_attr_getguardsize \
8923b996
FW
67 pthread_attr_getinheritsched \
68 pthread_attr_getschedparam \
ce197a6e 69 pthread_attr_getschedpolicy \
ed0a69b6 70 pthread_attr_getscope \
ec41af45 71 pthread_attr_getsigmask \
fb7abc34 72 pthread_attr_getstack \
b5e75df2 73 pthread_attr_getstackaddr \
ee092efe 74 pthread_attr_getstacksize \
8923b996 75 pthread_attr_init \
1979819d 76 pthread_attr_setaffinity \
8923b996 77 pthread_attr_setdetachstate \
da069d17 78 pthread_attr_setguardsize \
8923b996
FW
79 pthread_attr_setinheritsched \
80 pthread_attr_setschedparam \
f0929a22 81 pthread_attr_setschedpolicy \
dc260acd 82 pthread_attr_setscope \
ec41af45
FW
83 pthread_attr_setsigmask \
84 pthread_attr_setsigmask_internal \
b855e52b 85 pthread_attr_setstack \
736c57c9 86 pthread_attr_setstackaddr \
870218fb 87 pthread_attr_setstacksize \
43b3746a 88 pthread_barrier_destroy \
f1af331c 89 pthread_barrier_init \
b9aec0dd 90 pthread_barrier_wait \
bbacf0f5 91 pthread_barrierattr_destroy \
39e74af2 92 pthread_barrierattr_getpshared \
e731212b 93 pthread_barrierattr_init \
3f0808ef 94 pthread_barrierattr_setpshared \
d7c51fe4 95 pthread_cancel \
4647ce82 96 pthread_cleanup_upto \
ddd4a2d3 97 pthread_clockjoin \
08129b15 98 pthread_cond_broadcast \
dc6cfdc9 99 pthread_cond_destroy \
ad96df2c 100 pthread_cond_init \
08129b15
FW
101 pthread_cond_signal \
102 pthread_cond_wait \
249afce2 103 pthread_condattr_destroy \
ed00dcbb 104 pthread_condattr_getclock \
2a775a9e 105 pthread_condattr_getpshared \
7da5c345 106 pthread_condattr_init \
6a75fefc 107 pthread_condattr_setclock \
d9b600c9 108 pthread_condattr_setpshared \
f47f1d91 109 pthread_create \
df65f897 110 pthread_detach \
8923b996 111 pthread_equal \
c62cef02 112 pthread_exit \
52302bc2 113 pthread_getaffinity \
8f72bed1 114 pthread_getattr_default_np \
07a73d52 115 pthread_getattr_np \
fec776b8 116 pthread_getconcurrency \
310e59e6 117 pthread_getcpuclockid \
c924e44a 118 pthread_getname \
d5074b30 119 pthread_getschedparam \
aae43acf 120 pthread_getspecific \
74d463c5 121 pthread_gettid_np \
ddd4a2d3
FW
122 pthread_join \
123 pthread_join_common \
6f009ea9 124 pthread_key_create \
9ce44f46 125 pthread_key_delete \
a91bf4e0 126 pthread_keys \
b7665845 127 pthread_kill \
e4f1c0de 128 pthread_kill_other_threads \
08129b15 129 pthread_mutex_cond_lock \
eda0c098 130 pthread_mutex_conf \
f03b78fa 131 pthread_mutex_consistent \
27a44822 132 pthread_mutex_destroy \
4b85c6f5 133 pthread_mutex_getprioceiling \
27a44822
FW
134 pthread_mutex_init \
135 pthread_mutex_lock \
a2975191 136 pthread_mutex_setprioceiling \
4372dc7e 137 pthread_mutex_timedlock \
a2b0f2e1 138 pthread_mutex_trylock \
27a44822 139 pthread_mutex_unlock \
fd42022a 140 pthread_mutexattr_destroy \
d236322b 141 pthread_mutexattr_getprioceiling \
9f2f158b 142 pthread_mutexattr_getprotocol \
2e825f7d 143 pthread_mutexattr_getpshared \
9b7ab14e 144 pthread_mutexattr_getrobust \
2a23e899 145 pthread_mutexattr_gettype \
506385d3 146 pthread_mutexattr_init \
c6677228 147 pthread_mutexattr_setprioceiling \
241ac38c 148 pthread_mutexattr_setprotocol \
8a229ee9 149 pthread_mutexattr_setpshared \
1ec4cd5a 150 pthread_mutexattr_setrobust \
b76c066d 151 pthread_mutexattr_settype \
3fec7f18 152 pthread_once \
0ace9b19 153 pthread_rwlock_clockrdlock \
2cf5b43b 154 pthread_rwlock_clockwrlock \
504ac633 155 pthread_rwlock_destroy \
63627246 156 pthread_rwlock_init \
eb29dcde 157 pthread_rwlock_rdlock \
2392feb1 158 pthread_rwlock_timedrdlock \
e7d2d48e 159 pthread_rwlock_timedwrlock \
c96dddd7 160 pthread_rwlock_tryrdlock \
e8a95971 161 pthread_rwlock_trywrlock \
eb29dcde
FW
162 pthread_rwlock_unlock \
163 pthread_rwlock_wrlock \
a8841e00 164 pthread_rwlockattr_destroy \
9f13a95b 165 pthread_rwlockattr_getkind_np \
0af0ccc2 166 pthread_rwlockattr_getpshared \
dbfa12e2 167 pthread_rwlockattr_init \
b4444094 168 pthread_rwlockattr_setkind_np \
0505ae4e 169 pthread_rwlockattr_setpshared \
8923b996 170 pthread_self \
7b300ec7 171 pthread_setaffinity \
249bd833 172 pthread_setattr_default_np \
93d78ec1 173 pthread_setcancelstate \
75376a3f 174 pthread_setcanceltype \
fec776b8 175 pthread_setconcurrency \
8bc6a6d7 176 pthread_setname \
f2323817 177 pthread_setschedparam \
56f823ab 178 pthread_setschedprio \
64a8990b 179 pthread_setspecific \
c6663fee 180 pthread_sigmask \
2d53566e 181 pthread_sigqueue \
c7b1cd4a 182 pthread_spin_destroy \
ce4b3b7b 183 pthread_spin_init \
da8e3710 184 pthread_spin_lock \
4baf02b3 185 pthread_spin_trylock \
ce4b3b7b 186 pthread_spin_unlock \
0197c1bc 187 pthread_testcancel \
ddd4a2d3
FW
188 pthread_timedjoin \
189 pthread_tryjoin \
c2fd60a5 190 pthread_yield \
19cc20ef 191 sem_clockwait \
0b7d48d1 192 sem_close \
4b729cca 193 sem_destroy \
61878689 194 sem_getvalue \
1ae60ae7 195 sem_init \
0b7d48d1 196 sem_open \
793042c6 197 sem_post \
0b7d48d1 198 sem_routines \
018c75dc 199 sem_timedwait \
990c8ffd 200 sem_unlink \
5633541d 201 sem_wait \
89b53077 202 syscall_cancel \
798cacde 203 tpp \
1d95b035 204 unwind \
8c1c0da3 205 vars \
b600f477 206 # routines
8923b996 207
49e182c7
FW
208libpthread-routines = libpthread-compat
209libpthread-shared-only-routines = libpthread-compat
f077a4a9 210
3b638095
FW
211# Pretend that libpthread.so is a linker script, so that the symbolic
212# link is not installed.
213install-lib-ldscripts = libpthread.so
214$(inst_libdir)/libpthread.so:
215
7726edc2
UD
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
a5b8b56d 220# nptl-init.c contains sigcancel_handler().
36975e8e 221CFLAGS-nptl-init.c += -fexceptions -fasynchronous-unwind-tables
f0481d97 222# The unwind code itself,
36975e8e
L
223CFLAGS-unwind.c += -fexceptions
224CFLAGS-unwind-forcedunwind.c += -fexceptions -fasynchronous-unwind-tables
7726edc2
UD
225
226# The following three functions must be async-cancel safe.
36975e8e
L
227CFLAGS-pthread_cancel.c += -fexceptions -fasynchronous-unwind-tables
228CFLAGS-pthread_setcancelstate.c += -fexceptions -fasynchronous-unwind-tables
229CFLAGS-pthread_setcanceltype.c += -fexceptions -fasynchronous-unwind-tables
7726edc2
UD
230
231# These are internal functions which similar functionality as setcancelstate
232# and setcanceltype.
89b53077
AZ
233CFLAGS-cancellation.c += -fexceptions -fasynchronous-unwind-tables
234CFLAGS-syscall_cancel.c += -fexceptions -fasynchronous-unwind-tables
7726edc2
UD
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.
36975e8e 239CFLAGS-pthread_exit.c += -fexceptions
7726edc2 240
26676450
UD
241# Among others, __pthread_unwind is forwarded. This function must handle
242# exceptions.
36975e8e 243CFLAGS-forward.c += -fexceptions
26676450 244
7726edc2
UD
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.
36975e8e
L
248CFLAGS-pthread_testcancel.c += -fexceptions
249CFLAGS-pthread_join.c += -fexceptions -fasynchronous-unwind-tables
250CFLAGS-pthread_timedjoin.c += -fexceptions -fasynchronous-unwind-tables
69ca4b54 251CFLAGS-pthread_clockjoin.c += -fexceptions -fasynchronous-unwind-tables
36975e8e 252CFLAGS-pthread_once.c += $(uses-callbacks) -fexceptions \
e07bb02a 253 -fasynchronous-unwind-tables
36975e8e 254CFLAGS-pthread_cond_wait.c += -fexceptions -fasynchronous-unwind-tables
f779b1ef 255CFLAGS-pthread_kill.c = -fexceptions -fasynchronous-unwind-tables
36975e8e
L
256CFLAGS-sem_wait.c += -fexceptions -fasynchronous-unwind-tables
257CFLAGS-sem_timedwait.c += -fexceptions -fasynchronous-unwind-tables
6615f779 258CFLAGS-sem_clockwait.c = -fexceptions -fasynchronous-unwind-tables
bf293afe 259
541e53c9
FW
260CFLAGS-futex-internal.c += -fexceptions -fasynchronous-unwind-tables
261
ed225df3 262LDLIBS-tst-once5 = -lstdc++
99e1dc0a
FW
263CFLAGS-tst-thread_local1.o = -std=gnu++11
264LDLIBS-tst-thread_local1 = -lstdc++
579396ee
FW
265CFLAGS-tst-thread-exit-clobber.o = -std=gnu++11
266LDLIBS-tst-thread-exit-clobber = -lstdc++
b725132d 267CFLAGS-tst-minstack-throw.o = -std=gnu++11
860b0240 268LDLIBS-tst-minstack-throw = -lstdc++
76a50749 269
b600f477
CD
270tests = \
271 tst-attr2 \
272 tst-attr3 \
36b54992 273 tst-attr4 \
b600f477
CD
274 tst-cancel4_1 \
275 tst-cancel4_2 \
276 tst-cancel7 \
277 tst-cancel17 \
278 tst-cancel24 \
89b53077 279 tst-cancel31 \
b600f477
CD
280 tst-cond26 \
281 tst-context1 \
282 tst-default-attr \
283 tst-dlsym1 \
284 tst-exec4 \
285 tst-exec5 \
a6fbe36b 286 tst-guard1 \
b600f477
CD
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 \
e41aabcc 311 tst-pthread-affinity-inheritance \
b600f477
CD
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 \
03b8d764 318 tst-pthread-getcpuclockid-invalid \
42e48e72 319 tst-pthread-key1-static \
b600f477
CD
320 tst-pthread-timedlock-lockloop \
321 tst-pthread_exit-nothreads \
322 tst-pthread_exit-nothreads-static \
74d463c5 323 tst-pthread_gettid_np \
b600f477
CD
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
c62cef02
FW
362
363tests-nolibpthread = \
364 tst-pthread_exit-nothreads \
365 tst-pthread_exit-nothreads-static \
b600f477 366 # tests-nolibpthread
7c3018f9 367
279c68ce
DD
368tests-container = tst-pthread-getattr
369
b600f477
CD
370tests-internal := \
371 tst-barrier5 \
372 tst-cond22 \
332f8e62 373 tst-dl-debug-tid \
b600f477
CD
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
388xtests = \
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
18aa51ee 399
088d3291
AZ
400tests-time64 := \
401 tst-cancel4_2-time64
b600f477 402 # tests-time64
088d3291 403
18aa51ee
SN
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.
406xtests += tst-eintr1
407
0bf57f87 408test-srcs = tst-oddstacklimit
432aaf5b 409
89b53077
AZ
410gen-as-const-headers = \
411 descr-const.sym \
412 unwindbuf.sym \
413 # gen-as-const-headers
08192659 414
23b5cae1
MG
415gen-py-const-headers := nptl_lock_constants.pysym
416pretty-printers := nptl-printers.py
b600f477
CD
417tests-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
23b5cae1 425
81e0662e
CD
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.
23b5cae1
MG
430CFLAGS-test-mutexattr-printers.c := $(CFLAGS-printers-tests)
431CFLAGS-test-mutex-printers.c := $(CFLAGS-printers-tests)
432CFLAGS-test-condattr-printers.c := $(CFLAGS-printers-tests)
433CFLAGS-test-cond-printers.c := $(CFLAGS-printers-tests)
434CFLAGS-test-rwlockattr-printers.c := $(CFLAGS-printers-tests)
435CFLAGS-test-rwlock-printers.c := $(CFLAGS-printers-tests)
81e0662e
CD
436CPPFLAGS-test-mutexattr-printers.c := $(CFLAGS-printers-tests)
437CPPFLAGS-test-mutex-printers.c := $(CFLAGS-printers-tests)
438CPPFLAGS-test-condattr-printers.c := $(CFLAGS-printers-tests)
439CPPFLAGS-test-cond-printers.c := $(CFLAGS-printers-tests)
440CPPFLAGS-test-rwlockattr-printers.c := $(CFLAGS-printers-tests)
441CPPFLAGS-test-rwlock-printers.c := $(CFLAGS-printers-tests)
23b5cae1 442
a64afc22
FW
443# Reuse the CFLAGS setting for the GDB attaching test. It needs
444# debugging information.
445CFLAGS-tst-pthread-gdb-attach.c := $(CFLAGS-printers-tests)
446CPPFLAGS-tst-pthread-gdb-attach.c := $(CFLAGS-printers-tests)
447ifeq ($(build-shared)$(build-hardcoded-path-in-tests),yesno)
448CPPFLAGS-tst-pthread-gdb-attach.c += -DDO_ADD_SYMBOL_FILE=1
449else
450CPPFLAGS-tst-pthread-gdb-attach.c += -DDO_ADD_SYMBOL_FILE=0
451endif
452CFLAGS-tst-pthread-gdb-attach-static.c := $(CFLAGS-printers-tests)
453CPPFLAGS-tst-pthread-gdb-attach-static.c := \
454 $(CFLAGS-printers-tests) -DDO_ADD_SYMBOL_FILE=0
6f3e54d4
FW
455# As of version 9.2, GDB cannot attach properly to PIE programs that
456# were launched with an explicit ld.so invocation.
457tst-pthread-gdb-attach-no-pie = yes
a64afc22 458
b600f477
CD
459tests += \
460 tst-cancelx7 \
461 tst-cancelx17 \
462 # tests
c8b82b81 463
dfdd294a 464ifeq ($(build-shared),yes)
b600f477
CD
465tests += \
466 tst-audit-threads \
467 tst-compat-forwarder \
468 # tests
469tests-internal += \
470 tst-stackguard1 \
471 tst-tls3 \
472 tst-tls3-malloc \
473 tst-tls5 \
474 # tests-internal
d9d30f6c 475ifeq ($(have-z-execstack)$(have-test-cc-trampoline),yesyes)
8c8eff33 476tests += tst-execstack-threads
54ee14b3 477endif
dfdd294a
UD
478endif
479
b600f477
CD
480modules-names = \
481 tst-audit-threads-mod1 \
482 tst-audit-threads-mod2 \
483 tst-compat-forwarder-mod \
b600f477
CD
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
494extra-test-objs += \
495 $(addsuffix .os,$(strip $(modules-names))) \
496 tst-cleanup4aux.o \
497 tst-cleanupx4aux.o \
498 # extra-test-objs
499test-extras += \
500 tst-cleanup4aux \
501 tst-cleanupx4aux \
502 # test-extras
dfdd294a 503
d9d30f6c
L
504ifneq ($(have-test-clang),yes)
505modules-names += \
506 tst-execstack-threads-mod \
507 # modules-names
508endif
509
1f2e5bfe
FW
510# This test exercises compat symbols removed in glibc 2.34.
511ifdef have-GLIBC_2.33
512tests += tst-cleanup4
513ifeq ($(build-shared),yes)
514tests += tst-cleanupx4
515endif
516endif
517
1a379ea0 518tst-tls3mod.so-no-z-defs = yes
c874a32e
UD
519tst-tls5mod.so-no-z-defs = yes
520tst-tls5moda.so-no-z-defs = yes
521tst-tls5modb.so-no-z-defs = yes
522tst-tls5modc.so-no-z-defs = yes
523tst-tls5modd.so-no-z-defs = yes
524tst-tls5mode.so-no-z-defs = yes
525tst-tls5modf.so-no-z-defs = yes
1a379ea0 526
76a50749 527ifeq ($(build-shared),yes)
81f3ac4c
UD
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
58c2859f 533 $(make-target-directory)
81f3ac4c
UD
534 dir=`$(CC) $(CFLAGS) $(CPPFLAGS) -print-multi-directory`; \
535 echo "multidir := $$dir" > $@T
536 mv -f $@T $@
537
76a50749
UD
538endif
539
36975e8e
L
540CFLAGS-ftrylockfile.c += $(libio-mtsafe)
541CFLAGS-funlockfile.c += $(libio-mtsafe)
d3c9f895 542
feca5e0b
UD
543link-libc-static := $(common-objpfx)libc.a $(static-gnulib) \
544 $(common-objpfx)libc.a
09d65ff3 545
b600f477
CD
546tests-static += \
547 tst-cancel24-static \
548 tst-mutex8-static \
549 tst-mutexpi8-static \
550 tst-pthread-gdb-attach-static \
42e48e72 551 tst-pthread-key1-static \
b600f477
CD
552 tst-pthread_exit-nothreads-static \
553 tst-sem11-static \
554 tst-sem12-static tst-cond11-static \
555 tst-stackguard1-static \
556 # tests-static
1e8bdc3a 557
62d97c34 558tests += tst-cancel24-static
ba144c17
L
559ifeq ($(static-cxx-tests),no)
560tests-unsupported += tst-cancel24-static
561endif
d6d74ec1 562
b600f477
CD
563tests-internal += \
564 tst-sem11-static \
565 tst-sem12-static \
566 tst-stackguard1-static \
567 # tests-internal
ccd8de9a 568xtests-static += tst-setuid1-static
2119dcfa 569
f214606a 570ifeq ($(run-built-tests),yes)
b600f477 571tests-special += \
332f8e62 572 $(objpfx)tst-dl-debug-tid.out \
b600f477 573 $(objpfx)tst-oddstacklimit.out \
b600f477 574 # tests-special
f214606a 575ifeq ($(build-shared),yes)
d6d74ec1 576tests-special += $(objpfx)tst-tls6.out
a7fe3e80
CD
577ifneq ($(PERL),no)
578tests-special += $(objpfx)tst-stack3-mem.out
579endif
f214606a
JM
580endif
581endif
582
44a6213c
RM
583ifeq (,$(CXX))
584# These tests require a C++ compiler and runtime.
b600f477
CD
585tests-unsupported += \
586 tst-cancel24 \
587 tst-cancel24-static \
588 tst-minstack-throw \
589 tst-once5 \
590 tst-thread-exit-clobber \
591 # tests-unsupported
44a6213c 592endif
99e1dc0a
FW
593# These tests require a C++ compiler and runtime with thread_local support.
594ifneq ($(have-cxx-thread_local),yes)
10d200db 595tests-unsupported += tst-thread_local1
99e1dc0a 596endif
44a6213c 597
87293ddc
UD
598include ../Rules
599
dfdd294a
UD
600ifeq (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.
603lib-noranlib: $(addprefix $(objpfx),$(extra-objs))
09d65ff3
UD
604endif
605
76a50749 606
0c5d3ed9
UD
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.
574b892e 611CFLAGS-pthread_self.os += -fomit-frame-pointer
76a50749 612
7726edc2
UD
613# Run the cancellation and cleanup tests also for the modern, exception-based
614# implementation. For this we have to pass the -fexceptions parameter.
7726edc2 615CFLAGS-tst-cancelx7.c += -fexceptions
60d73a7a 616CFLAGS-tst-cancelx17.c += -fexceptions
44e94149 617CFLAGS-tst-cleanupx4.c += -fexceptions
dfc9ea7b 618CFLAGS-tst-cleanupx4aux.c += -fexceptions
36975e8e 619CFLAGS-tst-initializers1.c += -W -Wall -Werror
5d42c8c3
RM
620CFLAGS-tst-initializers1-< = $(CFLAGS-tst-initializers1.c) \
621 $(patsubst tst-initializers1-%.c,-std=%,$<)
36975e8e
L
622CFLAGS-tst-initializers1-c89.c += $(CFLAGS-tst-initializers1-<)
623CFLAGS-tst-initializers1-c99.c += $(CFLAGS-tst-initializers1-<)
624CFLAGS-tst-initializers1-c11.c += $(CFLAGS-tst-initializers1-<)
625CFLAGS-tst-initializers1-gnu89.c += $(CFLAGS-tst-initializers1-<)
626CFLAGS-tst-initializers1-gnu99.c += $(CFLAGS-tst-initializers1-<)
627CFLAGS-tst-initializers1-gnu11.c += $(CFLAGS-tst-initializers1-<)
7726edc2 628
740b3dbe 629tst-cancel7-ARGS = --command "exec $(host-test-program-cmd)"
01ff02d0 630tst-cancelx7-ARGS = $(tst-cancel7-ARGS)
b74121ae 631
2d2d9f2b
SP
632tst-stack3-ENV = MALLOC_TRACE=$(objpfx)tst-stack3.mtrace \
633 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
0b20a9e8 634$(objpfx)tst-stack3-mem.out: $(objpfx)tst-stack3.out
f0881698
JM
635 $(common-objpfx)malloc/mtrace $(objpfx)tst-stack3.mtrace > $@; \
636 $(evaluate-test)
a7fe3e80
CD
637
638ifeq ($(run-built-tests),yes)
639ifeq (yes,$(build-shared))
640ifneq ($(PERL),no)
b600f477
CD
641generated += \
642 tst-stack3-mem.out \
643 tst-stack3.mtrace \
644 # generated
a7fe3e80
CD
645endif
646endif
647endif
e796f92f 648
d8dd0080
L
649tst-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 $< $@
658clean:
659 rm -f $(tst-stack4mod.sos)
660
ac0353af
FW
661$(objpfx)tst-cleanup4: $(objpfx)tst-cleanup4aux.o
662$(objpfx)tst-cleanupx4: $(objpfx)tst-cleanupx4aux.o
44e94149 663
ffeb4481 664LDFLAGS-tst-tls3 = -rdynamic
3edca7f5 665LDFLAGS-tst-tls3mod.so = -Wl,-z,lazy
ffeb4481 666$(objpfx)tst-tls3.out: $(objpfx)tst-tls3mod.so
ffeb4481 667
6c444ad6
FW
668LDFLAGS-tst-tls3-malloc = -rdynamic
669$(objpfx)tst-tls3-malloc.out: $(objpfx)tst-tls3mod.so
670
ac0353af 671$(objpfx)tst-tls5: $(objpfx)tst-tls5mod.so
8b196ac4 672LDFLAGS-tst-tls5 = -Wl,--no-as-needed
701d185c 673LDFLAGS-tst-tls5mod.so = -Wl,-soname,tst-tls5mod.so
c874a32e
UD
674
675ifeq ($(build-shared),yes)
c874a32e
UD
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
740b3dbe 680 $(BASH) $< $(common-objpfx) '$(test-via-rtld-prefix)' \
8f8052c2 681 '$(test-wrapper-env)' '$(run-program-env)'; \
f0881698 682 $(evaluate-test)
c874a32e
UD
683endif
684
8b196ac4 685LDLIBS-tst-cancel24 = -Wl,--no-as-needed -lstdc++
1d1b34df 686LDLIBS-tst-cancel24-static = $(LDLIBS-tst-cancel24)
7735afa2 687
dd7a8ad7 688ifeq ($(build-shared),yes)
dd7a8ad7 689
b600f477
CD
690generated += \
691 multidir.mk \
692 tst-tls6.out \
693 # generated
76a50749 694endif
f077a4a9 695
740b3dbe 696tst-exec4-ARGS = $(host-test-program-cmd)
54ee14b3 697
8c8eff33
FW
698$(objpfx)tst-execstack-threads.out: $(objpfx)tst-execstack-threads-mod.so
699LDFLAGS-tst-execstack-threads = -Wl,-z,noexecstack
e21aa9b9 700LDFLAGS-tst-execstack-threads-mod.so = -Wl,-z,execstack
8c8eff33 701CFLAGS-tst-execstack-threads-mod.c += -Wno-trampolines
a2bd5008
SJ
702ifeq ($(have-no-error-execstack),yes)
703LDFLAGS-tst-execstack-threads-mod.so += -Wl,--no-error-execstack
704endif
893a3511 705
740b3dbe 706tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child"
35f1e827
UD
707tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
708
0bf57f87 709ifeq ($(run-built-tests),yes)
332f8e62
FB
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
0bf57f87 715$(objpfx)tst-oddstacklimit.out: $(objpfx)tst-oddstacklimit $(objpfx)tst-basic1
f0881698
JM
716 $(test-program-prefix) $< --command '$(host-test-program-cmd)' > $@; \
717 $(evaluate-test)
0bf57f87
JM
718endif
719
40c06a3d
AS
720$(objpfx)tst-compat-forwarder: $(objpfx)tst-compat-forwarder-mod.so
721
e5d262ef
TMQMF
722# Protect against a build using -Wl,-z,now.
723LDFLAGS-tst-audit-threads-mod1.so = -Wl,-z,lazy
724LDFLAGS-tst-audit-threads-mod2.so = -Wl,-z,lazy
725LDFLAGS-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
728tst-audit-threads-ENV = LD_AUDIT=$(objpfx)tst-audit-threads-mod1.so
729
def67465
FW
730# The test uses dlopen indirectly and would otherwise load system
731# objects.
732tst-setuid1-static-ENV = \
3dbbd2ff 733 LD_LIBRARY_PATH=$(ld-library-path):$(common-objpfx)elf:$(common-objpfx)nss
def67465 734
fee9e40a
AZ
735tst-pthread-proc-maps-ENV = \
736 GLIBC_TUNABLES=glibc.malloc.arena_max=8:glibc.malloc.mmap_threshold=1024
737tst-pthread-proc-maps-ARGS = 8
738
7e560880
FW
739# The tests here better do not run in parallel.
740ifeq ($(run-built-tests),yes)
893a3511
UD
741ifneq ($(filter %tests,$(MAKECMDGOALS)),)
742.NOTPARALLEL:
743endif
7e560880 744endif