1 # Copyright (C) 2002-2021 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
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.
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.
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/>.
19 # Sub-makefile for NPTL portion of the library.
25 headers
:= pthread.h semaphore.h bits
/semaphore.h \
26 bits
/struct_mutex.h bits
/struct_rwlock.h
28 extra-libs
:= libpthread
29 extra-libs-others
:= $(extra-libs
)
42 libc_multiple_threads \
45 old_pthread_cond_destroy \
46 old_pthread_cond_init \
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 \
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 \
68 pthread_condattr_destroy \
69 pthread_condattr_init \
73 pthread_getschedparam \
75 pthread_setschedparam \
78 shared-only-routines
= forward
79 static-only-routines
= pthread_atfork
81 # We need to provide certain routines for compatibility with existing
83 pthread-compat-wrappers
= \
85 connect recv recvfrom send \
86 sendto fsync lseek lseek64 \
87 msync open open64 pause \
88 pread pread64 pwrite pwrite64 \
89 tcdrain msgrcv msgsnd \
93 libpthread-routines
= \
94 $(pthread-compat-wrappers
) \
99 cleanup_defer_compat \
110 old_pthread_cond_broadcast \
111 old_pthread_cond_signal \
112 old_pthread_cond_timedwait \
113 old_pthread_cond_wait \
121 pthread_attr_getaffinity \
122 pthread_attr_getguardsize \
123 pthread_attr_getstack \
124 pthread_attr_getstackaddr \
125 pthread_attr_getstacksize \
126 pthread_attr_setguardsize \
127 pthread_attr_setstack \
128 pthread_attr_setstackaddr \
129 pthread_attr_setstacksize \
130 pthread_barrier_destroy \
131 pthread_barrier_init \
132 pthread_barrier_wait \
133 pthread_barrierattr_destroy \
134 pthread_barrierattr_getpshared \
135 pthread_barrierattr_init \
136 pthread_barrierattr_setpshared \
139 pthread_cond_broadcast \
140 pthread_cond_signal \
142 pthread_condattr_getclock \
143 pthread_condattr_getpshared \
144 pthread_condattr_setclock \
145 pthread_condattr_setpshared \
149 pthread_getattr_default_np \
150 pthread_getconcurrency \
151 pthread_getcpuclockid \
153 pthread_getspecific \
155 pthread_join_common \
159 pthread_kill_other_threads \
160 pthread_mutex_cond_lock \
162 pthread_mutex_consistent \
163 pthread_mutex_destroy \
164 pthread_mutex_getprioceiling \
167 pthread_mutex_setprioceiling \
168 pthread_mutex_timedlock \
169 pthread_mutex_trylock \
170 pthread_mutex_unlock \
171 pthread_mutexattr_destroy \
172 pthread_mutexattr_getprioceiling \
173 pthread_mutexattr_getprotocol \
174 pthread_mutexattr_getpshared \
175 pthread_mutexattr_getrobust \
176 pthread_mutexattr_gettype \
177 pthread_mutexattr_init \
178 pthread_mutexattr_setprioceiling \
179 pthread_mutexattr_setprotocol \
180 pthread_mutexattr_setpshared \
181 pthread_mutexattr_setrobust \
182 pthread_mutexattr_settype \
184 pthread_rwlock_clockrdlock \
185 pthread_rwlock_clockwrlock \
186 pthread_rwlock_destroy \
187 pthread_rwlock_init \
188 pthread_rwlock_rdlock \
189 pthread_rwlock_timedrdlock \
190 pthread_rwlock_timedwrlock \
191 pthread_rwlock_tryrdlock \
192 pthread_rwlock_trywrlock \
193 pthread_rwlock_unlock \
194 pthread_rwlock_wrlock \
195 pthread_rwlockattr_destroy \
196 pthread_rwlockattr_getkind_np \
197 pthread_rwlockattr_getpshared \
198 pthread_rwlockattr_init \
199 pthread_rwlockattr_setkind_np \
200 pthread_rwlockattr_setpshared \
201 pthread_setaffinity \
202 pthread_setattr_default_np \
203 pthread_setcancelstate \
204 pthread_setcanceltype \
205 pthread_setconcurrency \
207 pthread_setschedprio \
208 pthread_setspecific \
210 pthread_spin_destroy \
213 pthread_spin_trylock \
214 pthread_spin_unlock \
234 unwind-forcedunwind \
238 libpthread-shared-only-routines
= \
241 unwind-forcedunwind \
244 # Since cancellation handling is in large parts handled using exceptions
245 # we have to compile some files with exception handling enabled, some
246 # even with asynchronous unwind tables.
248 # nptl-init.c contains sigcancel_handler().
249 CFLAGS-nptl-init.c
+= -fexceptions
-fasynchronous-unwind-tables
250 # The unwind code itself,
251 CFLAGS-unwind.c
+= -fexceptions
252 CFLAGS-unwind-forcedunwind.c
+= -fexceptions
-fasynchronous-unwind-tables
254 # The following three functions must be async-cancel safe.
255 CFLAGS-pthread_cancel.c
+= -fexceptions
-fasynchronous-unwind-tables
256 CFLAGS-pthread_setcancelstate.c
+= -fexceptions
-fasynchronous-unwind-tables
257 CFLAGS-pthread_setcanceltype.c
+= -fexceptions
-fasynchronous-unwind-tables
259 # These are internal functions which similar functionality as setcancelstate
261 CFLAGS-cancellation.c
+= -fasynchronous-unwind-tables
262 CFLAGS-libc-cancellation.c
+= -fasynchronous-unwind-tables
264 # Calling pthread_exit() must cause the registered cancel handlers to
265 # be executed. Therefore exceptions have to be thrown through this
267 CFLAGS-pthread_exit.c
+= -fexceptions
269 # Among others, __pthread_unwind is forwarded. This function must handle
271 CFLAGS-forward.c
+= -fexceptions
273 # The following are cancellation points. Some of the functions can
274 # block and therefore temporarily enable asynchronous cancellation.
275 # Those must be compiled asynchronous unwind tables.
276 CFLAGS-pthread_testcancel.c
+= -fexceptions
277 CFLAGS-pthread_join.c
+= -fexceptions
-fasynchronous-unwind-tables
278 CFLAGS-pthread_timedjoin.c
+= -fexceptions
-fasynchronous-unwind-tables
279 CFLAGS-pthread_clockjoin.c
+= -fexceptions
-fasynchronous-unwind-tables
280 CFLAGS-pthread_once.c
+= $(uses-callbacks
) -fexceptions \
281 -fasynchronous-unwind-tables
282 CFLAGS-pthread_cond_wait.c
+= -fexceptions
-fasynchronous-unwind-tables
283 CFLAGS-sem_wait.c
+= -fexceptions
-fasynchronous-unwind-tables
284 CFLAGS-sem_timedwait.c
+= -fexceptions
-fasynchronous-unwind-tables
285 CFLAGS-sem_clockwait.c
= -fexceptions
-fasynchronous-unwind-tables
287 # These are the function wrappers we have to duplicate here.
288 CFLAGS-fcntl.c
+= -fexceptions
-fasynchronous-unwind-tables
289 CFLAGS-fcntl64.c
+= -fexceptions
-fasynchronous-unwind-tables
290 CFLAGS-lockf.c
+= -fexceptions
291 CFLAGS-pread.c
+= -fexceptions
-fasynchronous-unwind-tables
292 CFLAGS-pread64.c
+= -fexceptions
-fasynchronous-unwind-tables
293 CFLAGS-pwrite.c
+= -fexceptions
-fasynchronous-unwind-tables
294 CFLAGS-pwrite64.c
+= -fexceptions
-fasynchronous-unwind-tables
295 CFLAGS-sigwait.c
+= -fexceptions
-fasynchronous-unwind-tables
296 CFLAGS-msgrcv.c
+= -fexceptions
-fasynchronous-unwind-tables
297 CFLAGS-msgsnd.c
+= -fexceptions
-fasynchronous-unwind-tables
298 CFLAGS-tcdrain.c
+= -fexceptions
-fasynchronous-unwind-tables
299 CFLAGS-open.c
+= -fexceptions
-fasynchronous-unwind-tables
300 CFLAGS-open64.c
+= -fexceptions
-fasynchronous-unwind-tables
301 CFLAGS-pause.c
+= -fexceptions
-fasynchronous-unwind-tables
302 CFLAGS-recv.c
+= -fexceptions
-fasynchronous-unwind-tables
303 CFLAGS-send.c
+= -fexceptions
-fasynchronous-unwind-tables
304 CFLAGS-accept.c
+= -fexceptions
-fasynchronous-unwind-tables
305 CFLAGS-sendto.c
+= -fexceptions
-fasynchronous-unwind-tables
306 CFLAGS-connect.c
+= -fexceptions
-fasynchronous-unwind-tables
307 CFLAGS-recvfrom.c
+= -fexceptions
-fasynchronous-unwind-tables
308 CFLAGS-recvmsg.c
+= -fexceptions
-fasynchronous-unwind-tables
309 CFLAGS-sendmsg.c
+= -fexceptions
-fasynchronous-unwind-tables
310 CFLAGS-close.c
+= -fexceptions
-fasynchronous-unwind-tables
311 CFLAGS-read.c
+= -fexceptions
-fasynchronous-unwind-tables
312 CFLAGS-sigsuspend.c
+= -fexceptions
-fasynchronous-unwind-tables
313 CFLAGS-msync.c
+= -fexceptions
-fasynchronous-unwind-tables
314 CFLAGS-fdatasync.c
+= -fexceptions
-fasynchronous-unwind-tables
315 CFLAGS-fsync.c
+= -fexceptions
-fasynchronous-unwind-tables
317 CFLAGS-pt-system.c
+= -fexceptions
319 CFLAGS-futex-internal.c
+= -fexceptions
-fasynchronous-unwind-tables
321 LDLIBS-tst-once5
= -lstdc
++
322 CFLAGS-tst-thread_local1.o
= -std
=gnu
++11
323 LDLIBS-tst-thread_local1
= -lstdc
++
324 CFLAGS-tst-thread-exit-clobber.o
= -std
=gnu
++11
325 LDLIBS-tst-thread-exit-clobber
= -lstdc
++
326 CFLAGS-tst-minstack-throw.o
= -std
=gnu
++11
327 LDLIBS-tst-minstack-throw
= -lstdc
++
329 tests
= tst-attr2 tst-attr3 tst-default-attr \
330 tst-mutex5a tst-mutex7a \
331 tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 \
332 tst-mutexpi5 tst-mutexpi5a tst-mutexpi6 tst-mutexpi7 tst-mutexpi7a \
333 tst-mutexpi9 tst-mutexpi10 \
334 tst-cond22 tst-cond26 \
335 tst-robustpi1 tst-robustpi2 tst-robustpi3 tst-robustpi4 tst-robustpi5 \
336 tst-robustpi6 tst-robustpi7 tst-robustpi9 \
337 tst-rwlock2 tst-rwlock2a tst-rwlock2b tst-rwlock3 \
338 tst-rwlock6 tst-rwlock7 tst-rwlock8 \
339 tst-rwlock9 tst-rwlock10 tst-rwlock11 \
340 tst-rwlock15 tst-rwlock17 tst-rwlock18 \
344 tst-cancel4_1 tst-cancel4_2 \
345 tst-cancel7 tst-cancel17 tst-cancel24 \
348 tst-exec4 tst-exec5 \
349 tst-stack2 tst-stack3 tst-stack4 \
350 tst-pthread-attr-affinity \
354 tst-initializers1
$(addprefix tst-initializers1-
,\
355 c89 gnu89 c99 gnu99 c11 gnu11
) \
358 tst-thread-exit-clobber tst-minstack-cancel tst-minstack-exit \
361 tst-thread-affinity-pthread \
362 tst-thread-affinity-pthread2 \
363 tst-thread-affinity-sched \
364 tst-pthread-defaultattr-free \
365 tst-pthread-attr-sigmask \
366 tst-pthread-timedlock-lockloop
368 tests-container
= tst-pthread-getattr
370 tests-internal
:= tst-robustpi8 tst-rwlock19 tst-rwlock20 \
371 tst-sem11 tst-sem12 tst-sem13 \
372 tst-barrier5 tst-signal7 tst-mutex8 tst-mutex8-static \
373 tst-mutexpi8 tst-mutexpi8-static \
376 xtests
= tst-setuid1 tst-setuid1-static tst-setuid2 \
377 tst-mutexpp1 tst-mutexpp6 tst-mutexpp10 tst-setgroups \
378 tst-mutexpp5 tst-mutexpp9
380 # This test can run into task limits because of a linux kernel bug
381 # and then cause the make process to fail too, see bug 24537.
384 test-srcs
= tst-oddstacklimit
386 gen-as-const-headers
= unwindbuf.sym \
387 pthread-pi-defines.sym
389 gen-py-const-headers
:= nptl_lock_constants.pysym
390 pretty-printers
:= nptl-printers.py
391 tests-printers
:= test-mutexattr-printers test-mutex-printers \
392 test-condattr-printers test-cond-printers \
393 test-rwlockattr-printers test-rwlock-printers
395 # We must specify both CFLAGS and CPPFLAGS to override any
396 # compiler options the user might have provided that conflict
397 # with what we need e.g. user specifies CPPFLAGS with -O2 and
399 CFLAGS-test-mutexattr-printers.c
:= $(CFLAGS-printers-tests
)
400 CFLAGS-test-mutex-printers.c
:= $(CFLAGS-printers-tests
)
401 CFLAGS-test-condattr-printers.c
:= $(CFLAGS-printers-tests
)
402 CFLAGS-test-cond-printers.c
:= $(CFLAGS-printers-tests
)
403 CFLAGS-test-rwlockattr-printers.c
:= $(CFLAGS-printers-tests
)
404 CFLAGS-test-rwlock-printers.c
:= $(CFLAGS-printers-tests
)
405 CPPFLAGS-test-mutexattr-printers.c
:= $(CFLAGS-printers-tests
)
406 CPPFLAGS-test-mutex-printers.c
:= $(CFLAGS-printers-tests
)
407 CPPFLAGS-test-condattr-printers.c
:= $(CFLAGS-printers-tests
)
408 CPPFLAGS-test-cond-printers.c
:= $(CFLAGS-printers-tests
)
409 CPPFLAGS-test-rwlockattr-printers.c
:= $(CFLAGS-printers-tests
)
410 CPPFLAGS-test-rwlock-printers.c
:= $(CFLAGS-printers-tests
)
412 ifeq ($(build-shared
),yes
)
413 tests-printers-libs
:= $(shared-thread-library
)
415 tests-printers-libs
:= $(static-thread-library
)
418 LDFLAGS-pthread.so
= -Wl
,--enable-new-dtags
,-z
,nodelete
,-z
,initfirst
420 tests
+= tst-cancelx7 tst-cancelx17 tst-cleanupx4
422 ifeq ($(build-shared
),yes
)
423 tests
+= tst-compat-forwarder tst-audit-threads
424 tests-internal
+= tst-tls3 tst-tls3-malloc tst-tls5 tst-stackguard1
425 ifeq ($(have-z-execstack
),yes
)
426 tests
+= tst-execstack
430 modules-names
= tst-tls3mod \
431 tst-tls5mod tst-tls5moda tst-tls5modb tst-tls5modc \
432 tst-tls5modd tst-tls5mode tst-tls5modf tst-stack4mod \
434 tst-compat-forwarder-mod tst-audit-threads-mod1 \
435 tst-audit-threads-mod2
436 extra-test-objs
+= $(addsuffix .os
,$(strip $(modules-names
))) \
437 tst-cleanup4aux.o tst-cleanupx4aux.o
438 test-extras
+= tst-cleanup4aux tst-cleanupx4aux
440 tst-tls3mod.so-no-z-defs
= yes
441 tst-tls5mod.so-no-z-defs
= yes
442 tst-tls5moda.so-no-z-defs
= yes
443 tst-tls5modb.so-no-z-defs
= yes
444 tst-tls5modc.so-no-z-defs
= yes
445 tst-tls5modd.so-no-z-defs
= yes
446 tst-tls5mode.so-no-z-defs
= yes
447 tst-tls5modf.so-no-z-defs
= yes
449 ifeq ($(build-shared
),yes
)
451 # Set the `multidir' variable by grabbing the variable from the compiler.
452 # We do it once and save the result in a generated makefile.
453 -include $(objpfx
)multidir.mk
454 $(objpfx
)multidir.mk
: $(common-objpfx
)config.make
455 $(make-target-directory
)
456 dir=`$(CC) $(CFLAGS) $(CPPFLAGS) -print-multi-directory`; \
457 echo
"multidir := $$dir" > $@T
462 ifneq (,$(patsubst .
,,$(multidir
)))
463 generated-dirs
+= $(firstword $(subst /, , $(multidir
)))
464 crti-objs
+= $(multidir
)/crti.o
465 crtn-objs
+= $(multidir
)/crtn.o
466 $(objpfx
)$(multidir
):
469 extra-objs
+= $(crti-objs
) $(crtn-objs
)
470 extra-objs
+= pt-crti.o
473 CFLAGS-flockfile.c
+= $(libio-mtsafe
)
474 CFLAGS-ftrylockfile.c
+= $(libio-mtsafe
)
475 CFLAGS-funlockfile.c
+= $(libio-mtsafe
)
477 link-libc-static
:= $(common-objpfx
)libc.a
$(static-gnulib
) \
478 $(common-objpfx
)libc.a
480 tests-static
+= tst-stackguard1-static \
481 tst-cancel24-static \
482 tst-mutex8-static tst-mutexpi8-static tst-sem11-static \
483 tst-sem12-static tst-cond11-static
485 tests
+= tst-cancel24-static
487 tests-internal
+= tst-sem11-static tst-sem12-static tst-stackguard1-static
488 xtests-static
+= tst-setuid1-static
490 ifeq ($(run-built-tests
),yes
)
491 tests-special
+= $(objpfx
)tst-stack3-mem.out
$(objpfx
)tst-oddstacklimit.out
492 ifeq ($(build-shared
),yes
)
493 tests-special
+= $(objpfx
)tst-tls6.out
498 # These tests require a C++ compiler and runtime.
499 tests-unsupported
+= tst-cancel24 tst-cancel24-static tst-once5 \
500 tst-thread-exit-clobber tst-minstack-throw
502 # These tests require a C++ compiler and runtime with thread_local support.
503 ifneq ($(have-cxx-thread_local
),yes
)
504 tests-unsupported
+= tst-thread_local1
509 ifeq (yes
,$(build-shared
))
510 # Make sure these things are built in the `make lib' pass so they can be used
511 # to run programs during the `make others' pass.
512 lib-noranlib
: $(addprefix $(objpfx
),$(extra-objs
))
516 # 'pthread_self' is a simple memory or register load. Setting up the
517 # stack frame is more work than the actual operation. Disable the
518 # frame creation entirely. This will help applications which call the
519 # function frequently to get a thread-specific handle.
520 CFLAGS-pthread_self.os
+= -fomit-frame-pointer
522 # Run the cancellation and cleanup tests also for the modern, exception-based
523 # implementation. For this we have to pass the -fexceptions parameter.
524 CFLAGS-tst-cancelx7.c
+= -fexceptions
525 CFLAGS-tst-cancelx17.c
+= -fexceptions
526 CFLAGS-tst-cleanupx4.c
+= -fexceptions
527 CFLAGS-tst-cleanupx4aux.c
+= -fexceptions
528 CFLAGS-tst-initializers1.c
+= -W
-Wall
-Werror
529 CFLAGS-tst-initializers1-
< = $(CFLAGS-tst-initializers1.c
) \
530 $(patsubst tst-initializers1-
%.c
,-std
=%,$<)
531 CFLAGS-tst-initializers1-c89.c
+= $(CFLAGS-tst-initializers1-
<)
532 CFLAGS-tst-initializers1-c99.c
+= $(CFLAGS-tst-initializers1-
<)
533 CFLAGS-tst-initializers1-c11.c
+= $(CFLAGS-tst-initializers1-
<)
534 CFLAGS-tst-initializers1-gnu89.c
+= $(CFLAGS-tst-initializers1-
<)
535 CFLAGS-tst-initializers1-gnu99.c
+= $(CFLAGS-tst-initializers1-
<)
536 CFLAGS-tst-initializers1-gnu11.c
+= $(CFLAGS-tst-initializers1-
<)
538 tst-cancel7-ARGS
= --command
"exec $(host-test-program-cmd)"
539 tst-cancelx7-ARGS
= $(tst-cancel7-ARGS
)
541 tst-stack3-ENV
= MALLOC_TRACE
=$(objpfx
)tst-stack3.mtrace
542 $(objpfx
)tst-stack3-mem.out
: $(objpfx
)tst-stack3.out
543 $(common-objpfx
)malloc
/mtrace
$(objpfx
)tst-stack3.mtrace
> $@
; \
545 generated
+= tst-stack3-mem.out tst-stack3.mtrace
547 $(objpfx
)tst-stack4
: $(libdl
) $(shared-thread-library
)
548 tst-stack4mod.sos
=$(shell for i in
0 1 2 3 4 5 6 7 8 9 10 \
549 11 12 13 14 15 16 17 18 19; do \
550 for j in
0 1 2 3 4 5 6 7 8 9 10 \
551 11 12 13 14 15 16 17 18 19; do \
552 echo
$(objpfx
)tst-stack4mod-
$$i-$$j.so
; \
554 $(objpfx
)tst-stack4.out
: $(tst-stack4mod.sos
)
555 $(tst-stack4mod.sos
): $(objpfx
)tst-stack4mod.so
558 rm -f
$(tst-stack4mod.sos
)
560 $(objpfx
)tst-cleanup4
: $(objpfx
)tst-cleanup4aux.o
$(shared-thread-library
)
561 $(objpfx
)tst-cleanupx4
: $(objpfx
)tst-cleanupx4aux.o
$(shared-thread-library
)
563 $(objpfx
)tst-tls3
: $(libdl
) $(shared-thread-library
)
564 LDFLAGS-tst-tls3
= -rdynamic
565 $(objpfx
)tst-tls3.out
: $(objpfx
)tst-tls3mod.so
566 $(objpfx
)tst-tls3mod.so
: $(shared-thread-library
)
568 $(objpfx
)tst-tls3-malloc
: $(libdl
) $(shared-thread-library
)
569 LDFLAGS-tst-tls3-malloc
= -rdynamic
570 $(objpfx
)tst-tls3-malloc.out
: $(objpfx
)tst-tls3mod.so
572 $(objpfx
)tst-tls5
: $(objpfx
)tst-tls5mod.so
$(shared-thread-library
)
573 LDFLAGS-tst-tls5
= -Wl
,--no-as-needed
574 LDFLAGS-tst-tls5mod.so
= -Wl
,-soname
,tst-tls5mod.so
576 ifeq ($(build-shared
),yes
)
577 $(objpfx
)tst-tls6.out
: tst-tls6.sh
$(objpfx
)tst-tls5 \
578 $(objpfx
)tst-tls5moda.so
$(objpfx
)tst-tls5modb.so \
579 $(objpfx
)tst-tls5modc.so
$(objpfx
)tst-tls5modd.so \
580 $(objpfx
)tst-tls5mode.so
$(objpfx
)tst-tls5modf.so
581 $(BASH
) $< $(common-objpfx
) '$(test-via-rtld-prefix)' \
582 '$(test-wrapper-env)' '$(run-program-env)'; \
586 $(objpfx
)tst-dlsym1
: $(libdl
) $(shared-thread-library
)
588 ifeq (yes
,$(build-shared
))
589 librt
= $(common-objpfx
)rt
/librt.so
591 librt
= $(common-objpfx
)rt
/librt.a
594 # `make check' sometimes triggers a rebuild of librt.so using this Makefile,
595 # which ignores librt's dependence on libpthread
596 $(common-objpfx
)rt
/librt.so
: $(shared-thread-library
)
598 $(objpfx
)tst-cancel17
: $(librt
)
599 $(objpfx
)tst-cancelx17
: $(librt
)
601 LDLIBS-tst-cancel24
= -Wl
,--no-as-needed
-lstdc
++
602 LDLIBS-tst-cancel24-static
= $(LDLIBS-tst-cancel24
)
604 extra-B-pthread.so
= -B
$(common-objpfx
)nptl
/
605 $(objpfx
)libpthread.so
: $(addprefix $(objpfx
),$(crti-objs
) $(crtn-objs
))
606 $(objpfx
)libpthread.so
: +preinit
+= $(addprefix $(objpfx
),$(crti-objs
))
607 $(objpfx
)libpthread.so
: +postinit
+= $(addprefix $(objpfx
),$(crtn-objs
))
609 # Make sure we link with the thread library.
610 ifeq ($(build-shared
),yes
)
611 $(addprefix $(objpfx
), \
612 $(filter-out $(tests-static
) $(xtests-static
) $(tests-reverse
) \
613 $(tests-nolibpthread
), \
614 $(tests
) $(tests-internal
) $(xtests
) $(test-srcs
) $(tests-container
))): \
615 $(objpfx
)libpthread.so
616 $(objpfx
)tst-unload
: $(libdl
)
617 # $(objpfx)../libc.so is used instead of $(common-objpfx)libc.so,
618 # since otherwise libpthread.so comes before libc.so when linking.
619 $(addprefix $(objpfx
), $(tests-reverse
)): \
620 $(objpfx
)..
/libc.so
$(objpfx
)libpthread.so
621 $(objpfx
)..
/libc.so
: $(common-objpfx
)libc.so
;
622 $(addprefix $(objpfx
),$(tests-static
) $(xtests-static
)): $(objpfx
)libpthread.a
624 $(addprefix $(objpfx
),$(tests
) $(test-srcs
)): $(objpfx
)libpthread.a
627 ifeq ($(build-shared
),yes
)
628 $(objpfx
)crti.o
: $(objpfx
)pt-crti.o
631 ifneq ($(multidir
),.
)
632 $(objpfx
)$(multidir
)/crti.o
: $(objpfx
)crti.o
$(objpfx
)$(multidir
)/
635 $(objpfx
)$(multidir
)/crtn.o
: $(objpfx
)crtn.o
$(objpfx
)$(multidir
)/
639 generated
+= multidir.mk tst-tls6.out
641 # Give libpthread.so an entry point and make it directly runnable itself.
642 LDFLAGS-pthread.so
+= -e __nptl_main
643 # pt-interp.c exists just to get the runtime linker path into libpthread.so.
644 $(objpfx
)pt-interp.os
: $(common-objpfx
)runtime-linker.h
647 tst-exec4-ARGS
= $(host-test-program-cmd
)
649 $(objpfx
)tst-execstack
: $(libdl
)
650 $(objpfx
)tst-execstack.out
: $(objpfx
)tst-execstack-mod.so
651 LDFLAGS-tst-execstack
= -Wl
,-z
,noexecstack
652 CFLAGS-tst-execstack-mod.c
+= -Wno-trampolines
654 tst-stackguard1-ARGS
= --command
"$(host-test-program-cmd) --child"
655 tst-stackguard1-static-ARGS
= --command
"$(objpfx)tst-stackguard1-static --child"
657 ifeq ($(run-built-tests
),yes
)
658 $(objpfx
)tst-oddstacklimit.out
: $(objpfx
)tst-oddstacklimit
$(objpfx
)tst-basic1
659 $(test-program-prefix
) $< --command
'$(host-test-program-cmd)' > $@
; \
663 $(objpfx
)tst-compat-forwarder
: $(objpfx
)tst-compat-forwarder-mod.so
665 tst-mutex10-ENV
= GLIBC_TUNABLES
=glibc.elision.enable
=1
667 # Protect against a build using -Wl,-z,now.
668 LDFLAGS-tst-audit-threads-mod1.so
= -Wl
,-z
,lazy
669 LDFLAGS-tst-audit-threads-mod2.so
= -Wl
,-z
,lazy
670 LDFLAGS-tst-audit-threads
= -Wl
,-z
,lazy
671 $(objpfx
)tst-audit-threads
: $(objpfx
)tst-audit-threads-mod2.so
672 $(objpfx
)tst-audit-threads.out
: $(objpfx
)tst-audit-threads-mod1.so
673 tst-audit-threads-ENV
= LD_AUDIT
=$(objpfx
)tst-audit-threads-mod1.so
675 # The test uses dlopen indirectly and would otherwise load system
677 tst-setuid1-static-ENV
= \
678 LD_LIBRARY_PATH
=$(ld-library-path
):$(common-objpfx
)elf
:$(common-objpfx
)nss
680 # The tests here better do not run in parallel.
681 ifeq ($(run-built-tests
),yes
)
682 ifneq ($(filter %tests
,$(MAKECMDGOALS
)),)