powerpc: Add optimized strlen for POWER10
[glibc.git] / nptl / Makefile
blob294bb2faa495da833aae729e4f0a5423559217a6
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.
21 subdir := nptl
23 include ../Makeconfig
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)
31 routines = \
32 alloca_cutoff \
33 cleanup_compat \
34 cleanup_defer_compat \
35 cleanup_routine \
36 elision-conf \
37 elision-lock \
38 elision-timed \
39 elision-trylock \
40 elision-unlock \
41 futex-internal \
42 libc-cancellation \
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_init \
84 pthread_equal \
85 pthread_exit \
86 pthread_getaffinity \
87 pthread_getattr_np \
88 pthread_getschedparam \
89 pthread_getspecific \
90 pthread_key_create \
91 pthread_key_delete \
92 pthread_keys \
93 pthread_kill \
94 pthread_kill_other_threads \
95 pthread_mutex_cond_lock \
96 pthread_mutex_conf \
97 pthread_mutex_consistent \
98 pthread_mutex_destroy \
99 pthread_mutex_init \
100 pthread_mutex_lock \
101 pthread_mutex_unlock \
102 pthread_once \
103 pthread_rwlock_rdlock \
104 pthread_rwlock_unlock \
105 pthread_rwlock_wrlock \
106 pthread_self \
107 pthread_setcancelstate \
108 pthread_setcanceltype \
109 pthread_setschedparam \
110 pthread_setspecific \
111 pthread_sigmask \
112 tpp \
113 unwind \
115 shared-only-routines = forward
116 static-only-routines = pthread_atfork
118 libpthread-routines = \
119 cancellation \
120 cleanup \
121 cleanup_defer \
122 events \
123 flockfile \
124 ftrylockfile \
125 funlockfile \
126 herrno \
127 libpthread-compat \
128 nptl-init \
129 nptlfreeres \
130 pt-interp \
131 pthread_attr_getaffinity \
132 pthread_attr_getguardsize \
133 pthread_attr_getstack \
134 pthread_attr_getstackaddr \
135 pthread_attr_getstacksize \
136 pthread_attr_setguardsize \
137 pthread_attr_setstack \
138 pthread_attr_setstackaddr \
139 pthread_attr_setstacksize \
140 pthread_barrier_destroy \
141 pthread_barrier_init \
142 pthread_barrier_wait \
143 pthread_barrierattr_destroy \
144 pthread_barrierattr_getpshared \
145 pthread_barrierattr_init \
146 pthread_barrierattr_setpshared \
147 pthread_cancel \
148 pthread_clockjoin \
149 pthread_condattr_getclock \
150 pthread_condattr_getpshared \
151 pthread_condattr_setclock \
152 pthread_condattr_setpshared \
153 pthread_create \
154 pthread_detach \
155 pthread_getattr_default_np \
156 pthread_getconcurrency \
157 pthread_getcpuclockid \
158 pthread_getname \
159 pthread_join \
160 pthread_join_common \
161 pthread_mutex_getprioceiling \
162 pthread_mutex_setprioceiling \
163 pthread_mutex_timedlock \
164 pthread_mutex_trylock \
165 pthread_mutexattr_destroy \
166 pthread_mutexattr_getprioceiling \
167 pthread_mutexattr_getprotocol \
168 pthread_mutexattr_getpshared \
169 pthread_mutexattr_getrobust \
170 pthread_mutexattr_gettype \
171 pthread_mutexattr_init \
172 pthread_mutexattr_setprioceiling \
173 pthread_mutexattr_setprotocol \
174 pthread_mutexattr_setpshared \
175 pthread_mutexattr_setrobust \
176 pthread_mutexattr_settype \
177 pthread_rwlock_clockrdlock \
178 pthread_rwlock_clockwrlock \
179 pthread_rwlock_destroy \
180 pthread_rwlock_init \
181 pthread_rwlock_timedrdlock \
182 pthread_rwlock_timedwrlock \
183 pthread_rwlock_tryrdlock \
184 pthread_rwlock_trywrlock \
185 pthread_rwlockattr_destroy \
186 pthread_rwlockattr_getkind_np \
187 pthread_rwlockattr_getpshared \
188 pthread_rwlockattr_init \
189 pthread_rwlockattr_setkind_np \
190 pthread_rwlockattr_setpshared \
191 pthread_setaffinity \
192 pthread_setattr_default_np \
193 pthread_setconcurrency \
194 pthread_setname \
195 pthread_setschedprio \
196 pthread_sigqueue \
197 pthread_spin_destroy \
198 pthread_spin_init \
199 pthread_spin_lock \
200 pthread_spin_trylock \
201 pthread_spin_unlock \
202 pthread_testcancel \
203 pthread_timedjoin \
204 pthread_tryjoin \
205 pthread_yield \
206 res \
207 sem_clockwait \
208 sem_close \
209 sem_destroy \
210 sem_getvalue \
211 sem_init \
212 sem_open \
213 sem_post \
214 sem_routines \
215 sem_timedwait \
216 sem_unlink \
217 sem_wait \
218 vars \
219 version \
221 libpthread-shared-only-routines = \
222 pt-allocrtsig \
223 pt-interp \
224 version \
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
242 # and setcanceltype.
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
248 # function.
249 CFLAGS-pthread_exit.c += -fexceptions
251 # Among others, __pthread_unwind is forwarded. This function must handle
252 # exceptions.
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 \
291 tst-once5 \
292 tst-sem17 \
293 tst-tsd3 tst-tsd4 \
294 tst-cancel4_1 tst-cancel4_2 \
295 tst-cancel7 tst-cancel17 tst-cancel24 \
296 tst-signal3 \
297 tst-exec4 tst-exec5 \
298 tst-stack2 tst-stack3 tst-stack4 \
299 tst-pthread-attr-affinity \
300 tst-dlsym1 \
301 tst-context1 \
302 tst-sched1 \
303 tst-initializers1 $(addprefix tst-initializers1-,\
304 c89 gnu89 c99 gnu99 c11 gnu11) \
305 tst-thread_local1 \
306 tst-robust-fork \
307 tst-thread-exit-clobber tst-minstack-cancel tst-minstack-exit \
308 tst-minstack-throw \
309 tst-rwlock-pwn \
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 \
330 tst-setgetname \
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.
338 xtests += tst-eintr1
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
354 # we need -O0.
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
374 else
375 CPPFLAGS-tst-pthread-gdb-attach.c += -DDO_ADD_SYMBOL_FILE=0
376 endif
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
380 # As of version 9.2, GDB cannot attach properly to PIE programs that
381 # were launched with an explicit ld.so invocation.
382 tst-pthread-gdb-attach-no-pie = yes
384 ifeq ($(build-shared),yes)
385 tests-printers-libs := $(shared-thread-library)
386 else
387 tests-printers-libs := $(static-thread-library)
388 endif
390 LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
392 tests += tst-cancelx7 tst-cancelx17
394 ifeq ($(build-shared),yes)
395 tests += tst-compat-forwarder tst-audit-threads
396 tests-internal += tst-tls3 tst-tls3-malloc tst-tls5 tst-stackguard1
397 ifeq ($(have-z-execstack),yes)
398 tests += tst-execstack
399 endif
400 endif
402 modules-names = tst-tls3mod \
403 tst-tls5mod tst-tls5moda tst-tls5modb tst-tls5modc \
404 tst-tls5modd tst-tls5mode tst-tls5modf tst-stack4mod \
405 tst-execstack-mod \
406 tst-compat-forwarder-mod tst-audit-threads-mod1 \
407 tst-audit-threads-mod2
408 extra-test-objs += $(addsuffix .os,$(strip $(modules-names))) \
409 tst-cleanup4aux.o tst-cleanupx4aux.o
410 test-extras += tst-cleanup4aux tst-cleanupx4aux
412 # This test exercises compat symbols removed in glibc 2.34.
413 ifdef have-GLIBC_2.33
414 tests += tst-cleanup4
415 ifeq ($(build-shared),yes)
416 tests += tst-cleanupx4
417 endif
418 endif
420 tst-tls3mod.so-no-z-defs = yes
421 tst-tls5mod.so-no-z-defs = yes
422 tst-tls5moda.so-no-z-defs = yes
423 tst-tls5modb.so-no-z-defs = yes
424 tst-tls5modc.so-no-z-defs = yes
425 tst-tls5modd.so-no-z-defs = yes
426 tst-tls5mode.so-no-z-defs = yes
427 tst-tls5modf.so-no-z-defs = yes
429 ifeq ($(build-shared),yes)
431 # Set the `multidir' variable by grabbing the variable from the compiler.
432 # We do it once and save the result in a generated makefile.
433 -include $(objpfx)multidir.mk
434 $(objpfx)multidir.mk: $(common-objpfx)config.make
435 $(make-target-directory)
436 dir=`$(CC) $(CFLAGS) $(CPPFLAGS) -print-multi-directory`; \
437 echo "multidir := $$dir" > $@T
438 mv -f $@T $@
440 crti-objs := crti.o
441 crtn-objs := crtn.o
442 ifneq (,$(patsubst .,,$(multidir)))
443 generated-dirs += $(firstword $(subst /, , $(multidir)))
444 crti-objs += $(multidir)/crti.o
445 crtn-objs += $(multidir)/crtn.o
446 $(objpfx)$(multidir):
447 mkdir -p $@
448 endif
449 extra-objs += $(crti-objs) $(crtn-objs)
450 extra-objs += pt-crti.o
451 endif
453 CFLAGS-flockfile.c += $(libio-mtsafe)
454 CFLAGS-ftrylockfile.c += $(libio-mtsafe)
455 CFLAGS-funlockfile.c += $(libio-mtsafe)
457 link-libc-static := $(common-objpfx)libc.a $(static-gnulib) \
458 $(common-objpfx)libc.a
460 tests-static += tst-stackguard1-static \
461 tst-cancel24-static \
462 tst-mutex8-static tst-mutexpi8-static tst-sem11-static \
463 tst-sem12-static tst-cond11-static \
464 tst-pthread-gdb-attach-static \
465 tst-pthread_exit-nothreads-static
467 tests += tst-cancel24-static
469 tests-internal += tst-sem11-static tst-sem12-static tst-stackguard1-static
470 xtests-static += tst-setuid1-static
472 ifeq ($(run-built-tests),yes)
473 tests-special += $(objpfx)tst-stack3-mem.out $(objpfx)tst-oddstacklimit.out
474 ifeq ($(build-shared),yes)
475 tests-special += $(objpfx)tst-tls6.out
476 endif
477 endif
479 ifeq (,$(CXX))
480 # These tests require a C++ compiler and runtime.
481 tests-unsupported += tst-cancel24 tst-cancel24-static tst-once5 \
482 tst-thread-exit-clobber tst-minstack-throw
483 endif
484 # These tests require a C++ compiler and runtime with thread_local support.
485 ifneq ($(have-cxx-thread_local),yes)
486 tests-unsupported += tst-thread_local1
487 endif
489 include ../Rules
491 ifeq (yes,$(build-shared))
492 # Make sure these things are built in the `make lib' pass so they can be used
493 # to run programs during the `make others' pass.
494 lib-noranlib: $(addprefix $(objpfx),$(extra-objs))
495 endif
498 # 'pthread_self' is a simple memory or register load. Setting up the
499 # stack frame is more work than the actual operation. Disable the
500 # frame creation entirely. This will help applications which call the
501 # function frequently to get a thread-specific handle.
502 CFLAGS-pthread_self.os += -fomit-frame-pointer
504 # Run the cancellation and cleanup tests also for the modern, exception-based
505 # implementation. For this we have to pass the -fexceptions parameter.
506 CFLAGS-tst-cancelx7.c += -fexceptions
507 CFLAGS-tst-cancelx17.c += -fexceptions
508 CFLAGS-tst-cleanupx4.c += -fexceptions
509 CFLAGS-tst-cleanupx4aux.c += -fexceptions
510 CFLAGS-tst-initializers1.c += -W -Wall -Werror
511 CFLAGS-tst-initializers1-< = $(CFLAGS-tst-initializers1.c) \
512 $(patsubst tst-initializers1-%.c,-std=%,$<)
513 CFLAGS-tst-initializers1-c89.c += $(CFLAGS-tst-initializers1-<)
514 CFLAGS-tst-initializers1-c99.c += $(CFLAGS-tst-initializers1-<)
515 CFLAGS-tst-initializers1-c11.c += $(CFLAGS-tst-initializers1-<)
516 CFLAGS-tst-initializers1-gnu89.c += $(CFLAGS-tst-initializers1-<)
517 CFLAGS-tst-initializers1-gnu99.c += $(CFLAGS-tst-initializers1-<)
518 CFLAGS-tst-initializers1-gnu11.c += $(CFLAGS-tst-initializers1-<)
520 tst-cancel7-ARGS = --command "exec $(host-test-program-cmd)"
521 tst-cancelx7-ARGS = $(tst-cancel7-ARGS)
523 tst-stack3-ENV = MALLOC_TRACE=$(objpfx)tst-stack3.mtrace
524 $(objpfx)tst-stack3-mem.out: $(objpfx)tst-stack3.out
525 $(common-objpfx)malloc/mtrace $(objpfx)tst-stack3.mtrace > $@; \
526 $(evaluate-test)
527 generated += tst-stack3-mem.out tst-stack3.mtrace
529 $(objpfx)tst-stack4: $(libdl) $(shared-thread-library)
530 tst-stack4mod.sos=$(shell for i in 0 1 2 3 4 5 6 7 8 9 10 \
531 11 12 13 14 15 16 17 18 19; do \
532 for j in 0 1 2 3 4 5 6 7 8 9 10 \
533 11 12 13 14 15 16 17 18 19; do \
534 echo $(objpfx)tst-stack4mod-$$i-$$j.so; \
535 done; done)
536 $(objpfx)tst-stack4.out: $(tst-stack4mod.sos)
537 $(tst-stack4mod.sos): $(objpfx)tst-stack4mod.so
538 cp -f $< $@
539 clean:
540 rm -f $(tst-stack4mod.sos)
542 $(objpfx)tst-cleanup4: $(objpfx)tst-cleanup4aux.o $(shared-thread-library)
543 $(objpfx)tst-cleanupx4: $(objpfx)tst-cleanupx4aux.o $(shared-thread-library)
545 $(objpfx)tst-tls3: $(libdl) $(shared-thread-library)
546 LDFLAGS-tst-tls3 = -rdynamic
547 $(objpfx)tst-tls3.out: $(objpfx)tst-tls3mod.so
548 $(objpfx)tst-tls3mod.so: $(shared-thread-library)
550 $(objpfx)tst-tls3-malloc: $(libdl) $(shared-thread-library)
551 LDFLAGS-tst-tls3-malloc = -rdynamic
552 $(objpfx)tst-tls3-malloc.out: $(objpfx)tst-tls3mod.so
554 $(objpfx)tst-tls5: $(objpfx)tst-tls5mod.so $(shared-thread-library)
555 LDFLAGS-tst-tls5 = -Wl,--no-as-needed
556 LDFLAGS-tst-tls5mod.so = -Wl,-soname,tst-tls5mod.so
558 ifeq ($(build-shared),yes)
559 $(objpfx)tst-tls6.out: tst-tls6.sh $(objpfx)tst-tls5 \
560 $(objpfx)tst-tls5moda.so $(objpfx)tst-tls5modb.so \
561 $(objpfx)tst-tls5modc.so $(objpfx)tst-tls5modd.so \
562 $(objpfx)tst-tls5mode.so $(objpfx)tst-tls5modf.so
563 $(BASH) $< $(common-objpfx) '$(test-via-rtld-prefix)' \
564 '$(test-wrapper-env)' '$(run-program-env)'; \
565 $(evaluate-test)
566 endif
568 $(objpfx)tst-dlsym1: $(libdl) $(shared-thread-library)
570 ifeq (yes,$(build-shared))
571 librt = $(common-objpfx)rt/librt.so
572 else
573 librt = $(common-objpfx)rt/librt.a
574 endif
576 # `make check' sometimes triggers a rebuild of librt.so using this Makefile,
577 # which ignores librt's dependence on libpthread
578 $(common-objpfx)rt/librt.so: $(shared-thread-library)
580 $(objpfx)tst-cancel17: $(librt)
581 $(objpfx)tst-cancelx17: $(librt)
583 LDLIBS-tst-cancel24 = -Wl,--no-as-needed -lstdc++
584 LDLIBS-tst-cancel24-static = $(LDLIBS-tst-cancel24)
586 extra-B-pthread.so = -B$(common-objpfx)nptl/
587 $(objpfx)libpthread.so: $(addprefix $(objpfx),$(crti-objs) $(crtn-objs))
588 $(objpfx)libpthread.so: +preinit += $(addprefix $(objpfx),$(crti-objs))
589 $(objpfx)libpthread.so: +postinit += $(addprefix $(objpfx),$(crtn-objs))
591 # Make sure we link with the thread library.
592 ifeq ($(build-shared),yes)
593 $(addprefix $(objpfx), \
594 $(filter-out $(tests-static) $(xtests-static) $(tests-reverse) \
595 $(tests-nolibpthread), \
596 $(tests) $(tests-internal) $(xtests) $(test-srcs) $(tests-container))): \
597 $(objpfx)libpthread.so
598 $(objpfx)tst-unload: $(libdl)
599 # $(objpfx)../libc.so is used instead of $(common-objpfx)libc.so,
600 # since otherwise libpthread.so comes before libc.so when linking.
601 $(addprefix $(objpfx), $(tests-reverse)): \
602 $(objpfx)../libc.so $(objpfx)libpthread.so
603 $(objpfx)../libc.so: $(common-objpfx)libc.so ;
604 $(addprefix $(objpfx),$(tests-static) $(xtests-static)): $(objpfx)libpthread.a
605 else
606 $(addprefix $(objpfx),$(tests) $(test-srcs)): $(objpfx)libpthread.a
607 endif
609 ifeq ($(build-shared),yes)
610 $(objpfx)crti.o: $(objpfx)pt-crti.o
611 ln -f $< $@
613 ifneq ($(multidir),.)
614 $(objpfx)$(multidir)/crti.o: $(objpfx)crti.o $(objpfx)$(multidir)/
615 ln -f $< $@
617 $(objpfx)$(multidir)/crtn.o: $(objpfx)crtn.o $(objpfx)$(multidir)/
618 ln -f $< $@
619 endif
621 generated += multidir.mk tst-tls6.out
623 # Give libpthread.so an entry point and make it directly runnable itself.
624 LDFLAGS-pthread.so += -e __nptl_main
625 # pt-interp.c exists just to get the runtime linker path into libpthread.so.
626 $(objpfx)pt-interp.os: $(common-objpfx)runtime-linker.h
627 endif
629 tst-exec4-ARGS = $(host-test-program-cmd)
631 $(objpfx)tst-execstack: $(libdl)
632 $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
633 LDFLAGS-tst-execstack = -Wl,-z,noexecstack
634 CFLAGS-tst-execstack-mod.c += -Wno-trampolines
636 tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child"
637 tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
639 ifeq ($(run-built-tests),yes)
640 $(objpfx)tst-oddstacklimit.out: $(objpfx)tst-oddstacklimit $(objpfx)tst-basic1
641 $(test-program-prefix) $< --command '$(host-test-program-cmd)' > $@; \
642 $(evaluate-test)
643 endif
645 $(objpfx)tst-compat-forwarder: $(objpfx)tst-compat-forwarder-mod.so
647 tst-mutex10-ENV = GLIBC_TUNABLES=glibc.elision.enable=1
649 # Protect against a build using -Wl,-z,now.
650 LDFLAGS-tst-audit-threads-mod1.so = -Wl,-z,lazy
651 LDFLAGS-tst-audit-threads-mod2.so = -Wl,-z,lazy
652 LDFLAGS-tst-audit-threads = -Wl,-z,lazy
653 $(objpfx)tst-audit-threads: $(objpfx)tst-audit-threads-mod2.so
654 $(objpfx)tst-audit-threads.out: $(objpfx)tst-audit-threads-mod1.so
655 tst-audit-threads-ENV = LD_AUDIT=$(objpfx)tst-audit-threads-mod1.so
657 # The test uses dlopen indirectly and would otherwise load system
658 # objects.
659 tst-setuid1-static-ENV = \
660 LD_LIBRARY_PATH=$(ld-library-path):$(common-objpfx)elf:$(common-objpfx)nss
662 # The tests here better do not run in parallel.
663 ifeq ($(run-built-tests),yes)
664 ifneq ($(filter %tests,$(MAKECMDGOALS)),)
665 .NOTPARALLEL:
666 endif
667 endif