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
)
34 cleanup_defer_compat \
45 libc_multiple_threads \
50 old_pthread_cond_destroy \
51 old_pthread_cond_init \
54 pthread_attr_destroy \
55 pthread_attr_extension \
56 pthread_attr_getdetachstate \
57 pthread_attr_getinheritsched \
58 pthread_attr_getschedparam \
59 pthread_attr_getschedpolicy \
60 pthread_attr_getscope \
61 pthread_attr_getsigmask \
63 pthread_attr_setaffinity \
64 pthread_attr_setdetachstate \
65 pthread_attr_setinheritsched \
66 pthread_attr_setschedparam \
67 pthread_attr_setschedpolicy \
68 pthread_attr_setscope \
69 pthread_attr_setsigmask \
70 pthread_attr_setsigmask_internal \
71 pthread_cleanup_upto \
72 pthread_cond_destroy \
74 pthread_condattr_destroy \
75 pthread_condattr_init \
80 pthread_getschedparam \
83 pthread_mutex_consistent \
86 pthread_setcancelstate \
87 pthread_setschedparam \
91 shared-only-routines
= forward
92 static-only-routines
= pthread_atfork
94 libpthread-routines
= \
107 old_pthread_cond_broadcast \
108 old_pthread_cond_signal \
109 old_pthread_cond_timedwait \
110 old_pthread_cond_wait \
112 pthread_attr_getaffinity \
113 pthread_attr_getguardsize \
114 pthread_attr_getstack \
115 pthread_attr_getstackaddr \
116 pthread_attr_getstacksize \
117 pthread_attr_setguardsize \
118 pthread_attr_setstack \
119 pthread_attr_setstackaddr \
120 pthread_attr_setstacksize \
121 pthread_barrier_destroy \
122 pthread_barrier_init \
123 pthread_barrier_wait \
124 pthread_barrierattr_destroy \
125 pthread_barrierattr_getpshared \
126 pthread_barrierattr_init \
127 pthread_barrierattr_setpshared \
130 pthread_cond_broadcast \
131 pthread_cond_signal \
133 pthread_condattr_getclock \
134 pthread_condattr_getpshared \
135 pthread_condattr_setclock \
136 pthread_condattr_setpshared \
139 pthread_getattr_default_np \
140 pthread_getconcurrency \
141 pthread_getcpuclockid \
143 pthread_getspecific \
145 pthread_join_common \
148 pthread_kill_other_threads \
149 pthread_mutex_cond_lock \
151 pthread_mutex_destroy \
152 pthread_mutex_getprioceiling \
155 pthread_mutex_setprioceiling \
156 pthread_mutex_timedlock \
157 pthread_mutex_trylock \
158 pthread_mutex_unlock \
159 pthread_mutexattr_destroy \
160 pthread_mutexattr_getprioceiling \
161 pthread_mutexattr_getprotocol \
162 pthread_mutexattr_getpshared \
163 pthread_mutexattr_getrobust \
164 pthread_mutexattr_gettype \
165 pthread_mutexattr_init \
166 pthread_mutexattr_setprioceiling \
167 pthread_mutexattr_setprotocol \
168 pthread_mutexattr_setpshared \
169 pthread_mutexattr_setrobust \
170 pthread_mutexattr_settype \
171 pthread_rwlock_clockrdlock \
172 pthread_rwlock_clockwrlock \
173 pthread_rwlock_destroy \
174 pthread_rwlock_init \
175 pthread_rwlock_rdlock \
176 pthread_rwlock_timedrdlock \
177 pthread_rwlock_timedwrlock \
178 pthread_rwlock_tryrdlock \
179 pthread_rwlock_trywrlock \
180 pthread_rwlock_unlock \
181 pthread_rwlock_wrlock \
182 pthread_rwlockattr_destroy \
183 pthread_rwlockattr_getkind_np \
184 pthread_rwlockattr_getpshared \
185 pthread_rwlockattr_init \
186 pthread_rwlockattr_setkind_np \
187 pthread_rwlockattr_setpshared \
188 pthread_setaffinity \
189 pthread_setattr_default_np \
190 pthread_setcanceltype \
191 pthread_setconcurrency \
193 pthread_setschedprio \
194 pthread_setspecific \
196 pthread_spin_destroy \
199 pthread_spin_trylock \
200 pthread_spin_unlock \
221 libpthread-shared-only-routines
= \
226 # Since cancellation handling is in large parts handled using exceptions
227 # we have to compile some files with exception handling enabled, some
228 # even with asynchronous unwind tables.
230 # nptl-init.c contains sigcancel_handler().
231 CFLAGS-nptl-init.c
+= -fexceptions
-fasynchronous-unwind-tables
232 # The unwind code itself,
233 CFLAGS-unwind.c
+= -fexceptions
234 CFLAGS-unwind-forcedunwind.c
+= -fexceptions
-fasynchronous-unwind-tables
236 # The following three functions must be async-cancel safe.
237 CFLAGS-pthread_cancel.c
+= -fexceptions
-fasynchronous-unwind-tables
238 CFLAGS-pthread_setcancelstate.c
+= -fexceptions
-fasynchronous-unwind-tables
239 CFLAGS-pthread_setcanceltype.c
+= -fexceptions
-fasynchronous-unwind-tables
241 # These are internal functions which similar functionality as setcancelstate
243 CFLAGS-cancellation.c
+= -fasynchronous-unwind-tables
244 CFLAGS-libc-cancellation.c
+= -fasynchronous-unwind-tables
246 # Calling pthread_exit() must cause the registered cancel handlers to
247 # be executed. Therefore exceptions have to be thrown through this
249 CFLAGS-pthread_exit.c
+= -fexceptions
251 # Among others, __pthread_unwind is forwarded. This function must handle
253 CFLAGS-forward.c
+= -fexceptions
255 # The following are cancellation points. Some of the functions can
256 # block and therefore temporarily enable asynchronous cancellation.
257 # Those must be compiled asynchronous unwind tables.
258 CFLAGS-pthread_testcancel.c
+= -fexceptions
259 CFLAGS-pthread_join.c
+= -fexceptions
-fasynchronous-unwind-tables
260 CFLAGS-pthread_timedjoin.c
+= -fexceptions
-fasynchronous-unwind-tables
261 CFLAGS-pthread_clockjoin.c
+= -fexceptions
-fasynchronous-unwind-tables
262 CFLAGS-pthread_once.c
+= $(uses-callbacks
) -fexceptions \
263 -fasynchronous-unwind-tables
264 CFLAGS-pthread_cond_wait.c
+= -fexceptions
-fasynchronous-unwind-tables
265 CFLAGS-sem_wait.c
+= -fexceptions
-fasynchronous-unwind-tables
266 CFLAGS-sem_timedwait.c
+= -fexceptions
-fasynchronous-unwind-tables
267 CFLAGS-sem_clockwait.c
= -fexceptions
-fasynchronous-unwind-tables
269 CFLAGS-futex-internal.c
+= -fexceptions
-fasynchronous-unwind-tables
271 LDLIBS-tst-once5
= -lstdc
++
272 CFLAGS-tst-thread_local1.o
= -std
=gnu
++11
273 LDLIBS-tst-thread_local1
= -lstdc
++
274 CFLAGS-tst-thread-exit-clobber.o
= -std
=gnu
++11
275 LDLIBS-tst-thread-exit-clobber
= -lstdc
++
276 CFLAGS-tst-minstack-throw.o
= -std
=gnu
++11
277 LDLIBS-tst-minstack-throw
= -lstdc
++
279 tests
= tst-attr2 tst-attr3 tst-default-attr \
280 tst-mutex5a tst-mutex7a \
281 tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 \
282 tst-mutexpi5 tst-mutexpi5a tst-mutexpi6 tst-mutexpi7 tst-mutexpi7a \
283 tst-mutexpi9 tst-mutexpi10 \
284 tst-cond22 tst-cond26 \
285 tst-robustpi1 tst-robustpi2 tst-robustpi3 tst-robustpi4 tst-robustpi5 \
286 tst-robustpi6 tst-robustpi7 tst-robustpi9 \
287 tst-rwlock2 tst-rwlock2a tst-rwlock2b tst-rwlock3 \
288 tst-rwlock6 tst-rwlock7 tst-rwlock8 \
289 tst-rwlock9 tst-rwlock10 tst-rwlock11 \
290 tst-rwlock15 tst-rwlock17 tst-rwlock18 \
294 tst-cancel4_1 tst-cancel4_2 \
295 tst-cancel7 tst-cancel17 tst-cancel24 \
297 tst-exec4 tst-exec5 \
298 tst-stack2 tst-stack3 tst-stack4 \
299 tst-pthread-attr-affinity \
303 tst-initializers1
$(addprefix tst-initializers1-
,\
304 c89 gnu89 c99 gnu99 c11 gnu11
) \
307 tst-thread-exit-clobber tst-minstack-cancel tst-minstack-exit \
310 tst-thread-affinity-pthread \
311 tst-thread-affinity-pthread2 \
312 tst-thread-affinity-sched \
313 tst-pthread-defaultattr-free \
314 tst-pthread-attr-sigmask \
315 tst-pthread-timedlock-lockloop \
316 tst-pthread-gdb-attach tst-pthread-gdb-attach-static \
317 tst-pthread_exit-nothreads \
318 tst-pthread_exit-nothreads-static \
320 tests-nolibpthread
= \
321 tst-pthread_exit-nothreads \
322 tst-pthread_exit-nothreads-static \
324 tests-container
= tst-pthread-getattr
326 tests-internal
:= tst-robustpi8 tst-rwlock19 tst-rwlock20 \
327 tst-sem11 tst-sem12 tst-sem13 \
328 tst-barrier5 tst-signal7 tst-mutex8 tst-mutex8-static \
329 tst-mutexpi8 tst-mutexpi8-static \
332 xtests
= tst-setuid1 tst-setuid1-static tst-setuid2 \
333 tst-mutexpp1 tst-mutexpp6 tst-mutexpp10 tst-setgroups \
334 tst-mutexpp5 tst-mutexpp9
336 # This test can run into task limits because of a linux kernel bug
337 # and then cause the make process to fail too, see bug 24537.
340 test-srcs
= tst-oddstacklimit
342 gen-as-const-headers
= unwindbuf.sym \
343 pthread-pi-defines.sym
345 gen-py-const-headers
:= nptl_lock_constants.pysym
346 pretty-printers
:= nptl-printers.py
347 tests-printers
:= test-mutexattr-printers test-mutex-printers \
348 test-condattr-printers test-cond-printers \
349 test-rwlockattr-printers test-rwlock-printers
351 # We must specify both CFLAGS and CPPFLAGS to override any
352 # compiler options the user might have provided that conflict
353 # with what we need e.g. user specifies CPPFLAGS with -O2 and
355 CFLAGS-test-mutexattr-printers.c
:= $(CFLAGS-printers-tests
)
356 CFLAGS-test-mutex-printers.c
:= $(CFLAGS-printers-tests
)
357 CFLAGS-test-condattr-printers.c
:= $(CFLAGS-printers-tests
)
358 CFLAGS-test-cond-printers.c
:= $(CFLAGS-printers-tests
)
359 CFLAGS-test-rwlockattr-printers.c
:= $(CFLAGS-printers-tests
)
360 CFLAGS-test-rwlock-printers.c
:= $(CFLAGS-printers-tests
)
361 CPPFLAGS-test-mutexattr-printers.c
:= $(CFLAGS-printers-tests
)
362 CPPFLAGS-test-mutex-printers.c
:= $(CFLAGS-printers-tests
)
363 CPPFLAGS-test-condattr-printers.c
:= $(CFLAGS-printers-tests
)
364 CPPFLAGS-test-cond-printers.c
:= $(CFLAGS-printers-tests
)
365 CPPFLAGS-test-rwlockattr-printers.c
:= $(CFLAGS-printers-tests
)
366 CPPFLAGS-test-rwlock-printers.c
:= $(CFLAGS-printers-tests
)
368 # Reuse the CFLAGS setting for the GDB attaching test. It needs
369 # debugging information.
370 CFLAGS-tst-pthread-gdb-attach.c
:= $(CFLAGS-printers-tests
)
371 CPPFLAGS-tst-pthread-gdb-attach.c
:= $(CFLAGS-printers-tests
)
372 ifeq ($(build-shared
)$(build-hardcoded-path-in-tests
),yesno
)
373 CPPFLAGS-tst-pthread-gdb-attach.c
+= -DDO_ADD_SYMBOL_FILE
=1
375 CPPFLAGS-tst-pthread-gdb-attach.c
+= -DDO_ADD_SYMBOL_FILE
=0
377 CFLAGS-tst-pthread-gdb-attach-static.c
:= $(CFLAGS-printers-tests
)
378 CPPFLAGS-tst-pthread-gdb-attach-static.c
:= \
379 $(CFLAGS-printers-tests
) -DDO_ADD_SYMBOL_FILE
=0
381 ifeq ($(build-shared
),yes
)
382 tests-printers-libs
:= $(shared-thread-library
)
384 tests-printers-libs
:= $(static-thread-library
)
387 LDFLAGS-pthread.so
= -Wl
,--enable-new-dtags
,-z
,nodelete
,-z
,initfirst
389 tests
+= tst-cancelx7 tst-cancelx17
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
399 modules-names
= tst-tls3mod \
400 tst-tls5mod tst-tls5moda tst-tls5modb tst-tls5modc \
401 tst-tls5modd tst-tls5mode tst-tls5modf tst-stack4mod \
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
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
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
426 ifeq ($(build-shared
),yes
)
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
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
):
446 extra-objs
+= $(crti-objs
) $(crtn-objs
)
447 extra-objs
+= pt-crti.o
450 CFLAGS-flockfile.c
+= $(libio-mtsafe
)
451 CFLAGS-ftrylockfile.c
+= $(libio-mtsafe
)
452 CFLAGS-funlockfile.c
+= $(libio-mtsafe
)
454 link-libc-static
:= $(common-objpfx
)libc.a
$(static-gnulib
) \
455 $(common-objpfx
)libc.a
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
464 tests
+= tst-cancel24-static
466 tests-internal
+= tst-sem11-static tst-sem12-static tst-stackguard1-static
467 xtests-static
+= tst-setuid1-static
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
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
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
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
))
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
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-
<)
517 tst-cancel7-ARGS
= --command
"exec $(host-test-program-cmd)"
518 tst-cancelx7-ARGS
= $(tst-cancel7-ARGS
)
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
> $@
; \
524 generated
+= tst-stack3-mem.out tst-stack3.mtrace
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
; \
533 $(objpfx
)tst-stack4.out
: $(tst-stack4mod.sos
)
534 $(tst-stack4mod.sos
): $(objpfx
)tst-stack4mod.so
537 rm -f
$(tst-stack4mod.sos
)
539 $(objpfx
)tst-cleanup4
: $(objpfx
)tst-cleanup4aux.o
$(shared-thread-library
)
540 $(objpfx
)tst-cleanupx4
: $(objpfx
)tst-cleanupx4aux.o
$(shared-thread-library
)
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
)
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
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
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)'; \
565 $(objpfx
)tst-dlsym1
: $(libdl
) $(shared-thread-library
)
567 ifeq (yes
,$(build-shared
))
568 librt
= $(common-objpfx
)rt
/librt.so
570 librt
= $(common-objpfx
)rt
/librt.a
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
)
577 $(objpfx
)tst-cancel17
: $(librt
)
578 $(objpfx
)tst-cancelx17
: $(librt
)
580 LDLIBS-tst-cancel24
= -Wl
,--no-as-needed
-lstdc
++
581 LDLIBS-tst-cancel24-static
= $(LDLIBS-tst-cancel24
)
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
))
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
603 $(addprefix $(objpfx
),$(tests
) $(test-srcs
)): $(objpfx
)libpthread.a
606 ifeq ($(build-shared
),yes
)
607 $(objpfx
)crti.o
: $(objpfx
)pt-crti.o
610 ifneq ($(multidir
),.
)
611 $(objpfx
)$(multidir
)/crti.o
: $(objpfx
)crti.o
$(objpfx
)$(multidir
)/
614 $(objpfx
)$(multidir
)/crtn.o
: $(objpfx
)crtn.o
$(objpfx
)$(multidir
)/
618 generated
+= multidir.mk tst-tls6.out
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
626 tst-exec4-ARGS
= $(host-test-program-cmd
)
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
633 tst-stackguard1-ARGS
= --command
"$(host-test-program-cmd) --child"
634 tst-stackguard1-static-ARGS
= --command
"$(objpfx)tst-stackguard1-static --child"
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)' > $@
; \
642 $(objpfx
)tst-compat-forwarder
: $(objpfx
)tst-compat-forwarder-mod.so
644 tst-mutex10-ENV
= GLIBC_TUNABLES
=glibc.elision.enable
=1
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
654 # The test uses dlopen indirectly and would otherwise load system
656 tst-setuid1-static-ENV
= \
657 LD_LIBRARY_PATH
=$(ld-library-path
):$(common-objpfx
)elf
:$(common-objpfx
)nss
659 # The tests here better do not run in parallel.
660 ifeq ($(run-built-tests
),yes
)
661 ifneq ($(filter %tests
,$(MAKECMDGOALS
)),)