localedef: Update LC_MONETARY handling (Bug 28845)
[glibc.git] / elf / Makefile
blobbff94954c93df2a3406e3e68fb8e675e0658c6ad
1 # Copyright (C) 1995-2022 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/>.
18 # Makefile for elf subdirectory of GNU C Library.
20 subdir := elf
22 include ../Makeconfig
24 headers = \
25 bits/elfclass.h \
26 bits/link.h \
27 bits/link_lavcurrent.h \
28 elf.h \
29 link.h \
30 # headers
32 routines = \
33 $(all-dl-routines) \
34 dl-addr \
35 dl-addr-obj \
36 dl-error \
37 dl-iteratephdr \
38 dl-libc \
39 dl-origin \
40 dl-profstub \
41 dl-reloc-static-pie \
42 dl-support \
43 dl-sym \
44 dl-sysdep \
45 enbl-secure \
46 libc-dl_find_object \
47 libc_early_init \
48 rtld_static_init \
49 # routines
51 # The core dynamic linking functions are in libc for the static and
52 # profiled libraries.
53 dl-routines = \
54 dl-call-libc-early-init \
55 dl-close \
56 dl-debug \
57 dl-debug-symbols \
58 dl-deps \
59 dl-exception \
60 dl-execstack \
61 dl-find_object \
62 dl-fini \
63 dl-init \
64 dl-load \
65 dl-lookup \
66 dl-lookup-direct \
67 dl-minimal-malloc \
68 dl-misc \
69 dl-object \
70 dl-open \
71 dl-origin \
72 dl-printf \
73 dl-profile \
74 dl-reloc \
75 dl-runtime \
76 dl-scope \
77 dl-setup_hash \
78 dl-sort-maps \
79 dl-thread_gscope_wait \
80 dl-tls \
81 dl-tls_init_tp \
82 dl-trampoline \
83 dl-version \
84 dl-write \
85 # dl-routines
87 ifeq (yes,$(use-ldconfig))
88 dl-routines += dl-cache
89 endif
91 ifneq (no,$(have-tunables))
92 dl-routines += dl-tunables
93 tunables-type = $(addprefix TUNABLES_FRONTEND_,$(have-tunables))
94 CPPFLAGS-dl-tunables.c += -DTUNABLES_FRONTEND=$(tunables-type)
96 ifeq (yesyes,$(build-shared)$(run-built-tests))
97 tests-special += $(objpfx)list-tunables.out
98 endif
100 # Make sure that the compiler does not insert any library calls in tunables
101 # code paths.
102 ifeq (yes,$(have-loop-to-function))
103 CFLAGS-dl-tunables.c += -fno-tree-loop-distribute-patterns
104 endif
105 endif
107 all-dl-routines = $(dl-routines) $(sysdep-dl-routines)
108 # But they are absent from the shared libc, because that code is in ld.so.
109 elide-routines.os = \
110 $(all-dl-routines) \
111 dl-exception \
112 dl-origin \
113 dl-reloc-static-pie \
114 dl-support \
115 dl-sysdep \
116 enbl-secure \
117 rtld_static_init \
118 thread_gscope_wait \
119 # elide-routines.os
121 # These object files are only included in the dynamically-linked libc.
122 shared-only-routines = libc-dl_find_object
124 # ld.so uses those routines, plus some special stuff for being the program
125 # interpreter and operating independent of libc.
126 rtld-routines = \
127 $(all-dl-routines) \
128 dl-audit \
129 dl-compat \
130 dl-diagnostics \
131 dl-diagnostics-cpu \
132 dl-diagnostics-kernel \
133 dl-environ \
134 dl-error-minimal \
135 dl-hwcaps \
136 dl-hwcaps-subdirs \
137 dl-hwcaps_split \
138 dl-libc_freeres \
139 dl-minimal \
140 dl-mutex \
141 dl-sysdep \
142 dl-usage \
143 rtld \
144 # rtld-routines
146 all-rtld-routines = $(rtld-routines) $(sysdep-rtld-routines)
148 CFLAGS-dl-runtime.c += -fexceptions -fasynchronous-unwind-tables
149 CFLAGS-dl-lookup.c += -fexceptions -fasynchronous-unwind-tables
150 CFLAGS-dl-iteratephdr.c += $(uses-callbacks)
152 # Called during static library initialization, so turn stack-protection
153 # off for non-shared builds.
154 CFLAGS-dl-minimal-malloc.o = $(no-stack-protector)
155 CFLAGS-dl-minimal-malloc.op = $(no-stack-protector)
157 # On targets without __builtin_memset, rtld.c uses a hand-coded loop
158 # in _dl_start. Make sure this isn't turned into a call to regular memset.
159 ifeq (yes,$(have-loop-to-function))
160 CFLAGS-rtld.c += -fno-tree-loop-distribute-patterns
161 endif
163 # Compile rtld itself without stack protection.
164 # Also compile all routines in the static library that are elided from
165 # the shared libc because they are in libc.a in the same way.
167 CFLAGS-.o += $(call elide-stack-protector,.o,$(elide-routines.os))
168 CFLAGS-.op += $(call elide-stack-protector,.op,$(elide-routines.os))
169 CFLAGS-.os += $(call elide-stack-protector,.os,$(all-rtld-routines))
171 # Add the requested compiler flags to the early startup code.
172 CFLAGS-dl-printf.os += $(rtld-early-cflags)
173 CFLAGS-dl-setup_hash.os += $(rtld-early-cflags)
174 CFLAGS-dl-sysdep.os += $(rtld-early-cflags)
175 CFLAGS-dl-tunables.os += $(rtld-early-cflags)
176 CFLAGS-dl-write.os += $(rtld-early-cflags)
177 CFLAGS-dl-writev.os += $(rtld-early-cflags)
178 CFLAGS-rtld.os += $(rtld-early-cflags)
180 ifeq ($(unwind-find-fde),yes)
181 routines += unwind-dw2-fde-glibc
182 shared-only-routines += unwind-dw2-fde-glibc
183 endif
185 before-compile += $(objpfx)trusted-dirs.h
186 generated += trusted-dirs.h trusted-dirs.st for-renamed/renamed.so
187 generated-dirs += for-renamed
189 ifeq ($(build-shared),yes)
190 ld-map = $(common-objpfx)ld.map
191 endif
193 ifeq (yes,$(build-shared))
194 extra-objs = \
195 $(all-rtld-routines:%=%.os) \
196 sofini.os \
197 interp.os \
198 # extra-objs
199 generated += \
200 dl-allobjs.os \
201 ld.so ldd \
202 librtld.os \
203 # generated
204 install-others = $(inst_rtlddir)/$(rtld-installed-name) $(inst_bindir)/ld.so
205 install-bin-script = ldd
206 endif
208 others = sprof sln
209 install-bin = sprof
210 others-static = sln
211 install-rootsbin = sln
212 sln-modules := static-stubs
213 extra-objs += $(sln-modules:=.o)
215 ifeq (yes,$(use-ldconfig))
216 ifeq (yes,$(build-shared))
217 others-static += ldconfig
218 others += ldconfig
219 install-rootsbin += ldconfig
221 ldconfig-modules := \
222 cache \
223 chroot_canon \
224 readlib \
225 static-stubs \
226 stringtable \
227 xmalloc \
228 xstrdup \
229 # ldconfig-modules
230 extra-objs += $(ldconfig-modules:=.o)
231 others-extras = $(ldconfig-modules)
232 endif
233 endif
235 # To find xmalloc.c and xstrdup.c
236 vpath %.c ../locale/programs
238 ifeq ($(build-shared),yes)
239 extra-objs += sotruss-lib.os sotruss-lib.so
240 install-others += $(inst_auditdir)/sotruss-lib.so
241 install-bin-script += sotruss
242 generated += sotruss
243 libof-sotruss-lib = extramodules
244 LDFLAGS-sotruss-lib.so += $(z-now-$(bind-now))
245 $(objpfx)sotruss-lib.so: $(objpfx)sotruss-lib.os
246 $(build-module-asneeded)
247 $(objpfx)sotruss-lib.so: $(common-objpfx)libc.so $(objpfx)ld.so \
248 $(common-objpfx)libc_nonshared.a
250 $(objpfx)sotruss: sotruss.sh $(common-objpfx)config.make
251 sed -e 's%@VERSION@%$(version)%g' \
252 -e 's%@TEXTDOMAINDIR@%$(localedir)%g' \
253 -e 's%@PREFIX@%$(prefix)%g' \
254 -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
255 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' \
256 < $< > $@.new
257 chmod 555 $@.new
258 mv -f $@.new $@
259 $(inst_auditdir)/sotruss-lib.so: $(objpfx)sotruss-lib.so $(+force)
260 $(do-install-program)
261 endif
263 tests-static-normal := \
264 tst-array1-static \
265 tst-array5-static \
266 tst-dl-iter-static \
267 tst-dst-static \
268 tst-env-setuid \
269 tst-env-setuid-tunables \
270 tst-getauxval-static \
271 tst-linkall-static \
272 tst-single_threaded-pthread-static \
273 tst-single_threaded-static \
274 tst-tlsalign-extern-static \
275 tst-tlsalign-static \
276 # tests-static-normal
278 tests-static-internal := \
279 tst-dl_find_object-static \
280 tst-ptrguard1-static \
281 tst-stackguard1-static \
282 tst-tls1-static \
283 tst-tls1-static-non-pie \
284 # tests-static-internal
286 CRT-tst-tls1-static-non-pie := $(csu-objpfx)crt1.o
287 tst-tls1-static-non-pie-no-pie = yes
289 tests-container := \
290 tst-ldconfig-bad-aux-cache \
291 tst-ldconfig-ld_so_conf-update \
292 # tests-container
294 ifeq (no,$(build-hardcoded-path-in-tests))
295 # This is an ld.so.cache test, and RPATH/RUNPATH in the executable
296 # interferes with its test objectives.
297 tests-container += tst-glibc-hwcaps-prepend-cache
298 endif
300 tests := \
301 tst-array1 \
302 tst-array2 \
303 tst-array3 \
304 tst-array4 \
305 tst-array5 \
306 tst-auxv \
307 tst-leaks1 \
308 tst-stringtable \
309 tst-tls9 \
310 # tests
312 tests-internal := \
313 $(tests-static-internal) \
314 tst-tls1 \
315 # tests-internal
317 tests-static := $(tests-static-normal) $(tests-static-internal)
319 ifeq (yes,$(build-shared))
320 tests-static += \
321 tst-single_threaded-static-dlopen \
322 tst-tls9-static \
323 # tests-static
325 static-dlopen-environment = \
326 LD_LIBRARY_PATH=$(ld-library-path):$(common-objpfx)dlfcn
327 tst-tls9-static-ENV = $(static-dlopen-environment)
328 tst-single_threaded-static-dlopen-ENV = $(static-dlopen-environment)
330 tests += \
331 argv0test \
332 constload1 \
333 dblload \
334 dblunload \
335 filter \
336 global \
337 initfirst \
338 lateglobal \
339 loadfail \
340 multiload \
341 next \
342 nodelete \
343 nodelete2 \
344 nodlopen \
345 nodlopen2 \
346 noload \
347 order \
348 order2 \
349 origtest \
350 preloadtest \
351 reldep \
352 reldep2 \
353 reldep3 \
354 reldep4 \
355 reldep5 \
356 reldep6 \
357 reldep7 \
358 reldep8 \
359 resolvfail \
360 restest1 \
361 restest2 \
362 tst-absolute-sym \
363 tst-absolute-zero \
364 tst-addr1 \
365 tst-align \
366 tst-align2 \
367 tst-align3 \
368 tst-audit1 \
369 tst-audit2 \
370 tst-audit8 \
371 tst-audit9 \
372 tst-audit11 \
373 tst-audit12 \
374 tst-audit13 \
375 tst-audit17 \
376 tst-audit18 \
377 tst-audit19b \
378 tst-audit20 \
379 tst-audit21 \
380 tst-audit22 \
381 tst-audit23 \
382 tst-audit24a \
383 tst-audit24b \
384 tst-audit24c \
385 tst-audit24d \
386 tst-audit25a \
387 tst-audit25b \
388 tst-auditmany \
389 tst-auxobj \
390 tst-auxobj-dlopen \
391 tst-big-note \
392 tst-debug1 \
393 tst-deep1 \
394 tst-dl-is_dso \
395 tst-dlmodcount \
396 tst-dlmopen1 \
397 tst-dlmopen3 \
398 tst-dlmopen4 \
399 tst-dlmopen-dlerror \
400 tst-dlmopen-gethostbyname \
401 tst-dlopenfail \
402 tst-dlopenfail-2 \
403 tst-dlopenrpath \
404 tst-dlopen-self \
405 tst-dlopen-tlsmodid \
406 tst-dlsym-error \
407 tst-filterobj \
408 tst-filterobj-dlopen \
409 tst-glibc-hwcaps \
410 tst-glibc-hwcaps-mask \
411 tst-glibc-hwcaps-prepend \
412 tst-global1 \
413 tst-global2 \
414 tst-initfinilazyfail \
415 tst-initorder \
416 tst-initorder2 \
417 tst-latepthread \
418 tst-main1 \
419 tst-nodelete2 \
420 tst-nodelete-dlclose \
421 tst-nodelete-opened \
422 tst-noload \
423 tst-null-argv \
424 tst-p_align1 \
425 tst-p_align2 \
426 tst-p_align3 \
427 tst-relsort1 \
428 tst-ro-dynamic \
429 tst-rtld-run-static \
430 tst-single_threaded \
431 tst-single_threaded-pthread \
432 tst-sonamemove-dlopen \
433 tst-sonamemove-link \
434 tst-thrlock \
435 tst-tls10 \
436 tst-tls11 \
437 tst-tls12 \
438 tst-tls13 \
439 tst-tls14 \
440 tst-tls15 \
441 tst-tls16 \
442 tst-tls17 \
443 tst-tls18 \
444 tst-tls19 \
445 tst-tls20 \
446 tst-tls21 \
447 tst-tls4 \
448 tst-tls5 \
449 tst-tlsalign \
450 tst-tlsalign-extern \
451 tst-tls-dlinfo \
452 tst-tls-ie \
453 tst-tls-ie-dlmopen \
454 tst-tls-manydynamic \
455 tst-unique1 \
456 tst-unique2 \
457 tst-unwind-ctor \
458 tst-unwind-main \
459 unload3 \
460 unload4 \
461 unload5 \
462 unload6 \
463 unload7 \
464 unload8 \
465 valgrind-test \
466 # tests
467 tests-cxx = \
468 tst-dlopen-nodelete-reloc \
469 tst-nodelete \
470 tst-unique3 \
471 tst-unique4 \
472 # tests-cxx
474 tests += $(if $(CXX),$(tests-cxx))
476 tests-internal += \
477 circleload1 \
478 loadtest \
479 neededtest \
480 neededtest2 \
481 neededtest3 \
482 neededtest4 \
483 tst-audit19a \
484 tst-create_format1 \
485 tst-dl-hwcaps_split \
486 tst-dl_find_object \
487 tst-dl_find_object-threads \
488 tst-dlmopen2 \
489 tst-ptrguard1 \
490 tst-stackguard1 \
491 tst-tls-surplus \
492 tst-tls3 \
493 tst-tls6 \
494 tst-tls7 \
495 tst-tls8 \
496 unload \
497 unload2 \
498 # tests-internal
500 tests-container += \
501 tst-dlopen-self-container \
502 tst-dlopen-tlsmodid-container \
503 tst-pldd \
504 tst-preload-pthread-libc \
505 # tests-container
507 test-srcs = \
508 tst-pathopt \
509 # tests-srcs
511 ifeq (yes,$(have-fpie))
512 tests-pie += tst-align3
513 endif
514 selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
516 ifneq ($(selinux-enabled),1)
517 tests-execstack-yes = \
518 tst-execstack \
519 tst-execstack-needed \
520 tst-execstack-prog \
521 # tests-execstack-yes
522 endif
523 ifeq ($(have-depaudit),yes)
524 tests += \
525 tst-audit14 \
526 tst-audit14a \
527 tst-audit15 \
528 tst-audit16 \
529 # tests
530 ifeq ($(run-built-tests),yes)
531 tests-special += \
532 $(objpfx)tst-audit14-cmp.out \
533 $(objpfx)tst-audit14a-cmp.out \
534 $(objpfx)tst-audit15-cmp.out \
535 $(objpfx)tst-audit16-cmp.out \
536 # tests-special
537 endif
538 endif
539 endif
541 ifeq ($(run-built-tests),yes)
542 tests-special += $(objpfx)tst-valgrind-smoke.out
543 endif
544 $(objpfx)tst-valgrind-smoke.out: tst-valgrind-smoke.sh $(objpfx)ld.so $(objpfx)valgrind-test
545 $(SHELL) $< $(objpfx)ld.so $(rtlddir)/$(rtld-installed-name) '$(test-wrapper-env)' \
546 '$(run-program-env)' '$(rpath-link)' $(objpfx)valgrind-test > $@; $(evaluate-test)
548 tests += $(tests-execstack-$(have-z-execstack))
549 ifeq ($(run-built-tests),yes)
550 tests-special += \
551 $(objpfx)noload-mem.out \
552 $(objpfx)tst-ldconfig-X.out \
553 $(objpfx)tst-leaks1-mem.out \
554 $(objpfx)tst-rtld-help.out \
555 # tests-special
556 endif
557 tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
558 tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
559 tlsmod17a-modules = $(addprefix tst-tlsmod17a, $(tlsmod17a-suffixes))
560 tlsmod18a-modules = $(addprefix tst-tlsmod18a, $(tlsmod17a-suffixes))
561 one-hundred = $(foreach x,0 1 2 3 4 5 6 7 8 9, \
562 0$x 1$x 2$x 3$x 4$x 5$x 6$x 7$x 8$x 9$x)
563 tst-tls-many-dynamic-modules := \
564 $(foreach n,$(one-hundred),tst-tls-manydynamic$(n)mod)
565 tst-tls-many-dynamic-modules-dep-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 \
566 14 15 16 17 18 19
567 tst-tls-many-dynamic-modules-dep = \
568 $(foreach n,$(tst-tls-many-dynamic-modules-dep-suffixes),tst-tls-manydynamic$(n)mod-dep)
569 tst-tls-many-dynamic-modules-dep-bad-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
570 tst-tls-many-dynamic-modules-dep-bad = \
571 $(foreach n,$(tst-tls-many-dynamic-modules-dep-bad-suffixes),tst-tls-manydynamic$(n)mod-dep-bad)
572 extra-test-objs += \
573 $(tlsmod17a-modules:=.os) \
574 $(tlsmod18a-modules:=.os) \
575 tst-tlsalign-vars.o \
576 # extra-test-objs
577 test-extras += \
578 tst-tlsalign-vars \
579 tst-tlsmod17a \
580 tst-tlsmod18a \
581 # test-extras
582 modules-names = \
583 circlemod1 \
584 circlemod1a \
585 circlemod2 \
586 circlemod2a \
587 circlemod3 \
588 circlemod3a \
589 constload2 \
590 constload3 \
591 dblloadmod1 \
592 dblloadmod2 \
593 dblloadmod3 \
594 dep1 \
595 dep2 \
596 dep3 \
597 dep4 \
598 failobj \
599 filtmod1 \
600 filtmod2 \
601 firstobj \
602 globalmod1 \
603 libmarkermod1-1 \
604 libmarkermod1-2 \
605 libmarkermod1-3 \
606 libmarkermod2-1 \
607 libmarkermod2-2 \
608 libmarkermod3-1 \
609 libmarkermod3-2 \
610 libmarkermod3-3 \
611 libmarkermod4-1 \
612 libmarkermod4-2 \
613 libmarkermod4-3 \
614 libmarkermod4-4 \
615 ltglobmod1 \
616 ltglobmod2 \
617 neededobj1 \
618 neededobj2 \
619 neededobj3 \
620 neededobj4 \
621 neededobj5 \
622 neededobj6 \
623 nextmod1 \
624 nextmod2 \
625 nodel2mod1 \
626 nodel2mod2 \
627 nodel2mod3 \
628 nodelmod1 \
629 nodelmod2 \
630 nodelmod3 \
631 nodelmod4 \
632 nodlopenmod \
633 nodlopenmod2 \
634 order2mod1 \
635 order2mod2 \
636 order2mod3 \
637 order2mod4 \
638 pathoptobj \
639 reldep4mod1 \
640 reldep4mod2 \
641 reldep4mod3 \
642 reldep4mod4 \
643 reldep6mod0 \
644 reldep6mod1 \
645 reldep6mod2 \
646 reldep6mod3 \
647 reldep6mod4 \
648 reldep7mod1 \
649 reldep7mod2 \
650 reldep8mod1 \
651 reldep8mod2 \
652 reldep8mod3 \
653 reldep9mod1 \
654 reldep9mod2 \
655 reldep9mod3 \
656 reldepmod1 \
657 reldepmod2 \
658 reldepmod3 \
659 reldepmod4 \
660 reldepmod5 \
661 reldepmod6 \
662 testobj1 \
663 testobj1_1 \
664 testobj2 \
665 testobj3 \
666 testobj4 \
667 testobj5 \
668 testobj6 \
669 tst-absolute-sym-lib \
670 tst-absolute-zero-lib \
671 tst-alignmod \
672 tst-alignmod2 \
673 tst-alignmod3 \
674 tst-array2dep \
675 tst-array5dep \
676 tst-audit11mod1 \
677 tst-audit11mod2 \
678 tst-audit12mod1 \
679 tst-audit12mod2 \
680 tst-audit12mod3 \
681 tst-audit13mod1 \
682 tst-audit18mod \
683 tst-audit19bmod \
684 tst-audit23mod \
685 tst-audit24amod1 \
686 tst-audit24amod2 \
687 tst-audit24bmod1 \
688 tst-audit24bmod2 \
689 tst-audit24dmod1 \
690 tst-audit24dmod2 \
691 tst-audit24dmod3 \
692 tst-audit24dmod4 \
693 tst-audit25mod1 \
694 tst-audit25mod2 \
695 tst-audit25mod3 \
696 tst-audit25mod4 \
697 tst-auditlogmod-1 \
698 tst-auditlogmod-2 \
699 tst-auditlogmod-3 \
700 tst-auditmanymod1 \
701 tst-auditmanymod2 \
702 tst-auditmanymod3 \
703 tst-auditmanymod4 \
704 tst-auditmanymod5 \
705 tst-auditmanymod6 \
706 tst-auditmanymod7 \
707 tst-auditmanymod8 \
708 tst-auditmanymod9 \
709 tst-auditmod1 \
710 tst-auditmod9a \
711 tst-auditmod9b \
712 tst-auditmod11 \
713 tst-auditmod12 \
714 tst-auditmod18 \
715 tst-auditmod19a \
716 tst-auditmod19b \
717 tst-auditmod20 \
718 tst-auditmod21a \
719 tst-auditmod21b \
720 tst-auditmod22 \
721 tst-auditmod23 \
722 tst-auditmod24a \
723 tst-auditmod24b \
724 tst-auditmod24c \
725 tst-auditmod24d \
726 tst-auditmod25 \
727 tst-auxvalmod \
728 tst-big-note-lib \
729 tst-deep1mod1 \
730 tst-deep1mod2 \
731 tst-deep1mod3 \
732 tst-dl_find_object-mod1 \
733 tst-dl_find_object-mod2 \
734 tst-dl_find_object-mod3 \
735 tst-dl_find_object-mod4 \
736 tst-dl_find_object-mod5 \
737 tst-dl_find_object-mod6 \
738 tst-dl_find_object-mod7 \
739 tst-dl_find_object-mod8 \
740 tst-dl_find_object-mod9 \
741 tst-dlmopen1mod \
742 tst-dlmopen-dlerror-mod \
743 tst-dlmopen-gethostbyname-mod \
744 tst-dlopenfaillinkmod \
745 tst-dlopenfailmod1 \
746 tst-dlopenfailmod2 \
747 tst-dlopenfailmod3 \
748 tst-dlopenfailnodelmod \
749 tst-dlopenrpathmod \
750 tst-filterobj-aux \
751 tst-filterobj-filtee \
752 tst-filterobj-flt \
753 tst-finilazyfailmod \
754 tst-globalmod2 \
755 tst-initlazyfailmod \
756 tst-initorder2a \
757 tst-initorder2b \
758 tst-initorder2c \
759 tst-initorder2d \
760 tst-initordera1 \
761 tst-initordera2 \
762 tst-initordera3 \
763 tst-initordera4 \
764 tst-initorderb1 \
765 tst-initorderb2 \
766 tst-latepthreadmod \
767 tst-ldconfig-ld-mod \
768 tst-main1mod \
769 tst-nodelete2mod \
770 tst-nodelete-dlclose-dso \
771 tst-nodelete-dlclose-plugin \
772 tst-nodelete-opened-lib \
773 tst-null-argv-lib \
774 tst-p_alignmod-base \
775 tst-p_alignmod3 \
776 tst-relsort1mod1 \
777 tst-relsort1mod2 \
778 tst-ro-dynamic-mod \
779 tst-single_threaded-mod1 \
780 tst-single_threaded-mod2 \
781 tst-single_threaded-mod3 \
782 tst-single_threaded-mod4 \
783 tst-sonamemove-linkmod1 \
784 tst-sonamemove-runmod1 \
785 tst-sonamemove-runmod2 \
786 tst-tls19mod1 \
787 tst-tls19mod2 \
788 tst-tls19mod3 \
789 tst-tls20mod-bad \
790 tst-tls21mod \
791 tst-tlsalign-lib \
792 tst-tls-ie-mod0 \
793 tst-tls-ie-mod1 \
794 tst-tls-ie-mod2 \
795 tst-tls-ie-mod3 \
796 tst-tls-ie-mod4 \
797 tst-tls-ie-mod5 \
798 tst-tls-ie-mod6 \
799 tst-tlsmod1 \
800 tst-tlsmod10 \
801 tst-tlsmod11 \
802 tst-tlsmod12 \
803 tst-tlsmod13 \
804 tst-tlsmod13a \
805 tst-tlsmod14a \
806 tst-tlsmod14b \
807 tst-tlsmod15a \
808 tst-tlsmod15b \
809 tst-tlsmod16a \
810 tst-tlsmod16b \
811 tst-tlsmod17b \
812 tst-tlsmod2 \
813 tst-tlsmod3 \
814 tst-tlsmod4 \
815 tst-tlsmod5 \
816 tst-tlsmod6 \
817 tst-tlsmod7 \
818 tst-tlsmod8 \
819 tst-tlsmod9 \
820 tst-unique1mod1 \
821 tst-unique1mod2 \
822 tst-unique2mod1 \
823 tst-unique2mod2 \
824 tst-unwind-ctor-lib \
825 unload2dep \
826 unload2mod \
827 unload3mod1 \
828 unload3mod2 \
829 unload3mod3 \
830 unload3mod4 \
831 unload4mod1 \
832 unload4mod2 \
833 unload4mod3 \
834 unload4mod4 \
835 unload6mod1 \
836 unload6mod2 \
837 unload6mod3 \
838 unload7mod1 \
839 unload7mod2 \
840 unload8mod1 \
841 unload8mod1x \
842 unload8mod2 \
843 unload8mod3 \
844 unloadmod \
845 vismod1 \
846 vismod2 \
847 vismod3 \
848 # modules-names
850 modules-names-cxx = \
851 tst-dlopen-nodelete-reloc-mod1 \
852 tst-dlopen-nodelete-reloc-mod10 \
853 tst-dlopen-nodelete-reloc-mod11 \
854 tst-dlopen-nodelete-reloc-mod12 \
855 tst-dlopen-nodelete-reloc-mod13 \
856 tst-dlopen-nodelete-reloc-mod14 \
857 tst-dlopen-nodelete-reloc-mod15 \
858 tst-dlopen-nodelete-reloc-mod16 \
859 tst-dlopen-nodelete-reloc-mod17 \
860 tst-dlopen-nodelete-reloc-mod2 \
861 tst-dlopen-nodelete-reloc-mod3 \
862 tst-dlopen-nodelete-reloc-mod4 \
863 tst-dlopen-nodelete-reloc-mod5 \
864 tst-dlopen-nodelete-reloc-mod6 \
865 tst-dlopen-nodelete-reloc-mod7 \
866 tst-dlopen-nodelete-reloc-mod8 \
867 tst-dlopen-nodelete-reloc-mod9 \
868 tst-nodelete-rtldmod \
869 tst-nodelete-uniquemod \
870 tst-nodelete-zmod \
871 tst-unique3lib \
872 tst-unique3lib2 \
873 tst-unique4lib \
874 # modules-names-cxx
876 modules-names += \
877 $(if $(CXX),$(modules-names-cxx)) \
878 $(modules-execstack-$(have-z-execstack)) \
879 $(tlsmod17a-modules) \
880 $(tlsmod18a-modules) \
881 $(tst-tls-many-dynamic-modules) \
882 $(tst-tls-many-dynamic-modules-dep) \
883 $(tst-tls-many-dynamic-modules-dep-bad) \
884 # modules-names
886 # Most modules build with _ISOMAC defined, but those filtered out
887 # depend on internal headers.
888 modules-names-tests = $(filter-out ifuncmod% tst-tlsmod%,\
889 $(modules-names))
891 ifeq (yes,$(have-mtls-dialect-gnu2))
892 tests += tst-gnu2-tls1
893 modules-names += tst-gnu2-tls1mod
894 $(objpfx)tst-gnu2-tls1: $(objpfx)tst-gnu2-tls1mod.so
895 tst-gnu2-tls1mod.so-no-z-defs = yes
896 CFLAGS-tst-gnu2-tls1mod.c += -mtls-dialect=gnu2
898 tests += tst-audit-tlsdesc tst-audit-tlsdesc-dlopen
899 modules-names += tst-audit-tlsdesc-mod1 tst-audit-tlsdesc-mod2 tst-auditmod-tlsdesc
900 $(objpfx)tst-audit-tlsdesc: $(objpfx)tst-audit-tlsdesc-mod1.so \
901 $(objpfx)tst-audit-tlsdesc-mod2.so \
902 $(shared-thread-library)
903 CFLAGS-tst-audit-tlsdesc-mod1.c += -mtls-dialect=gnu2
904 CFLAGS-tst-audit-tlsdesc-mod2.c += -mtls-dialect=gnu2
905 $(objpfx)tst-audit-tlsdesc-dlopen: $(shared-thread-library)
906 $(objpfx)tst-audit-tlsdesc-dlopen.out: $(objpfx)tst-audit-tlsdesc-mod1.so \
907 $(objpfx)tst-audit-tlsdesc-mod2.so
908 $(objpfx)tst-audit-tlsdesc-mod1.so: $(objpfx)tst-audit-tlsdesc-mod2.so
909 $(objpfx)tst-audit-tlsdesc.out: $(objpfx)tst-auditmod-tlsdesc.so
910 tst-audit-tlsdesc-ENV = LD_AUDIT=$(objpfx)tst-auditmod-tlsdesc.so
911 $(objpfx)tst-audit-tlsdesc-dlopen.out: $(objpfx)tst-auditmod-tlsdesc.so
912 tst-audit-tlsdesc-dlopen-ENV = LD_AUDIT=$(objpfx)tst-auditmod-tlsdesc.so
913 endif
914 ifeq (yes,$(have-protected-data))
915 modules-names += tst-protected1moda tst-protected1modb
916 tests += tst-protected1a tst-protected1b
917 $(objpfx)tst-protected1a: $(addprefix $(objpfx),tst-protected1moda.so tst-protected1modb.so)
918 $(objpfx)tst-protected1b: $(addprefix $(objpfx),tst-protected1modb.so tst-protected1moda.so)
919 tst-protected1modb.so-no-z-defs = yes
920 # These tests fail with GCC versions prior to 5.1 and with some versions
921 # of binutils. See https://sourceware.org/bugzilla/show_bug.cgi?id=17709
922 # and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248 for details.
923 # Perhaps in future we can make these XFAILs conditional on some detection
924 # of compiler/linker behavior/version.
925 test-xfail-tst-protected1a = yes
926 test-xfail-tst-protected1b = yes
927 endif
928 ifeq (yesyes,$(have-fpie)$(build-shared))
929 modules-names += tst-piemod1
930 tests += tst-pie1 tst-pie2 tst-dlopen-pie tst-dlopen-tlsmodid-pie \
931 tst-dlopen-self-pie
932 tests-pie += tst-pie1 tst-pie2 tst-dlopen-tlsmodid-pie tst-dlopen-self-pie
933 ifeq (yes,$(have-protected-data))
934 tests += vismain
935 tests-pie += vismain
936 CFLAGS-vismain.c += $(PIE-ccflag)
937 endif
938 endif
939 modules-execstack-yes = tst-execstack-mod
940 extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
942 # filtmod1.so, tst-big-note-lib.so, tst-ro-dynamic-mod.so have special
943 # rules.
944 modules-names-nobuild := filtmod1 tst-big-note-lib tst-ro-dynamic-mod \
945 tst-audit24bmod1 tst-audit24bmod2
947 tests += $(tests-static)
949 ifeq (yes,$(have-ifunc))
950 tests-ifuncstatic := \
951 ifuncmain1static \
952 ifuncmain1picstatic \
953 ifuncmain2static \
954 ifuncmain2picstatic \
955 ifuncmain4static \
956 ifuncmain4picstatic \
957 ifuncmain5static \
958 ifuncmain5picstatic \
959 ifuncmain7static \
960 ifuncmain7picstatic \
961 # tests-ifuncstatic
962 ifeq (yes,$(have-gcc-ifunc))
963 tests-ifuncstatic += ifuncmain9static ifuncmain9picstatic
964 endif
965 tests-static += $(tests-ifuncstatic)
966 tests-internal += $(tests-ifuncstatic)
967 ifeq (yes,$(build-shared))
968 tests += \
969 tst-ifunc-fault-bindnow \
970 tst-ifunc-fault-lazy \
971 # tests
972 # Note: sysdeps/x86_64/ifuncmain8.c uses ifuncmain8.
973 tests-internal += \
974 ifuncmain1pic \
975 ifuncmain1staticpic \
976 ifuncmain1vis \
977 ifuncmain1vispic \
978 ifuncmain2 \
979 ifuncmain2pic \
980 ifuncmain3 \
981 ifuncmain4 \
982 ifuncmain5staticpic \
983 ifuncmain7 \
984 ifuncmain7pic \
985 # tests-internal
986 ifeq (no,$(with-lld))
987 tests-internal += \
988 ifuncmain1 \
989 ifuncmain5 \
990 ifuncmain5pic \
991 # tests-internal
992 endif
993 ifeq (yes,$(have-gcc-ifunc))
994 tests-internal += \
995 ifuncmain9 \
996 ifuncmain9pic \
997 # tests-internal
998 endif
999 ifunc-test-modules = \
1000 ifuncdep1 \
1001 ifuncdep1pic \
1002 ifuncdep2 \
1003 ifuncdep2pic \
1004 ifuncdep5 \
1005 ifuncdep5pic \
1006 # ifunc-test-modules
1007 extra-test-objs += $(ifunc-test-modules:=.o)
1008 test-internal-extras += $(ifunc-test-modules)
1009 ifeq (yes,$(have-fpie))
1010 ifunc-pie-tests = \
1011 ifuncmain1pie \
1012 ifuncmain1staticpie \
1013 ifuncmain1vispie \
1014 ifuncmain6pie \
1015 ifuncmain7pie \
1016 # ifunc-pie-tests
1017 ifeq (yes,$(have-gcc-ifunc))
1018 ifunc-pie-tests += ifuncmain9pie
1019 endif
1020 ifeq (no,$(with-lld))
1021 ifunc-pie-tests += ifuncmain5pie
1022 endif
1023 ifeq (yes,$(have-textrel_ifunc))
1024 ifunc-pie-tests += tst-ifunc-textrel
1025 endif
1026 tests-internal += $(ifunc-pie-tests)
1027 tests-pie += $(ifunc-pie-tests)
1028 endif
1029 modules-names += \
1030 ifuncmod1 \
1031 ifuncmod3 \
1032 ifuncmod6 \
1033 # module-names
1034 ifeq (no,$(with-lld))
1035 modules-names += ifuncmod5
1036 endif
1037 endif
1038 endif
1040 ifeq (yes,$(build-shared))
1041 ifeq ($(run-built-tests),yes)
1042 tests-special += \
1043 $(objpfx)argv0test.out \
1044 $(objpfx)tst-pathopt.out \
1045 $(objpfx)tst-rtld-help.out \
1046 $(objpfx)tst-rtld-load-self.out \
1047 $(objpfx)tst-rtld-preload.out \
1048 # tests-special
1049 endif
1050 tests-special += \
1051 $(objpfx)check-execstack.out \
1052 $(objpfx)check-initfini.out \
1053 $(objpfx)check-localplt.out \
1054 $(objpfx)check-textrel.out \
1055 $(objpfx)check-wx-segment.out \
1056 # tests-special
1057 endif
1059 ifeq ($(run-built-tests),yes)
1060 tests-special += \
1061 $(objpfx)order-cmp.out \
1062 $(objpfx)order2-cmp.out \
1063 $(objpfx)tst-array1-cmp.out \
1064 $(objpfx)tst-array1-static-cmp.out \
1065 $(objpfx)tst-array2-cmp.out \
1066 $(objpfx)tst-array3-cmp.out \
1067 $(objpfx)tst-array4-cmp.out \
1068 $(objpfx)tst-array5-cmp.out \
1069 $(objpfx)tst-array5-static-cmp.out \
1070 $(objpfx)tst-initorder-cmp.out \
1071 $(objpfx)tst-initorder2-cmp.out \
1072 $(objpfx)tst-unused-dep-cmp.out \
1073 $(objpfx)tst-unused-dep.out \
1074 # tests-special
1075 endif
1077 ifndef avoid-generated
1078 # DSO sorting tests:
1079 # The dso-ordering-test.py script generates testcase source files in $(objpfx),
1080 # creating a $(objpfx)<testcase-name>-dir for each testcase, and creates a
1081 # Makefile fragment to be included.
1082 define include_dsosort_tests
1083 $(objpfx)$(1).generated-makefile: $(1)
1084 $(PYTHON) $(..)scripts/dso-ordering-test.py \
1085 --description-file $$< --objpfx $(objpfx) --output-makefile $$@T
1086 mv $$@T $$@
1087 -include $(objpfx)$(1).generated-makefile
1088 endef
1089 endif
1091 postclean-generated += $(objpfx)/dso-sort-tests-2.generated-makefile \
1092 $(objpfx)/dso-sort-tests-2.generated-makefile
1094 # Generate from each testcase description file
1095 ifeq (yes,$(have-tunables))
1096 $(eval $(call include_dsosort_tests,dso-sort-tests-1.def))
1097 $(eval $(call include_dsosort_tests,dso-sort-tests-2.def))
1098 endif
1100 check-abi: $(objpfx)check-abi-ld.out
1101 tests-special += $(objpfx)check-abi-ld.out
1102 update-abi: update-abi-ld
1103 update-all-abi: update-all-abi-ld
1105 # The test requires shared _and_ PIE because the executable
1106 # unit test driver must be able to link with the shared object
1107 # that is going to eventually go into an installed DSO.
1108 ifeq (yesyes,$(have-fpie)$(build-shared))
1109 tests-internal += tst-_dl_addr_inside_object
1110 tests-pie += tst-_dl_addr_inside_object
1111 $(objpfx)tst-_dl_addr_inside_object: $(objpfx)dl-addr-obj.os
1112 CFLAGS-tst-_dl_addr_inside_object.c += $(PIE-ccflag)
1113 endif
1115 # We can only test static libcrypt use if libcrypt has been built,
1116 # and either NSS crypto is not in use, or static NSS libraries are
1117 # available.
1118 ifeq ($(build-crypt),no)
1119 CFLAGS-tst-linkall-static.c += -DUSE_CRYPT=0
1120 else
1121 ifeq ($(nss-crypt),no)
1122 CFLAGS-tst-linkall-static.c += -DUSE_CRYPT=1
1123 else
1124 ifeq ($(static-nss-crypt),no)
1125 CFLAGS-tst-linkall-static.c += -DUSE_CRYPT=0
1126 else
1127 CFLAGS-tst-linkall-static.c += -DUSE_CRYPT=1
1128 endif
1129 endif
1130 endif
1132 include ../Rules
1134 ifeq (yes,$(build-shared))
1135 # Make sure these things are built in the `make lib' pass so they can be used
1136 # to run programs during the `make others' pass.
1137 lib-noranlib: $(objpfx)$(rtld-installed-name) \
1138 $(addprefix $(objpfx),$(extra-objs))
1139 endif
1141 # Command to link into a larger single relocatable object.
1142 reloc-link = $(LINK.o) -nostdlib -nostartfiles -r
1144 $(objpfx)sotruss-lib.so: $(shlib-lds)
1146 $(objpfx)dl-allobjs.os: $(all-rtld-routines:%=$(objpfx)%.os)
1147 $(reloc-link) -o $@ $^
1149 # Link together the dynamic linker into a single relocatable object.
1150 # First we do a link against libc_pic.a just to get a link map,
1151 # and discard the object produced by that link. From the link map
1152 # we can glean all the libc modules that need to go into the dynamic
1153 # linker. Then we do a recursive make that goes into all the subdirs
1154 # those modules come from and builds special rtld-foo.os versions that
1155 # are compiled with special flags, and puts these modules into rtld-libc.a
1156 # for us. Then we do the real link using rtld-libc.a instead of libc_pic.a.
1158 # These symbols need to be stubbed out during symbol discovery because
1159 # their implementation is provided differently in rtld, and the symbol
1160 # discovery mechanism is not compatible with the libc implementation
1161 # when compiled for libc.
1162 rtld-stubbed-symbols = \
1163 __GI___pthread_disable_asynccancel \
1164 __GI___pthread_enable_asynccancel \
1165 __pthread_disable_asynccancel \
1166 __pthread_enable_asynccancel \
1167 calloc \
1168 free \
1169 malloc \
1170 realloc \
1171 # rtld-stubbed-symbols
1173 ifeq ($(have-ssp),yes)
1174 # rtld is not built with the stack protector, so these references will
1175 # go away in the rebuilds.
1176 rtld-stubbed-symbols += __stack_chk_fail __stack_chk_fail_local
1177 endif
1179 $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
1180 @-rm -f $@T
1181 for symbol in $(rtld-stubbed-symbols); do \
1182 echo ".globl $$symbol"; \
1183 echo "$$symbol:"; \
1184 done | $(CC) -o $@T.o $(ASFLAGS) -c -x assembler -
1185 $(reloc-link) -o $@.o $@T.o '-Wl,-(' $^ -lgcc '-Wl,-)' -Wl,-Map,$@T
1186 rm -f %@T.o $@.o
1187 mv -f $@T $@
1189 # For lld, skip preceding addresses and values before matching the archive and the member.
1190 $(objpfx)librtld.mk: $(objpfx)librtld.map Makefile
1191 LC_ALL=C \
1192 sed -n 's@^[0-9a-f ]*$(common-objpfx)\([^(]*\)(\([^)]*\.os\)) *.*$$@\1 \2@p' \
1193 $< | \
1194 while read lib file; do \
1195 case $$lib in \
1196 libc_pic.a) \
1197 LC_ALL=C fgrep -l /$$file \
1198 $(common-objpfx)stamp.os $(common-objpfx)*/stamp.os | \
1199 LC_ALL=C \
1200 sed 's@^$(common-objpfx)\([^/]*\)/stamp\.os$$@rtld-\1'" +=$$file@"\
1201 ;; \
1202 */*.a) \
1203 echo rtld-$${lib%%/*} += $$file ;; \
1204 *) echo "Wasn't expecting $$lib($$file)" >&2; exit 1 ;; \
1205 esac; \
1206 done > $@T
1207 echo rtld-subdirs = `LC_ALL=C sed 's/^rtld-\([^ ]*\).*$$/\1/' $@T \
1208 | LC_ALL=C sort -u` >> $@T
1209 mv -f $@T $@
1211 $(objpfx)rtld-libc.a: $(objpfx)librtld.mk FORCE
1212 $(MAKE) -f $< -f rtld-Rules
1214 $(objpfx)librtld.os: $(objpfx)dl-allobjs.os $(objpfx)rtld-libc.a
1215 $(LINK.o) -nostdlib -nostartfiles -r -o $@ '-Wl,-(' $^ -lgcc '-Wl,-)' \
1216 -Wl,-Map,$@.map
1218 generated += librtld.map librtld.mk rtld-libc.a librtld.os.map
1220 z-now-yes = -Wl,-z,now
1222 $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
1223 # Link into a temporary file so that we don't touch $@ at all
1224 # if the sanity check below fails.
1225 $(LINK.o) -nostdlib -nostartfiles -shared -o $@.new \
1226 $(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \
1227 $(filter-out $(map-file),$^) $(load-map-file) \
1228 -Wl,-soname=$(rtld-installed-name) \
1229 -Wl,-defsym=_begin=0
1230 $(call after-link,$@.new)
1231 $(READELF) -s $@.new \
1232 | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
1233 mv -f $@.new $@
1235 ifeq (yes,$(build-shared))
1236 # interp.c exists just to get the runtime linker path into libc.so.
1237 $(objpfx)interp.os: $(common-objpfx)runtime-linker.h
1238 endif
1240 ifneq (ld.so,$(rtld-installed-name))
1241 # Make sure ld.so.1 exists in the build directory so we can link
1242 # against it.
1243 $(objpfx)$(rtld-installed-name): $(objpfx)ld.so
1244 $(make-link)
1245 generated += $(rtld-installed-name)
1246 endif
1248 # Build a file mentioning all trustworthy directories to look for shared
1249 # libraries when using LD_LIBRARY_PATH in a setuid program. The user can
1250 # add directories to the list by defining $(user-defined-trusted-dirs)
1251 # before starting make.
1252 $(objpfx)trusted-dirs.h: $(objpfx)trusted-dirs.st; @:
1253 $(objpfx)trusted-dirs.st: Makefile $(..)Makeconfig
1254 $(make-target-directory)
1255 echo "$(subst :, ,$(default-rpath) $(user-defined-trusted-dirs))" \
1256 | $(AWK) -f gen-trusted-dirs.awk > ${@:st=T};
1257 echo '#define DL_DST_LIB "$(notdir $(slibdir))"' >> ${@:st=T}
1258 $(move-if-change) ${@:st=T} ${@:st=h}
1259 touch $@
1260 CPPFLAGS-dl-load.c += -I$(objpfx). -I$(csu-objpfx).
1262 ifeq (yes,$(build-shared))
1263 $(inst_rtlddir)/$(rtld-installed-name): $(objpfx)ld.so $(+force)
1264 $(make-target-directory)
1265 $(do-install-program)
1267 # Creates the relative /usr/bin/ld.so symbolic link.
1268 $(inst_bindir)/ld.so: $(inst_rtlddir)/$(rtld-installed-name)
1269 $(make-target-directory)
1270 $(make-link)
1272 # Special target called by parent to install just the dynamic linker.
1273 .PHONY: ldso_install
1274 ldso_install: $(inst_rtlddir)/$(rtld-installed-name)
1275 endif # $(build-shared)
1278 # Workarounds for ${exec_prefix} expansion in configure variables.
1279 # config.status cannot be used directly for processing ldd.bash.in or
1280 # expanding variables such as sysconfdir because the expansion
1281 # contains the literal string ${exec_prefix}, which is not valid in C
1282 # headers or installed shell scripts.
1284 ldd-rewrite = -e 's%@RTLD@%$(rtlddir)/$(rtld-installed-name)%g' \
1285 -e 's%@VERSION@%$(version)%g' \
1286 -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
1287 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' \
1288 -e 's%@TEXTDOMAINDIR@%$(localedir)%g'
1290 ifeq ($(ldd-rewrite-script),no)
1291 define gen-ldd
1292 LC_ALL=C sed $(ldd-rewrite) < $< > $@.new
1293 endef
1294 else
1295 define gen-ldd
1296 LC_ALL=C sed $(ldd-rewrite) < $< \
1297 | LC_ALL=C sed -f $(patsubst $(..)/%,/%,$(..)$(ldd-rewrite-script)) > $@.new
1298 endef
1299 endif
1301 $(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \
1302 $(common-objpfx)config.make
1303 $(gen-ldd)
1304 chmod 555 $@.new
1305 mv -f $@.new $@
1307 $(objpfx)sln: $(sln-modules:%=$(objpfx)%.o)
1309 $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
1311 SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
1312 CFLAGS-ldconfig.c += $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
1313 -D'SLIBDIR="$(slibdir)"'
1314 libof-ldconfig = ldconfig
1315 CFLAGS-dl-cache.c += $(SYSCONF-FLAGS)
1316 CFLAGS-cache.c += $(SYSCONF-FLAGS)
1317 CFLAGS-rtld.c += $(SYSCONF-FLAGS)
1318 CFLAGS-dl-usage.c += $(SYSCONF-FLAGS) \
1319 -D'RTLD="$(rtlddir)/$(rtld-installed-name)"'
1320 CFLAGS-dl-diagnostics.c += $(SYSCONF-FLAGS) \
1321 -D'PREFIX="$(prefix)"' \
1322 -D'RTLD="$(rtlddir)/$(rtld-installed-name)"'
1324 cpp-srcs-left := $(all-rtld-routines:=.os)
1325 lib := rtld
1326 include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
1328 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
1329 generated += $(addsuffix .so,$(strip $(modules-names)))
1331 $(objpfx)testobj1_1.so: $(objpfx)testobj1.so
1332 $(objpfx)testobj2.so: $(objpfx)testobj1.so
1333 $(objpfx)testobj6.so: $(objpfx)testobj1.so $(objpfx)testobj2.so
1334 $(objpfx)failobj.so: $(objpfx)testobj6.so
1335 $(objpfx)dep1.so: $(objpfx)dep2.so $(objpfx)dep4.so
1336 $(objpfx)dep2.so: $(objpfx)dep3.so $(objpfx)dep4.so
1337 $(objpfx)dep4.so: $(objpfx)dep3.so
1338 $(objpfx)nodelmod3.so: $(objpfx)nodelmod4.so
1339 $(objpfx)neededobj2.so: $(objpfx)neededobj1.so
1340 $(objpfx)neededobj3.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so
1341 $(objpfx)neededobj4.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
1342 $(objpfx)neededobj3.so
1343 $(objpfx)neededobj6.so: $(objpfx)neededobj5.so
1344 $(objpfx)unload2mod.so: $(objpfx)unload2dep.so
1345 $(objpfx)firstobj.so: $(shared-thread-library)
1346 $(objpfx)reldep4mod1.so: $(objpfx)reldep4mod3.so
1347 $(objpfx)reldep4mod2.so: $(objpfx)reldep4mod4.so
1348 $(objpfx)dblloadmod1.so: $(objpfx)dblloadmod3.so
1349 $(objpfx)dblloadmod2.so: $(objpfx)dblloadmod3.so
1350 $(objpfx)reldepmod5.so: $(objpfx)reldepmod2.so
1351 $(objpfx)reldepmod6.so: $(objpfx)reldepmod2.so
1352 $(objpfx)reldep6mod1.so: $(objpfx)reldep6mod0.so
1353 $(objpfx)reldep6mod2.so: $(objpfx)reldep6mod1.so
1354 $(objpfx)reldep6mod3.so: $(objpfx)reldep6mod2.so
1355 $(objpfx)reldep6mod4.so: $(objpfx)reldep6mod1.so
1356 $(objpfx)tst-tlsmod3.so: $(objpfx)tst-tlsmod2.so
1357 $(objpfx)tst-tlsmod8.so: $(objpfx)tst-tlsmod7.so
1358 $(objpfx)tst-tlsmod10.so: $(objpfx)tst-tlsmod9.so
1359 $(objpfx)tst-tlsmod12.so: $(objpfx)tst-tlsmod11.so
1360 $(objpfx)tst-tlsmod13a.so: $(objpfx)tst-tlsmod13.so
1361 # For tst-tls9-static, make sure the modules it dlopens have libc.so in DT_NEEDED
1362 $(objpfx)tst-tlsmod5.so: $(common-objpfx)libc.so
1363 $(objpfx)tst-tlsmod6.so: $(common-objpfx)libc.so
1364 $(objpfx)tst-tls19mod1.so: $(objpfx)tst-tls19mod2.so $(objpfx)tst-tls19mod3.so
1365 $(objpfx)tst-tls19mod3.so: $(objpfx)ld.so
1366 $(objpfx)reldep8mod3.so: $(objpfx)reldep8mod1.so $(objpfx)reldep8mod2.so
1367 $(objpfx)nodel2mod3.so: $(objpfx)nodel2mod1.so $(objpfx)nodel2mod2.so
1368 $(objpfx)reldep9mod2.so: $(objpfx)reldep9mod1.so
1369 $(objpfx)reldep9mod3.so: $(objpfx)reldep9mod1.so $(objpfx)reldep9mod2.so
1370 $(objpfx)unload3mod1.so: $(objpfx)unload3mod3.so
1371 $(objpfx)unload3mod2.so: $(objpfx)unload3mod3.so
1372 $(objpfx)unload3mod3.so: $(objpfx)unload3mod4.so
1373 $(objpfx)unload4mod1.so: $(objpfx)unload4mod2.so $(objpfx)unload4mod3.so
1374 $(objpfx)unload4mod2.so: $(objpfx)unload4mod4.so $(objpfx)unload4mod3.so
1375 $(objpfx)unload7mod2.so: $(objpfx)unload7mod1.so
1376 $(objpfx)unload8mod1.so: $(objpfx)unload8mod2.so
1377 $(objpfx)unload8mod2.so: $(objpfx)unload8mod3.so
1378 $(objpfx)tst-initordera2.so: $(objpfx)tst-initordera1.so
1379 $(objpfx)tst-initorderb2.so: $(objpfx)tst-initorderb1.so $(objpfx)tst-initordera2.so
1380 $(objpfx)tst-initordera3.so: $(objpfx)tst-initorderb2.so $(objpfx)tst-initorderb1.so
1381 $(objpfx)tst-initordera4.so: $(objpfx)tst-initordera3.so
1382 $(objpfx)tst-initorder: $(objpfx)tst-initordera4.so $(objpfx)tst-initordera1.so $(objpfx)tst-initorderb2.so
1383 $(objpfx)tst-null-argv: $(objpfx)tst-null-argv-lib.so
1384 $(objpfx)tst-tlsalign: $(objpfx)tst-tlsalign-lib.so
1385 $(objpfx)tst-nodelete-opened.out: $(objpfx)tst-nodelete-opened-lib.so
1387 $(objpfx)tst-tlsalign-extern: $(objpfx)tst-tlsalign-vars.o
1388 $(objpfx)tst-tlsalign-extern-static: $(objpfx)tst-tlsalign-vars.o
1390 tst-null-argv-ENV = LD_DEBUG=all LD_DEBUG_OUTPUT=$(objpfx)tst-null-argv.debug.out
1391 LDFLAGS-nodel2mod3.so = -Wl,--no-as-needed
1392 LDFLAGS-reldepmod5.so = -Wl,--no-as-needed
1393 LDFLAGS-reldep6mod1.so = -Wl,--no-as-needed
1394 LDFLAGS-reldep6mod4.so = -Wl,--no-as-needed
1395 LDFLAGS-reldep8mod3.so = -Wl,--no-as-needed
1396 LDFLAGS-unload4mod1.so = -Wl,--no-as-needed
1397 LDFLAGS-unload4mod2.so = -Wl,--no-as-needed
1398 LDFLAGS-tst-initorder = -Wl,--no-as-needed
1399 LDFLAGS-tst-initordera2.so = -Wl,--no-as-needed
1400 LDFLAGS-tst-initordera3.so = -Wl,--no-as-needed
1401 LDFLAGS-tst-initordera4.so = -Wl,--no-as-needed
1402 LDFLAGS-tst-initorderb2.so = -Wl,--no-as-needed
1403 LDFLAGS-tst-tlsmod5.so = -nostdlib -Wl,--no-as-needed
1404 LDFLAGS-tst-tlsmod6.so = -nostdlib -Wl,--no-as-needed
1406 testobj1.so-no-z-defs = yes
1407 testobj3.so-no-z-defs = yes
1408 testobj4.so-no-z-defs = yes
1409 testobj5.so-no-z-defs = yes
1410 testobj6.so-no-z-defs = yes
1411 failobj.so-no-z-defs = yes
1412 constload2.so-no-z-defs = yes
1413 constload3.so-no-z-defs = yes
1414 nodelmod1.so-no-z-defs = yes
1415 nodelmod2.so-no-z-defs = yes
1416 nodelmod4.so-no-z-defs = yes
1417 nodel2mod2.so-no-z-defs = yes
1418 reldepmod2.so-no-z-defs = yes
1419 reldepmod3.so-no-z-defs = yes
1420 reldepmod4.so-no-z-defs = yes
1421 reldep4mod4.so-no-z-defs = yes
1422 reldep4mod2.so-no-z-defs = yes
1423 ltglobmod2.so-no-z-defs = yes
1424 dblloadmod3.so-no-z-defs = yes
1425 tst-tlsmod1.so-no-z-defs = yes
1426 tst-tlsmod2.so-no-z-defs = yes
1427 tst-tlsmod3.so-no-z-defs = yes
1428 tst-tlsmod4.so-no-z-defs = yes
1429 tst-tlsmod7.so-no-z-defs = yes
1430 tst-tlsmod8.so-no-z-defs = yes
1431 tst-tlsmod9.so-no-z-defs = yes
1432 tst-tlsmod10.so-no-z-defs = yes
1433 tst-tlsmod12.so-no-z-defs = yes
1434 tst-tlsmod14a.so-no-z-defs = yes
1435 tst-tlsmod14b.so-no-z-defs = yes
1436 tst-tlsmod15a.so-no-z-defs = yes
1437 tst-tlsmod16b.so-no-z-defs = yes
1438 circlemod2.so-no-z-defs = yes
1439 circlemod3.so-no-z-defs = yes
1440 circlemod3a.so-no-z-defs = yes
1441 reldep8mod2.so-no-z-defs = yes
1442 reldep9mod1.so-no-z-defs = yes
1443 unload3mod4.so-no-z-defs = yes
1444 unload4mod1.so-no-z-defs = yes
1445 ifuncmod1.so-no-z-defs = yes
1446 ifuncmod5.so-no-z-defs = yes
1447 ifuncmod6.so-no-z-defs = yes
1448 tst-auditmod9a.so-no-z-defs = yes
1449 tst-auditmod9b.so-no-z-defs = yes
1450 tst-nodelete-uniquemod.so-no-z-defs = yes
1451 tst-nodelete-rtldmod.so-no-z-defs = yes
1452 tst-nodelete-zmod.so-no-z-defs = yes
1453 tst-nodelete2mod.so-no-z-defs = yes
1455 ifeq ($(build-shared),yes)
1456 # Build all the modules even when not actually running test programs.
1457 tests: $(test-modules)
1458 endif
1460 LDFLAGS-loadtest = -rdynamic
1462 $(objpfx)loadtest.out: $(test-modules)
1464 $(objpfx)neededtest.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
1465 $(objpfx)neededobj3.so
1467 $(objpfx)neededtest2.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
1468 $(objpfx)neededobj3.so
1470 $(objpfx)neededtest3.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
1471 $(objpfx)neededobj3.so $(objpfx)neededobj4.so
1473 $(objpfx)neededtest4: $(objpfx)neededobj1.so
1474 $(objpfx)neededtest4.out: $(objpfx)neededobj5.so $(objpfx)neededobj6.so
1476 $(objpfx)restest1: $(objpfx)testobj1.so $(objpfx)testobj1_1.so
1477 LDFLAGS-restest1 = -rdynamic
1479 LDFLAGS-restest2 = -rdynamic
1481 $(objpfx)restest1.out: $(test-modules)
1483 preloadtest-preloads = testobj1 testobj2 testobj3 testobj4 testobj5
1484 $(objpfx)preloadtest: $(objpfx)testobj6.so
1485 LDFLAGS-preloadtest = -rdynamic
1486 $(objpfx)preloadtest.out: $(preloadtest-preloads:%=$(objpfx)%.so)
1487 preloadtest-ENV = \
1488 LD_PRELOAD=$(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
1490 LDFLAGS-loadfail = -rdynamic
1492 $(objpfx)loadfail.out: $(objpfx)failobj.so $(objpfx)testobj1.so \
1493 $(objpfx)testobj2.so $(objpfx)testobj3.so \
1494 $(objpfx)testobj4.so $(objpfx)testobj5.so
1496 LDFLAGS-multiload = -rdynamic
1497 CFLAGS-multiload.c += -DOBJDIR=\"$(elf-objpfx)\"
1499 $(objpfx)multiload.out: $(objpfx)testobj1.so
1501 LDFLAGS-origtest = -rdynamic
1502 $(objpfx)origtest.out: $(objpfx)testobj1.so
1504 ifeq ($(have-thread-library),yes)
1505 $(objpfx)resolvfail: $(shared-thread-library)
1506 endif
1508 $(objpfx)constload1.out: $(objpfx)constload2.so $(objpfx)constload3.so
1510 $(objpfx)circleload1.out: $(objpfx)circlemod1.so \
1511 $(objpfx)circlemod1a.so
1513 $(objpfx)circlemod1.so: $(objpfx)circlemod2.so
1514 $(objpfx)circlemod2.so: $(objpfx)circlemod3.so
1515 $(objpfx)circlemod1a.so: $(objpfx)circlemod2a.so
1516 $(objpfx)circlemod2a.so: $(objpfx)circlemod3a.so
1518 $(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so)
1520 $(objpfx)order-cmp.out: $(objpfx)order.out
1521 (echo "0123456789" | cmp $< -) > $@; \
1522 $(evaluate-test)
1524 $(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so)
1525 $(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
1526 vismain-ENV = LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
1528 $(objpfx)noload: $(objpfx)testobj1.so
1529 LDFLAGS-noload = -rdynamic -Wl,--no-as-needed
1530 $(objpfx)noload.out: $(objpfx)testobj5.so
1532 $(objpfx)noload-mem.out: $(objpfx)noload.out
1533 $(common-objpfx)malloc/mtrace $(objpfx)noload.mtrace > $@; \
1534 $(evaluate-test)
1535 noload-ENV = MALLOC_TRACE=$(objpfx)noload.mtrace \
1536 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
1538 LDFLAGS-nodelete = -rdynamic
1539 LDFLAGS-nodelmod1.so = -Wl,--enable-new-dtags,-z,nodelete
1540 LDFLAGS-nodelmod4.so = -Wl,--enable-new-dtags,-z,nodelete
1541 $(objpfx)nodelete.out: $(objpfx)nodelmod1.so $(objpfx)nodelmod2.so \
1542 $(objpfx)nodelmod3.so
1544 LDFLAGS-nodlopenmod.so = -Wl,--enable-new-dtags,-z,nodlopen
1545 $(objpfx)nodlopen.out: $(objpfx)nodlopenmod.so
1547 $(objpfx)nodlopenmod2.so: $(objpfx)nodlopenmod.so
1548 $(objpfx)nodlopen2.out: $(objpfx)nodlopenmod2.so
1550 $(objpfx)filtmod1.so: $(objpfx)filtmod1.os $(objpfx)filtmod2.so
1551 $(LINK.o) -shared -o $@ -B$(csu-objpfx) $(LDFLAGS.so) \
1552 -L$(subst :, -L,$(rpath-link)) \
1553 -Wl,-rpath-link=$(rpath-link) \
1554 $< -Wl,-F,$(objpfx)filtmod2.so
1555 $(objpfx)filter: $(objpfx)filtmod1.so
1557 # This does not link against libc.
1558 CFLAGS-filtmod1.c += $(no-stack-protector)
1560 $(objpfx)unload.out: $(objpfx)unloadmod.so
1562 $(objpfx)reldep.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod2.so
1564 $(objpfx)reldep2.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod3.so
1566 $(objpfx)reldep3.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
1568 $(objpfx)reldep4.out: $(objpfx)reldep4mod1.so $(objpfx)reldep4mod2.so
1570 $(objpfx)next: $(objpfx)nextmod1.so $(objpfx)nextmod2.so
1571 LDFLAGS-next = -Wl,--no-as-needed
1573 $(objpfx)unload2.out: $(objpfx)unload2mod.so $(objpfx)unload2dep.so
1575 $(objpfx)lateglobal.out: $(objpfx)ltglobmod1.so $(objpfx)ltglobmod2.so
1577 $(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \
1578 $(objpfx)pathoptobj.so
1579 $(SHELL) $< $(common-objpfx) '$(test-wrapper-env)' \
1580 '$(run-program-env)'; \
1581 $(evaluate-test)
1583 $(objpfx)tst-rtld-load-self.out: tst-rtld-load-self.sh $(objpfx)ld.so
1584 $(SHELL) $^ '$(test-wrapper)' '$(test-wrapper-env)' > $@; \
1585 $(evaluate-test)
1587 tst-rtld-preload-OBJS = $(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
1588 $(objpfx)tst-rtld-preload.out: tst-rtld-preload.sh $(objpfx)ld.so \
1589 $(objpfx)preloadtest \
1590 $(preloadtest-preloads:%=$(objpfx)%.so)
1591 $(SHELL) $< $(objpfx)ld.so $(objpfx)preloadtest \
1592 '$(test-wrapper-env)' '$(run_program_env)' \
1593 '$(rpath-link)' '$(tst-rtld-preload-OBJS)' > $@; \
1594 $(evaluate-test)
1596 $(objpfx)initfirst.out: $(objpfx)firstobj.so
1598 $(objpfx)global: $(objpfx)globalmod1.so
1599 $(objpfx)global.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
1601 $(objpfx)dblload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
1603 $(objpfx)dblunload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
1605 $(objpfx)reldep5.out: $(objpfx)reldepmod5.so $(objpfx)reldepmod6.so
1607 $(objpfx)reldep6.out: $(objpfx)reldep6mod3.so $(objpfx)reldep6mod4.so
1609 $(objpfx)reldep7.out: $(objpfx)reldep7mod1.so $(objpfx)reldep7mod2.so
1611 $(objpfx)reldep8.out: $(objpfx)reldep8mod3.so
1613 LDFLAGS-nodel2mod2.so = -Wl,--enable-new-dtags,-z,nodelete
1614 $(objpfx)nodelete2.out: $(objpfx)nodel2mod3.so
1616 $(objpfx)reldep9.out: $(objpfx)reldep9mod3.so
1618 $(objpfx)tst-tls3: $(objpfx)tst-tlsmod1.so
1620 $(objpfx)tst-tls4.out: $(objpfx)tst-tlsmod2.so
1622 $(objpfx)tst-tls5.out: $(objpfx)tst-tlsmod2.so
1624 $(objpfx)tst-tls6.out: $(objpfx)tst-tlsmod2.so
1626 $(objpfx)tst-tls7.out: $(objpfx)tst-tlsmod3.so
1628 $(objpfx)tst-tls8.out: $(objpfx)tst-tlsmod3.so $(objpfx)tst-tlsmod4.so
1630 $(objpfx)tst-tls9.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
1632 $(objpfx)tst-tls10: $(objpfx)tst-tlsmod8.so $(objpfx)tst-tlsmod7.so
1634 $(objpfx)tst-tls11: $(objpfx)tst-tlsmod10.so $(objpfx)tst-tlsmod9.so
1636 $(objpfx)tst-tls12: $(objpfx)tst-tlsmod12.so $(objpfx)tst-tlsmod11.so
1638 $(objpfx)tst-tls13.out: $(objpfx)tst-tlsmod13a.so
1640 $(objpfx)tst-tls14: $(objpfx)tst-tlsmod14a.so
1641 $(objpfx)tst-tls14.out: $(objpfx)tst-tlsmod14b.so
1643 $(objpfx)tst-tls15.out: $(objpfx)tst-tlsmod15a.so $(objpfx)tst-tlsmod15b.so
1645 $(objpfx)tst-tls-dlinfo.out: $(objpfx)tst-tlsmod2.so
1649 $(objpfx)tst-tls16.out: $(objpfx)tst-tlsmod16a.so $(objpfx)tst-tlsmod16b.so
1651 $(objpfx)tst-tls17.out: $(objpfx)tst-tlsmod17b.so
1652 $(patsubst %,$(objpfx)%.os,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.os: tst-tlsmod17a.c
1653 $(compile-command.c) -DN=$*
1654 $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.so: $(objpfx)ld.so
1655 $(objpfx)tst-tlsmod17b.so: $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules))
1657 $(objpfx)tst-tls18.out: $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules))
1658 $(patsubst %,$(objpfx)%.os,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.os : tst-tlsmod18a.c
1659 $(compile-command.c) -DN=$*
1660 $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.so: $(objpfx)ld.so
1662 $(objpfx)tst-tls19.out: $(objpfx)tst-tls19mod1.so
1664 CFLAGS-tst-align.c += $(stack-align-test-flags)
1665 CFLAGS-tst-align2.c += $(stack-align-test-flags)
1666 CFLAGS-tst-alignmod.c += $(stack-align-test-flags)
1667 CFLAGS-tst-alignmod2.c += $(stack-align-test-flags)
1668 $(objpfx)tst-align.out: $(objpfx)tst-alignmod.so
1669 $(objpfx)tst-align2: $(objpfx)tst-alignmod2.so
1670 $(objpfx)tst-align3: $(objpfx)tst-alignmod3.so
1671 ifeq (yes,$(have-fpie))
1672 CFLAGS-tst-align3.c += $(PIE-ccflag)
1673 endif
1674 LDFLAGS-tst-align3 += -Wl,-z,max-page-size=0x200000
1675 LDFLAGS-tst-alignmod3.so += -Wl,-z,max-page-size=0x200000
1676 $(objpfx)tst-alignmod3.so: $(libsupport)
1678 $(objpfx)unload3.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
1679 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
1681 $(objpfx)unload4.out: $(objpfx)unload4mod1.so $(objpfx)unload4mod3.so
1683 $(objpfx)unload5.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
1684 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
1686 $(objpfx)unload6.out: $(objpfx)unload6mod1.so $(objpfx)unload6mod2.so \
1687 $(objpfx)unload6mod3.so
1689 $(objpfx)unload7.out: $(objpfx)unload7mod1.so $(objpfx)unload7mod2.so
1690 unload7-ENV = MALLOC_PERTURB_=85
1692 $(objpfx)unload8.out: $(objpfx)unload8mod1.so $(objpfx)unload8mod1x.so
1694 $(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
1696 ifeq ($(have-z-execstack),yes)
1697 $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
1698 CPPFLAGS-tst-execstack.c += -DUSE_PTHREADS=0
1699 LDFLAGS-tst-execstack = -Wl,-z,noexecstack
1700 LDFLAGS-tst-execstack-mod.so = -Wl,-z,execstack
1702 $(objpfx)tst-execstack-needed: $(objpfx)tst-execstack-mod.so
1703 LDFLAGS-tst-execstack-needed = -Wl,-z,noexecstack
1705 LDFLAGS-tst-execstack-prog = -Wl,-z,execstack
1706 CFLAGS-tst-execstack-prog.c += -Wno-trampolines
1707 CFLAGS-tst-execstack-mod.c += -Wno-trampolines
1708 endif
1710 LDFLAGS-tst-array2 = -Wl,--no-as-needed
1711 LDFLAGS-tst-array5 = -Wl,--no-as-needed
1713 $(objpfx)tst-array1-cmp.out: tst-array1.exp $(objpfx)tst-array1.out
1714 cmp $^ > $@; \
1715 $(evaluate-test)
1717 $(objpfx)tst-array1-static-cmp.out: tst-array1.exp \
1718 $(objpfx)tst-array1-static.out
1719 cmp $^ > $@; \
1720 $(evaluate-test)
1722 $(objpfx)tst-array2: $(objpfx)tst-array2dep.so
1723 $(objpfx)tst-array2-cmp.out: tst-array2.exp $(objpfx)tst-array2.out
1724 cmp $^ > $@; \
1725 $(evaluate-test)
1727 $(objpfx)tst-array3-cmp.out: tst-array1.exp $(objpfx)tst-array3.out
1728 cmp $^ > $@; \
1729 $(evaluate-test)
1731 $(objpfx)tst-array4.out: $(objpfx)tst-array2dep.so
1732 $(objpfx)tst-array4-cmp.out: tst-array4.exp $(objpfx)tst-array4.out
1733 cmp $^ > $@; \
1734 $(evaluate-test)
1736 $(objpfx)tst-array5: $(objpfx)tst-array5dep.so
1737 $(objpfx)tst-array5-cmp.out: tst-array5.exp $(objpfx)tst-array5.out
1738 cmp $^ > $@; \
1739 $(evaluate-test)
1741 $(objpfx)tst-array5-static-cmp.out: tst-array5-static.exp \
1742 $(objpfx)tst-array5-static.out
1743 cmp $^ > $@; \
1744 $(evaluate-test)
1746 CFLAGS-tst-pie1.c += $(pie-ccflag)
1747 CFLAGS-tst-pie2.c += $(pie-ccflag)
1749 $(objpfx)tst-piemod1.so: $(libsupport)
1750 $(objpfx)tst-pie1: $(objpfx)tst-piemod1.so
1751 $(objpfx)tst-dlopen-pie.out: $(objpfx)tst-pie1
1753 ifeq (yes,$(build-shared))
1754 # NB: Please keep cet-built-dso in sysdeps/x86/Makefile in sync with
1755 # all-built-dso here.
1756 all-built-dso := $(common-objpfx)elf/ld.so $(common-objpfx)libc.so \
1757 $(filter-out $(common-objpfx)linkobj/libc.so, \
1758 $(sort $(wildcard $(addprefix $(common-objpfx), \
1759 */lib*.so \
1760 iconvdata/*.so))))
1762 $(all-built-dso:=.dyn): %.dyn: %
1763 @rm -f $@T
1764 LC_ALL=C $(READELF) -W -d $< > $@T
1765 test -s $@T
1766 mv -f $@T $@
1767 common-generated += $(all-built-dso:$(common-objpfx)%=%.dyn)
1769 $(objpfx)check-textrel.out: $(..)scripts/check-textrel.awk \
1770 $(all-built-dso:=.dyn)
1771 LC_ALL=C $(AWK) -f $^ > $@; \
1772 $(evaluate-test)
1773 generated += check-textrel.out
1775 $(objpfx)execstack-default: $(first-word $(wildcard $(sysdirs:%=%/stackinfo.h)))
1776 $(make-target-directory)
1777 { echo '#include <elf.h>'; \
1778 echo '#include <stackinfo.h>'; \
1779 echo '#if (DEFAULT_STACK_PERMS & PF_X) == 0'; \
1780 echo '@@@execstack-no@@@'; \
1781 echo '#else'; \
1782 echo '@@@execstack-yes@@@'; \
1783 echo '#endif'; } | \
1784 $(CC) $(CFLAGS) $(CPPFLAGS) -E -x c-header - | \
1785 sed -n -e 's/^@@@\(.*\)@@@/\1/p' > $@T
1786 mv -f $@T $@
1787 generated += execstack-default
1789 $(all-built-dso:=.phdr): %.phdr: %
1790 @rm -f $@T
1791 LC_ALL=C $(READELF) -W -l $< > $@T
1792 test -s $@T
1793 mv -f $@T $@
1794 common-generated += $(all-built-dso:$(common-objpfx)%=%.phdr)
1796 $(objpfx)check-execstack.out: $(..)scripts/check-execstack.awk \
1797 $(objpfx)execstack-default \
1798 $(all-built-dso:=.phdr)
1799 LC_ALL=C $(AWK) -v "xfail=$(check-execstack-xfail)" -f $^ > $@; \
1800 $(evaluate-test)
1801 generated += check-execstack.out
1803 $(objpfx)check-wx-segment.out: $(..)scripts/check-wx-segment.py \
1804 $(all-built-dso:=.phdr)
1805 $(PYTHON) $^ --xfail="$(check-wx-segment-xfail)" > $@; \
1806 $(evaluate-test)
1807 generated += check-wx-segment.out
1809 $(objpfx)tst-dlmodcount.out: $(test-modules)
1811 $(all-built-dso:=.jmprel): %.jmprel: % Makefile
1812 @rm -f $@T
1813 LC_ALL=C $(READELF) -W -S -d -r $< > $@T
1814 test -s $@T
1815 mv -f $@T $@
1816 common-generated += $(all-built-dso:$(common-objpfx)%=%.jmprel)
1818 localplt-built-dso := $(addprefix $(common-objpfx),\
1819 libc.so \
1820 elf/ld.so \
1821 math/libm.so \
1822 dlfcn/libdl.so \
1823 resolv/libresolv.so \
1825 ifeq ($(build-mathvec),yes)
1826 localplt-built-dso += $(addprefix $(common-objpfx), mathvec/libmvec.so)
1827 endif
1828 ifeq ($(have-thread-library),yes)
1829 localplt-built-dso += $(filter-out %_nonshared.a, $(shared-thread-library))
1830 endif
1831 ifeq ($(build-crypt),yes)
1832 localplt-built-dso += $(addprefix $(common-objpfx), crypt/libcrypt.so)
1833 endif
1834 ifneq ($(pthread-in-libc),yes)
1835 localplt-built-dso += $(addprefix $(common-objpfx), rt/librt.so)
1836 endif
1838 vpath localplt.data $(+sysdep_dirs)
1840 $(objpfx)check-localplt.out: $(..)scripts/check-localplt.awk \
1841 $(..)scripts/localplt.awk \
1842 $(localplt-built-dso:=.jmprel) \
1843 localplt.data
1844 LC_ALL=C $(AWK) -f $(filter-out $< %localplt.data,$^) | \
1845 LC_ALL=C $(AWK) -f $< $(filter %localplt.data,$^) - \
1846 > $@; \
1847 $(evaluate-test)
1848 endif
1850 $(all-built-dso:=.dynsym): %.dynsym: %
1851 @rm -f $@T
1852 LC_ALL=C $(READELF) -W --dyn-syms $< > $@T
1853 test -s $@T
1854 mv -f $@T $@
1855 common-generated += $(all-built-dso:$(common-objpfx)%=%.dynsym)
1857 $(objpfx)check-initfini.out: $(..)scripts/check-initfini.awk \
1858 $(all-built-dso:=.dynsym)
1859 LC_ALL=C $(AWK) -f $^ > $@; \
1860 $(evaluate-test)
1861 generated += check-initfini.out
1863 $(objpfx)tst-dlopenrpath: $(objpfx)tst-dlopenrpathmod.so
1864 CFLAGS-tst-dlopenrpath.c += -DPFX=\"$(objpfx)\"
1865 LDFLAGS-tst-dlopenrpathmod.so += -Wl,-rpath,\$$ORIGIN/test-subdir
1866 $(objpfx)tst-dlopenrpath.out: $(objpfx)firstobj.so
1868 $(objpfx)tst-deep1mod2.so: $(objpfx)tst-deep1mod3.so
1869 $(objpfx)tst-deep1: $(objpfx)tst-deep1mod1.so
1870 $(objpfx)tst-deep1.out: $(objpfx)tst-deep1mod2.so
1871 LDFLAGS-tst-deep1 += -rdynamic
1872 tst-deep1mod3.so-no-z-defs = yes
1874 $(objpfx)tst-dlmopen1.out: $(objpfx)tst-dlmopen1mod.so
1876 $(objpfx)tst-dlmopen2.out: $(objpfx)tst-dlmopen1mod.so
1878 $(objpfx)tst-dlmopen3.out: $(objpfx)tst-dlmopen1mod.so
1880 $(objpfx)tst-dlmopen4.out: $(objpfx)tst-dlmopen1mod.so
1882 $(objpfx)tst-audit1.out: $(objpfx)tst-auditmod1.so
1883 tst-audit1-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1885 $(objpfx)tst-audit2.out: $(objpfx)tst-auditmod1.so $(objpfx)tst-auditmod9b.so
1886 # Prevent GCC-5 from translating a malloc/memset pair into calloc
1887 CFLAGS-tst-audit2.c += -fno-builtin
1888 tst-audit2-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1890 $(objpfx)tst-audit9.out: $(objpfx)tst-auditmod9a.so $(objpfx)tst-auditmod9b.so
1891 tst-audit9-ENV = LD_AUDIT=$(objpfx)tst-auditmod9a.so
1893 $(objpfx)tst-audit8: $(libm)
1894 $(objpfx)tst-audit8.out: $(objpfx)tst-auditmod1.so
1895 tst-audit8-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1897 $(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
1899 $(objpfx)tst-global2: $(objpfx)tst-globalmod2.so
1900 $(objpfx)tst-global2.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
1901 LDFLAGS-tst-global2 = -Wl,--enable-new-dtags
1902 LDFLAGS-tst-globalmod2.so = -Wl,--enable-new-dtags
1904 $(objpfx)order2.out: $(objpfx)order2mod1.so $(objpfx)order2mod2.so
1905 $(objpfx)order2-cmp.out: $(objpfx)order2.out
1906 (echo "12345" | cmp $< -) > $@; \
1907 $(evaluate-test)
1908 $(objpfx)order2mod1.so: $(objpfx)order2mod4.so
1909 $(objpfx)order2mod4.so: $(objpfx)order2mod3.so
1910 $(objpfx)order2mod2.so: $(objpfx)order2mod3.so
1911 order2mod2.so-no-z-defs = yes
1912 LDFLAGS-order2mod1.so = -Wl,--no-as-needed
1913 LDFLAGS-order2mod2.so = -Wl,--no-as-needed
1915 tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child"
1916 tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
1918 tst-ptrguard1-ARGS = --command "$(host-test-program-cmd) --child"
1919 # When built statically, the pointer guard interface uses
1920 # __pointer_chk_guard_local.
1921 CFLAGS-tst-ptrguard1-static.c += -DPTRGUARD_LOCAL
1922 tst-ptrguard1-static-ARGS = --command "$(objpfx)tst-ptrguard1-static --child"
1924 $(objpfx)tst-leaks1-mem.out: $(objpfx)tst-leaks1.out
1925 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1.mtrace > $@; \
1926 $(evaluate-test)
1928 tst-leaks1-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1.mtrace \
1929 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
1931 $(objpfx)tst-thrlock: $(shared-thread-library)
1932 $(objpfx)tst-thrlock.out: $(libm)
1933 $(objpfx)tst-noload.out: $(libm)
1935 tst-tst-dlopen-tlsmodid-no-pie = yes
1936 $(objpfx)tst-dlopen-tlsmodid: $(shared-thread-library)
1937 $(objpfx)tst-dlopen-tlsmodid.out: $(objpfx)tst-dlopen-self
1938 CFLAGS-tst-dlopen-tlsmodid-pie.c += $(pie-ccflag)
1939 $(objpfx)tst-dlopen-tlsmodid-pie: $(shared-thread-library)
1940 $(objpfx)tst-dlopen-tlsmodid-pie.out: $(objpfx)tst-dlopen-self-pie
1941 $(objpfx)tst-dlopen-tlsmodid-container: $(shared-thread-library)
1942 LDFLAGS-tst-dlopen-tlsmodid-container += -Wl,-rpath,\$$ORIGIN
1944 tst-tst-dlopen-self-no-pie = yes
1945 CFLAGS-tst-dlopen-self-pie.c += $(pie-ccflag)
1946 LDFLAGS-tst-dlopen-self-container += -Wl,-rpath,\$$ORIGIN
1948 CFLAGS-ifuncmain1pic.c += $(pic-ccflag)
1949 CFLAGS-ifuncmain1picstatic.c += $(pic-ccflag)
1950 CFLAGS-ifuncmain1staticpic.c += $(pic-ccflag)
1951 CFLAGS-ifuncdep1pic.c += $(pic-ccflag)
1952 CFLAGS-ifuncmain1vispic.c += $(pic-ccflag)
1953 CFLAGS-ifuncmain2pic.c += $(pic-ccflag)
1954 CFLAGS-ifuncmain2picstatic.c += $(pic-ccflag)
1955 CFLAGS-ifuncdep2pic.c += $(pic-ccflag)
1956 CFLAGS-ifuncmain4picstatic.c += $(pic-ccflag)
1957 CFLAGS-ifuncmain5pic.c += $(pic-ccflag)
1958 CFLAGS-ifuncmain5picstatic.c += $(pic-ccflag)
1959 CFLAGS-ifuncmain5staticpic.c += $(pic-ccflag)
1960 CFLAGS-ifuncdep5pic.c += $(pic-ccflag)
1961 CFLAGS-ifuncmain7pic.c += $(pic-ccflag)
1962 CFLAGS-ifuncmain7picstatic.c += $(pic-ccflag)
1963 CFLAGS-ifuncmain9pic.c += $(pic-ccflag)
1964 CFLAGS-ifuncmain9picstatic.c += $(pic-ccflag)
1966 LDFLAGS-ifuncmain3 = -Wl,-export-dynamic
1968 CFLAGS-ifuncmain1pie.c += $(pie-ccflag)
1969 CFLAGS-ifuncmain1vispie.c += $(pie-ccflag)
1970 CFLAGS-ifuncmain1staticpie.c += $(pie-ccflag)
1971 CFLAGS-ifuncmain5pie.c += $(pie-ccflag)
1972 CFLAGS-ifuncmain6pie.c += $(pie-ccflag)
1973 CFLAGS-ifuncmain7pie.c += $(pie-ccflag)
1974 CFLAGS-ifuncmain9pie.c += $(pie-ccflag)
1975 CFLAGS-tst-ifunc-textrel.c += $(pic-ccflag)
1977 LDFLAGS-ifuncmain6pie = -Wl,-z,lazy
1979 $(objpfx)ifuncmain1pie: $(objpfx)ifuncmod1.so
1980 $(objpfx)ifuncmain1staticpie: $(objpfx)ifuncdep1pic.o
1981 $(objpfx)ifuncmain1vispie: $(objpfx)ifuncmod1.so
1982 $(objpfx)ifuncmain5pie: $(objpfx)ifuncmod5.so
1983 $(objpfx)ifuncmain6pie: $(objpfx)ifuncmod6.so
1985 $(objpfx)ifuncmain1: $(addprefix $(objpfx),ifuncmod1.so)
1986 $(objpfx)ifuncmain1pic: $(addprefix $(objpfx),ifuncmod1.so)
1987 $(objpfx)ifuncmain1staticpic: $(addprefix $(objpfx),ifuncdep1pic.o)
1988 $(objpfx)ifuncmain1static: $(addprefix $(objpfx),ifuncdep1.o)
1989 $(objpfx)ifuncmain1picstatic: $(addprefix $(objpfx),ifuncdep1pic.o)
1990 $(objpfx)ifuncmain1vis: $(addprefix $(objpfx),ifuncmod1.so)
1991 $(objpfx)ifuncmain1vispic: $(addprefix $(objpfx),ifuncmod1.so)
1992 $(objpfx)ifuncmain2: $(addprefix $(objpfx),ifuncdep2.o)
1993 $(objpfx)ifuncmain2pic: $(addprefix $(objpfx),ifuncdep2pic.o)
1994 $(objpfx)ifuncmain2static: $(addprefix $(objpfx),ifuncdep2.o)
1995 $(objpfx)ifuncmain2picstatic: $(addprefix $(objpfx),ifuncdep2pic.o)
1997 $(objpfx)ifuncmain3.out: $(objpfx)ifuncmod3.so
1999 $(objpfx)ifuncmain5: $(addprefix $(objpfx),ifuncmod5.so)
2000 $(objpfx)ifuncmain5pic: $(addprefix $(objpfx),ifuncmod5.so)
2001 $(objpfx)ifuncmain5static: $(addprefix $(objpfx),ifuncdep5.o)
2002 $(objpfx)ifuncmain5staticpic: $(addprefix $(objpfx),ifuncdep5pic.o)
2003 $(objpfx)ifuncmain5picstatic: $(addprefix $(objpfx),ifuncdep5pic.o)
2005 LDFLAGS-tst-ifunc-fault-lazy = -Wl,-z,lazy
2006 LDFLAGS-tst-ifunc-fault-bindnow = -Wl,-z,now
2007 define tst-ifunc-fault-script
2008 ( $(test-wrapper) $(rtld-prefix) --verify $^ \
2009 && $(test-wrapper-env) LD_TRACE_LOADED_OBJECTS=1 $(rtld-prefix) $^ \
2010 && $(test-wrapper-env) LD_TRACE_LOADED_OBJECTS=1 LD_DEBUG=unused \
2011 $(rtld-prefix) $^ \
2012 ) > $@; $(evaluate-test)
2013 endef
2014 $(objpfx)tst-ifunc-fault-lazy.out: $(objpfx)tst-ifunc-fault-lazy $(objpfx)ld.so
2015 $(tst-ifunc-fault-script)
2016 $(objpfx)tst-ifunc-fault-bindnow.out: $(objpfx)tst-ifunc-fault-bindnow \
2017 $(objpfx)ld.so
2018 $(tst-ifunc-fault-script)
2020 $(objpfx)tst-unique1.out: $(objpfx)tst-unique1mod1.so \
2021 $(objpfx)tst-unique1mod2.so
2023 $(objpfx)tst-unique2: $(objpfx)tst-unique2mod1.so
2024 $(objpfx)tst-unique2.out: $(objpfx)tst-unique2mod2.so
2026 $(objpfx)tst-unique3: $(objpfx)tst-unique3lib.so
2027 $(objpfx)tst-unique3.out: $(objpfx)tst-unique3lib2.so
2029 $(objpfx)tst-unique4: $(objpfx)tst-unique4lib.so
2031 $(objpfx)tst-nodelete.out: $(objpfx)tst-nodelete-uniquemod.so \
2032 $(objpfx)tst-nodelete-rtldmod.so \
2033 $(objpfx)tst-nodelete-zmod.so
2035 LDFLAGS-tst-nodelete = -rdynamic
2036 LDFLAGS-tst-nodelete-zmod.so = -Wl,--enable-new-dtags,-z,nodelete
2038 $(objpfx)tst-nodelete2.out: $(objpfx)tst-nodelete2mod.so
2040 LDFLAGS-tst-nodelete2 = -rdynamic
2042 $(objpfx)tst-initorder-cmp.out: tst-initorder.exp $(objpfx)tst-initorder.out
2043 cmp $^ > $@; \
2044 $(evaluate-test)
2046 $(objpfx)tst-initorder2: $(objpfx)tst-initorder2a.so $(objpfx)tst-initorder2d.so $(objpfx)tst-initorder2c.so
2047 $(objpfx)tst-initorder2a.so: $(objpfx)tst-initorder2b.so
2048 $(objpfx)tst-initorder2b.so: $(objpfx)tst-initorder2c.so
2049 $(objpfx)tst-initorder2c.so: $(objpfx)tst-initorder2d.so
2050 LDFLAGS-tst-initorder2 = -Wl,--no-as-needed
2051 LDFLAGS-tst-initorder2a.so = -Wl,--no-as-needed
2052 LDFLAGS-tst-initorder2b.so = -Wl,--no-as-needed
2053 LDFLAGS-tst-initorder2c.so = -Wl,--no-as-needed
2054 define o-iterator-doit
2055 $(objpfx)tst-initorder2$o.os: tst-initorder2.c; \
2056 $$(compile-command.c) -DNAME=\"$o\"
2057 endef
2058 object-suffixes-left := a b c d
2059 include $(o-iterator)
2061 $(objpfx)tst-initorder2-cmp.out: tst-initorder2.exp $(objpfx)tst-initorder2.out
2062 cmp $^ > $@; \
2063 $(evaluate-test)
2065 $(objpfx)tst-relsort1mod1.so: $(libm) $(objpfx)tst-relsort1mod2.so
2066 $(objpfx)tst-relsort1mod2.so: $(libm)
2067 $(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
2068 $(objpfx)tst-relsort1mod2.so
2070 $(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so
2071 $(test-wrapper-env) \
2072 LD_TRACE_LOADED_OBJECTS=1 \
2073 LD_DEBUG=unused \
2074 LD_PRELOAD= \
2075 $(rtld-prefix) \
2076 $< > $@; \
2077 $(evaluate-test)
2079 $(objpfx)tst-unused-dep-cmp.out: $(objpfx)tst-unused-dep.out
2080 cmp $< /dev/null > $@; \
2081 $(evaluate-test)
2083 $(objpfx)tst-audit11.out: $(objpfx)tst-auditmod11.so $(objpfx)tst-audit11mod1.so
2084 tst-audit11-ENV = LD_AUDIT=$(objpfx)tst-auditmod11.so
2085 $(objpfx)tst-audit11mod1.so: $(objpfx)tst-audit11mod2.so
2086 LDFLAGS-tst-audit11mod2.so = -Wl,--version-script=tst-audit11mod2.map,-soname,tst-audit11mod2.so
2088 $(objpfx)tst-audit12.out: $(objpfx)tst-auditmod12.so $(objpfx)tst-audit12mod1.so $(objpfx)tst-audit12mod3.so
2089 tst-audit12-ENV = LD_AUDIT=$(objpfx)tst-auditmod12.so
2090 $(objpfx)tst-audit12mod1.so: $(objpfx)tst-audit12mod2.so
2091 LDFLAGS-tst-audit12mod2.so = -Wl,--version-script=tst-audit12mod2.map
2093 $(objpfx)tst-audit13.out: $(objpfx)tst-audit13mod1.so
2094 LDFLAGS-tst-audit13mod1.so = -Wl,-z,lazy
2095 tst-audit13-ENV = LD_AUDIT=$(objpfx)tst-audit13mod1.so
2097 $(objpfx)tst-auditmany.out: $(objpfx)tst-auditmanymod1.so \
2098 $(objpfx)tst-auditmanymod2.so $(objpfx)tst-auditmanymod3.so \
2099 $(objpfx)tst-auditmanymod4.so $(objpfx)tst-auditmanymod5.so \
2100 $(objpfx)tst-auditmanymod6.so $(objpfx)tst-auditmanymod7.so \
2101 $(objpfx)tst-auditmanymod8.so $(objpfx)tst-auditmanymod9.so
2102 tst-auditmany-ENV = \
2103 LD_AUDIT=tst-auditmanymod1.so:tst-auditmanymod2.so:tst-auditmanymod3.so:tst-auditmanymod4.so:tst-auditmanymod5.so:tst-auditmanymod6.so:tst-auditmanymod7.so:tst-auditmanymod8.so:tst-auditmanymod9.so
2105 LDFLAGS-tst-audit14 = -Wl,--audit=tst-auditlogmod-1.so,--disable-new-dtags
2106 $(objpfx)tst-auditlogmod-1.so: $(libsupport)
2107 $(objpfx)tst-audit14.out: $(objpfx)tst-auditlogmod-1.so
2108 LDFLAGS-tst-audit14a = -Wl,--audit=tst-auditlogmod-1.so,--enable-new-dtags
2109 $(objpfx)tst-audit14a.out: $(objpfx)tst-auditlogmod-1.so
2110 LDFLAGS-tst-audit15 = \
2111 -Wl,--audit=tst-auditlogmod-1.so,--depaudit=tst-auditlogmod-2.so
2112 $(objpfx)tst-auditlogmod-2.so: $(libsupport)
2113 $(objpfx)tst-audit15.out: \
2114 $(objpfx)tst-auditlogmod-1.so $(objpfx)tst-auditlogmod-2.so
2115 LDFLAGS-tst-audit16 = \
2116 -Wl,--audit=tst-auditlogmod-1.so:tst-auditlogmod-2.so \
2117 -Wl,--depaudit=tst-auditlogmod-3.so
2118 $(objpfx)tst-auditlogmod-3.so: $(libsupport)
2119 $(objpfx)tst-audit16.out: \
2120 $(objpfx)tst-auditlogmod-1.so $(objpfx)tst-auditlogmod-2.so \
2121 $(objpfx)tst-auditlogmod-3.so
2122 $(objpfx)tst-audit17.out: $(objpfx)tst-auditmod17.so
2123 # The test check if a audit library without libc.so on DT_NEEDED works as
2124 # intended, so it uses an explicit link rule.
2125 $(objpfx)tst-auditmod17.so: $(objpfx)tst-auditmod17.os
2126 $(CC) -nostdlib -nostartfiles -shared -o $@.new \
2127 $(filter-out $(map-file),$^)
2128 $(call after-link,$@.new)
2129 mv -f $@.new $@
2130 CFLAGS-.os += $(call elide-stack-protector,.os,tst-auditmod17)
2131 tst-audit17-ENV = LD_AUDIT=$(objpfx)tst-auditmod17.so
2133 $(objpfx)tst-audit14-cmp.out: tst-audit14.exp $(objpfx)tst-audit14.out
2134 cmp $^ > $@; \
2135 $(evaluate-test)
2136 $(objpfx)tst-audit14a-cmp.out: tst-audit14.exp $(objpfx)tst-audit14a.out
2137 cmp $^ > $@; \
2138 $(evaluate-test)
2139 $(objpfx)tst-audit15-cmp.out: tst-audit15.exp $(objpfx)tst-audit15.out
2140 cmp $^ > $@; \
2141 $(evaluate-test)
2142 $(objpfx)tst-audit16-cmp.out: tst-audit16.exp $(objpfx)tst-audit16.out
2143 cmp $^ > $@; \
2144 $(evaluate-test)
2146 $(objpfx)tst-audit18.out: $(objpfx)tst-auditmod18.so \
2147 $(objpfx)tst-audit18mod.so
2148 tst-audit18-ARGS = -- $(host-test-program-cmd)
2150 $(objpfx)tst-audit19a.out: $(objpfx)tst-auditmod19a.so
2151 tst-audit19a-ENV = LD_AUDIT=$(objpfx)tst-auditmod19a.so
2153 $(objpfx)tst-audit19b.out: $(objpfx)tst-auditmod19b.so
2154 $(objpfx)tst-audit19b: $(objpfx)tst-audit19bmod.so
2155 tst-audit19b-ARGS = -- $(host-test-program-cmd)
2157 $(objpfx)tst-audit20.out: $(objpfx)tst-auditmod20.so
2158 tst-audit20-ENV = LD_AUDIT=$(objpfx)tst-auditmod20.so
2160 $(objpfx)tst-audit21: $(shared-thread-library)
2161 $(objpfx)tst-audit21.out: $(objpfx)tst-auditmod21a.so
2162 $(objpfx)tst-auditmod21a.so: $(objpfx)tst-auditmod21b.so
2163 tst-audit21-ENV = LD_AUDIT=$(objpfx)tst-auditmod21a.so
2165 $(objpfx)tst-audit22.out: $(objpfx)tst-auditmod22.so
2166 tst-audit22-ARGS = -- $(host-test-program-cmd)
2168 $(objpfx)tst-audit23.out: $(objpfx)tst-auditmod23.so \
2169 $(objpfx)tst-audit23mod.so
2170 tst-audit23-ARGS = -- $(host-test-program-cmd)
2172 $(objpfx)tst-audit24a.out: $(objpfx)tst-auditmod24a.so
2173 $(objpfx)tst-audit24a: $(objpfx)tst-audit24amod1.so \
2174 $(objpfx)tst-audit24amod2.so
2175 tst-audit24a-ENV = LD_AUDIT=$(objpfx)tst-auditmod24a.so
2176 LDFLAGS-tst-audit24a = -Wl,-z,now
2178 $(objpfx)tst-audit24b.out: $(objpfx)tst-auditmod24b.so
2179 $(objpfx)tst-audit24b: $(objpfx)tst-audit24bmod1.so \
2180 $(objpfx)tst-audit24bmod2.so
2181 $(objpfx)tst-audit24bmod1: $(objpfx)tst-audit24bmod2.so
2182 # The test checks if a library without .gnu.version correctly calls the
2183 # audit callbacks. So it uses an explicit link rule to avoid linking
2184 # against libc.so.
2185 $(objpfx)tst-audit24bmod1.so: $(objpfx)tst-audit24bmod1.os
2186 $(CC) -nostdlib -nostartfiles -shared -o $@.new $(objpfx)tst-audit24bmod1.os \
2187 -Wl,-z,now
2188 $(call after-link,$@.new)
2189 mv -f $@.new $@
2190 CFLAGS-.os += $(call elide-stack-protector,.os,tst-audit24bmod1)
2191 $(objpfx)tst-audit24bmod2.so: $(objpfx)tst-audit24bmod2.os
2192 $(CC) -nostdlib -nostartfiles -shared -o $@.new $(objpfx)tst-audit24bmod2.os
2193 $(call after-link,$@.new)
2194 mv -f $@.new $@
2195 CFLAGS-.os += $(call elide-stack-protector,.os,tst-audit24bmod2)
2196 tst-audit24b-ENV = LD_AUDIT=$(objpfx)tst-auditmod24b.so
2197 LDFLAGS-tst-audit24b = -Wl,-z,now
2199 # Same as tst-audit24a, but tests LD_BIND_NOW
2200 $(objpfx)tst-audit24c.out: $(objpfx)tst-auditmod24c.so
2201 $(objpfx)tst-audit24c: $(objpfx)tst-audit24amod1.so \
2202 $(objpfx)tst-audit24amod2.so
2203 tst-audit24c-ENV = LD_BIND_NOW=1 LD_AUDIT=$(objpfx)tst-auditmod24c.so
2204 LDFLAGS-tst-audit24c = -Wl,-z,lazy
2206 $(objpfx)tst-audit24d.out: $(objpfx)tst-auditmod24d.so
2207 $(objpfx)tst-audit24d: $(objpfx)tst-audit24dmod1.so \
2208 $(objpfx)tst-audit24dmod2.so
2209 $(objpfx)tst-audit24dmod1.so: $(objpfx)tst-audit24dmod3.so
2210 LDFLAGS-tst-audit24dmod1.so = -Wl,-z,now
2211 $(objpfx)tst-audit24dmod2.so: $(objpfx)tst-audit24dmod4.so
2212 LDFLAGS-tst-audit24dmod2.so = -Wl,-z,lazy
2213 tst-audit24d-ENV = LD_AUDIT=$(objpfx)tst-auditmod24d.so
2214 LDFLAGS-tst-audit24d = -Wl,-z,lazy
2216 $(objpfx)tst-audit25a.out: $(objpfx)tst-auditmod25.so
2217 $(objpfx)tst-audit25a: $(objpfx)tst-audit25mod1.so \
2218 $(objpfx)tst-audit25mod2.so \
2219 $(objpfx)tst-audit25mod3.so \
2220 $(objpfx)tst-audit25mod4.so
2221 LDFLAGS-tst-audit25a = -Wl,-z,lazy
2222 $(objpfx)tst-audit25mod1.so: $(objpfx)tst-audit25mod3.so
2223 LDFLAGS-tst-audit25mod1.so = -Wl,-z,now
2224 $(objpfx)tst-audit25mod2.so: $(objpfx)tst-audit25mod4.so
2225 LDFLAGS-tst-audit25mod2.so = -Wl,-z,lazy
2226 tst-audit25a-ARGS = -- $(host-test-program-cmd)
2228 $(objpfx)tst-audit25b.out: $(objpfx)tst-auditmod25.so
2229 $(objpfx)tst-audit25b: $(objpfx)tst-audit25mod1.so \
2230 $(objpfx)tst-audit25mod2.so \
2231 $(objpfx)tst-audit25mod3.so \
2232 $(objpfx)tst-audit25mod4.so
2233 LDFLAGS-tst-audit25b = -Wl,-z,now
2234 tst-audit25b-ARGS = -- $(host-test-program-cmd)
2236 # tst-sonamemove links against an older implementation of the library.
2237 LDFLAGS-tst-sonamemove-linkmod1.so = \
2238 -Wl,--version-script=tst-sonamemove-linkmod1.map \
2239 -Wl,-soname,tst-sonamemove-runmod1.so
2240 LDFLAGS-tst-sonamemove-runmod1.so = -Wl,--no-as-needed \
2241 -Wl,--version-script=tst-sonamemove-runmod1.map \
2242 -Wl,-soname,tst-sonamemove-runmod1.so
2243 LDFLAGS-tst-sonamemove-runmod2.so = \
2244 -Wl,--version-script=tst-sonamemove-runmod2.map \
2245 -Wl,-soname,tst-sonamemove-runmod2.so
2246 $(objpfx)tst-sonamemove-runmod1.so: $(objpfx)tst-sonamemove-runmod2.so
2247 # Link against the link module, but depend on the run-time modules
2248 # for execution.
2249 $(objpfx)tst-sonamemove-link: $(objpfx)tst-sonamemove-linkmod1.so
2250 $(objpfx)tst-sonamemove-link.out: \
2251 $(objpfx)tst-sonamemove-runmod1.so \
2252 $(objpfx)tst-sonamemove-runmod2.so
2253 $(objpfx)tst-sonamemove-dlopen.out: \
2254 $(objpfx)tst-sonamemove-runmod1.so \
2255 $(objpfx)tst-sonamemove-runmod2.so
2257 $(objpfx)tst-dlmopen-dlerror-mod.so: $(libsupport)
2258 $(objpfx)tst-dlmopen-dlerror.out: $(objpfx)tst-dlmopen-dlerror-mod.so
2260 # Override -z defs, so that we can reference an undefined symbol.
2261 # Force lazy binding for the same reason.
2262 LDFLAGS-tst-latepthreadmod.so = \
2263 -Wl,-z,lazy -Wl,--unresolved-symbols=ignore-all
2264 # Do not optimize sibling calls as the test relies on a JMP_SLOT relocation for
2265 # function this_function_is_not_defined.
2266 CFLAGS-tst-latepthreadmod.c += -fno-optimize-sibling-calls
2267 $(objpfx)tst-latepthreadmod.so: $(shared-thread-library)
2268 $(objpfx)tst-latepthread.out: $(objpfx)tst-latepthreadmod.so
2270 # The test modules are parameterized by preprocessor macros.
2271 $(patsubst %,$(objpfx)%.os,$(tst-tls-many-dynamic-modules)): \
2272 $(objpfx)tst-tls-manydynamic%mod.os : tst-tls-manydynamicmod.c
2273 $(compile-command.c) \
2274 -DNAME=tls_global_$* -DSETTER=set_value_$* -DGETTER=get_value_$*
2275 $(objpfx)tst-tls-manydynamic: $(shared-thread-library)
2276 $(objpfx)tst-tls-manydynamic.out: \
2277 $(patsubst %,$(objpfx)%.so,$(tst-tls-many-dynamic-modules))
2279 $(objpfx)tst-ldconfig-X.out : tst-ldconfig-X.sh $(objpfx)ldconfig
2280 $(SHELL) $< '$(common-objpfx)' '$(test-wrapper-env)' \
2281 '$(run-program-env)' > $@; \
2282 $(evaluate-test)
2284 # Test static linking of all the libraries we can possibly link
2285 # together. Note that in some configurations this may be less than the
2286 # complete list of libraries we build but we try to maxmimize this list.
2287 ifeq ($(pthread-in-libc),no)
2288 $(objpfx)tst-linkall-static: \
2289 $(common-objpfx)resolv/libanl.a
2290 endif
2291 $(objpfx)tst-linkall-static: \
2292 $(common-objpfx)math/libm.a \
2293 $(common-objpfx)resolv/libresolv.a \
2294 $(common-objpfx)login/libutil.a \
2295 $(common-objpfx)rt/librt.a \
2296 $(static-thread-library)
2298 ifeq ($(build-crypt),yes)
2299 # If we are using NSS crypto and we have the ability to link statically
2300 # then we include libcrypt.a, otherwise we leave out libcrypt.a and
2301 # link as much as we can into the tst-linkall-static test. This assumes
2302 # that linking with libcrypt.a does everything required to include the
2303 # static NSS crypto library.
2304 ifeq (yesyes,$(nss-crypt)$(static-nss-crypt))
2305 $(objpfx)tst-linkall-static: \
2306 $(common-objpfx)crypt/libcrypt.a
2307 endif
2308 # If we are not using NSS crypto then we always have the ability to link
2309 # with libcrypt.a.
2310 ifeq (no,$(nss-crypt))
2311 $(objpfx)tst-linkall-static: \
2312 $(common-objpfx)crypt/libcrypt.a
2313 endif
2314 endif
2316 # The application depends on the DSO, and the DSO loads the plugin.
2317 # The plugin also depends on the DSO. This creates the circular
2318 # dependency via dlopen that we're testing to make sure works.
2319 $(objpfx)tst-nodelete-dlclose-plugin.so: $(objpfx)tst-nodelete-dlclose-dso.so
2320 $(objpfx)tst-nodelete-dlclose: $(objpfx)tst-nodelete-dlclose-dso.so
2321 $(objpfx)tst-nodelete-dlclose.out: $(objpfx)tst-nodelete-dlclose-dso.so \
2322 $(objpfx)tst-nodelete-dlclose-plugin.so
2324 tst-env-setuid-ENV = MALLOC_CHECK_=2 MALLOC_MMAP_THRESHOLD_=4096 \
2325 LD_HWCAP_MASK=0x1
2327 $(objpfx)tst-debug1.out: $(objpfx)tst-debug1mod1.so
2329 $(objpfx)tst-debug1mod1.so: $(objpfx)testobj1.so
2330 $(OBJCOPY) --only-keep-debug $< $@
2332 $(objpfx)tst-main1: $(objpfx)tst-main1mod.so
2333 CRT-tst-main1 := $(csu-objpfx)crt1.o
2334 tst-main1-no-pie = yes
2335 LDLIBS-tst-main1 = $(libsupport)
2336 tst-main1mod.so-no-z-defs = yes
2338 LDLIBS-tst-absolute-sym-lib.so = tst-absolute-sym-lib.lds
2339 $(objpfx)tst-absolute-sym-lib.so: $(LDLIBS-tst-absolute-sym-lib.so)
2340 $(objpfx)tst-absolute-sym: $(objpfx)tst-absolute-sym-lib.so
2342 LDLIBS-tst-absolute-zero-lib.so = tst-absolute-zero-lib.lds
2343 $(objpfx)tst-absolute-zero-lib.so: $(LDLIBS-tst-absolute-zero-lib.so)
2344 $(objpfx)tst-absolute-zero: $(objpfx)tst-absolute-zero-lib.so
2346 $(objpfx)tst-big-note: $(objpfx)tst-big-note-lib.so
2347 # Avoid creating an ABI tag note, which may come before the
2348 # artificial, large note in tst-big-note-lib.o and invalidate the
2349 # test.
2350 $(objpfx)tst-big-note-lib.so: $(objpfx)tst-big-note-lib.o
2351 $(LINK.o) -shared -o $@ $(LDFLAGS.so) $<
2353 $(objpfx)tst-unwind-ctor: $(objpfx)tst-unwind-ctor-lib.so
2355 CFLAGS-tst-unwind-main.c += -funwind-tables -DUSE_PTHREADS=0
2357 $(objpfx)tst-initfinilazyfail.out: \
2358 $(objpfx)tst-initlazyfailmod.so $(objpfx)tst-finilazyfailmod.so
2359 # Override -z defs, so that we can reference an undefined symbol.
2360 # Force lazy binding for the same reason.
2361 LDFLAGS-tst-initlazyfailmod.so = \
2362 -Wl,-z,lazy -Wl,--unresolved-symbols=ignore-all
2363 LDFLAGS-tst-finilazyfailmod.so = \
2364 -Wl,-z,lazy -Wl,--unresolved-symbols=ignore-all
2366 $(objpfx)tst-dlopenfail.out: \
2367 $(objpfx)tst-dlopenfailmod1.so $(objpfx)tst-dlopenfailmod2.so
2368 # Order matters here. tst-dlopenfaillinkmod.so's soname ensures a
2369 # run-time loader failure. --as-needed breaks this test because
2370 # nothing actually references tst-dlopenfailmod2.so (with its soname
2371 # tst-dlopenfail-missingmod.so).
2372 LDFLAGS-tst-dlopenfailmod1.so = -Wl,--no-as-needed
2373 $(objpfx)tst-dlopenfailmod1.so: \
2374 $(shared-thread-library) $(objpfx)tst-dlopenfaillinkmod.so
2375 LDFLAGS-tst-dlopenfaillinkmod.so = -Wl,-soname,tst-dlopenfail-missingmod.so
2376 $(objpfx)tst-dlopenfailmod2.so: $(objpfx)tst-dlopenfailnodelmod.so
2377 $(objpfx)tst-dlopenfail-2.out: \
2378 $(objpfx)tst-dlopenfailmod1.so $(objpfx)tst-dlopenfailmod2.so \
2379 $(objpfx)tst-dlopenfailmod3.so
2380 # tst-dlopenfailnodelmod.so emulates how libpthread was linked.
2381 $(objpfx)tst-dlopenfailnodelmod.so: $(libsupport)
2382 LDFLAGS-tst-dlopenfailnodelmod.so = \
2383 -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
2384 # tst-dlopenfail should export the libsupport symbols, so that
2385 # tst-dlopenfailnodelmod.so uses them for error reporting.
2386 LDFLAGS-tst-dlopenfail = -Wl,-E
2388 $(objpfx)tst-dlopen-nodelete-reloc.out: \
2389 $(objpfx)tst-dlopen-nodelete-reloc-mod1.so \
2390 $(objpfx)tst-dlopen-nodelete-reloc-mod2.so \
2391 $(objpfx)tst-dlopen-nodelete-reloc-mod3.so \
2392 $(objpfx)tst-dlopen-nodelete-reloc-mod4.so \
2393 $(objpfx)tst-dlopen-nodelete-reloc-mod5.so \
2394 $(objpfx)tst-dlopen-nodelete-reloc-mod6.so \
2395 $(objpfx)tst-dlopen-nodelete-reloc-mod7.so \
2396 $(objpfx)tst-dlopen-nodelete-reloc-mod8.so \
2397 $(objpfx)tst-dlopen-nodelete-reloc-mod9.so \
2398 $(objpfx)tst-dlopen-nodelete-reloc-mod10.so \
2399 $(objpfx)tst-dlopen-nodelete-reloc-mod11.so \
2400 $(objpfx)tst-dlopen-nodelete-reloc-mod12.so \
2401 $(objpfx)tst-dlopen-nodelete-reloc-mod13.so \
2402 $(objpfx)tst-dlopen-nodelete-reloc-mod14.so \
2403 $(objpfx)tst-dlopen-nodelete-reloc-mod15.so \
2404 $(objpfx)tst-dlopen-nodelete-reloc-mod16.so \
2405 $(objpfx)tst-dlopen-nodelete-reloc-mod17.so
2406 tst-dlopen-nodelete-reloc-mod2.so-no-z-defs = yes
2407 LDFLAGS-tst-dlopen-nodelete-reloc-mod2.so = -Wl,-z,nodelete
2408 $(objpfx)tst-dlopen-nodelete-reloc-mod4.so: \
2409 $(objpfx)tst-dlopen-nodelete-reloc-mod3.so
2410 LDFLAGS-tst-dlopen-nodelete-reloc-mod4.so = -Wl,--no-as-needed
2411 $(objpfx)tst-dlopen-nodelete-reloc-mod5.so: \
2412 $(objpfx)tst-dlopen-nodelete-reloc-mod4.so
2413 LDFLAGS-tst-dlopen-nodelete-reloc-mod5.so = -Wl,-z,nodelete,--no-as-needed
2414 tst-dlopen-nodelete-reloc-mod5.so-no-z-defs = yes
2415 tst-dlopen-nodelete-reloc-mod7.so-no-z-defs = yes
2416 tst-dlopen-nodelete-reloc-mod11.so-no-z-defs = yes
2417 $(objpfx)tst-dlopen-nodelete-reloc-mod13.so: \
2418 $(objpfx)tst-dlopen-nodelete-reloc-mod12.so
2419 $(objpfx)tst-dlopen-nodelete-reloc-mod15.so: \
2420 $(objpfx)tst-dlopen-nodelete-reloc-mod14.so
2421 tst-dlopen-nodelete-reloc-mod16.so-no-z-defs = yes
2422 $(objpfx)tst-dlopen-nodelete-reloc-mod16.so: \
2423 $(objpfx)tst-dlopen-nodelete-reloc-mod15.so
2424 LDFLAGS-tst-dlopen-nodelete-reloc-mod16.so = -Wl,--no-as-needed
2425 $(objpfx)tst-dlopen-nodelete-reloc-mod17.so: \
2426 $(objpfx)tst-dlopen-nodelete-reloc-mod15.so \
2427 $(objpfx)tst-dlopen-nodelete-reloc-mod16.so
2428 LDFLAGS-tst-dlopen-nodelete-reloc-mod17.so = -Wl,--no-as-needed
2430 $(objpfx)tst-ldconfig-ld_so_conf-update.out: $(objpfx)tst-ldconfig-ld-mod.so
2432 LDFLAGS-tst-filterobj-flt.so = -Wl,--filter=$(objpfx)tst-filterobj-filtee.so
2433 $(objpfx)tst-filterobj: $(objpfx)tst-filterobj-flt.so
2434 $(objpfx)tst-filterobj.out: $(objpfx)tst-filterobj-filtee.so
2435 $(objpfx)tst-filterobj-dlopen.out: $(objpfx)tst-filterobj-filtee.so
2437 LDFLAGS-tst-filterobj-aux.so = -Wl,--auxiliary=$(objpfx)tst-filterobj-filtee.so
2438 $(objpfx)tst-auxobj: $(objpfx)tst-filterobj-aux.so
2439 $(objpfx)tst-auxobj.out: $(objpfx)tst-filterobj-filtee.so
2440 $(objpfx)tst-auxobj-dlopen.out: $(objpfx)tst-filterobj-filtee.so
2442 $(objpfx)tst-single_threaded: $(objpfx)tst-single_threaded-mod1.so
2443 $(objpfx)tst-single_threaded.out: \
2444 $(objpfx)tst-single_threaded-mod2.so $(objpfx)tst-single_threaded-mod3.so
2445 $(objpfx)tst-single_threaded-static-dlopen: \
2446 $(objpfx)tst-single_threaded-mod1.o
2447 $(objpfx)tst-single_threaded-static-dlopen.out: \
2448 $(objpfx)tst-single_threaded-mod2.so
2449 $(objpfx)tst-single_threaded-pthread: \
2450 $(objpfx)tst-single_threaded-mod1.so $(shared-thread-library)
2451 $(objpfx)tst-single_threaded-pthread.out: \
2452 $(objpfx)tst-single_threaded-mod2.so $(objpfx)tst-single_threaded-mod3.so \
2453 $(objpfx)tst-single_threaded-mod4.so
2454 $(objpfx)tst-single_threaded-pthread-static: $(static-thread-library)
2456 $(objpfx)tst-tls-ie: $(shared-thread-library)
2457 $(objpfx)tst-tls-ie.out: \
2458 $(objpfx)tst-tls-ie-mod0.so \
2459 $(objpfx)tst-tls-ie-mod1.so \
2460 $(objpfx)tst-tls-ie-mod2.so \
2461 $(objpfx)tst-tls-ie-mod3.so \
2462 $(objpfx)tst-tls-ie-mod4.so \
2463 $(objpfx)tst-tls-ie-mod5.so \
2464 $(objpfx)tst-tls-ie-mod6.so
2466 $(objpfx)tst-tls-ie-dlmopen: $(shared-thread-library)
2467 $(objpfx)tst-tls-ie-dlmopen.out: \
2468 $(objpfx)tst-tls-ie-mod0.so \
2469 $(objpfx)tst-tls-ie-mod1.so \
2470 $(objpfx)tst-tls-ie-mod2.so \
2471 $(objpfx)tst-tls-ie-mod3.so \
2472 $(objpfx)tst-tls-ie-mod4.so \
2473 $(objpfx)tst-tls-ie-mod5.so \
2474 $(objpfx)tst-tls-ie-mod6.so
2476 $(objpfx)argv0test.out: tst-rtld-argv0.sh $(objpfx)ld.so \
2477 $(objpfx)argv0test
2478 $(SHELL) $< $(objpfx)ld.so $(objpfx)argv0test \
2479 '$(test-wrapper-env)' '$(run_program_env)' \
2480 '$(rpath-link)' 'test-argv0' > $@; \
2481 $(evaluate-test)
2483 # A list containing the name of the most likely searched subdirectory
2484 # of the glibc-hwcaps directory, for each supported architecture (in
2485 # other words, the oldest hardware level recognized by the
2486 # glibc-hwcaps mechanism for this architecture). Used to obtain test
2487 # coverage for some glibc-hwcaps tests for the widest possible range
2488 # of systems.
2489 glibc-hwcaps-first-subdirs-for-tests = power9 x86-64-v2 z13
2491 # The test modules are parameterized by preprocessor macros.
2492 LDFLAGS-libmarkermod1-1.so += -Wl,-soname,libmarkermod1.so
2493 LDFLAGS-libmarkermod2-1.so += -Wl,-soname,libmarkermod2.so
2494 LDFLAGS-libmarkermod3-1.so += -Wl,-soname,libmarkermod3.so
2495 LDFLAGS-libmarkermod4-1.so += -Wl,-soname,libmarkermod4.so
2496 $(objpfx)libmarkermod%.os : markermodMARKER-VALUE.c
2497 $(compile-command.c) \
2498 -DMARKER=marker$(firstword $(subst -, ,$*)) \
2499 -DVALUE=$(lastword $(subst -, ,$*))
2500 $(objpfx)libmarkermod1.so: $(objpfx)libmarkermod1-1.so
2501 cp $< $@
2502 $(objpfx)libmarkermod2.so: $(objpfx)libmarkermod2-1.so
2503 cp $< $@
2504 $(objpfx)libmarkermod3.so: $(objpfx)libmarkermod3-1.so
2505 cp $< $@
2506 $(objpfx)libmarkermod4.so: $(objpfx)libmarkermod4-1.so
2507 cp $< $@
2509 # tst-glibc-hwcaps-prepend checks that --glibc-hwcaps-prepend is
2510 # preferred over auto-detected subdirectories.
2511 $(objpfx)tst-glibc-hwcaps-prepend: $(objpfx)libmarkermod1-1.so
2512 $(objpfx)glibc-hwcaps/prepend-markermod1/libmarkermod1.so: \
2513 $(objpfx)libmarkermod1-2.so
2514 $(make-target-directory)
2515 cp $< $@
2516 $(objpfx)glibc-hwcaps/%/libmarkermod1.so: $(objpfx)libmarkermod1-3.so
2517 $(make-target-directory)
2518 cp $< $@
2519 $(objpfx)tst-glibc-hwcaps-prepend.out: \
2520 $(objpfx)tst-glibc-hwcaps-prepend $(objpfx)libmarkermod1.so \
2521 $(patsubst %,$(objpfx)glibc-hwcaps/%/libmarkermod1.so,prepend-markermod1 \
2522 $(glibc-hwcaps-first-subdirs-for-tests))
2523 $(test-wrapper) $(rtld-prefix) \
2524 --glibc-hwcaps-prepend prepend-markermod1 \
2525 $< > $@; \
2526 $(evaluate-test)
2528 # Like tst-glibc-hwcaps-prepend, but uses a container and loads the
2529 # library via ld.so.cache. Test setup is contained in the test
2530 # itself.
2531 $(objpfx)tst-glibc-hwcaps-prepend-cache.out: \
2532 $(objpfx)tst-glibc-hwcaps-prepend-cache $(objpfx)libmarkermod1-1.so \
2533 $(objpfx)libmarkermod1-2.so $(objpfx)libmarkermod1-3.so
2535 # tst-glibc-hwcaps-mask checks that --glibc-hwcaps-mask can be used to
2536 # suppress all auto-detected subdirectories.
2537 $(objpfx)tst-glibc-hwcaps-mask: $(objpfx)libmarkermod1-1.so
2538 $(objpfx)tst-glibc-hwcaps-mask.out: \
2539 $(objpfx)tst-glibc-hwcaps-mask $(objpfx)libmarkermod1.so \
2540 $(patsubst %,$(objpfx)glibc-hwcaps/%/libmarkermod1.so,\
2541 $(glibc-hwcaps-first-subdirs-for-tests))
2542 $(test-wrapper) $(rtld-prefix) \
2543 --glibc-hwcaps-mask does-not-exist \
2544 $< > $@; \
2545 $(evaluate-test)
2547 # Generic dependency for sysdeps implementation of
2548 # tst-glibc-hwcaps-cache.
2549 $(objpfx)tst-glibc-hwcaps-cache.out: $(objpfx)tst-glibc-hwcaps
2551 $(objpfx)list-tunables.out: tst-rtld-list-tunables.sh $(objpfx)ld.so
2552 $(SHELL) $< $(objpfx)ld.so '$(test-wrapper-env)' \
2553 '$(run_program_env)' > $(objpfx)/tst-rtld-list-tunables.out
2554 cmp tst-rtld-list-tunables.exp \
2555 $(objpfx)/tst-rtld-list-tunables.out > $@; \
2556 $(evaluate-test)
2558 tst-dst-static-ENV = LD_LIBRARY_PATH='$$ORIGIN'
2560 $(objpfx)tst-rtld-help.out: $(objpfx)ld.so
2561 $(test-wrapper) $(rtld-prefix) --help > $@; \
2562 status=$$?; \
2563 echo "info: ld.so exit status: $$status" >> $@; \
2564 if ! grep -q 'Legacy HWCAP subdirectories under library search path directories' $@; then \
2565 echo "error: missing subdirectory pattern" >> $@; \
2566 if test $$status -eq 0; then \
2567 status=1; \
2568 fi; \
2569 fi; \
2570 (exit $$status); \
2571 $(evaluate-test)
2573 # Reuses tst-tls-many-dynamic-modules
2574 $(patsubst %,$(objpfx)%.os,$(tst-tls-many-dynamic-modules-dep)): \
2575 $(objpfx)tst-tls-manydynamic%mod-dep.os : tst-tls-manydynamicmod.c
2576 $(compile-command.c) \
2577 -DNAME=tls_global_$* -DSETTER=set_value_$* -DGETTER=get_value_$*
2578 $(patsubst %,$(objpfx)%.os,$(tst-tls-many-dynamic-modules-dep-bad)): \
2579 $(objpfx)tst-tls-manydynamic%mod-dep-bad.os : tst-tls-manydynamicmod.c
2580 $(compile-command.c) \
2581 -DNAME=tls_global_$* -DSETTER=set_value_$* -DGETTER=get_value_$*
2582 tst-tls20mod-bad.so-no-z-defs = yes
2583 # Single dependency.
2584 $(objpfx)tst-tls-manydynamic0mod-dep.so: $(objpfx)tst-tls-manydynamic1mod-dep.so
2585 # Double dependencies.
2586 $(objpfx)tst-tls-manydynamic2mod-dep.so: $(objpfx)tst-tls-manydynamic3mod-dep.so \
2587 $(objpfx)tst-tls-manydynamic4mod-dep.so
2588 # Double dependencies with each dependency depent of another module.
2589 $(objpfx)tst-tls-manydynamic5mod-dep.so: $(objpfx)tst-tls-manydynamic6mod-dep.so \
2590 $(objpfx)tst-tls-manydynamic7mod-dep.so
2591 $(objpfx)tst-tls-manydynamic6mod-dep.so: $(objpfx)tst-tls-manydynamic8mod-dep.so
2592 $(objpfx)tst-tls-manydynamic7mod-dep.so: $(objpfx)tst-tls-manydynamic8mod-dep.so
2593 # Long chain with one double dependency in the middle
2594 $(objpfx)tst-tls-manydynamic9mod-dep.so: $(objpfx)tst-tls-manydynamic10mod-dep.so \
2595 $(objpfx)tst-tls-manydynamic11mod-dep.so
2596 $(objpfx)tst-tls-manydynamic10mod-dep.so: $(objpfx)tst-tls-manydynamic12mod-dep.so
2597 $(objpfx)tst-tls-manydynamic12mod-dep.so: $(objpfx)tst-tls-manydynamic13mod-dep.so
2598 # Long chain with two double depedencies in the middle
2599 $(objpfx)tst-tls-manydynamic14mod-dep.so: $(objpfx)tst-tls-manydynamic15mod-dep.so
2600 $(objpfx)tst-tls-manydynamic15mod-dep.so: $(objpfx)tst-tls-manydynamic16mod-dep.so \
2601 $(objpfx)tst-tls-manydynamic17mod-dep.so
2602 $(objpfx)tst-tls-manydynamic16mod-dep.so: $(objpfx)tst-tls-manydynamic18mod-dep.so \
2603 $(objpfx)tst-tls-manydynamic19mod-dep.so
2604 # Same but with an invalid module.
2605 # Single dependency.
2606 $(objpfx)tst-tls-manydynamic0mod-dep-bad.so: $(objpfx)tst-tls20mod-bad.so
2607 LDFLAGS-tst-tls-manydynamic0mod-dep-bad.so = -Wl,--no-as-needed
2608 # Double dependencies.
2609 $(objpfx)tst-tls-manydynamic1mod-dep-bad.so: $(objpfx)tst-tls-manydynamic2mod-dep-bad.so \
2610 $(objpfx)tst-tls20mod-bad.so
2611 LDFLAGS-tst-tls-manydynamic1mod-dep-bad.so = -Wl,--no-as-needed
2612 # Double dependencies with each dependency depent of another module.
2613 $(objpfx)tst-tls-manydynamic3mod-dep-bad.so: $(objpfx)tst-tls-manydynamic4mod-dep-bad.so \
2614 $(objpfx)tst-tls-manydynamic5mod-dep-bad.so
2615 LDFLAGS-tst-tls-manydynamic3mod-dep-bad.so = -Wl,--no-as-needed
2616 $(objpfx)tst-tls-manydynamic4mod-dep-bad.so: $(objpfx)tst-tls20mod-bad.so
2617 LDFLAGS-tst-tls-manydynamic4mod-dep-bad.so = -Wl,--no-as-needed
2618 $(objpfx)tst-tls-manydynamic5mod-dep-bad.so: $(objpfx)tst-tls20mod-bad.so
2619 LDFLAGS-tst-tls-manydynamic5mod-dep-bad.so = -Wl,--no-as-needed
2620 # Long chain with one double dependency in the middle
2621 $(objpfx)tst-tls-manydynamic6mod-dep-bad.so: $(objpfx)tst-tls-manydynamic7mod-dep-bad.so \
2622 $(objpfx)tst-tls-manydynamic8mod-dep-bad.so
2623 LDFLAGS-tst-tls-manydynamic6mod-dep-bad.so = -Wl,--no-as-needed
2624 $(objpfx)tst-tls-manydynamic7mod-dep-bad.so: $(objpfx)tst-tls-manydynamic9mod-dep-bad.so
2625 LDFLAGS-tst-tls-manydynamic7mod-dep-bad.so = -Wl,--no-as-needed
2626 $(objpfx)tst-tls-manydynamic9mod-dep-bad.so: $(objpfx)tst-tls20mod-bad.so
2627 LDFLAGS-tst-tls-manydynamic9mod-dep-bad.so = -Wl,--no-as-needed
2628 # Long chain with two double depedencies in the middle
2629 $(objpfx)tst-tls-manydynamic10mod-dep-bad.so: $(objpfx)tst-tls-manydynamic11mod-dep-bad.so
2630 LDFLAGS-tst-tls-manydynamic10mod-dep-bad.so = -Wl,--no-as-needed
2631 $(objpfx)tst-tls-manydynamic11mod-dep-bad.so: $(objpfx)tst-tls-manydynamic12mod-dep-bad.so \
2632 $(objpfx)tst-tls-manydynamic13mod-dep-bad.so
2633 LDFLAGS-tst-tls-manydynamic11mod-dep-bad.so = -Wl,--no-as-needed
2634 $(objpfx)tst-tls-manydynamic12mod-dep-bad.so: $(objpfx)tst-tls-manydynamic14mod-dep-bad.so \
2635 $(objpfx)tst-tls20mod-bad.so
2636 LDFLAGS-tst-tls-manydynamic12mod-dep-bad.so = -Wl,--no-as-needed
2637 $(objpfx)tst-tls20: $(shared-thread-library)
2638 $(objpfx)tst-tls20.out: $(objpfx)tst-tls20mod-bad.so \
2639 $(tst-tls-many-dynamic-modules:%=$(objpfx)%.so) \
2640 $(tst-tls-many-dynamic-modules-dep:%=$(objpfx)%.so) \
2641 $(tst-tls-many-dynamic-modules-dep-bad:%=$(objpfx)%.so) \
2643 # Reuses tst-tls-many-dynamic-modules
2644 $(objpfx)tst-tls21: $(shared-thread-library)
2645 $(objpfx)tst-tls21.out: $(objpfx)tst-tls21mod.so
2646 $(objpfx)tst-tls21mod.so: $(tst-tls-many-dynamic-modules:%=$(objpfx)%.so)
2648 $(objpfx)tst-getauxval-static.out: $(objpfx)tst-auxvalmod.so
2649 tst-getauxval-static-ENV = LD_LIBRARY_PATH=$(objpfx):$(common-objpfx)
2651 $(objpfx)tst-dlmopen-gethostbyname.out: $(objpfx)tst-dlmopen-gethostbyname-mod.so
2653 $(objpfx)tst-ro-dynamic: $(objpfx)tst-ro-dynamic-mod.so
2654 $(objpfx)tst-ro-dynamic-mod.so: $(objpfx)tst-ro-dynamic-mod.os \
2655 tst-ro-dynamic-mod.map
2656 $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
2657 -Wl,--script=tst-ro-dynamic-mod.map \
2658 $(objpfx)tst-ro-dynamic-mod.os
2660 $(objpfx)tst-rtld-run-static.out: $(objpfx)/ldconfig
2662 $(objpfx)tst-dl_find_object.out: \
2663 $(objpfx)tst-dl_find_object-mod1.so $(objpfx)tst-dl_find_object-mod2.so
2664 $(objpfx)tst-dl_find_object-static.out: \
2665 $(objpfx)tst-dl_find_object-mod1.so $(objpfx)tst-dl_find_object-mod2.so
2666 tst-dl_find_object-static-ENV = $(static-dlopen-environment)
2667 CFLAGS-tst-dl_find_object.c += -funwind-tables
2668 CFLAGS-tst-dl_find_object-static.c += -funwind-tables
2669 LDFLAGS-tst-dl_find_object-static += -Wl,--eh-frame-hdr
2670 CFLAGS-tst-dl_find_object-mod1.c += -funwind-tables
2671 CFLAGS-tst-dl_find_object-mod2.c += -funwind-tables
2672 LDFLAGS-tst-dl_find_object-mod2.so += -Wl,--enable-new-dtags,-z,nodelete
2673 $(objpfx)tst-dl_find_object-threads: $(shared-thread-library)
2674 CFLAGS-tst-dl_find_object-threads.c += -funwind-tables
2675 $(objpfx)tst-dl_find_object-threads.out: \
2676 $(objpfx)tst-dl_find_object-mod1.so \
2677 $(objpfx)tst-dl_find_object-mod2.so \
2678 $(objpfx)tst-dl_find_object-mod3.so \
2679 $(objpfx)tst-dl_find_object-mod4.so \
2680 $(objpfx)tst-dl_find_object-mod5.so \
2681 $(objpfx)tst-dl_find_object-mod6.so \
2682 $(objpfx)tst-dl_find_object-mod7.so \
2683 $(objpfx)tst-dl_find_object-mod8.so \
2684 $(objpfx)tst-dl_find_object-mod9.so
2685 CFLAGS-tst-dl_find_object-mod3.c += -funwind-tables
2686 CFLAGS-tst-dl_find_object-mod4.c += -funwind-tables
2687 CFLAGS-tst-dl_find_object-mod5.c += -funwind-tables
2688 CFLAGS-tst-dl_find_object-mod6.c += -funwind-tables
2689 CFLAGS-tst-dl_find_object-mod7.c += -funwind-tables
2690 CFLAGS-tst-dl_find_object-mod8.c += -funwind-tables
2691 CFLAGS-tst-dl_find_object-mod9.c += -funwind-tables
2693 $(objpfx)tst-p_alignmod-base.so: $(libsupport)
2694 LDFLAGS-tst-p_alignmod-base.so += -Wl,-z,max-page-size=0x200000
2696 $(objpfx)tst-p_align1: $(objpfx)tst-p_alignmod1.so
2698 # Make a copy of tst-p_alignmod-base.so and lower p_align of the first
2699 # PT_LOAD segment.
2700 $(objpfx)tst-p_alignmod1.so: $(objpfx)tst-p_alignmod-base.so
2701 rm -f $@
2702 cp $(objpfx)tst-p_alignmod-base.so $@
2703 $(PYTHON) $(..)scripts/tst-elf-edit.py -a half $@
2705 $(objpfx)tst-p_align2: $(objpfx)tst-p_alignmod2.so
2707 # Make a copy of tst-p_alignmod-base.so and update p_align of the first
2708 # PT_LOAD segment.
2709 $(objpfx)tst-p_alignmod2.so: $(objpfx)tst-p_alignmod-base.so
2710 rm -f $@
2711 cp $(objpfx)tst-p_alignmod-base.so $@
2712 $(PYTHON) $(..)scripts/tst-elf-edit.py -a 1 $@
2714 LDFLAGS-tst-p_alignmod3.so += -Wl,-z,max-page-size=0x100,-z,common-page-size=0x100
2716 $(objpfx)tst-p_align3: $(objpfx)tst-p_alignmod3.so
2717 $(objpfx)tst-p_align3.out: tst-p_align3.sh $(objpfx)tst-p_align3
2718 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \
2719 $(evaluate-test)