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