]> git.ipfire.org Git - thirdparty/glibc.git/blame - nptl/Makefile
LoongArch: Ensure sp 16-byte aligned for tlsdesc
[thirdparty/glibc.git] / nptl / Makefile
CommitLineData
dff8da6b 1# Copyright (C) 2002-2024 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 \
8923b996 66 pthread_atfork \
331c6e8a 67 pthread_attr_copy \
8923b996 68 pthread_attr_destroy \
7538d461 69 pthread_attr_extension \
f5bc5f6e 70 pthread_attr_getaffinity \
8923b996 71 pthread_attr_getdetachstate \
b5668f08 72 pthread_attr_getguardsize \
8923b996
FW
73 pthread_attr_getinheritsched \
74 pthread_attr_getschedparam \
ce197a6e 75 pthread_attr_getschedpolicy \
ed0a69b6 76 pthread_attr_getscope \
ec41af45 77 pthread_attr_getsigmask \
fb7abc34 78 pthread_attr_getstack \
b5e75df2 79 pthread_attr_getstackaddr \
ee092efe 80 pthread_attr_getstacksize \
8923b996 81 pthread_attr_init \
1979819d 82 pthread_attr_setaffinity \
8923b996 83 pthread_attr_setdetachstate \
da069d17 84 pthread_attr_setguardsize \
8923b996
FW
85 pthread_attr_setinheritsched \
86 pthread_attr_setschedparam \
f0929a22 87 pthread_attr_setschedpolicy \
dc260acd 88 pthread_attr_setscope \
ec41af45
FW
89 pthread_attr_setsigmask \
90 pthread_attr_setsigmask_internal \
b855e52b 91 pthread_attr_setstack \
736c57c9 92 pthread_attr_setstackaddr \
870218fb 93 pthread_attr_setstacksize \
43b3746a 94 pthread_barrier_destroy \
f1af331c 95 pthread_barrier_init \
b9aec0dd 96 pthread_barrier_wait \
bbacf0f5 97 pthread_barrierattr_destroy \
39e74af2 98 pthread_barrierattr_getpshared \
e731212b 99 pthread_barrierattr_init \
3f0808ef 100 pthread_barrierattr_setpshared \
d7c51fe4 101 pthread_cancel \
4647ce82 102 pthread_cleanup_upto \
ddd4a2d3 103 pthread_clockjoin \
08129b15 104 pthread_cond_broadcast \
dc6cfdc9 105 pthread_cond_destroy \
ad96df2c 106 pthread_cond_init \
08129b15
FW
107 pthread_cond_signal \
108 pthread_cond_wait \
249afce2 109 pthread_condattr_destroy \
ed00dcbb 110 pthread_condattr_getclock \
2a775a9e 111 pthread_condattr_getpshared \
7da5c345 112 pthread_condattr_init \
6a75fefc 113 pthread_condattr_setclock \
d9b600c9 114 pthread_condattr_setpshared \
f47f1d91 115 pthread_create \
df65f897 116 pthread_detach \
8923b996 117 pthread_equal \
c62cef02 118 pthread_exit \
52302bc2 119 pthread_getaffinity \
8f72bed1 120 pthread_getattr_default_np \
07a73d52 121 pthread_getattr_np \
fec776b8 122 pthread_getconcurrency \
310e59e6 123 pthread_getcpuclockid \
c924e44a 124 pthread_getname \
d5074b30 125 pthread_getschedparam \
aae43acf 126 pthread_getspecific \
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 \
798cacde 207 tpp \
1d95b035 208 unwind \
8c1c0da3 209 vars \
b600f477 210 # routines
8923b996 211
bd60ce86 212static-only-routines = pthread_atfork
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.
36975e8e 238CFLAGS-cancellation.c += -fasynchronous-unwind-tables
7726edc2
UD
239
240# Calling pthread_exit() must cause the registered cancel handlers to
241# be executed. Therefore exceptions have to be thrown through this
242# function.
36975e8e 243CFLAGS-pthread_exit.c += -fexceptions
7726edc2 244
26676450
UD
245# Among others, __pthread_unwind is forwarded. This function must handle
246# exceptions.
36975e8e 247CFLAGS-forward.c += -fexceptions
26676450 248
7726edc2
UD
249# The following are cancellation points. Some of the functions can
250# block and therefore temporarily enable asynchronous cancellation.
251# Those must be compiled asynchronous unwind tables.
36975e8e
L
252CFLAGS-pthread_testcancel.c += -fexceptions
253CFLAGS-pthread_join.c += -fexceptions -fasynchronous-unwind-tables
254CFLAGS-pthread_timedjoin.c += -fexceptions -fasynchronous-unwind-tables
69ca4b54 255CFLAGS-pthread_clockjoin.c += -fexceptions -fasynchronous-unwind-tables
36975e8e 256CFLAGS-pthread_once.c += $(uses-callbacks) -fexceptions \
e07bb02a 257 -fasynchronous-unwind-tables
36975e8e 258CFLAGS-pthread_cond_wait.c += -fexceptions -fasynchronous-unwind-tables
f779b1ef 259CFLAGS-pthread_kill.c = -fexceptions -fasynchronous-unwind-tables
36975e8e
L
260CFLAGS-sem_wait.c += -fexceptions -fasynchronous-unwind-tables
261CFLAGS-sem_timedwait.c += -fexceptions -fasynchronous-unwind-tables
6615f779 262CFLAGS-sem_clockwait.c = -fexceptions -fasynchronous-unwind-tables
bf293afe 263
541e53c9
FW
264CFLAGS-futex-internal.c += -fexceptions -fasynchronous-unwind-tables
265
ed225df3 266LDLIBS-tst-once5 = -lstdc++
99e1dc0a
FW
267CFLAGS-tst-thread_local1.o = -std=gnu++11
268LDLIBS-tst-thread_local1 = -lstdc++
579396ee
FW
269CFLAGS-tst-thread-exit-clobber.o = -std=gnu++11
270LDLIBS-tst-thread-exit-clobber = -lstdc++
b725132d 271CFLAGS-tst-minstack-throw.o = -std=gnu++11
860b0240 272LDLIBS-tst-minstack-throw = -lstdc++
76a50749 273
b600f477
CD
274tests = \
275 tst-attr2 \
276 tst-attr3 \
277 tst-cancel4_1 \
278 tst-cancel4_2 \
279 tst-cancel7 \
280 tst-cancel17 \
281 tst-cancel24 \
282 tst-cond26 \
283 tst-context1 \
284 tst-default-attr \
285 tst-dlsym1 \
286 tst-exec4 \
287 tst-exec5 \
288 tst-initializers1 \
289 tst-initializers1-c11 \
290 tst-initializers1-c89 \
291 tst-initializers1-c99 \
292 tst-initializers1-gnu11 \
293 tst-initializers1-gnu89 \
294 tst-initializers1-gnu99 \
295 tst-minstack-cancel \
296 tst-minstack-exit \
297 tst-minstack-throw \
298 tst-mutex5a \
299 tst-mutex7a \
300 tst-mutexpi1 \
301 tst-mutexpi2 \
302 tst-mutexpi3 \
303 tst-mutexpi4 \
304 tst-mutexpi5 \
305 tst-mutexpi6 \
306 tst-mutexpi7 \
307 tst-mutexpi9 \
308 tst-mutexpi10 \
309 tst-mutexpi11 \
310 tst-mutexpi12 \
311 tst-once5 \
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 \
42e48e72 318 tst-pthread-key1-static \
b600f477
CD
319 tst-pthread-timedlock-lockloop \
320 tst-pthread_exit-nothreads \
321 tst-pthread_exit-nothreads-static \
322 tst-robust-fork \
323 tst-robustpi1 \
324 tst-robustpi2 \
325 tst-robustpi3 \
326 tst-robustpi4 \
327 tst-robustpi5 \
328 tst-robustpi6 \
329 tst-robustpi7 \
330 tst-robustpi9 \
331 tst-rwlock-pwn \
332 tst-rwlock2 \
333 tst-rwlock3 \
334 tst-rwlock6 \
335 tst-rwlock7 \
336 tst-rwlock8 \
337 tst-rwlock9 \
338 tst-rwlock10 \
339 tst-rwlock11 \
340 tst-rwlock15 \
341 tst-rwlock17 \
342 tst-rwlock18 \
343 tst-rwlock21 \
344 tst-rwlock22 \
345 tst-sched1 \
346 tst-sem17 \
347 tst-signal3 \
348 tst-stack2 \
349 tst-stack3 \
350 tst-stack4 \
351 tst-thread-affinity-pthread \
352 tst-thread-affinity-pthread2 \
353 tst-thread-affinity-sched \
354 tst-thread-exit-clobber \
355 tst-thread-setspecific \
356 tst-thread_local1 \
357 tst-tsd3 \
358 tst-tsd4 \
359 # tests
c62cef02
FW
360
361tests-nolibpthread = \
362 tst-pthread_exit-nothreads \
363 tst-pthread_exit-nothreads-static \
b600f477 364 # tests-nolibpthread
7c3018f9 365
279c68ce
DD
366tests-container = tst-pthread-getattr
367
b600f477
CD
368tests-internal := \
369 tst-barrier5 \
370 tst-cond22 \
371 tst-mutex8 \
372 tst-mutex8-static \
373 tst-mutexpi8 \
374 tst-mutexpi8-static \
375 tst-robustpi8 \
376 tst-rwlock19 \
377 tst-rwlock20 \
378 tst-sem11 \
379 tst-sem12 \
380 tst-sem13 \
381 tst-setgetname \
382 tst-signal7 \
383 # tests-internal
384
385xtests = \
386 tst-mutexpp1 \
387 tst-mutexpp5 \
388 tst-mutexpp6 \
389 tst-mutexpp9 \
390 tst-mutexpp10 \
391 tst-setgroups \
392 tst-setuid1 \
393 tst-setuid1-static \
394 tst-setuid2 \
395 # xtests
18aa51ee 396
088d3291
AZ
397tests-time64 := \
398 tst-cancel4_2-time64
b600f477 399 # tests-time64
088d3291 400
18aa51ee
SN
401# This test can run into task limits because of a linux kernel bug
402# and then cause the make process to fail too, see bug 24537.
403xtests += tst-eintr1
404
0bf57f87 405test-srcs = tst-oddstacklimit
432aaf5b 406
359a0b9d 407gen-as-const-headers = unwindbuf.sym
08192659 408
23b5cae1
MG
409gen-py-const-headers := nptl_lock_constants.pysym
410pretty-printers := nptl-printers.py
b600f477
CD
411tests-printers := \
412 test-cond-printers \
413 test-condattr-printers \
414 test-mutex-printers \
415 test-mutexattr-printers \
416 test-rwlock-printers \
417 test-rwlockattr-printers \
418 # tests-printers
23b5cae1 419
81e0662e
CD
420# We must specify both CFLAGS and CPPFLAGS to override any
421# compiler options the user might have provided that conflict
422# with what we need e.g. user specifies CPPFLAGS with -O2 and
423# we need -O0.
23b5cae1
MG
424CFLAGS-test-mutexattr-printers.c := $(CFLAGS-printers-tests)
425CFLAGS-test-mutex-printers.c := $(CFLAGS-printers-tests)
426CFLAGS-test-condattr-printers.c := $(CFLAGS-printers-tests)
427CFLAGS-test-cond-printers.c := $(CFLAGS-printers-tests)
428CFLAGS-test-rwlockattr-printers.c := $(CFLAGS-printers-tests)
429CFLAGS-test-rwlock-printers.c := $(CFLAGS-printers-tests)
81e0662e
CD
430CPPFLAGS-test-mutexattr-printers.c := $(CFLAGS-printers-tests)
431CPPFLAGS-test-mutex-printers.c := $(CFLAGS-printers-tests)
432CPPFLAGS-test-condattr-printers.c := $(CFLAGS-printers-tests)
433CPPFLAGS-test-cond-printers.c := $(CFLAGS-printers-tests)
434CPPFLAGS-test-rwlockattr-printers.c := $(CFLAGS-printers-tests)
435CPPFLAGS-test-rwlock-printers.c := $(CFLAGS-printers-tests)
23b5cae1 436
a64afc22
FW
437# Reuse the CFLAGS setting for the GDB attaching test. It needs
438# debugging information.
439CFLAGS-tst-pthread-gdb-attach.c := $(CFLAGS-printers-tests)
440CPPFLAGS-tst-pthread-gdb-attach.c := $(CFLAGS-printers-tests)
441ifeq ($(build-shared)$(build-hardcoded-path-in-tests),yesno)
442CPPFLAGS-tst-pthread-gdb-attach.c += -DDO_ADD_SYMBOL_FILE=1
443else
444CPPFLAGS-tst-pthread-gdb-attach.c += -DDO_ADD_SYMBOL_FILE=0
445endif
446CFLAGS-tst-pthread-gdb-attach-static.c := $(CFLAGS-printers-tests)
447CPPFLAGS-tst-pthread-gdb-attach-static.c := \
448 $(CFLAGS-printers-tests) -DDO_ADD_SYMBOL_FILE=0
6f3e54d4
FW
449# As of version 9.2, GDB cannot attach properly to PIE programs that
450# were launched with an explicit ld.so invocation.
451tst-pthread-gdb-attach-no-pie = yes
a64afc22 452
b600f477
CD
453tests += \
454 tst-cancelx7 \
455 tst-cancelx17 \
456 # tests
c8b82b81 457
dfdd294a 458ifeq ($(build-shared),yes)
b600f477
CD
459tests += \
460 tst-audit-threads \
461 tst-compat-forwarder \
462 # tests
463tests-internal += \
464 tst-stackguard1 \
465 tst-tls3 \
466 tst-tls3-malloc \
467 tst-tls5 \
468 # tests-internal
54ee14b3 469ifeq ($(have-z-execstack),yes)
8c8eff33 470tests += tst-execstack-threads
54ee14b3 471endif
dfdd294a
UD
472endif
473
b600f477
CD
474modules-names = \
475 tst-audit-threads-mod1 \
476 tst-audit-threads-mod2 \
477 tst-compat-forwarder-mod \
8c8eff33 478 tst-execstack-threads-mod \
b600f477
CD
479 tst-stack4mod \
480 tst-tls3mod \
481 tst-tls5mod \
482 tst-tls5moda \
483 tst-tls5modb \
484 tst-tls5modc \
485 tst-tls5modd \
486 tst-tls5mode \
487 tst-tls5modf \
488 # modules-names
489extra-test-objs += \
490 $(addsuffix .os,$(strip $(modules-names))) \
491 tst-cleanup4aux.o \
492 tst-cleanupx4aux.o \
493 # extra-test-objs
494test-extras += \
495 tst-cleanup4aux \
496 tst-cleanupx4aux \
497 # test-extras
dfdd294a 498
1f2e5bfe
FW
499# This test exercises compat symbols removed in glibc 2.34.
500ifdef have-GLIBC_2.33
501tests += tst-cleanup4
502ifeq ($(build-shared),yes)
503tests += tst-cleanupx4
504endif
505endif
506
1a379ea0 507tst-tls3mod.so-no-z-defs = yes
c874a32e
UD
508tst-tls5mod.so-no-z-defs = yes
509tst-tls5moda.so-no-z-defs = yes
510tst-tls5modb.so-no-z-defs = yes
511tst-tls5modc.so-no-z-defs = yes
512tst-tls5modd.so-no-z-defs = yes
513tst-tls5mode.so-no-z-defs = yes
514tst-tls5modf.so-no-z-defs = yes
1a379ea0 515
76a50749 516ifeq ($(build-shared),yes)
81f3ac4c
UD
517
518# Set the `multidir' variable by grabbing the variable from the compiler.
519# We do it once and save the result in a generated makefile.
520-include $(objpfx)multidir.mk
521$(objpfx)multidir.mk: $(common-objpfx)config.make
58c2859f 522 $(make-target-directory)
81f3ac4c
UD
523 dir=`$(CC) $(CFLAGS) $(CPPFLAGS) -print-multi-directory`; \
524 echo "multidir := $$dir" > $@T
525 mv -f $@T $@
526
76a50749
UD
527endif
528
36975e8e
L
529CFLAGS-ftrylockfile.c += $(libio-mtsafe)
530CFLAGS-funlockfile.c += $(libio-mtsafe)
d3c9f895 531
feca5e0b
UD
532link-libc-static := $(common-objpfx)libc.a $(static-gnulib) \
533 $(common-objpfx)libc.a
09d65ff3 534
b600f477
CD
535tests-static += \
536 tst-cancel24-static \
537 tst-mutex8-static \
538 tst-mutexpi8-static \
539 tst-pthread-gdb-attach-static \
42e48e72 540 tst-pthread-key1-static \
b600f477
CD
541 tst-pthread_exit-nothreads-static \
542 tst-sem11-static \
543 tst-sem12-static tst-cond11-static \
544 tst-stackguard1-static \
545 # tests-static
1e8bdc3a 546
62d97c34 547tests += tst-cancel24-static
d6d74ec1 548
b600f477
CD
549tests-internal += \
550 tst-sem11-static \
551 tst-sem12-static \
552 tst-stackguard1-static \
553 # tests-internal
ccd8de9a 554xtests-static += tst-setuid1-static
2119dcfa 555
f214606a 556ifeq ($(run-built-tests),yes)
b600f477
CD
557tests-special += \
558 $(objpfx)tst-oddstacklimit.out \
559 $(objpfx)tst-stack3-mem.out \
560 # tests-special
f214606a 561ifeq ($(build-shared),yes)
d6d74ec1 562tests-special += $(objpfx)tst-tls6.out
f214606a
JM
563endif
564endif
565
44a6213c
RM
566ifeq (,$(CXX))
567# These tests require a C++ compiler and runtime.
b600f477
CD
568tests-unsupported += \
569 tst-cancel24 \
570 tst-cancel24-static \
571 tst-minstack-throw \
572 tst-once5 \
573 tst-thread-exit-clobber \
574 # tests-unsupported
44a6213c 575endif
99e1dc0a
FW
576# These tests require a C++ compiler and runtime with thread_local support.
577ifneq ($(have-cxx-thread_local),yes)
10d200db 578tests-unsupported += tst-thread_local1
99e1dc0a 579endif
44a6213c 580
87293ddc
UD
581include ../Rules
582
dfdd294a
UD
583ifeq (yes,$(build-shared))
584# Make sure these things are built in the `make lib' pass so they can be used
585# to run programs during the `make others' pass.
586lib-noranlib: $(addprefix $(objpfx),$(extra-objs))
09d65ff3
UD
587endif
588
76a50749 589
0c5d3ed9
UD
590# 'pthread_self' is a simple memory or register load. Setting up the
591# stack frame is more work than the actual operation. Disable the
592# frame creation entirely. This will help applications which call the
593# function frequently to get a thread-specific handle.
574b892e 594CFLAGS-pthread_self.os += -fomit-frame-pointer
76a50749 595
7726edc2
UD
596# Run the cancellation and cleanup tests also for the modern, exception-based
597# implementation. For this we have to pass the -fexceptions parameter.
7726edc2 598CFLAGS-tst-cancelx7.c += -fexceptions
60d73a7a 599CFLAGS-tst-cancelx17.c += -fexceptions
44e94149 600CFLAGS-tst-cleanupx4.c += -fexceptions
dfc9ea7b 601CFLAGS-tst-cleanupx4aux.c += -fexceptions
36975e8e 602CFLAGS-tst-initializers1.c += -W -Wall -Werror
5d42c8c3
RM
603CFLAGS-tst-initializers1-< = $(CFLAGS-tst-initializers1.c) \
604 $(patsubst tst-initializers1-%.c,-std=%,$<)
36975e8e
L
605CFLAGS-tst-initializers1-c89.c += $(CFLAGS-tst-initializers1-<)
606CFLAGS-tst-initializers1-c99.c += $(CFLAGS-tst-initializers1-<)
607CFLAGS-tst-initializers1-c11.c += $(CFLAGS-tst-initializers1-<)
608CFLAGS-tst-initializers1-gnu89.c += $(CFLAGS-tst-initializers1-<)
609CFLAGS-tst-initializers1-gnu99.c += $(CFLAGS-tst-initializers1-<)
610CFLAGS-tst-initializers1-gnu11.c += $(CFLAGS-tst-initializers1-<)
7726edc2 611
740b3dbe 612tst-cancel7-ARGS = --command "exec $(host-test-program-cmd)"
01ff02d0 613tst-cancelx7-ARGS = $(tst-cancel7-ARGS)
b74121ae 614
2d2d9f2b
SP
615tst-stack3-ENV = MALLOC_TRACE=$(objpfx)tst-stack3.mtrace \
616 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
0b20a9e8 617$(objpfx)tst-stack3-mem.out: $(objpfx)tst-stack3.out
f0881698
JM
618 $(common-objpfx)malloc/mtrace $(objpfx)tst-stack3.mtrace > $@; \
619 $(evaluate-test)
b600f477
CD
620generated += \
621 tst-stack3-mem.out \
622 tst-stack3.mtrace \
623 # generated
e796f92f 624
d8dd0080
L
625tst-stack4mod.sos=$(shell for i in 0 1 2 3 4 5 6 7 8 9 10 \
626 11 12 13 14 15 16 17 18 19; do \
627 for j in 0 1 2 3 4 5 6 7 8 9 10 \
628 11 12 13 14 15 16 17 18 19; do \
629 echo $(objpfx)tst-stack4mod-$$i-$$j.so; \
630 done; done)
631$(objpfx)tst-stack4.out: $(tst-stack4mod.sos)
632$(tst-stack4mod.sos): $(objpfx)tst-stack4mod.so
633 cp -f $< $@
634clean:
635 rm -f $(tst-stack4mod.sos)
636
ac0353af
FW
637$(objpfx)tst-cleanup4: $(objpfx)tst-cleanup4aux.o
638$(objpfx)tst-cleanupx4: $(objpfx)tst-cleanupx4aux.o
44e94149 639
ffeb4481 640LDFLAGS-tst-tls3 = -rdynamic
3edca7f5 641LDFLAGS-tst-tls3mod.so = -Wl,-z,lazy
ffeb4481 642$(objpfx)tst-tls3.out: $(objpfx)tst-tls3mod.so
ffeb4481 643
6c444ad6
FW
644LDFLAGS-tst-tls3-malloc = -rdynamic
645$(objpfx)tst-tls3-malloc.out: $(objpfx)tst-tls3mod.so
646
ac0353af 647$(objpfx)tst-tls5: $(objpfx)tst-tls5mod.so
8b196ac4 648LDFLAGS-tst-tls5 = -Wl,--no-as-needed
701d185c 649LDFLAGS-tst-tls5mod.so = -Wl,-soname,tst-tls5mod.so
c874a32e
UD
650
651ifeq ($(build-shared),yes)
c874a32e
UD
652$(objpfx)tst-tls6.out: tst-tls6.sh $(objpfx)tst-tls5 \
653 $(objpfx)tst-tls5moda.so $(objpfx)tst-tls5modb.so \
654 $(objpfx)tst-tls5modc.so $(objpfx)tst-tls5modd.so \
655 $(objpfx)tst-tls5mode.so $(objpfx)tst-tls5modf.so
740b3dbe 656 $(BASH) $< $(common-objpfx) '$(test-via-rtld-prefix)' \
8f8052c2 657 '$(test-wrapper-env)' '$(run-program-env)'; \
f0881698 658 $(evaluate-test)
c874a32e
UD
659endif
660
8b196ac4 661LDLIBS-tst-cancel24 = -Wl,--no-as-needed -lstdc++
1d1b34df 662LDLIBS-tst-cancel24-static = $(LDLIBS-tst-cancel24)
7735afa2 663
dd7a8ad7 664ifeq ($(build-shared),yes)
dd7a8ad7 665
b600f477
CD
666generated += \
667 multidir.mk \
668 tst-tls6.out \
669 # generated
76a50749 670endif
f077a4a9 671
740b3dbe 672tst-exec4-ARGS = $(host-test-program-cmd)
54ee14b3 673
8c8eff33
FW
674$(objpfx)tst-execstack-threads.out: $(objpfx)tst-execstack-threads-mod.so
675LDFLAGS-tst-execstack-threads = -Wl,-z,noexecstack
e21aa9b9 676LDFLAGS-tst-execstack-threads-mod.so = -Wl,-z,execstack
8c8eff33 677CFLAGS-tst-execstack-threads-mod.c += -Wno-trampolines
893a3511 678
740b3dbe 679tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child"
35f1e827
UD
680tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
681
0bf57f87 682ifeq ($(run-built-tests),yes)
0bf57f87 683$(objpfx)tst-oddstacklimit.out: $(objpfx)tst-oddstacklimit $(objpfx)tst-basic1
f0881698
JM
684 $(test-program-prefix) $< --command '$(host-test-program-cmd)' > $@; \
685 $(evaluate-test)
0bf57f87
JM
686endif
687
40c06a3d
AS
688$(objpfx)tst-compat-forwarder: $(objpfx)tst-compat-forwarder-mod.so
689
403b4feb
SL
690tst-mutex10-ENV = GLIBC_TUNABLES=glibc.elision.enable=1
691
e5d262ef
TMQMF
692# Protect against a build using -Wl,-z,now.
693LDFLAGS-tst-audit-threads-mod1.so = -Wl,-z,lazy
694LDFLAGS-tst-audit-threads-mod2.so = -Wl,-z,lazy
695LDFLAGS-tst-audit-threads = -Wl,-z,lazy
696$(objpfx)tst-audit-threads: $(objpfx)tst-audit-threads-mod2.so
697$(objpfx)tst-audit-threads.out: $(objpfx)tst-audit-threads-mod1.so
698tst-audit-threads-ENV = LD_AUDIT=$(objpfx)tst-audit-threads-mod1.so
699
def67465
FW
700# The test uses dlopen indirectly and would otherwise load system
701# objects.
702tst-setuid1-static-ENV = \
3dbbd2ff 703 LD_LIBRARY_PATH=$(ld-library-path):$(common-objpfx)elf:$(common-objpfx)nss
def67465 704
fee9e40a
AZ
705tst-pthread-proc-maps-ENV = \
706 GLIBC_TUNABLES=glibc.malloc.arena_max=8:glibc.malloc.mmap_threshold=1024
707tst-pthread-proc-maps-ARGS = 8
708
7e560880
FW
709# The tests here better do not run in parallel.
710ifeq ($(run-built-tests),yes)
893a3511
UD
711ifneq ($(filter %tests,$(MAKECMDGOALS)),)
712.NOTPARALLEL:
713endif
7e560880 714endif