1 # Copyright (C) 2002-2020 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
)
37 libc_multiple_threads \
39 old_pthread_cond_destroy \
40 old_pthread_cond_init \
43 pthread_attr_destroy \
44 pthread_attr_extension \
45 pthread_attr_getdetachstate \
46 pthread_attr_getinheritsched \
47 pthread_attr_getschedparam \
48 pthread_attr_getschedpolicy \
49 pthread_attr_getscope \
50 pthread_attr_getsigmask \
52 pthread_attr_setaffinity \
53 pthread_attr_setdetachstate \
54 pthread_attr_setinheritsched \
55 pthread_attr_setschedparam \
56 pthread_attr_setschedpolicy \
57 pthread_attr_setscope \
58 pthread_attr_setsigmask \
59 pthread_attr_setsigmask_internal \
60 pthread_cond_destroy \
62 pthread_condattr_destroy \
63 pthread_condattr_init \
67 pthread_getschedparam \
69 pthread_setschedparam \
73 shared-only-routines
= forward
74 static-only-routines
= pthread_atfork
76 # We need to provide certain routines for compatibility with existing
78 pthread-compat-wrappers
= \
79 write read close accept \
80 connect recv recvfrom send \
81 sendto fsync lseek lseek64 \
82 msync open open64 pause \
83 pread pread64 pwrite pwrite64 \
84 tcdrain msgrcv msgsnd \
88 libpthread-routines
= nptl-init nptlfreeres vars events version pt-interp \
89 pthread_create pthread_exit pthread_detach \
90 pthread_join pthread_tryjoin pthread_timedjoin \
91 pthread_clockjoin pthread_join_common pthread_yield \
92 pthread_getconcurrency pthread_setconcurrency \
93 pthread_setschedprio \
94 pthread_attr_getguardsize pthread_attr_setguardsize \
95 pthread_attr_getstackaddr pthread_attr_setstackaddr \
96 pthread_attr_getstacksize pthread_attr_setstacksize \
97 pthread_attr_getstack pthread_attr_setstack \
98 pthread_mutex_init pthread_mutex_destroy \
99 pthread_mutex_lock pthread_mutex_trylock \
100 pthread_mutex_timedlock pthread_mutex_unlock \
101 pthread_mutex_cond_lock \
102 pthread_mutexattr_init pthread_mutexattr_destroy \
103 pthread_mutexattr_getpshared \
104 pthread_mutexattr_setpshared \
105 pthread_mutexattr_gettype pthread_mutexattr_settype \
106 pthread_rwlock_init pthread_rwlock_destroy \
107 pthread_rwlock_rdlock pthread_rwlock_timedrdlock \
108 pthread_rwlock_clockrdlock \
109 pthread_rwlock_wrlock pthread_rwlock_timedwrlock \
110 pthread_rwlock_clockwrlock \
111 pthread_rwlock_tryrdlock pthread_rwlock_trywrlock \
112 pthread_rwlock_unlock \
113 pthread_rwlockattr_init pthread_rwlockattr_destroy \
114 pthread_rwlockattr_getpshared \
115 pthread_rwlockattr_setpshared \
116 pthread_rwlockattr_getkind_np \
117 pthread_rwlockattr_setkind_np \
119 pthread_cond_signal pthread_cond_broadcast \
120 old_pthread_cond_wait old_pthread_cond_timedwait \
121 old_pthread_cond_signal old_pthread_cond_broadcast \
122 pthread_condattr_getpshared pthread_condattr_setpshared \
123 pthread_condattr_getclock pthread_condattr_setclock \
124 pthread_spin_init pthread_spin_destroy \
125 pthread_spin_lock pthread_spin_trylock \
126 pthread_spin_unlock \
127 pthread_barrier_init pthread_barrier_destroy \
128 pthread_barrier_wait \
129 pthread_barrierattr_init pthread_barrierattr_destroy \
130 pthread_barrierattr_getpshared \
131 pthread_barrierattr_setpshared \
132 pthread_key_create pthread_key_delete \
133 pthread_getspecific pthread_setspecific \
134 pthread_kill pthread_sigqueue \
135 pthread_cancel pthread_testcancel \
136 pthread_setcancelstate pthread_setcanceltype \
139 pthread_getcpuclockid \
141 sem_init sem_destroy \
142 sem_open sem_close sem_unlink \
144 sem_wait sem_timedwait sem_clockwait sem_post \
145 cleanup cleanup_defer cleanup_compat \
146 cleanup_defer_compat unwind \
147 pt-longjmp pt-cleanup\
152 $(pthread-compat-wrappers
) \
154 flockfile ftrylockfile funlockfile \
156 herrno res pt-allocrtsig \
157 pthread_kill_other_threads \
158 pthread_setaffinity \
159 pthread_attr_getaffinity \
160 pthread_mutexattr_getrobust pthread_mutexattr_setrobust \
161 pthread_mutex_consistent \
162 cleanup_routine unwind-forcedunwind \
163 pthread_mutexattr_getprotocol \
164 pthread_mutexattr_setprotocol \
165 pthread_mutexattr_getprioceiling \
166 pthread_mutexattr_setprioceiling tpp \
167 pthread_mutex_getprioceiling \
168 pthread_mutex_setprioceiling \
169 pthread_setname pthread_getname \
170 pthread_setattr_default_np pthread_getattr_default_np \
173 # pthread_setuid pthread_seteuid pthread_setreuid \
174 # pthread_setresuid \
175 # pthread_setgid pthread_setegid pthread_setregid \
178 libpthread-shared-only-routines
= version pt-interp pt-allocrtsig \
181 # Since cancellation handling is in large parts handled using exceptions
182 # we have to compile some files with exception handling enabled, some
183 # even with asynchronous unwind tables.
185 # nptl-init.c contains sigcancel_handler().
186 CFLAGS-nptl-init.c
+= -fexceptions
-fasynchronous-unwind-tables
187 # The unwind code itself,
188 CFLAGS-unwind.c
+= -fexceptions
189 CFLAGS-unwind-forcedunwind.c
+= -fexceptions
-fasynchronous-unwind-tables
191 # The following three functions must be async-cancel safe.
192 CFLAGS-pthread_cancel.c
+= -fexceptions
-fasynchronous-unwind-tables
193 CFLAGS-pthread_setcancelstate.c
+= -fexceptions
-fasynchronous-unwind-tables
194 CFLAGS-pthread_setcanceltype.c
+= -fexceptions
-fasynchronous-unwind-tables
196 # These are internal functions which similar functionality as setcancelstate
198 CFLAGS-cancellation.c
+= -fasynchronous-unwind-tables
199 CFLAGS-libc-cancellation.c
+= -fasynchronous-unwind-tables
201 # Calling pthread_exit() must cause the registered cancel handlers to
202 # be executed. Therefore exceptions have to be thrown through this
204 CFLAGS-pthread_exit.c
+= -fexceptions
206 # Among others, __pthread_unwind is forwarded. This function must handle
208 CFLAGS-forward.c
+= -fexceptions
210 # The following are cancellation points. Some of the functions can
211 # block and therefore temporarily enable asynchronous cancellation.
212 # Those must be compiled asynchronous unwind tables.
213 CFLAGS-pthread_testcancel.c
+= -fexceptions
214 CFLAGS-pthread_join.c
+= -fexceptions
-fasynchronous-unwind-tables
215 CFLAGS-pthread_timedjoin.c
+= -fexceptions
-fasynchronous-unwind-tables
216 CFLAGS-pthread_clockjoin.c
+= -fexceptions
-fasynchronous-unwind-tables
217 CFLAGS-pthread_once.c
+= $(uses-callbacks
) -fexceptions \
218 -fasynchronous-unwind-tables
219 CFLAGS-pthread_cond_wait.c
+= -fexceptions
-fasynchronous-unwind-tables
220 CFLAGS-sem_wait.c
+= -fexceptions
-fasynchronous-unwind-tables
221 CFLAGS-sem_timedwait.c
+= -fexceptions
-fasynchronous-unwind-tables
222 CFLAGS-sem_clockwait.c
= -fexceptions
-fasynchronous-unwind-tables
224 # These are the function wrappers we have to duplicate here.
225 CFLAGS-fcntl.c
+= -fexceptions
-fasynchronous-unwind-tables
226 CFLAGS-fcntl64.c
+= -fexceptions
-fasynchronous-unwind-tables
227 CFLAGS-lockf.c
+= -fexceptions
228 CFLAGS-pread.c
+= -fexceptions
-fasynchronous-unwind-tables
229 CFLAGS-pread64.c
+= -fexceptions
-fasynchronous-unwind-tables
230 CFLAGS-pwrite.c
+= -fexceptions
-fasynchronous-unwind-tables
231 CFLAGS-pwrite64.c
+= -fexceptions
-fasynchronous-unwind-tables
232 CFLAGS-sigwait.c
+= -fexceptions
-fasynchronous-unwind-tables
233 CFLAGS-msgrcv.c
+= -fexceptions
-fasynchronous-unwind-tables
234 CFLAGS-msgsnd.c
+= -fexceptions
-fasynchronous-unwind-tables
235 CFLAGS-tcdrain.c
+= -fexceptions
-fasynchronous-unwind-tables
236 CFLAGS-open.c
+= -fexceptions
-fasynchronous-unwind-tables
237 CFLAGS-open64.c
+= -fexceptions
-fasynchronous-unwind-tables
238 CFLAGS-pause.c
+= -fexceptions
-fasynchronous-unwind-tables
239 CFLAGS-recv.c
+= -fexceptions
-fasynchronous-unwind-tables
240 CFLAGS-send.c
+= -fexceptions
-fasynchronous-unwind-tables
241 CFLAGS-accept.c
+= -fexceptions
-fasynchronous-unwind-tables
242 CFLAGS-sendto.c
+= -fexceptions
-fasynchronous-unwind-tables
243 CFLAGS-connect.c
+= -fexceptions
-fasynchronous-unwind-tables
244 CFLAGS-recvfrom.c
+= -fexceptions
-fasynchronous-unwind-tables
245 CFLAGS-recvmsg.c
+= -fexceptions
-fasynchronous-unwind-tables
246 CFLAGS-sendmsg.c
+= -fexceptions
-fasynchronous-unwind-tables
247 CFLAGS-close.c
+= -fexceptions
-fasynchronous-unwind-tables
248 CFLAGS-read.c
+= -fexceptions
-fasynchronous-unwind-tables
249 CFLAGS-write.c
+= -fexceptions
-fasynchronous-unwind-tables
250 CFLAGS-sigsuspend.c
+= -fexceptions
-fasynchronous-unwind-tables
251 CFLAGS-msync.c
+= -fexceptions
-fasynchronous-unwind-tables
252 CFLAGS-fdatasync.c
+= -fexceptions
-fasynchronous-unwind-tables
253 CFLAGS-fsync.c
+= -fexceptions
-fasynchronous-unwind-tables
255 CFLAGS-pt-system.c
+= -fexceptions
257 LDLIBS-tst-once5
= -lstdc
++
258 CFLAGS-tst-thread_local1.o
= -std
=gnu
++11
259 LDLIBS-tst-thread_local1
= -lstdc
++
260 CFLAGS-tst-thread-exit-clobber.o
= -std
=gnu
++11
261 LDLIBS-tst-thread-exit-clobber
= -lstdc
++
262 CFLAGS-tst-minstack-throw.o
= -std
=gnu
++11
263 LDLIBS-tst-minstack-throw
= -lstdc
++
265 tests
= tst-attr2 tst-attr3 tst-default-attr \
266 tst-mutex5a tst-mutex7a \
267 tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 \
268 tst-mutexpi5 tst-mutexpi5a tst-mutexpi6 tst-mutexpi7 tst-mutexpi7a \
270 tst-cond22 tst-cond26 \
271 tst-robustpi1 tst-robustpi2 tst-robustpi3 tst-robustpi4 tst-robustpi5 \
272 tst-robustpi6 tst-robustpi7 tst-robustpi9 \
273 tst-rwlock2 tst-rwlock2a tst-rwlock2b tst-rwlock3 \
274 tst-rwlock6 tst-rwlock7 tst-rwlock8 \
275 tst-rwlock9 tst-rwlock10 tst-rwlock11 \
276 tst-rwlock15 tst-rwlock17 tst-rwlock18 \
280 tst-cancel4 tst-cancel4_1 tst-cancel4_2 tst-cancel5 \
281 tst-cancel7 tst-cancel17 tst-cancel24 \
284 tst-exec4 tst-exec5 \
285 tst-stack2 tst-stack3 tst-stack4 \
286 tst-pthread-attr-affinity \
290 tst-initializers1
$(addprefix tst-initializers1-
,\
291 c89 gnu89 c99 gnu99 c11 gnu11
) \
294 tst-thread-exit-clobber tst-minstack-cancel tst-minstack-exit \
297 tst-thread-affinity-pthread \
298 tst-thread-affinity-pthread2 \
299 tst-thread-affinity-sched \
300 tst-pthread-defaultattr-free \
301 tst-pthread-attr-sigmask \
304 tests-container
= tst-pthread-getattr
306 tests-internal
:= tst-robustpi8 tst-rwlock19 tst-rwlock20 \
307 tst-sem11 tst-sem12 tst-sem13 \
308 tst-barrier5 tst-signal7 tst-mutex8 tst-mutex8-static \
309 tst-mutexpi8 tst-mutexpi8-static \
312 xtests
= tst-setuid1 tst-setuid1-static tst-setuid2 \
313 tst-mutexpp1 tst-mutexpp6 tst-mutexpp10
315 # This test can run into task limits because of a linux kernel bug
316 # and then cause the make process to fail too, see bug 24537.
319 test-srcs
= tst-oddstacklimit
321 # Test expected to fail on most targets (except x86_64) due to bug
322 # 18435 - pthread_once hangs when init routine throws an exception.
323 test-xfail-tst-once5
= yes
325 gen-as-const-headers
= unwindbuf.sym \
326 pthread-pi-defines.sym
328 gen-py-const-headers
:= nptl_lock_constants.pysym
329 pretty-printers
:= nptl-printers.py
330 tests-printers
:= test-mutexattr-printers test-mutex-printers \
331 test-condattr-printers test-cond-printers \
332 test-rwlockattr-printers test-rwlock-printers
334 # We must specify both CFLAGS and CPPFLAGS to override any
335 # compiler options the user might have provided that conflict
336 # with what we need e.g. user specifies CPPFLAGS with -O2 and
338 CFLAGS-test-mutexattr-printers.c
:= $(CFLAGS-printers-tests
)
339 CFLAGS-test-mutex-printers.c
:= $(CFLAGS-printers-tests
)
340 CFLAGS-test-condattr-printers.c
:= $(CFLAGS-printers-tests
)
341 CFLAGS-test-cond-printers.c
:= $(CFLAGS-printers-tests
)
342 CFLAGS-test-rwlockattr-printers.c
:= $(CFLAGS-printers-tests
)
343 CFLAGS-test-rwlock-printers.c
:= $(CFLAGS-printers-tests
)
344 CPPFLAGS-test-mutexattr-printers.c
:= $(CFLAGS-printers-tests
)
345 CPPFLAGS-test-mutex-printers.c
:= $(CFLAGS-printers-tests
)
346 CPPFLAGS-test-condattr-printers.c
:= $(CFLAGS-printers-tests
)
347 CPPFLAGS-test-cond-printers.c
:= $(CFLAGS-printers-tests
)
348 CPPFLAGS-test-rwlockattr-printers.c
:= $(CFLAGS-printers-tests
)
349 CPPFLAGS-test-rwlock-printers.c
:= $(CFLAGS-printers-tests
)
351 ifeq ($(build-shared
),yes
)
352 tests-printers-libs
:= $(shared-thread-library
)
354 tests-printers-libs
:= $(static-thread-library
)
357 LDFLAGS-pthread.so
= -Wl
,--enable-new-dtags
,-z
,nodelete
,-z
,initfirst
359 tests
+= tst-cancelx4 tst-cancelx5 tst-cancelx7 tst-cancelx17 tst-cleanupx4
361 ifeq ($(build-shared
),yes
)
362 tests
+= tst-compat-forwarder tst-audit-threads
363 tests-internal
+= tst-tls3 tst-tls3-malloc tst-tls5 tst-stackguard1
364 ifeq ($(have-z-execstack
),yes
)
365 tests
+= tst-execstack
369 modules-names
= tst-tls3mod \
370 tst-tls5mod tst-tls5moda tst-tls5modb tst-tls5modc \
371 tst-tls5modd tst-tls5mode tst-tls5modf tst-stack4mod \
373 tst-compat-forwarder-mod tst-audit-threads-mod1 \
374 tst-audit-threads-mod2
375 extra-test-objs
+= $(addsuffix .os
,$(strip $(modules-names
))) \
376 tst-cleanup4aux.o tst-cleanupx4aux.o
377 test-extras
+= tst-cleanup4aux tst-cleanupx4aux
379 tst-tls3mod.so-no-z-defs
= yes
380 tst-tls5mod.so-no-z-defs
= yes
381 tst-tls5moda.so-no-z-defs
= yes
382 tst-tls5modb.so-no-z-defs
= yes
383 tst-tls5modc.so-no-z-defs
= yes
384 tst-tls5modd.so-no-z-defs
= yes
385 tst-tls5mode.so-no-z-defs
= yes
386 tst-tls5modf.so-no-z-defs
= yes
388 ifeq ($(build-shared
),yes
)
390 # Set the `multidir' variable by grabbing the variable from the compiler.
391 # We do it once and save the result in a generated makefile.
392 -include $(objpfx
)multidir.mk
393 $(objpfx
)multidir.mk
: $(common-objpfx
)config.make
394 $(make-target-directory
)
395 dir=`$(CC) $(CFLAGS) $(CPPFLAGS) -print-multi-directory`; \
396 echo
"multidir := $$dir" > $@T
401 ifneq (,$(patsubst .
,,$(multidir
)))
402 generated-dirs
+= $(firstword $(subst /, , $(multidir
)))
403 crti-objs
+= $(multidir
)/crti.o
404 crtn-objs
+= $(multidir
)/crtn.o
405 $(objpfx
)$(multidir
):
408 extra-objs
+= $(crti-objs
) $(crtn-objs
)
409 extra-objs
+= pt-crti.o
412 CFLAGS-flockfile.c
+= $(libio-mtsafe
)
413 CFLAGS-ftrylockfile.c
+= $(libio-mtsafe
)
414 CFLAGS-funlockfile.c
+= $(libio-mtsafe
)
416 link-libc-static
:= $(common-objpfx
)libc.a
$(static-gnulib
) \
417 $(common-objpfx
)libc.a
419 tests-static
+= tst-stackguard1-static \
420 tst-cancel24-static \
421 tst-mutex8-static tst-mutexpi8-static tst-sem11-static \
422 tst-sem12-static tst-cond11-static
424 tests
+= tst-cancel24-static
426 tests-internal
+= tst-sem11-static tst-sem12-static tst-stackguard1-static
427 xtests-static
+= tst-setuid1-static
429 # These tests are linked with libc before libpthread
430 tests-reverse
+= tst-cancel5
432 ifeq ($(run-built-tests
),yes
)
433 tests-special
+= $(objpfx
)tst-stack3-mem.out
$(objpfx
)tst-oddstacklimit.out
434 ifeq ($(build-shared
),yes
)
435 tests-special
+= $(objpfx
)tst-tls6.out
440 # These tests require a C++ compiler and runtime.
441 tests-unsupported
+= tst-cancel24 tst-cancel24-static tst-once5 \
442 tst-thread-exit-clobber tst-minstack-throw
444 # These tests require a C++ compiler and runtime with thread_local support.
445 ifneq ($(have-cxx-thread_local
),yes
)
446 tests-unsupported
+= tst-thread_local1
451 ifeq (yes
,$(build-shared
))
452 # Make sure these things are built in the `make lib' pass so they can be used
453 # to run programs during the `make others' pass.
454 lib-noranlib
: $(addprefix $(objpfx
),$(extra-objs
))
458 # 'pthread_self' is a simple memory or register load. Setting up the
459 # stack frame is more work than the actual operation. Disable the
460 # frame creation entirely. This will help applications which call the
461 # function frequently to get a thread-specific handle.
462 CFLAGS-pthread_self.os
+= -fomit-frame-pointer
464 # The sigmask macro is deprecated and triggers are compiler warning
465 # which cannot be suppressed (as of GCC 9).
466 CFLAGS-tst-cancel4.c
+= -Wno-error
467 CFLAGS-tst-cancel5.c
+= -Wno-error
468 CFLAGS-tst-cancelx4.c
+= -Wno-error
469 CFLAGS-tst-cancelx5.c
+= -Wno-error
471 # Run the cancellation and cleanup tests also for the modern, exception-based
472 # implementation. For this we have to pass the -fexceptions parameter.
473 CFLAGS-tst-cancelx4.c
+= -fexceptions
474 CFLAGS-tst-cancelx5.c
+= -fexceptions
475 CFLAGS-tst-cancelx7.c
+= -fexceptions
476 CFLAGS-tst-cancelx17.c
+= -fexceptions
477 CFLAGS-tst-cleanupx4.c
+= -fexceptions
478 CFLAGS-tst-cleanupx4aux.c
+= -fexceptions
479 CFLAGS-tst-initializers1.c
+= -W
-Wall
-Werror
480 CFLAGS-tst-initializers1-
< = $(CFLAGS-tst-initializers1.c
) \
481 $(patsubst tst-initializers1-
%.c
,-std
=%,$<)
482 CFLAGS-tst-initializers1-c89.c
+= $(CFLAGS-tst-initializers1-
<)
483 CFLAGS-tst-initializers1-c99.c
+= $(CFLAGS-tst-initializers1-
<)
484 CFLAGS-tst-initializers1-c11.c
+= $(CFLAGS-tst-initializers1-
<)
485 CFLAGS-tst-initializers1-gnu89.c
+= $(CFLAGS-tst-initializers1-
<)
486 CFLAGS-tst-initializers1-gnu99.c
+= $(CFLAGS-tst-initializers1-
<)
487 CFLAGS-tst-initializers1-gnu11.c
+= $(CFLAGS-tst-initializers1-
<)
489 tst-cancel7-ARGS
= --command
"exec $(host-test-program-cmd)"
490 tst-cancelx7-ARGS
= $(tst-cancel7-ARGS
)
492 tst-stack3-ENV
= MALLOC_TRACE
=$(objpfx
)tst-stack3.mtrace
493 $(objpfx
)tst-stack3-mem.out
: $(objpfx
)tst-stack3.out
494 $(common-objpfx
)malloc
/mtrace
$(objpfx
)tst-stack3.mtrace
> $@
; \
496 generated
+= tst-stack3-mem.out tst-stack3.mtrace
498 $(objpfx
)tst-stack4
: $(libdl
) $(shared-thread-library
)
499 tst-stack4mod.sos
=$(shell for i in
0 1 2 3 4 5 6 7 8 9 10 \
500 11 12 13 14 15 16 17 18 19; do \
501 for j in
0 1 2 3 4 5 6 7 8 9 10 \
502 11 12 13 14 15 16 17 18 19; do \
503 echo
$(objpfx
)tst-stack4mod-
$$i-$$j.so
; \
505 $(objpfx
)tst-stack4.out
: $(tst-stack4mod.sos
)
506 $(tst-stack4mod.sos
): $(objpfx
)tst-stack4mod.so
509 rm -f
$(tst-stack4mod.sos
)
511 $(objpfx
)tst-cleanup4
: $(objpfx
)tst-cleanup4aux.o
$(shared-thread-library
)
512 $(objpfx
)tst-cleanupx4
: $(objpfx
)tst-cleanupx4aux.o
$(shared-thread-library
)
514 $(objpfx
)tst-tls3
: $(libdl
) $(shared-thread-library
)
515 LDFLAGS-tst-tls3
= -rdynamic
516 $(objpfx
)tst-tls3.out
: $(objpfx
)tst-tls3mod.so
517 $(objpfx
)tst-tls3mod.so
: $(shared-thread-library
)
519 $(objpfx
)tst-tls3-malloc
: $(libdl
) $(shared-thread-library
)
520 LDFLAGS-tst-tls3-malloc
= -rdynamic
521 $(objpfx
)tst-tls3-malloc.out
: $(objpfx
)tst-tls3mod.so
523 $(objpfx
)tst-tls5
: $(objpfx
)tst-tls5mod.so
$(shared-thread-library
)
524 LDFLAGS-tst-tls5
= -Wl
,--no-as-needed
525 LDFLAGS-tst-tls5mod.so
= -Wl
,-soname
,tst-tls5mod.so
527 ifeq ($(build-shared
),yes
)
528 $(objpfx
)tst-tls6.out
: tst-tls6.sh
$(objpfx
)tst-tls5 \
529 $(objpfx
)tst-tls5moda.so
$(objpfx
)tst-tls5modb.so \
530 $(objpfx
)tst-tls5modc.so
$(objpfx
)tst-tls5modd.so \
531 $(objpfx
)tst-tls5mode.so
$(objpfx
)tst-tls5modf.so
532 $(BASH
) $< $(common-objpfx
) '$(test-via-rtld-prefix)' \
533 '$(test-wrapper-env)' '$(run-program-env)' > $@
; \
537 $(objpfx
)tst-dlsym1
: $(libdl
) $(shared-thread-library
)
539 ifeq (yes
,$(build-shared
))
540 librt
= $(common-objpfx
)rt
/librt.so
542 librt
= $(common-objpfx
)rt
/librt.a
545 # `make check' sometimes triggers a rebuild of librt.so using this Makefile,
546 # which ignores librt's dependence on libpthread
547 $(common-objpfx
)rt
/librt.so
: $(shared-thread-library
)
549 $(objpfx
)tst-cancel17
: $(librt
)
550 $(objpfx
)tst-cancelx17
: $(librt
)
552 LDLIBS-tst-cancel24
= -Wl
,--no-as-needed
-lstdc
++
553 LDLIBS-tst-cancel24-static
= $(LDLIBS-tst-cancel24
)
555 extra-B-pthread.so
= -B
$(common-objpfx
)nptl
/
556 $(objpfx
)libpthread.so
: $(addprefix $(objpfx
),$(crti-objs
) $(crtn-objs
))
557 $(objpfx
)libpthread.so
: +preinit
+= $(addprefix $(objpfx
),$(crti-objs
))
558 $(objpfx
)libpthread.so
: +postinit
+= $(addprefix $(objpfx
),$(crtn-objs
))
560 # Make sure we link with the thread library.
561 ifeq ($(build-shared
),yes
)
562 $(addprefix $(objpfx
), \
563 $(filter-out $(tests-static
) $(xtests-static
) $(tests-reverse
) \
564 $(tests-nolibpthread
), \
565 $(tests
) $(tests-internal
) $(xtests
) $(test-srcs
) $(tests-container
))): \
566 $(objpfx
)libpthread.so
567 $(objpfx
)tst-unload
: $(libdl
)
568 # $(objpfx)../libc.so is used instead of $(common-objpfx)libc.so,
569 # since otherwise libpthread.so comes before libc.so when linking.
570 $(addprefix $(objpfx
), $(tests-reverse
)): \
571 $(objpfx
)..
/libc.so
$(objpfx
)libpthread.so
572 $(objpfx
)..
/libc.so
: $(common-objpfx
)libc.so
;
573 $(addprefix $(objpfx
),$(tests-static
) $(xtests-static
)): $(objpfx
)libpthread.a
575 $(addprefix $(objpfx
),$(tests
) $(test-srcs
)): $(objpfx
)libpthread.a
578 ifeq ($(build-shared
),yes
)
579 $(objpfx
)crti.o
: $(objpfx
)pt-crti.o
582 ifneq ($(multidir
),.
)
583 $(objpfx
)$(multidir
)/crti.o
: $(objpfx
)crti.o
$(objpfx
)$(multidir
)/
586 $(objpfx
)$(multidir
)/crtn.o
: $(objpfx
)crtn.o
$(objpfx
)$(multidir
)/
590 generated
+= multidir.mk tst-tls6.out
592 # Give libpthread.so an entry point and make it directly runnable itself.
593 LDFLAGS-pthread.so
+= -e __nptl_main
594 # pt-interp.c exists just to get the runtime linker path into libpthread.so.
595 $(objpfx
)pt-interp.os
: $(common-objpfx
)runtime-linker.h
598 tst-exec4-ARGS
= $(host-test-program-cmd
)
600 $(objpfx
)tst-execstack
: $(libdl
)
601 $(objpfx
)tst-execstack.out
: $(objpfx
)tst-execstack-mod.so
602 LDFLAGS-tst-execstack
= -Wl
,-z
,noexecstack
603 CFLAGS-tst-execstack-mod.c
+= -Wno-trampolines
605 tst-stackguard1-ARGS
= --command
"$(host-test-program-cmd) --child"
606 tst-stackguard1-static-ARGS
= --command
"$(objpfx)tst-stackguard1-static --child"
608 ifeq ($(run-built-tests
),yes
)
609 $(objpfx
)tst-oddstacklimit.out
: $(objpfx
)tst-oddstacklimit
$(objpfx
)tst-basic1
610 $(test-program-prefix
) $< --command
'$(host-test-program-cmd)' > $@
; \
614 $(objpfx
)tst-compat-forwarder
: $(objpfx
)tst-compat-forwarder-mod.so
616 tst-mutex10-ENV
= GLIBC_TUNABLES
=glibc.elision.enable
=1
618 # Protect against a build using -Wl,-z,now.
619 LDFLAGS-tst-audit-threads-mod1.so
= -Wl
,-z
,lazy
620 LDFLAGS-tst-audit-threads-mod2.so
= -Wl
,-z
,lazy
621 LDFLAGS-tst-audit-threads
= -Wl
,-z
,lazy
622 $(objpfx
)tst-audit-threads
: $(objpfx
)tst-audit-threads-mod2.so
623 $(objpfx
)tst-audit-threads.out
: $(objpfx
)tst-audit-threads-mod1.so
624 tst-audit-threads-ENV
= LD_AUDIT
=$(objpfx
)tst-audit-threads-mod1.so
626 # The test uses dlopen indirectly and would otherwise load system
628 tst-setuid1-static-ENV
= \
629 LD_LIBRARY_PATH
=$(objpfx
):$(common-objpfx
):$(common-objpfx
)elf
631 # The tests here better do not run in parallel.
632 ifeq ($(run-built-tests
),yes
)
633 ifneq ($(filter %tests
,$(MAKECMDGOALS
)),)