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