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