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