libio: Remove the usage of __libc_IO_vtables
[glibc.git] / elf / Makefile
blobbe6f2ca068976ffea8f3ca49cb710a0b0e41cd83
1 # Copyright (C) 1995-2023 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-early_allocate \
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-call_fini \
56 dl-catch \
57 dl-close \
58 dl-debug \
59 dl-debug-symbols \
60 dl-deps \
61 dl-exception \
62 dl-execstack \
63 dl-find_object \
64 dl-fini \
65 dl-init \
66 dl-load \
67 dl-lookup \
68 dl-lookup-direct \
69 dl-minimal-malloc \
70 dl-misc \
71 dl-object \
72 dl-open \
73 dl-origin \
74 dl-printf \
75 dl-profile \
76 dl-reloc \
77 dl-runtime \
78 dl-scope \
79 dl-setup_hash \
80 dl-sort-maps \
81 dl-thread_gscope_wait \
82 dl-tls \
83 dl-tls_init_tp \
84 dl-trampoline \
85 dl-version \
86 dl-write \
87 # dl-routines
89 ifeq (yes,$(use-ldconfig))
90 dl-routines += dl-cache
91 endif
93 ifneq (no,$(have-tunables))
94 dl-routines += dl-tunables
95 tunables-type = $(addprefix TUNABLES_FRONTEND_,$(have-tunables))
96 CPPFLAGS-dl-tunables.c += -DTUNABLES_FRONTEND=$(tunables-type)
98 ifeq (yesyes,$(build-shared)$(run-built-tests))
99 tests-special += $(objpfx)list-tunables.out
100 endif
102 # Make sure that the compiler does not insert any library calls in tunables
103 # code paths.
104 ifeq (yes,$(have-loop-to-function))
105 CFLAGS-dl-tunables.c += -fno-tree-loop-distribute-patterns
106 endif
107 endif
109 all-dl-routines = $(dl-routines) $(sysdep-dl-routines)
110 # But they are absent from the shared libc, because that code is in ld.so.
111 elide-routines.os = \
112 $(all-dl-routines) \
113 dl-early_allocate \
114 dl-exception \
115 dl-origin \
116 dl-reloc-static-pie \
117 dl-support \
118 dl-sysdep \
119 enbl-secure \
120 rtld_static_init \
121 thread_gscope_wait \
122 # elide-routines.os
124 # These object files are only included in the dynamically-linked libc.
125 shared-only-routines = libc-dl_find_object
127 # ld.so uses those routines, plus some special stuff for being the program
128 # interpreter and operating independent of libc.
129 rtld-routines = \
130 $(all-dl-routines) \
131 dl-audit \
132 dl-compat \
133 dl-diagnostics \
134 dl-diagnostics-cpu \
135 dl-diagnostics-kernel \
136 dl-environ \
137 dl-hwcaps \
138 dl-hwcaps-subdirs \
139 dl-hwcaps_split \
140 dl-libc_freeres \
141 dl-minimal \
142 dl-mutex \
143 dl-sysdep \
144 dl-usage \
145 rtld \
146 # rtld-routines
148 all-rtld-routines = $(rtld-routines) $(sysdep-rtld-routines)
150 CFLAGS-dl-runtime.c += -fexceptions -fasynchronous-unwind-tables
151 CFLAGS-dl-lookup.c += -fexceptions -fasynchronous-unwind-tables
152 CFLAGS-dl-iteratephdr.c += $(uses-callbacks)
154 # Called during static library initialization, so turn stack-protection
155 # off for non-shared builds.
156 CFLAGS-dl-minimal-malloc.o = $(no-stack-protector)
157 CFLAGS-dl-minimal-malloc.op = $(no-stack-protector)
159 # On targets without __builtin_memset, rtld.c uses a hand-coded loop
160 # in _dl_start. Make sure this isn't turned into a call to regular memset.
161 ifeq (yes,$(have-loop-to-function))
162 CFLAGS-rtld.c += -fno-tree-loop-distribute-patterns
163 endif
165 # Compile rtld itself without stack protection.
166 # Also compile all routines in the static library that are elided from
167 # the shared libc because they are in libc.a in the same way.
169 CFLAGS-.o += $(call elide-stack-protector,.o,$(elide-routines.os))
170 CFLAGS-.op += $(call elide-stack-protector,.op,$(elide-routines.os))
171 CFLAGS-.os += $(call elide-stack-protector,.os,$(all-rtld-routines))
173 # Add the requested compiler flags to the early startup code.
174 CFLAGS-dl-printf.os += $(rtld-early-cflags)
175 CFLAGS-dl-setup_hash.os += $(rtld-early-cflags)
176 CFLAGS-dl-sysdep.os += $(rtld-early-cflags)
177 CFLAGS-dl-tunables.os += $(rtld-early-cflags)
178 CFLAGS-dl-write.os += $(rtld-early-cflags)
179 CFLAGS-dl-writev.os += $(rtld-early-cflags)
180 CFLAGS-rtld.os += $(rtld-early-cflags)
182 ifeq ($(unwind-find-fde),yes)
183 routines += unwind-dw2-fde-glibc
184 shared-only-routines += unwind-dw2-fde-glibc
185 endif
187 before-compile += $(objpfx)trusted-dirs.h
188 generated += trusted-dirs.h trusted-dirs.st for-renamed/renamed.so
189 generated-dirs += for-renamed
191 ifeq ($(build-shared),yes)
192 ld-map = $(common-objpfx)ld.map
193 endif
195 ifeq (yes,$(build-shared))
196 extra-objs = \
197 $(all-rtld-routines:%=%.os) \
198 sofini.os \
199 interp.os \
200 # extra-objs
201 generated += \
202 dl-allobjs.os \
203 ld.so ldd \
204 librtld.os \
205 # generated
206 install-others = $(inst_rtlddir)/$(rtld-installed-name) $(inst_bindir)/ld.so
207 install-bin-script = ldd
208 endif
210 others = sprof sln
211 install-bin = sprof
212 others-static = sln
213 install-rootsbin = sln
214 sln-modules := static-stubs
215 extra-objs += $(sln-modules:=.o)
217 ifeq (yes,$(use-ldconfig))
218 ifeq (yes,$(build-shared))
219 others-static += ldconfig
220 others += ldconfig
221 install-rootsbin += ldconfig
223 ldconfig-modules := \
224 cache \
225 chroot_canon \
226 readlib \
227 static-stubs \
228 stringtable \
229 xmalloc \
230 xstrdup \
231 # ldconfig-modules
232 extra-objs += $(ldconfig-modules:=.o)
233 others-extras = $(ldconfig-modules)
234 endif
235 endif
237 # To find xmalloc.c and xstrdup.c
238 vpath %.c ../locale/programs
240 ifeq ($(build-shared),yes)
241 extra-objs += sotruss-lib.os sotruss-lib.so
242 install-others += $(inst_auditdir)/sotruss-lib.so
243 install-bin-script += sotruss
244 generated += sotruss
245 libof-sotruss-lib = extramodules
246 LDFLAGS-sotruss-lib.so += $(z-now-$(bind-now))
247 $(objpfx)sotruss-lib.so: $(objpfx)sotruss-lib.os
248 $(build-module-asneeded)
249 $(objpfx)sotruss-lib.so: $(common-objpfx)libc.so $(objpfx)ld.so \
250 $(common-objpfx)libc_nonshared.a
252 $(objpfx)sotruss: sotruss.sh $(common-objpfx)config.make
253 sed -e 's%@VERSION@%$(version)%g' \
254 -e 's%@TEXTDOMAINDIR@%$(localedir)%g' \
255 -e 's%@PREFIX@%$(prefix)%g' \
256 -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
257 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' \
258 < $< > $@.new
259 chmod 555 $@.new
260 mv -f $@.new $@
261 $(inst_auditdir)/sotruss-lib.so: $(objpfx)sotruss-lib.so $(+force)
262 $(do-install-program)
263 endif
265 tests-static-normal := \
266 tst-array1-static \
267 tst-array5-static \
268 tst-dl-iter-static \
269 tst-dst-static \
270 tst-env-setuid \
271 tst-env-setuid-tunables \
272 tst-getauxval-static \
273 tst-linkall-static \
274 tst-single_threaded-pthread-static \
275 tst-single_threaded-static \
276 tst-tls-allocation-failure-static \
277 tst-tlsalign-extern-static \
278 tst-tlsalign-static \
279 # tests-static-normal
281 tests-static-internal := \
282 tst-dl_find_object-static \
283 tst-ptrguard1-static \
284 tst-stackguard1-static \
285 tst-tls1-static \
286 tst-tls1-static-non-pie \
287 # tests-static-internal
289 CRT-tst-tls1-static-non-pie := $(csu-objpfx)crt1.o
290 tst-tls1-static-non-pie-no-pie = yes
292 tests-container := \
293 tst-ldconfig-bad-aux-cache \
294 tst-ldconfig-ld_so_conf-update \
295 # tests-container
297 ifeq (no,$(build-hardcoded-path-in-tests))
298 # This is an ld.so.cache test, and RPATH/RUNPATH in the executable
299 # interferes with its test objectives.
300 tests-container += tst-glibc-hwcaps-prepend-cache
301 endif
303 tests := \
304 tst-array1 \
305 tst-array2 \
306 tst-array3 \
307 tst-array4 \
308 tst-array5 \
309 tst-auxv \
310 tst-dl-hash \
311 tst-leaks1 \
312 tst-stringtable \
313 tst-tls9 \
314 # tests
316 tests-internal := \
317 $(tests-static-internal) \
318 tst-tls1 \
319 # tests-internal
321 tests-static := $(tests-static-normal) $(tests-static-internal)
323 ifeq (yes,$(build-shared))
324 tests-static += \
325 tst-single_threaded-static-dlopen \
326 tst-tls9-static \
327 # tests-static
329 static-dlopen-environment = \
330 LD_LIBRARY_PATH=$(ld-library-path):$(common-objpfx)dlfcn
331 tst-tls9-static-ENV = $(static-dlopen-environment)
332 tst-single_threaded-static-dlopen-ENV = $(static-dlopen-environment)
334 tests += \
335 argv0test \
336 constload1 \
337 dblload \
338 dblunload \
339 filter \
340 global \
341 initfirst \
342 lateglobal \
343 loadfail \
344 multiload \
345 next \
346 nodelete \
347 nodelete2 \
348 nodlopen \
349 nodlopen2 \
350 noload \
351 order \
352 order2 \
353 origtest \
354 preloadtest \
355 reldep \
356 reldep2 \
357 reldep3 \
358 reldep4 \
359 reldep5 \
360 reldep6 \
361 reldep7 \
362 reldep8 \
363 resolvfail \
364 restest1 \
365 restest2 \
366 tst-absolute-sym \
367 tst-absolute-zero \
368 tst-addr1 \
369 tst-align \
370 tst-align2 \
371 tst-align3 \
372 tst-audit-tlsdesc \
373 tst-audit-tlsdesc-dlopen \
374 tst-audit1 \
375 tst-audit2 \
376 tst-audit8 \
377 tst-audit9 \
378 tst-audit11 \
379 tst-audit12 \
380 tst-audit13 \
381 tst-audit17 \
382 tst-audit18 \
383 tst-audit19b \
384 tst-audit20 \
385 tst-audit21 \
386 tst-audit22 \
387 tst-audit23 \
388 tst-audit24a \
389 tst-audit24b \
390 tst-audit24c \
391 tst-audit24d \
392 tst-audit25a \
393 tst-audit25b \
394 tst-audit28 \
395 tst-auditmany \
396 tst-auxobj \
397 tst-auxobj-dlopen \
398 tst-big-note \
399 tst-debug1 \
400 tst-deep1 \
401 tst-dl-is_dso \
402 tst-dlmodcount \
403 tst-dlmopen1 \
404 tst-dlmopen3 \
405 tst-dlmopen4 \
406 tst-dlmopen-dlerror \
407 tst-dlmopen-gethostbyname \
408 tst-dlmopen-twice \
409 tst-dlopenfail \
410 tst-dlopenfail-2 \
411 tst-dlopenrpath \
412 tst-dlopen-self \
413 tst-dlopen-tlsmodid \
414 tst-dlsym-error \
415 tst-filterobj \
416 tst-filterobj-dlopen \
417 tst-glibc-hwcaps \
418 tst-glibc-hwcaps-mask \
419 tst-glibc-hwcaps-prepend \
420 tst-global1 \
421 tst-global2 \
422 tst-initfinilazyfail \
423 tst-initorder \
424 tst-initorder2 \
425 tst-latepthread \
426 tst-main1 \
427 tst-next-ver \
428 tst-nodelete2 \
429 tst-nodelete-dlclose \
430 tst-nodelete-opened \
431 tst-noload \
432 tst-null-argv \
433 tst-p_align1 \
434 tst-p_align2 \
435 tst-p_align3 \
436 tst-relsort1 \
437 tst-ro-dynamic \
438 tst-rtld-run-static \
439 tst-single_threaded \
440 tst-single_threaded-pthread \
441 tst-sonamemove-dlopen \
442 tst-sonamemove-link \
443 tst-thrlock \
444 tst-tls10 \
445 tst-tls11 \
446 tst-tls12 \
447 tst-tls13 \
448 tst-tls14 \
449 tst-tls15 \
450 tst-tls16 \
451 tst-tls17 \
452 tst-tls18 \
453 tst-tls19 \
454 tst-tls20 \
455 tst-tls21 \
456 tst-tls4 \
457 tst-tls5 \
458 tst-tlsalign \
459 tst-tlsalign-extern \
460 tst-tls-dlinfo \
461 tst-tls-ie \
462 tst-tls-ie-dlmopen \
463 tst-tls-manydynamic \
464 tst-unique1 \
465 tst-unique2 \
466 tst-unwind-ctor \
467 tst-unwind-main \
468 unload3 \
469 unload4 \
470 unload5 \
471 unload6 \
472 unload7 \
473 unload8 \
474 valgrind-test \
475 # tests
476 tests-cxx = \
477 tst-dlopen-nodelete-reloc \
478 tst-nodelete \
479 tst-unique3 \
480 tst-unique4 \
481 # tests-cxx
483 tests += $(if $(CXX),$(tests-cxx))
485 tests-internal += \
486 circleload1 \
487 loadtest \
488 neededtest \
489 neededtest2 \
490 neededtest3 \
491 neededtest4 \
492 tst-audit19a \
493 tst-create_format1 \
494 tst-dl-hwcaps_split \
495 tst-dl_find_object \
496 tst-dl_find_object-threads \
497 tst-dlmopen2 \
498 tst-ptrguard1 \
499 tst-stackguard1 \
500 tst-tls-surplus \
501 tst-tls3 \
502 tst-tls6 \
503 tst-tls7 \
504 tst-tls8 \
505 unload \
506 unload2 \
507 # tests-internal
509 tests-container += \
510 tst-dlopen-self-container \
511 tst-dlopen-tlsmodid-container \
512 tst-pldd \
513 tst-preload-pthread-libc \
514 # tests-container
516 test-srcs = \
517 tst-pathopt \
518 # tests-srcs
520 ifeq (yes,$(have-fpie))
521 tests-pie += tst-align3
522 endif
523 selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
525 ifneq ($(selinux-enabled),1)
526 tests-execstack-yes = \
527 tst-execstack \
528 tst-execstack-needed \
529 tst-execstack-prog \
530 # tests-execstack-yes
531 endif
532 ifeq ($(have-depaudit),yes)
533 tests += \
534 tst-audit14 \
535 tst-audit14a \
536 tst-audit15 \
537 tst-audit16 \
538 # tests
539 ifeq ($(run-built-tests),yes)
540 tests-special += \
541 $(objpfx)tst-audit14-cmp.out \
542 $(objpfx)tst-audit14a-cmp.out \
543 $(objpfx)tst-audit15-cmp.out \
544 $(objpfx)tst-audit16-cmp.out \
545 # tests-special
546 endif
547 endif
548 ifeq ($(have-dt-relr),yes)
549 tests += \
550 tst-relr \
551 tst-relr2 \
552 tst-relr3 \
553 tst-relr4 \
554 # tests
555 modules-names-dt-relr = \
556 tst-relr-mod2 \
557 tst-relr-mod3a \
558 tst-relr-mod3b \
559 tst-relr-mod4a \
560 tst-relr-mod4b \
561 # modules-names-dt-relr
562 modules-names += $(modules-names-dt-relr)
563 # These shared libraries have special build rules.
564 modules-names-nobuild += $(modules-names-dt-relr)
565 ifeq ($(have-fpie),yes)
566 tests += \
567 tst-relr-pie \
568 # tests
569 tests-pie += \
570 tst-relr-pie \
571 # tests-pie
572 tests-special += \
573 $(objpfx)check-tst-relr-pie.out \
574 # tests-special
575 endif
576 CFLAGS-tst-relr-pie.c += $(pie-ccflag)
577 LDFLAGS-tst-relr += -Wl,-z,pack-relative-relocs
578 LDFLAGS-tst-relr-pie += -Wl,-z,pack-relative-relocs
579 CFLAGS-tst-relr-mod2.c += $(no-stack-protector)
580 CFLAGS-tst-relr-mod3a.c += $(no-stack-protector)
581 CFLAGS-tst-relr-mod3b.c += $(no-stack-protector)
582 CFLAGS-tst-relr-mod4a.c += $(no-stack-protector)
583 CFLAGS-tst-relr-mod4b.c += $(no-stack-protector)
584 endif
585 endif
587 tests-special += $(objpfx)tst-relro-ldso.out $(objpfx)tst-relro-libc.out
588 $(objpfx)tst-relro-ldso.out: tst-relro-symbols.py $(..)/scripts/glibcelf.py \
589 $(objpfx)ld.so
590 $(PYTHON) tst-relro-symbols.py $(objpfx)ld.so \
591 --required=_rtld_global_ro \
592 > $@ 2>&1; $(evaluate-test)
593 # The optional symbols are present in libc only if the architecture has
594 # the GLIBC_2.0 symbol set in libc.
595 $(objpfx)tst-relro-libc.out: tst-relro-symbols.py $(..)/scripts/glibcelf.py \
596 $(common-objpfx)libc.so
597 $(PYTHON) tst-relro-symbols.py $(common-objpfx)libc.so \
598 --required=_IO_file_jumps \
599 --required=_IO_wfile_jumps \
600 --required=__io_vtables \
601 > $@ 2>&1; $(evaluate-test)
603 ifeq ($(run-built-tests),yes)
604 tests-special += $(objpfx)tst-valgrind-smoke.out
605 endif
606 $(objpfx)tst-valgrind-smoke.out: tst-valgrind-smoke.sh $(objpfx)ld.so $(objpfx)valgrind-test
607 $(SHELL) $< $(objpfx)ld.so $(rtlddir)/$(rtld-installed-name) '$(test-wrapper-env)' \
608 '$(run-program-env)' '$(rpath-link)' $(objpfx)valgrind-test > $@; $(evaluate-test)
610 tests += $(tests-execstack-$(have-z-execstack))
611 ifeq ($(run-built-tests),yes)
612 tests-special += \
613 $(objpfx)noload-mem.out \
614 $(objpfx)tst-ldconfig-X.out \
615 $(objpfx)tst-ldconfig-p.out \
616 $(objpfx)tst-ldconfig-soname.out \
617 $(objpfx)tst-leaks1-mem.out \
618 $(objpfx)tst-rtld-help.out \
619 # tests-special
620 endif
621 tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
622 tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
623 tlsmod17a-modules = $(addprefix tst-tlsmod17a, $(tlsmod17a-suffixes))
624 tlsmod18a-modules = $(addprefix tst-tlsmod18a, $(tlsmod17a-suffixes))
625 one-hundred = $(foreach x,0 1 2 3 4 5 6 7 8 9, \
626 0$x 1$x 2$x 3$x 4$x 5$x 6$x 7$x 8$x 9$x)
627 tst-tls-many-dynamic-modules := \
628 $(foreach n,$(one-hundred),tst-tls-manydynamic$(n)mod)
629 tst-tls-many-dynamic-modules-dep-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 \
630 14 15 16 17 18 19
631 tst-tls-many-dynamic-modules-dep = \
632 $(foreach n,$(tst-tls-many-dynamic-modules-dep-suffixes),tst-tls-manydynamic$(n)mod-dep)
633 tst-tls-many-dynamic-modules-dep-bad-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
634 tst-tls-many-dynamic-modules-dep-bad = \
635 $(foreach n,$(tst-tls-many-dynamic-modules-dep-bad-suffixes),tst-tls-manydynamic$(n)mod-dep-bad)
636 extra-test-objs += \
637 $(tlsmod17a-modules:=.os) \
638 $(tlsmod18a-modules:=.os) \
639 tst-tlsalign-vars.o \
640 # extra-test-objs
641 test-extras += \
642 tst-tlsalign-vars \
643 tst-tlsmod17a \
644 tst-tlsmod18a \
645 # test-extras
646 modules-names += \
647 circlemod1 \
648 circlemod1a \
649 circlemod2 \
650 circlemod2a \
651 circlemod3 \
652 circlemod3a \
653 constload2 \
654 constload3 \
655 dblloadmod1 \
656 dblloadmod2 \
657 dblloadmod3 \
658 dep1 \
659 dep2 \
660 dep3 \
661 dep4 \
662 failobj \
663 filtmod1 \
664 filtmod2 \
665 firstobj \
666 globalmod1 \
667 libmarkermod1-1 \
668 libmarkermod1-2 \
669 libmarkermod1-3 \
670 libmarkermod2-1 \
671 libmarkermod2-2 \
672 libmarkermod3-1 \
673 libmarkermod3-2 \
674 libmarkermod3-3 \
675 libmarkermod4-1 \
676 libmarkermod4-2 \
677 libmarkermod4-3 \
678 libmarkermod4-4 \
679 libmarkermod5-1 \
680 libmarkermod5-2 \
681 libmarkermod5-3 \
682 libmarkermod5-4 \
683 libmarkermod5-5 \
684 libtracemod1-1 \
685 libtracemod2-1 \
686 libtracemod3-1 \
687 libtracemod4-1 \
688 libtracemod5-1 \
689 ltglobmod1 \
690 ltglobmod2 \
691 neededobj1 \
692 neededobj2 \
693 neededobj3 \
694 neededobj4 \
695 neededobj5 \
696 neededobj6 \
697 nextmod1 \
698 nextmod2 \
699 nextmod3 \
700 nodel2mod1 \
701 nodel2mod2 \
702 nodel2mod3 \
703 nodelmod1 \
704 nodelmod2 \
705 nodelmod3 \
706 nodelmod4 \
707 nodlopenmod \
708 nodlopenmod2 \
709 order2mod1 \
710 order2mod2 \
711 order2mod3 \
712 order2mod4 \
713 pathoptobj \
714 reldep4mod1 \
715 reldep4mod2 \
716 reldep4mod3 \
717 reldep4mod4 \
718 reldep6mod0 \
719 reldep6mod1 \
720 reldep6mod2 \
721 reldep6mod3 \
722 reldep6mod4 \
723 reldep7mod1 \
724 reldep7mod2 \
725 reldep8mod1 \
726 reldep8mod2 \
727 reldep8mod3 \
728 reldep9mod1 \
729 reldep9mod2 \
730 reldep9mod3 \
731 reldepmod1 \
732 reldepmod2 \
733 reldepmod3 \
734 reldepmod4 \
735 reldepmod5 \
736 reldepmod6 \
737 testobj1 \
738 testobj1_1 \
739 testobj2 \
740 testobj3 \
741 testobj4 \
742 testobj5 \
743 testobj6 \
744 tst-absolute-sym-lib \
745 tst-absolute-zero-lib \
746 tst-alignmod \
747 tst-alignmod2 \
748 tst-alignmod3 \
749 tst-array2dep \
750 tst-array5dep \
751 tst-audit-tlsdesc-mod1 \
752 tst-audit-tlsdesc-mod2 \
753 tst-audit11mod1 \
754 tst-audit11mod2 \
755 tst-audit12mod1 \
756 tst-audit12mod2 \
757 tst-audit12mod3 \
758 tst-audit13mod1 \
759 tst-audit18mod \
760 tst-audit19bmod \
761 tst-audit23mod \
762 tst-audit24amod1 \
763 tst-audit24amod2 \
764 tst-audit24bmod1 \
765 tst-audit24bmod2 \
766 tst-audit24dmod1 \
767 tst-audit24dmod2 \
768 tst-audit24dmod3 \
769 tst-audit24dmod4 \
770 tst-audit25mod1 \
771 tst-audit25mod2 \
772 tst-audit25mod3 \
773 tst-audit25mod4 \
774 tst-auditlogmod-1 \
775 tst-auditlogmod-2 \
776 tst-auditlogmod-3 \
777 tst-auditmanymod1 \
778 tst-auditmanymod2 \
779 tst-auditmanymod3 \
780 tst-auditmanymod4 \
781 tst-auditmanymod5 \
782 tst-auditmanymod6 \
783 tst-auditmanymod7 \
784 tst-auditmanymod8 \
785 tst-auditmanymod9 \
786 tst-auditmod-tlsdesc \
787 tst-auditmod1 \
788 tst-auditmod9a \
789 tst-auditmod9b \
790 tst-auditmod11 \
791 tst-auditmod12 \
792 tst-auditmod18 \
793 tst-auditmod19a \
794 tst-auditmod19b \
795 tst-auditmod20 \
796 tst-auditmod21a \
797 tst-auditmod21b \
798 tst-auditmod22 \
799 tst-auditmod23 \
800 tst-auditmod24a \
801 tst-auditmod24b \
802 tst-auditmod24c \
803 tst-auditmod24d \
804 tst-auditmod25 \
805 tst-auditmod28 \
806 tst-auxvalmod \
807 tst-big-note-lib \
808 tst-deep1mod1 \
809 tst-deep1mod2 \
810 tst-deep1mod3 \
811 tst-dl_find_object-mod1 \
812 tst-dl_find_object-mod2 \
813 tst-dl_find_object-mod3 \
814 tst-dl_find_object-mod4 \
815 tst-dl_find_object-mod5 \
816 tst-dl_find_object-mod6 \
817 tst-dl_find_object-mod7 \
818 tst-dl_find_object-mod8 \
819 tst-dl_find_object-mod9 \
820 tst-dlmopen1mod \
821 tst-dlmopen-dlerror-mod \
822 tst-dlmopen-gethostbyname-mod \
823 tst-dlmopen-twice-mod1 \
824 tst-dlmopen-twice-mod2 \
825 tst-dlopenfaillinkmod \
826 tst-dlopenfailmod1 \
827 tst-dlopenfailmod2 \
828 tst-dlopenfailmod3 \
829 tst-dlopenfailnodelmod \
830 tst-dlopenrpathmod \
831 tst-filterobj-aux \
832 tst-filterobj-filtee \
833 tst-filterobj-flt \
834 tst-finilazyfailmod \
835 tst-globalmod2 \
836 tst-initlazyfailmod \
837 tst-initorder2a \
838 tst-initorder2b \
839 tst-initorder2c \
840 tst-initorder2d \
841 tst-initordera1 \
842 tst-initordera2 \
843 tst-initordera3 \
844 tst-initordera4 \
845 tst-initorderb1 \
846 tst-initorderb2 \
847 tst-latepthreadmod \
848 tst-ldconfig-ld-mod \
849 tst-ldconfig-soname-lib-with-soname \
850 tst-ldconfig-soname-lib-without-soname \
851 tst-main1mod \
852 tst-nodelete2mod \
853 tst-nodelete-dlclose-dso \
854 tst-nodelete-dlclose-plugin \
855 tst-nodelete-opened-lib \
856 tst-null-argv-lib \
857 tst-p_alignmod-base \
858 tst-p_alignmod3 \
859 tst-relsort1mod1 \
860 tst-relsort1mod2 \
861 tst-ro-dynamic-mod \
862 tst-single_threaded-mod1 \
863 tst-single_threaded-mod2 \
864 tst-single_threaded-mod3 \
865 tst-single_threaded-mod4 \
866 tst-sonamemove-linkmod1 \
867 tst-sonamemove-runmod1 \
868 tst-sonamemove-runmod2 \
869 tst-tls19mod1 \
870 tst-tls19mod2 \
871 tst-tls19mod3 \
872 tst-tls20mod-bad \
873 tst-tls21mod \
874 tst-tlsalign-lib \
875 tst-tls-ie-mod0 \
876 tst-tls-ie-mod1 \
877 tst-tls-ie-mod2 \
878 tst-tls-ie-mod3 \
879 tst-tls-ie-mod4 \
880 tst-tls-ie-mod5 \
881 tst-tls-ie-mod6 \
882 tst-tlsmod1 \
883 tst-tlsmod10 \
884 tst-tlsmod11 \
885 tst-tlsmod12 \
886 tst-tlsmod13 \
887 tst-tlsmod13a \
888 tst-tlsmod14a \
889 tst-tlsmod14b \
890 tst-tlsmod15a \
891 tst-tlsmod15b \
892 tst-tlsmod16a \
893 tst-tlsmod16b \
894 tst-tlsmod17b \
895 tst-tlsmod2 \
896 tst-tlsmod3 \
897 tst-tlsmod4 \
898 tst-tlsmod5 \
899 tst-tlsmod6 \
900 tst-tlsmod7 \
901 tst-tlsmod8 \
902 tst-tlsmod9 \
903 tst-unique1mod1 \
904 tst-unique1mod2 \
905 tst-unique2mod1 \
906 tst-unique2mod2 \
907 tst-unwind-ctor-lib \
908 unload2dep \
909 unload2mod \
910 unload3mod1 \
911 unload3mod2 \
912 unload3mod3 \
913 unload3mod4 \
914 unload4mod1 \
915 unload4mod2 \
916 unload4mod3 \
917 unload4mod4 \
918 unload6mod1 \
919 unload6mod2 \
920 unload6mod3 \
921 unload7mod1 \
922 unload7mod2 \
923 unload8mod1 \
924 unload8mod1x \
925 unload8mod2 \
926 unload8mod3 \
927 unloadmod \
928 vismod1 \
929 vismod2 \
930 vismod3 \
931 # modules-names
933 modules-names-cxx = \
934 tst-dlopen-nodelete-reloc-mod1 \
935 tst-dlopen-nodelete-reloc-mod10 \
936 tst-dlopen-nodelete-reloc-mod11 \
937 tst-dlopen-nodelete-reloc-mod12 \
938 tst-dlopen-nodelete-reloc-mod13 \
939 tst-dlopen-nodelete-reloc-mod14 \
940 tst-dlopen-nodelete-reloc-mod15 \
941 tst-dlopen-nodelete-reloc-mod16 \
942 tst-dlopen-nodelete-reloc-mod17 \
943 tst-dlopen-nodelete-reloc-mod2 \
944 tst-dlopen-nodelete-reloc-mod3 \
945 tst-dlopen-nodelete-reloc-mod4 \
946 tst-dlopen-nodelete-reloc-mod5 \
947 tst-dlopen-nodelete-reloc-mod6 \
948 tst-dlopen-nodelete-reloc-mod7 \
949 tst-dlopen-nodelete-reloc-mod8 \
950 tst-dlopen-nodelete-reloc-mod9 \
951 tst-nodelete-rtldmod \
952 tst-nodelete-uniquemod \
953 tst-nodelete-zmod \
954 tst-unique3lib \
955 tst-unique3lib2 \
956 tst-unique4lib \
957 # modules-names-cxx
959 modules-names += \
960 $(if $(CXX),$(modules-names-cxx)) \
961 $(modules-execstack-$(have-z-execstack)) \
962 $(tlsmod17a-modules) \
963 $(tlsmod18a-modules) \
964 $(tst-tls-many-dynamic-modules) \
965 $(tst-tls-many-dynamic-modules-dep) \
966 $(tst-tls-many-dynamic-modules-dep-bad) \
967 # modules-names
969 # Most modules build with _ISOMAC defined, but those filtered out
970 # depend on internal headers.
971 modules-names-tests = $(filter-out ifuncmod% tst-tlsmod%,\
972 $(modules-names))
974 # For +depfiles in Makerules.
975 extra-test-objs += tst-auditmod17.os
977 ifeq (yes,$(have-mtls-dialect-gnu2))
978 tests += tst-gnu2-tls1
979 modules-names += tst-gnu2-tls1mod
980 $(objpfx)tst-gnu2-tls1: $(objpfx)tst-gnu2-tls1mod.so
981 tst-gnu2-tls1mod.so-no-z-defs = yes
982 CFLAGS-tst-gnu2-tls1mod.c += -mtls-dialect=gnu2
983 endif # $(have-mtls-dialect-gnu2)
985 ifeq (yes,$(have-protected-data))
986 modules-names += tst-protected1moda tst-protected1modb
987 tests += tst-protected1a tst-protected1b
988 $(objpfx)tst-protected1a: $(addprefix $(objpfx),tst-protected1moda.so tst-protected1modb.so)
989 $(objpfx)tst-protected1b: $(addprefix $(objpfx),tst-protected1modb.so tst-protected1moda.so)
990 tst-protected1modb.so-no-z-defs = yes
991 # These tests fail with GCC versions prior to 5.1 and with some versions
992 # of binutils. See https://sourceware.org/bugzilla/show_bug.cgi?id=17709
993 # and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248 for details.
994 # Perhaps in future we can make these XFAILs conditional on some detection
995 # of compiler/linker behavior/version.
996 test-xfail-tst-protected1a = yes
997 test-xfail-tst-protected1b = yes
998 endif
999 ifeq (yesyes,$(have-fpie)$(build-shared))
1000 modules-names += tst-piemod1
1001 tests += tst-pie1 tst-pie2 tst-dlopen-pie tst-dlopen-tlsmodid-pie \
1002 tst-dlopen-self-pie
1003 tests-pie += tst-pie1 tst-pie2 tst-dlopen-tlsmodid-pie tst-dlopen-self-pie
1004 ifeq (yes,$(have-protected-data))
1005 tests += vismain
1006 tests-pie += vismain
1007 CFLAGS-vismain.c += $(PIE-ccflag)
1008 endif
1009 endif
1010 modules-execstack-yes = tst-execstack-mod
1011 extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
1013 # filtmod1.so, tst-big-note-lib.so, tst-ro-dynamic-mod.so have special
1014 # rules.
1015 modules-names-nobuild += \
1016 filtmod1 \
1017 tst-audit24bmod1 \
1018 tst-audit24bmod2 \
1019 tst-big-note-lib \
1020 tst-ro-dynamic-mod \
1021 # modules-names-nobuild
1023 tests += $(tests-static)
1025 ifeq (yes,$(have-ifunc))
1026 tests-ifuncstatic := \
1027 ifuncmain1static \
1028 ifuncmain1picstatic \
1029 ifuncmain2static \
1030 ifuncmain2picstatic \
1031 ifuncmain4static \
1032 ifuncmain4picstatic \
1033 ifuncmain5static \
1034 ifuncmain5picstatic \
1035 ifuncmain7static \
1036 ifuncmain7picstatic \
1037 # tests-ifuncstatic
1038 ifeq (yes,$(have-gcc-ifunc))
1039 tests-ifuncstatic += ifuncmain9static ifuncmain9picstatic
1040 endif
1041 tests-static += $(tests-ifuncstatic)
1042 tests-internal += $(tests-ifuncstatic)
1043 ifeq (yes,$(build-shared))
1044 tests += \
1045 tst-ifunc-fault-bindnow \
1046 tst-ifunc-fault-lazy \
1047 # tests
1048 # Note: sysdeps/x86_64/ifuncmain8.c uses ifuncmain8.
1049 tests-internal += \
1050 ifuncmain1pic \
1051 ifuncmain1staticpic \
1052 ifuncmain1vis \
1053 ifuncmain1vispic \
1054 ifuncmain2 \
1055 ifuncmain2pic \
1056 ifuncmain3 \
1057 ifuncmain4 \
1058 ifuncmain5staticpic \
1059 ifuncmain7 \
1060 ifuncmain7pic \
1061 # tests-internal
1062 ifeq (no,$(with-lld))
1063 tests-internal += \
1064 ifuncmain1 \
1065 ifuncmain5 \
1066 ifuncmain5pic \
1067 # tests-internal
1068 endif
1069 ifeq (yes,$(have-gcc-ifunc))
1070 tests-internal += \
1071 ifuncmain9 \
1072 ifuncmain9pic \
1073 # tests-internal
1074 endif
1075 ifunc-test-modules = \
1076 ifuncdep1 \
1077 ifuncdep1pic \
1078 ifuncdep2 \
1079 ifuncdep2pic \
1080 ifuncdep5 \
1081 ifuncdep5pic \
1082 # ifunc-test-modules
1083 extra-test-objs += $(ifunc-test-modules:=.o)
1084 test-internal-extras += $(ifunc-test-modules)
1085 ifeq (yes,$(have-fpie))
1086 ifunc-pie-tests = \
1087 ifuncmain1pie \
1088 ifuncmain1staticpie \
1089 ifuncmain1vispie \
1090 ifuncmain6pie \
1091 ifuncmain7pie \
1092 # ifunc-pie-tests
1093 ifeq (yes,$(have-gcc-ifunc))
1094 ifunc-pie-tests += ifuncmain9pie
1095 endif
1096 ifeq (no,$(with-lld))
1097 ifunc-pie-tests += ifuncmain5pie
1098 endif
1099 ifeq (yes,$(have-textrel_ifunc))
1100 ifunc-pie-tests += tst-ifunc-textrel
1101 endif
1102 tests-internal += $(ifunc-pie-tests)
1103 tests-pie += $(ifunc-pie-tests)
1104 endif
1105 modules-names += \
1106 ifuncmod1 \
1107 ifuncmod3 \
1108 ifuncmod6 \
1109 # module-names
1110 ifeq (no,$(with-lld))
1111 modules-names += ifuncmod5
1112 endif
1113 endif
1114 endif
1116 ifeq (yes,$(build-shared))
1117 ifeq ($(run-built-tests),yes)
1118 tests-special += \
1119 $(objpfx)argv0test.out \
1120 $(objpfx)tst-pathopt.out \
1121 $(objpfx)tst-rtld-help.out \
1122 $(objpfx)tst-rtld-load-self.out \
1123 $(objpfx)tst-rtld-preload.out \
1124 # tests-special
1125 endif
1126 tests-special += \
1127 $(objpfx)check-execstack.out \
1128 $(objpfx)check-initfini.out \
1129 $(objpfx)check-localplt.out \
1130 $(objpfx)check-textrel.out \
1131 $(objpfx)check-wx-segment.out \
1132 # tests-special
1133 endif
1135 ifeq ($(run-built-tests),yes)
1136 tests-special += \
1137 $(objpfx)order-cmp.out \
1138 $(objpfx)order2-cmp.out \
1139 $(objpfx)tst-array1-cmp.out \
1140 $(objpfx)tst-array1-static-cmp.out \
1141 $(objpfx)tst-array2-cmp.out \
1142 $(objpfx)tst-array3-cmp.out \
1143 $(objpfx)tst-array4-cmp.out \
1144 $(objpfx)tst-array5-cmp.out \
1145 $(objpfx)tst-array5-static-cmp.out \
1146 $(objpfx)tst-initorder-cmp.out \
1147 $(objpfx)tst-initorder2-cmp.out \
1148 $(objpfx)tst-unused-dep-cmp.out \
1149 $(objpfx)tst-unused-dep.out \
1150 $(objpfx)tst-trace1.out \
1151 $(objpfx)tst-trace2.out \
1152 $(objpfx)tst-trace3.out \
1153 $(objpfx)tst-trace4.out \
1154 $(objpfx)tst-trace5.out \
1155 # tests-special
1156 endif
1158 ifndef avoid-generated
1159 # DSO sorting tests:
1160 # The dso-ordering-test.py script generates testcase source files in $(objpfx),
1161 # creating a $(objpfx)<testcase-name>-dir for each testcase, and creates a
1162 # Makefile fragment to be included.
1163 define include_dsosort_tests
1164 $(objpfx)$(1).generated-makefile: $(1)
1165 $(PYTHON) $(..)scripts/dso-ordering-test.py \
1166 --description-file $$< --objpfx $(objpfx) --output-makefile $$@T
1167 mv $$@T $$@
1168 -include $(objpfx)$(1).generated-makefile
1169 endef
1170 endif
1172 postclean-generated += $(objpfx)/dso-sort-tests-2.generated-makefile \
1173 $(objpfx)/dso-sort-tests-2.generated-makefile
1175 # Generate from each testcase description file
1176 ifeq (yes,$(have-tunables))
1177 $(eval $(call include_dsosort_tests,dso-sort-tests-1.def))
1178 $(eval $(call include_dsosort_tests,dso-sort-tests-2.def))
1180 # BZ15311 is intentionally underlinked.
1181 LDFLAGS-tst-bz15311-b.so += -Wl,-z,lazy
1182 LDFLAGS-tst-bz15311-c.so += -Wl,-z,lazy
1183 LDFLAGS-tst-bz15311-d.so += -Wl,-z,lazy
1184 endif
1186 check-abi: $(objpfx)check-abi-ld.out \
1187 $(objpfx)check-abi-version-libc.out
1188 tests-special += \
1189 $(objpfx)check-abi-ld.out \
1190 $(objpfx)check-abi-version-libc.out \
1191 # tests-special
1192 update-abi: update-abi-ld
1193 update-all-abi: update-all-abi-ld
1195 tests-special += $(objpfx)tst-glibcelf.out
1196 $(objpfx)tst-glibcelf.out: tst-glibcelf.py elf.h $(..)/scripts/glibcelf.py \
1197 $(..)/scripts/glibcextract.py
1198 PYTHONPATH=$(..)scripts $(PYTHON) tst-glibcelf.py \
1199 --cc="$(CC) $(patsubst -DMODULE_NAME=%,-DMODULE_NAME=testsuite,$(CPPFLAGS))" \
1200 < /dev/null > $@ 2>&1; $(evaluate-test)
1202 ifeq ($(run-built-tests),yes)
1203 tests-special += $(objpfx)tst-tls-allocation-failure-static-patched.out
1204 endif
1206 # The test requires shared _and_ PIE because the executable
1207 # unit test driver must be able to link with the shared object
1208 # that is going to eventually go into an installed DSO.
1209 ifeq (yesyes,$(have-fpie)$(build-shared))
1210 tests-internal += tst-_dl_addr_inside_object
1211 tests-pie += tst-_dl_addr_inside_object
1212 $(objpfx)tst-_dl_addr_inside_object: $(objpfx)dl-addr-obj.os
1213 CFLAGS-tst-_dl_addr_inside_object.c += $(PIE-ccflag)
1214 endif
1216 # We can only test static libcrypt use if libcrypt has been built,
1217 # and either NSS crypto is not in use, or static NSS libraries are
1218 # available.
1219 ifeq ($(build-crypt),no)
1220 CFLAGS-tst-linkall-static.c += -DUSE_CRYPT=0
1221 else
1222 ifeq ($(nss-crypt),no)
1223 CFLAGS-tst-linkall-static.c += -DUSE_CRYPT=1
1224 else
1225 ifeq ($(static-nss-crypt),no)
1226 CFLAGS-tst-linkall-static.c += -DUSE_CRYPT=0
1227 else
1228 CFLAGS-tst-linkall-static.c += -DUSE_CRYPT=1
1229 endif
1230 endif
1231 endif
1233 include ../Rules
1235 ifeq (yes,$(build-shared))
1236 # Make sure these things are built in the `make lib' pass so they can be used
1237 # to run programs during the `make others' pass.
1238 lib-noranlib: $(objpfx)$(rtld-installed-name) \
1239 $(addprefix $(objpfx),$(extra-objs))
1240 endif
1242 # Command to link into a larger single relocatable object.
1243 reloc-link = $(LINK.o) -nostdlib -nostartfiles -r
1245 $(objpfx)sotruss-lib.so: $(shlib-lds)
1247 $(objpfx)dl-allobjs.os: $(all-rtld-routines:%=$(objpfx)%.os)
1248 $(reloc-link) -o $@ $^
1250 # Link together the dynamic linker into a single relocatable object.
1251 # First we do a link against libc_pic.a just to get a link map,
1252 # and discard the object produced by that link. From the link map
1253 # we can glean all the libc modules that need to go into the dynamic
1254 # linker. Then we do a recursive make that goes into all the subdirs
1255 # those modules come from and builds special rtld-foo.os versions that
1256 # are compiled with special flags, and puts these modules into rtld-libc.a
1257 # for us. Then we do the real link using rtld-libc.a instead of libc_pic.a.
1259 # These symbols need to be stubbed out during symbol discovery because
1260 # their implementation is provided differently in rtld, and the symbol
1261 # discovery mechanism is not compatible with the libc implementation
1262 # when compiled for libc.
1263 rtld-stubbed-symbols = \
1264 __GI___pthread_disable_asynccancel \
1265 __GI___pthread_enable_asynccancel \
1266 __libc_assert_fail \
1267 __pthread_disable_asynccancel \
1268 __pthread_enable_asynccancel \
1269 calloc \
1270 free \
1271 malloc \
1272 realloc \
1273 # rtld-stubbed-symbols
1275 ifeq ($(have-ssp),yes)
1276 # rtld is not built with the stack protector, so these references will
1277 # go away in the rebuilds.
1278 rtld-stubbed-symbols += __stack_chk_fail __stack_chk_fail_local
1279 endif
1281 $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
1282 @-rm -f $@T
1283 for symbol in $(rtld-stubbed-symbols); do \
1284 echo ".globl $$symbol"; \
1285 echo "$$symbol:"; \
1286 done | $(CC) -o $@T.o $(ASFLAGS) -c -x assembler -
1287 $(reloc-link) -o $@.o $@T.o '-Wl,-(' $^ -lgcc '-Wl,-)' -Wl,-Map,$@T
1288 rm -f %@T.o $@.o
1289 mv -f $@T $@
1291 # For lld, skip preceding addresses and values before matching the archive and the member.
1292 $(objpfx)librtld.mk: $(objpfx)librtld.map Makefile
1293 LC_ALL=C \
1294 sed -n 's@^[0-9a-f ]*$(common-objpfx)\([^(]*\)(\([^)]*\.os\)) *.*$$@\1 \2@p' \
1295 $< | \
1296 while read lib file; do \
1297 case $$lib in \
1298 libc_pic.a) \
1299 LC_ALL=C grep -F -l /$$file \
1300 $(common-objpfx)stamp.os $(common-objpfx)*/stamp.os | \
1301 LC_ALL=C \
1302 sed 's@^$(common-objpfx)\([^/]*\)/stamp\.os$$@rtld-\1'" +=$$file@"\
1303 ;; \
1304 */*.a) \
1305 echo rtld-$${lib%%/*} += $$file ;; \
1306 *) echo "Wasn't expecting $$lib($$file)" >&2; exit 1 ;; \
1307 esac; \
1308 done > $@T
1309 echo rtld-subdirs = `LC_ALL=C sed 's/^rtld-\([^ ]*\).*$$/\1/' $@T \
1310 | LC_ALL=C sort -u` >> $@T
1311 mv -f $@T $@
1313 $(objpfx)rtld-libc.a: $(objpfx)librtld.mk FORCE
1314 $(MAKE) -f $< -f rtld-Rules
1316 $(objpfx)librtld.os: $(objpfx)dl-allobjs.os $(objpfx)rtld-libc.a
1317 $(LINK.o) -nostdlib -nostartfiles -r -o $@ '-Wl,-(' $^ -lgcc '-Wl,-)' \
1318 -Wl,-Map,$@.map
1320 generated += librtld.map librtld.mk rtld-libc.a librtld.os.map
1322 z-now-yes = -Wl,-z,now
1324 $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
1325 # Link into a temporary file so that we don't touch $@ at all
1326 # if the sanity check below fails.
1327 $(LINK.o) -nostdlib -nostartfiles -shared -o $@.new \
1328 $(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \
1329 $(dt-relr-ldflag) \
1330 $(filter-out $(map-file),$^) $(load-map-file) \
1331 -Wl,-soname=$(rtld-installed-name)
1332 $(call after-link,$@.new)
1333 $(READELF) -s $@.new \
1334 | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
1335 mv -f $@.new $@
1337 ifeq (yes,$(build-shared))
1338 # interp.c exists just to get the runtime linker path into libc.so.
1339 $(objpfx)interp.os: $(common-objpfx)runtime-linker.h
1340 endif
1342 ifneq (ld.so,$(rtld-installed-name))
1343 # Make sure ld.so.1 exists in the build directory so we can link
1344 # against it.
1345 $(objpfx)$(rtld-installed-name): $(objpfx)ld.so
1346 $(make-link)
1347 generated += $(rtld-installed-name)
1348 endif
1350 # Build a file mentioning all trustworthy directories to look for shared
1351 # libraries when using LD_LIBRARY_PATH in a setuid program. The user can
1352 # add directories to the list by defining $(user-defined-trusted-dirs)
1353 # before starting make.
1354 $(objpfx)trusted-dirs.h: $(objpfx)trusted-dirs.st; @:
1355 $(objpfx)trusted-dirs.st: Makefile $(..)Makeconfig
1356 $(make-target-directory)
1357 echo "$(subst :, ,$(default-rpath) $(user-defined-trusted-dirs))" \
1358 | $(AWK) -f gen-trusted-dirs.awk > ${@:st=T};
1359 echo '#define DL_DST_LIB "$(notdir $(slibdir))"' >> ${@:st=T}
1360 $(move-if-change) ${@:st=T} ${@:st=h}
1361 touch $@
1362 CPPFLAGS-dl-load.c += -I$(objpfx). -I$(csu-objpfx).
1364 ifeq (yes,$(build-shared))
1365 $(inst_rtlddir)/$(rtld-installed-name): $(objpfx)ld.so $(+force)
1366 $(make-target-directory)
1367 $(do-install-program)
1369 # Creates the relative /usr/bin/ld.so symbolic link.
1370 $(inst_bindir)/ld.so: $(inst_rtlddir)/$(rtld-installed-name)
1371 $(make-target-directory)
1372 $(make-link)
1374 # Special target called by parent to install just the dynamic linker.
1375 .PHONY: ldso_install
1376 ldso_install: $(inst_rtlddir)/$(rtld-installed-name)
1377 endif # $(build-shared)
1380 # Workarounds for ${exec_prefix} expansion in configure variables.
1381 # config.status cannot be used directly for processing ldd.bash.in or
1382 # expanding variables such as sysconfdir because the expansion
1383 # contains the literal string ${exec_prefix}, which is not valid in C
1384 # headers or installed shell scripts.
1386 ldd-rewrite = -e 's%@RTLD@%$(rtlddir)/$(rtld-installed-name)%g' \
1387 -e 's%@VERSION@%$(version)%g' \
1388 -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
1389 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' \
1390 -e 's%@TEXTDOMAINDIR@%$(localedir)%g'
1392 ifeq ($(ldd-rewrite-script),no)
1393 define gen-ldd
1394 LC_ALL=C sed $(ldd-rewrite) < $< > $@.new
1395 endef
1396 else
1397 define gen-ldd
1398 LC_ALL=C sed $(ldd-rewrite) < $< \
1399 | LC_ALL=C sed -f $(patsubst $(..)/%,/%,$(..)$(ldd-rewrite-script)) > $@.new
1400 endef
1401 endif
1403 $(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \
1404 $(common-objpfx)config.make
1405 $(gen-ldd)
1406 chmod 555 $@.new
1407 mv -f $@.new $@
1409 $(objpfx)sln: $(sln-modules:%=$(objpfx)%.o)
1411 $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
1413 SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
1414 CFLAGS-ldconfig.c += $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
1415 -D'SLIBDIR="$(slibdir)"'
1416 libof-ldconfig = ldconfig
1417 CFLAGS-dl-cache.c += $(SYSCONF-FLAGS)
1418 CFLAGS-cache.c += $(SYSCONF-FLAGS)
1419 CFLAGS-rtld.c += $(SYSCONF-FLAGS)
1420 CFLAGS-dl-usage.c += $(SYSCONF-FLAGS) \
1421 -D'RTLD="$(rtlddir)/$(rtld-installed-name)"'
1422 CFLAGS-dl-diagnostics.c += $(SYSCONF-FLAGS) \
1423 -D'PREFIX="$(prefix)"' \
1424 -D'RTLD="$(rtlddir)/$(rtld-installed-name)"'
1426 cpp-srcs-left := $(all-rtld-routines:=.os)
1427 lib := rtld
1428 include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
1430 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
1431 generated += $(addsuffix .so,$(strip $(modules-names)))
1433 $(objpfx)testobj1_1.so: $(objpfx)testobj1.so
1434 $(objpfx)testobj2.so: $(objpfx)testobj1.so
1435 $(objpfx)testobj6.so: $(objpfx)testobj1.so $(objpfx)testobj2.so
1436 $(objpfx)failobj.so: $(objpfx)testobj6.so
1437 $(objpfx)dep1.so: $(objpfx)dep2.so $(objpfx)dep4.so
1438 $(objpfx)dep2.so: $(objpfx)dep3.so $(objpfx)dep4.so
1439 $(objpfx)dep4.so: $(objpfx)dep3.so
1440 $(objpfx)nodelmod3.so: $(objpfx)nodelmod4.so
1441 $(objpfx)neededobj2.so: $(objpfx)neededobj1.so
1442 $(objpfx)neededobj3.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so
1443 $(objpfx)neededobj4.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
1444 $(objpfx)neededobj3.so
1445 $(objpfx)neededobj6.so: $(objpfx)neededobj5.so
1446 $(objpfx)unload2mod.so: $(objpfx)unload2dep.so
1447 $(objpfx)firstobj.so: $(shared-thread-library)
1448 $(objpfx)reldep4mod1.so: $(objpfx)reldep4mod3.so
1449 $(objpfx)reldep4mod2.so: $(objpfx)reldep4mod4.so
1450 $(objpfx)dblloadmod1.so: $(objpfx)dblloadmod3.so
1451 $(objpfx)dblloadmod2.so: $(objpfx)dblloadmod3.so
1452 $(objpfx)reldepmod5.so: $(objpfx)reldepmod2.so
1453 $(objpfx)reldepmod6.so: $(objpfx)reldepmod2.so
1454 $(objpfx)reldep6mod1.so: $(objpfx)reldep6mod0.so
1455 $(objpfx)reldep6mod2.so: $(objpfx)reldep6mod1.so
1456 $(objpfx)reldep6mod3.so: $(objpfx)reldep6mod2.so
1457 $(objpfx)reldep6mod4.so: $(objpfx)reldep6mod1.so
1458 $(objpfx)tst-tlsmod3.so: $(objpfx)tst-tlsmod2.so
1459 $(objpfx)tst-tlsmod8.so: $(objpfx)tst-tlsmod7.so
1460 $(objpfx)tst-tlsmod10.so: $(objpfx)tst-tlsmod9.so
1461 $(objpfx)tst-tlsmod12.so: $(objpfx)tst-tlsmod11.so
1462 $(objpfx)tst-tlsmod13a.so: $(objpfx)tst-tlsmod13.so
1463 # For tst-tls9-static, make sure the modules it dlopens have libc.so in DT_NEEDED
1464 $(objpfx)tst-tlsmod5.so: $(common-objpfx)libc.so
1465 $(objpfx)tst-tlsmod6.so: $(common-objpfx)libc.so
1466 $(objpfx)tst-tls19mod1.so: $(objpfx)tst-tls19mod2.so $(objpfx)tst-tls19mod3.so
1467 $(objpfx)tst-tls19mod3.so: $(objpfx)ld.so
1468 $(objpfx)reldep8mod3.so: $(objpfx)reldep8mod1.so $(objpfx)reldep8mod2.so
1469 $(objpfx)nodel2mod3.so: $(objpfx)nodel2mod1.so $(objpfx)nodel2mod2.so
1470 $(objpfx)reldep9mod2.so: $(objpfx)reldep9mod1.so
1471 $(objpfx)reldep9mod3.so: $(objpfx)reldep9mod1.so $(objpfx)reldep9mod2.so
1472 $(objpfx)unload3mod1.so: $(objpfx)unload3mod3.so
1473 $(objpfx)unload3mod2.so: $(objpfx)unload3mod3.so
1474 $(objpfx)unload3mod3.so: $(objpfx)unload3mod4.so
1475 $(objpfx)unload4mod1.so: $(objpfx)unload4mod2.so $(objpfx)unload4mod3.so
1476 $(objpfx)unload4mod2.so: $(objpfx)unload4mod4.so $(objpfx)unload4mod3.so
1477 $(objpfx)unload7mod2.so: $(objpfx)unload7mod1.so
1478 $(objpfx)unload8mod1.so: $(objpfx)unload8mod2.so
1479 $(objpfx)unload8mod2.so: $(objpfx)unload8mod3.so
1480 $(objpfx)tst-initordera2.so: $(objpfx)tst-initordera1.so
1481 $(objpfx)tst-initorderb2.so: $(objpfx)tst-initorderb1.so $(objpfx)tst-initordera2.so
1482 $(objpfx)tst-initordera3.so: $(objpfx)tst-initorderb2.so $(objpfx)tst-initorderb1.so
1483 $(objpfx)tst-initordera4.so: $(objpfx)tst-initordera3.so
1484 $(objpfx)tst-initorder: $(objpfx)tst-initordera4.so $(objpfx)tst-initordera1.so $(objpfx)tst-initorderb2.so
1485 $(objpfx)tst-null-argv: $(objpfx)tst-null-argv-lib.so
1486 $(objpfx)tst-tlsalign: $(objpfx)tst-tlsalign-lib.so
1487 $(objpfx)tst-nodelete-opened.out: $(objpfx)tst-nodelete-opened-lib.so
1489 $(objpfx)tst-tlsalign-extern: $(objpfx)tst-tlsalign-vars.o
1490 $(objpfx)tst-tlsalign-extern-static: $(objpfx)tst-tlsalign-vars.o
1492 tst-null-argv-ENV = LD_DEBUG=all LD_DEBUG_OUTPUT=$(objpfx)tst-null-argv.debug.out
1493 LDFLAGS-nodel2mod3.so = -Wl,--no-as-needed
1494 LDFLAGS-reldepmod5.so = -Wl,--no-as-needed
1495 LDFLAGS-reldep6mod1.so = -Wl,--no-as-needed
1496 LDFLAGS-reldep6mod4.so = -Wl,--no-as-needed
1497 LDFLAGS-reldep8mod3.so = -Wl,--no-as-needed
1498 LDFLAGS-unload4mod1.so = -Wl,--no-as-needed
1499 LDFLAGS-unload4mod2.so = -Wl,--no-as-needed
1500 LDFLAGS-tst-initorder = -Wl,--no-as-needed
1501 LDFLAGS-tst-initordera2.so = -Wl,--no-as-needed
1502 LDFLAGS-tst-initordera3.so = -Wl,--no-as-needed
1503 LDFLAGS-tst-initordera4.so = -Wl,--no-as-needed
1504 LDFLAGS-tst-initorderb2.so = -Wl,--no-as-needed
1505 LDFLAGS-tst-tlsmod5.so = -nostdlib -Wl,--no-as-needed
1506 LDFLAGS-tst-tlsmod6.so = -nostdlib -Wl,--no-as-needed
1508 # The following tests are underlinked, and rely on late loading. On toolchains
1509 # that set -z now by default, this leads to failures to load or fix up the
1510 # executables being tested.
1511 LDFLAGS-circlemod2.so = -Wl,-z,lazy
1512 LDFLAGS-tst-tls20mod-bad.so = -Wl,-z,lazy
1513 LDFLAGS-reldep6mod1.so += -Wl,-z,lazy
1514 LDFLAGS-constload2.so = -Wl,-z,lazy
1515 LDFLAGS-constload3.so = -Wl,-z,lazy
1516 LDFLAGS-dblloadmod3.so = -Wl,-z,lazy
1517 LDFLAGS-ifuncmod6.so = -Wl,-z,lazy
1518 LDFLAGS-ltglobmod2.so = -Wl,-z,lazy
1519 LDFLAGS-testobj1.so = -Wl,-z,lazy
1520 LDFLAGS-testobj6.so = -Wl,-z,lazy
1522 testobj1.so-no-z-defs = yes
1523 testobj3.so-no-z-defs = yes
1524 testobj4.so-no-z-defs = yes
1525 testobj5.so-no-z-defs = yes
1526 testobj6.so-no-z-defs = yes
1527 failobj.so-no-z-defs = yes
1528 constload2.so-no-z-defs = yes
1529 constload3.so-no-z-defs = yes
1530 nodelmod1.so-no-z-defs = yes
1531 nodelmod2.so-no-z-defs = yes
1532 nodelmod4.so-no-z-defs = yes
1533 nodel2mod2.so-no-z-defs = yes
1534 reldepmod2.so-no-z-defs = yes
1535 reldepmod3.so-no-z-defs = yes
1536 reldepmod4.so-no-z-defs = yes
1537 reldep4mod4.so-no-z-defs = yes
1538 reldep4mod2.so-no-z-defs = yes
1539 ltglobmod2.so-no-z-defs = yes
1540 dblloadmod3.so-no-z-defs = yes
1541 tst-tlsmod1.so-no-z-defs = yes
1542 tst-tlsmod2.so-no-z-defs = yes
1543 tst-tlsmod3.so-no-z-defs = yes
1544 tst-tlsmod4.so-no-z-defs = yes
1545 tst-tlsmod7.so-no-z-defs = yes
1546 tst-tlsmod8.so-no-z-defs = yes
1547 tst-tlsmod9.so-no-z-defs = yes
1548 tst-tlsmod10.so-no-z-defs = yes
1549 tst-tlsmod12.so-no-z-defs = yes
1550 tst-tlsmod14a.so-no-z-defs = yes
1551 tst-tlsmod14b.so-no-z-defs = yes
1552 tst-tlsmod15a.so-no-z-defs = yes
1553 tst-tlsmod16b.so-no-z-defs = yes
1554 circlemod2.so-no-z-defs = yes
1555 circlemod3.so-no-z-defs = yes
1556 circlemod3a.so-no-z-defs = yes
1557 reldep8mod2.so-no-z-defs = yes
1558 reldep9mod1.so-no-z-defs = yes
1559 unload3mod4.so-no-z-defs = yes
1560 unload4mod1.so-no-z-defs = yes
1561 ifuncmod1.so-no-z-defs = yes
1562 ifuncmod5.so-no-z-defs = yes
1563 ifuncmod6.so-no-z-defs = yes
1564 tst-auditmod9a.so-no-z-defs = yes
1565 tst-auditmod9b.so-no-z-defs = yes
1566 tst-nodelete-uniquemod.so-no-z-defs = yes
1567 tst-nodelete-rtldmod.so-no-z-defs = yes
1568 tst-nodelete-zmod.so-no-z-defs = yes
1569 tst-nodelete2mod.so-no-z-defs = yes
1571 ifeq ($(build-shared),yes)
1572 # Build all the modules even when not actually running test programs.
1573 tests: $(test-modules)
1574 endif
1576 LDFLAGS-loadtest = -rdynamic
1578 $(objpfx)loadtest.out: $(test-modules)
1580 $(objpfx)neededtest.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
1581 $(objpfx)neededobj3.so
1583 $(objpfx)neededtest2.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
1584 $(objpfx)neededobj3.so
1586 $(objpfx)neededtest3.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
1587 $(objpfx)neededobj3.so $(objpfx)neededobj4.so
1589 $(objpfx)neededtest4: $(objpfx)neededobj1.so
1590 $(objpfx)neededtest4.out: $(objpfx)neededobj5.so $(objpfx)neededobj6.so
1592 $(objpfx)restest1: $(objpfx)testobj1.so $(objpfx)testobj1_1.so
1593 LDFLAGS-restest1 = -rdynamic
1595 LDFLAGS-restest2 = -rdynamic
1597 $(objpfx)restest1.out: $(test-modules)
1599 preloadtest-preloads = testobj1 testobj2 testobj3 testobj4 testobj5
1600 $(objpfx)preloadtest: $(objpfx)testobj6.so
1601 LDFLAGS-preloadtest = -rdynamic
1602 $(objpfx)preloadtest.out: $(preloadtest-preloads:%=$(objpfx)%.so)
1603 preloadtest-ENV = \
1604 LD_PRELOAD=$(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
1606 LDFLAGS-loadfail = -rdynamic
1608 $(objpfx)loadfail.out: $(objpfx)failobj.so $(objpfx)testobj1.so \
1609 $(objpfx)testobj2.so $(objpfx)testobj3.so \
1610 $(objpfx)testobj4.so $(objpfx)testobj5.so
1612 LDFLAGS-multiload = -rdynamic
1613 CFLAGS-multiload.c += -DOBJDIR=\"$(elf-objpfx)\"
1615 $(objpfx)multiload.out: $(objpfx)testobj1.so
1617 LDFLAGS-origtest = -rdynamic
1618 $(objpfx)origtest.out: $(objpfx)testobj1.so
1620 $(objpfx)resolvfail.out: $(objpfx)testobj1.so
1621 ifeq ($(have-thread-library),yes)
1622 $(objpfx)resolvfail: $(shared-thread-library)
1623 endif
1625 $(objpfx)constload1.out: $(objpfx)constload2.so $(objpfx)constload3.so
1627 $(objpfx)circleload1.out: $(objpfx)circlemod1.so \
1628 $(objpfx)circlemod1a.so
1630 $(objpfx)circlemod1.so: $(objpfx)circlemod2.so
1631 $(objpfx)circlemod2.so: $(objpfx)circlemod3.so
1632 $(objpfx)circlemod1a.so: $(objpfx)circlemod2a.so
1633 $(objpfx)circlemod2a.so: $(objpfx)circlemod3a.so
1635 $(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so)
1637 $(objpfx)order-cmp.out: $(objpfx)order.out
1638 (echo "0123456789" | cmp $< -) > $@; \
1639 $(evaluate-test)
1641 $(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so)
1642 $(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
1643 vismain-ENV = LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
1645 $(objpfx)noload: $(objpfx)testobj1.so
1646 LDFLAGS-noload = -rdynamic -Wl,--no-as-needed
1647 $(objpfx)noload.out: $(objpfx)testobj5.so
1649 $(objpfx)noload-mem.out: $(objpfx)noload.out
1650 $(common-objpfx)malloc/mtrace $(objpfx)noload.mtrace > $@; \
1651 $(evaluate-test)
1652 noload-ENV = MALLOC_TRACE=$(objpfx)noload.mtrace \
1653 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
1655 LDFLAGS-nodelete = -rdynamic
1656 LDFLAGS-nodelmod1.so = -Wl,--enable-new-dtags,-z,nodelete
1657 LDFLAGS-nodelmod4.so = -Wl,--enable-new-dtags,-z,nodelete
1658 $(objpfx)nodelete.out: $(objpfx)nodelmod1.so $(objpfx)nodelmod2.so \
1659 $(objpfx)nodelmod3.so
1661 LDFLAGS-nodlopenmod.so = -Wl,--enable-new-dtags,-z,nodlopen
1662 $(objpfx)nodlopen.out: $(objpfx)nodlopenmod.so
1664 $(objpfx)nodlopenmod2.so: $(objpfx)nodlopenmod.so
1665 $(objpfx)nodlopen2.out: $(objpfx)nodlopenmod2.so
1667 $(objpfx)filtmod1.so: $(objpfx)filtmod1.os $(objpfx)filtmod2.so
1668 $(LINK.o) -shared -o $@ -B$(csu-objpfx) $(LDFLAGS.so) \
1669 $(dt-relr-ldflag) \
1670 -L$(subst :, -L,$(rpath-link)) \
1671 -Wl,-rpath-link=$(rpath-link) \
1672 $< -Wl,-F,$(objpfx)filtmod2.so
1673 $(objpfx)filter: $(objpfx)filtmod1.so
1675 # This does not link against libc.
1676 CFLAGS-filtmod1.c += $(no-stack-protector)
1678 $(objpfx)unload.out: $(objpfx)unloadmod.so
1680 $(objpfx)reldep.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod2.so
1682 $(objpfx)reldep2.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod3.so
1684 $(objpfx)reldep3.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
1686 $(objpfx)reldep4.out: $(objpfx)reldep4mod1.so $(objpfx)reldep4mod2.so
1688 $(objpfx)next: $(objpfx)nextmod1.so $(objpfx)nextmod2.so
1689 LDFLAGS-next = -Wl,--no-as-needed
1691 $(objpfx)tst-next-ver: $(objpfx)nextmod3.so
1692 LDFLAGS-tst-next-ver = -Wl,--no-as-needed
1694 $(objpfx)unload2.out: $(objpfx)unload2mod.so $(objpfx)unload2dep.so
1696 $(objpfx)lateglobal.out: $(objpfx)ltglobmod1.so $(objpfx)ltglobmod2.so
1698 $(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \
1699 $(objpfx)pathoptobj.so
1700 $(SHELL) $< $(common-objpfx) '$(test-wrapper-env)' \
1701 '$(run-program-env)'; \
1702 $(evaluate-test)
1704 $(objpfx)tst-rtld-load-self.out: tst-rtld-load-self.sh $(objpfx)ld.so
1705 $(SHELL) $^ '$(test-wrapper)' '$(test-wrapper-env)' > $@; \
1706 $(evaluate-test)
1708 tst-rtld-preload-OBJS = $(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
1709 $(objpfx)tst-rtld-preload.out: tst-rtld-preload.sh $(objpfx)ld.so \
1710 $(objpfx)preloadtest \
1711 $(preloadtest-preloads:%=$(objpfx)%.so)
1712 $(SHELL) $< $(objpfx)ld.so $(objpfx)preloadtest \
1713 '$(test-wrapper-env)' '$(run_program_env)' \
1714 '$(rpath-link)' '$(tst-rtld-preload-OBJS)' > $@; \
1715 $(evaluate-test)
1717 $(objpfx)initfirst.out: $(objpfx)firstobj.so
1719 $(objpfx)global: $(objpfx)globalmod1.so
1720 $(objpfx)global.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
1722 $(objpfx)dblload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
1724 $(objpfx)dblunload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
1726 $(objpfx)reldep5.out: $(objpfx)reldepmod5.so $(objpfx)reldepmod6.so
1728 $(objpfx)reldep6.out: $(objpfx)reldep6mod3.so $(objpfx)reldep6mod4.so
1730 $(objpfx)reldep7.out: $(objpfx)reldep7mod1.so $(objpfx)reldep7mod2.so
1732 $(objpfx)reldep8.out: $(objpfx)reldep8mod3.so
1734 LDFLAGS-nodel2mod2.so = -Wl,--enable-new-dtags,-z,nodelete
1735 $(objpfx)nodelete2.out: $(objpfx)nodel2mod3.so
1737 $(objpfx)reldep9.out: $(objpfx)reldep9mod3.so
1739 $(objpfx)tst-tls3: $(objpfx)tst-tlsmod1.so
1741 $(objpfx)tst-tls4.out: $(objpfx)tst-tlsmod2.so
1743 $(objpfx)tst-tls5.out: $(objpfx)tst-tlsmod2.so
1745 $(objpfx)tst-tls6.out: $(objpfx)tst-tlsmod2.so
1747 $(objpfx)tst-tls7.out: $(objpfx)tst-tlsmod3.so
1749 $(objpfx)tst-tls8.out: $(objpfx)tst-tlsmod3.so $(objpfx)tst-tlsmod4.so
1751 $(objpfx)tst-tls9.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
1753 $(objpfx)tst-tls10: $(objpfx)tst-tlsmod8.so $(objpfx)tst-tlsmod7.so
1755 $(objpfx)tst-tls11: $(objpfx)tst-tlsmod10.so $(objpfx)tst-tlsmod9.so
1757 $(objpfx)tst-tls12: $(objpfx)tst-tlsmod12.so $(objpfx)tst-tlsmod11.so
1759 $(objpfx)tst-tls13.out: $(objpfx)tst-tlsmod13a.so
1761 $(objpfx)tst-tls14: $(objpfx)tst-tlsmod14a.so
1762 $(objpfx)tst-tls14.out: $(objpfx)tst-tlsmod14b.so
1764 $(objpfx)tst-tls15.out: $(objpfx)tst-tlsmod15a.so $(objpfx)tst-tlsmod15b.so
1766 $(objpfx)tst-tls-dlinfo.out: $(objpfx)tst-tlsmod2.so
1770 $(objpfx)tst-tls16.out: $(objpfx)tst-tlsmod16a.so $(objpfx)tst-tlsmod16b.so
1772 $(objpfx)tst-tls17.out: $(objpfx)tst-tlsmod17b.so
1773 $(patsubst %,$(objpfx)%.os,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.os: tst-tlsmod17a.c
1774 $(compile-command.c) -DN=$*
1775 $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.so: $(objpfx)ld.so
1776 $(objpfx)tst-tlsmod17b.so: $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules))
1778 $(objpfx)tst-tls18.out: $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules))
1779 $(patsubst %,$(objpfx)%.os,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.os : tst-tlsmod18a.c
1780 $(compile-command.c) -DN=$*
1781 $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.so: $(objpfx)ld.so
1783 $(objpfx)tst-tls19.out: $(objpfx)tst-tls19mod1.so
1785 CFLAGS-tst-align.c += $(stack-align-test-flags)
1786 CFLAGS-tst-align2.c += $(stack-align-test-flags)
1787 CFLAGS-tst-alignmod.c += $(stack-align-test-flags)
1788 CFLAGS-tst-alignmod2.c += $(stack-align-test-flags)
1789 $(objpfx)tst-align.out: $(objpfx)tst-alignmod.so
1790 $(objpfx)tst-align2: $(objpfx)tst-alignmod2.so
1791 $(objpfx)tst-align3: $(objpfx)tst-alignmod3.so
1792 ifeq (yes,$(have-fpie))
1793 CFLAGS-tst-align3.c += $(PIE-ccflag)
1794 endif
1795 LDFLAGS-tst-align3 += -Wl,-z,max-page-size=0x200000
1796 LDFLAGS-tst-alignmod3.so += -Wl,-z,max-page-size=0x200000
1797 $(objpfx)tst-alignmod3.so: $(libsupport)
1799 $(objpfx)unload3.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
1800 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
1802 $(objpfx)unload4.out: $(objpfx)unload4mod1.so $(objpfx)unload4mod3.so
1804 $(objpfx)unload5.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
1805 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
1807 $(objpfx)unload6.out: $(objpfx)unload6mod1.so $(objpfx)unload6mod2.so \
1808 $(objpfx)unload6mod3.so
1810 $(objpfx)unload7.out: $(objpfx)unload7mod1.so $(objpfx)unload7mod2.so
1811 unload7-ENV = MALLOC_PERTURB_=85
1813 $(objpfx)unload8.out: $(objpfx)unload8mod1.so $(objpfx)unload8mod1x.so
1815 $(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
1817 ifeq ($(have-z-execstack),yes)
1818 $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
1819 CPPFLAGS-tst-execstack.c += -DUSE_PTHREADS=0
1820 LDFLAGS-tst-execstack = -Wl,-z,noexecstack
1821 LDFLAGS-tst-execstack-mod.so = -Wl,-z,execstack
1823 $(objpfx)tst-execstack-needed: $(objpfx)tst-execstack-mod.so
1824 LDFLAGS-tst-execstack-needed = -Wl,-z,noexecstack
1826 LDFLAGS-tst-execstack-prog = -Wl,-z,execstack
1827 CFLAGS-tst-execstack-prog.c += -Wno-trampolines
1828 CFLAGS-tst-execstack-mod.c += -Wno-trampolines
1829 endif
1831 LDFLAGS-tst-array2 = -Wl,--no-as-needed
1832 LDFLAGS-tst-array5 = -Wl,--no-as-needed
1834 $(objpfx)tst-array1-cmp.out: tst-array1.exp $(objpfx)tst-array1.out
1835 cmp $^ > $@; \
1836 $(evaluate-test)
1838 $(objpfx)tst-array1-static-cmp.out: tst-array1.exp \
1839 $(objpfx)tst-array1-static.out
1840 cmp $^ > $@; \
1841 $(evaluate-test)
1843 $(objpfx)tst-array2: $(objpfx)tst-array2dep.so
1844 $(objpfx)tst-array2-cmp.out: tst-array2.exp $(objpfx)tst-array2.out
1845 cmp $^ > $@; \
1846 $(evaluate-test)
1848 $(objpfx)tst-array3-cmp.out: tst-array1.exp $(objpfx)tst-array3.out
1849 cmp $^ > $@; \
1850 $(evaluate-test)
1852 $(objpfx)tst-array4.out: $(objpfx)tst-array2dep.so
1853 $(objpfx)tst-array4-cmp.out: tst-array4.exp $(objpfx)tst-array4.out
1854 cmp $^ > $@; \
1855 $(evaluate-test)
1857 $(objpfx)tst-array5: $(objpfx)tst-array5dep.so
1858 $(objpfx)tst-array5-cmp.out: tst-array5.exp $(objpfx)tst-array5.out
1859 cmp $^ > $@; \
1860 $(evaluate-test)
1862 $(objpfx)tst-array5-static-cmp.out: tst-array5-static.exp \
1863 $(objpfx)tst-array5-static.out
1864 cmp $^ > $@; \
1865 $(evaluate-test)
1867 CFLAGS-tst-pie1.c += $(pie-ccflag)
1868 CFLAGS-tst-pie2.c += $(pie-ccflag)
1870 $(objpfx)tst-piemod1.so: $(libsupport)
1871 $(objpfx)tst-pie1: $(objpfx)tst-piemod1.so
1872 $(objpfx)tst-dlopen-pie.out: $(objpfx)tst-pie1
1874 ifeq (yes,$(build-shared))
1875 # NB: Please keep cet-built-dso in sysdeps/x86/Makefile in sync with
1876 # all-built-dso here.
1877 all-built-dso := $(common-objpfx)elf/ld.so $(common-objpfx)libc.so \
1878 $(filter-out $(common-objpfx)linkobj/libc.so, \
1879 $(sort $(wildcard $(addprefix $(common-objpfx), \
1880 */lib*.so \
1881 iconvdata/*.so))))
1883 $(all-built-dso:=.dyn): %.dyn: %
1884 @rm -f $@T
1885 LC_ALL=C $(READELF) -W -d $< > $@T
1886 test -s $@T
1887 mv -f $@T $@
1888 common-generated += $(all-built-dso:$(common-objpfx)%=%.dyn)
1890 $(objpfx)check-textrel.out: $(..)scripts/check-textrel.awk \
1891 $(all-built-dso:=.dyn)
1892 LC_ALL=C $(AWK) -f $^ > $@; \
1893 $(evaluate-test)
1894 generated += check-textrel.out
1896 $(objpfx)execstack-default: $(first-word $(wildcard $(sysdirs:%=%/stackinfo.h)))
1897 $(make-target-directory)
1898 { echo '#include <elf.h>'; \
1899 echo '#include <stackinfo.h>'; \
1900 echo '#if (DEFAULT_STACK_PERMS & PF_X) == 0'; \
1901 echo '@@@execstack-no@@@'; \
1902 echo '#else'; \
1903 echo '@@@execstack-yes@@@'; \
1904 echo '#endif'; } | \
1905 $(CC) $(CFLAGS) $(CPPFLAGS) -E -x c-header - | \
1906 sed -n -e 's/^@@@\(.*\)@@@/\1/p' > $@T
1907 mv -f $@T $@
1908 generated += execstack-default
1910 $(all-built-dso:=.phdr): %.phdr: %
1911 @rm -f $@T
1912 LC_ALL=C $(READELF) -W -l $< > $@T
1913 test -s $@T
1914 mv -f $@T $@
1915 common-generated += $(all-built-dso:$(common-objpfx)%=%.phdr)
1917 $(objpfx)check-execstack.out: $(..)scripts/check-execstack.awk \
1918 $(objpfx)execstack-default \
1919 $(all-built-dso:=.phdr)
1920 LC_ALL=C $(AWK) -v "xfail=$(check-execstack-xfail)" -f $^ > $@; \
1921 $(evaluate-test)
1922 generated += check-execstack.out
1924 $(objpfx)check-wx-segment.out: $(..)scripts/check-wx-segment.py \
1925 $(all-built-dso:=.phdr)
1926 $(PYTHON) $^ --xfail="$(check-wx-segment-xfail)" > $@; \
1927 $(evaluate-test)
1928 generated += check-wx-segment.out
1930 $(objpfx)tst-dlmodcount.out: $(test-modules)
1932 $(all-built-dso:=.jmprel): %.jmprel: % Makefile
1933 @rm -f $@T
1934 LC_ALL=C $(READELF) -W -S -d -r $< > $@T
1935 test -s $@T
1936 mv -f $@T $@
1937 common-generated += $(all-built-dso:$(common-objpfx)%=%.jmprel)
1939 localplt-built-dso := $(addprefix $(common-objpfx),\
1940 libc.so \
1941 elf/ld.so \
1942 math/libm.so \
1943 dlfcn/libdl.so \
1944 resolv/libresolv.so \
1946 ifeq ($(build-mathvec),yes)
1947 localplt-built-dso += $(addprefix $(common-objpfx), mathvec/libmvec.so)
1948 endif
1949 ifeq ($(have-thread-library),yes)
1950 localplt-built-dso += $(filter-out %_nonshared.a, $(shared-thread-library))
1951 endif
1952 ifeq ($(build-crypt),yes)
1953 localplt-built-dso += $(addprefix $(common-objpfx), crypt/libcrypt.so)
1954 endif
1955 ifneq ($(pthread-in-libc),yes)
1956 localplt-built-dso += $(addprefix $(common-objpfx), rt/librt.so)
1957 endif
1959 vpath localplt.data $(+sysdep_dirs)
1961 $(objpfx)check-localplt.out: $(..)scripts/check-localplt.awk \
1962 $(..)scripts/localplt.awk \
1963 $(localplt-built-dso:=.jmprel) \
1964 localplt.data
1965 LC_ALL=C $(AWK) -f $(filter-out $< %localplt.data,$^) | \
1966 LC_ALL=C $(AWK) -f $< $(filter %localplt.data,$^) - \
1967 > $@; \
1968 $(evaluate-test)
1969 endif
1971 $(all-built-dso:=.dynsym): %.dynsym: %
1972 @rm -f $@T
1973 LC_ALL=C $(READELF) -W --dyn-syms $< > $@T
1974 test -s $@T
1975 mv -f $@T $@
1976 common-generated += $(all-built-dso:$(common-objpfx)%=%.dynsym)
1978 $(objpfx)check-initfini.out: $(..)scripts/check-initfini.awk \
1979 $(all-built-dso:=.dynsym)
1980 LC_ALL=C $(AWK) -f $^ > $@; \
1981 $(evaluate-test)
1982 generated += check-initfini.out
1984 $(objpfx)tst-dlopenrpath: $(objpfx)tst-dlopenrpathmod.so
1985 CFLAGS-tst-dlopenrpath.c += -DPFX=\"$(objpfx)\"
1986 LDFLAGS-tst-dlopenrpathmod.so += -Wl,-rpath,\$$ORIGIN/test-subdir
1987 $(objpfx)tst-dlopenrpath.out: $(objpfx)firstobj.so
1989 $(objpfx)tst-deep1mod2.so: $(objpfx)tst-deep1mod3.so
1990 $(objpfx)tst-deep1: $(objpfx)tst-deep1mod1.so
1991 $(objpfx)tst-deep1.out: $(objpfx)tst-deep1mod2.so
1992 LDFLAGS-tst-deep1 += -rdynamic
1993 tst-deep1mod3.so-no-z-defs = yes
1995 $(objpfx)tst-dlmopen1.out: $(objpfx)tst-dlmopen1mod.so
1997 $(objpfx)tst-dlmopen2.out: $(objpfx)tst-dlmopen1mod.so
1999 $(objpfx)tst-dlmopen3.out: $(objpfx)tst-dlmopen1mod.so
2001 $(objpfx)tst-dlmopen4.out: $(objpfx)tst-dlmopen1mod.so
2003 $(objpfx)tst-audit1.out: $(objpfx)tst-auditmod1.so
2004 tst-audit1-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
2006 $(objpfx)tst-audit2.out: $(objpfx)tst-auditmod1.so $(objpfx)tst-auditmod9b.so
2007 # Prevent GCC-5 from translating a malloc/memset pair into calloc
2008 CFLAGS-tst-audit2.c += -fno-builtin
2009 tst-audit2-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
2011 $(objpfx)tst-audit9.out: $(objpfx)tst-auditmod9a.so $(objpfx)tst-auditmod9b.so
2012 tst-audit9-ENV = LD_AUDIT=$(objpfx)tst-auditmod9a.so
2014 $(objpfx)tst-audit8: $(libm)
2015 $(objpfx)tst-audit8.out: $(objpfx)tst-auditmod1.so
2016 tst-audit8-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
2018 $(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
2020 $(objpfx)tst-global2: $(objpfx)tst-globalmod2.so
2021 $(objpfx)tst-global2.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
2022 LDFLAGS-tst-global2 = -Wl,--enable-new-dtags
2023 LDFLAGS-tst-globalmod2.so = -Wl,--enable-new-dtags
2025 $(objpfx)order2.out: $(objpfx)order2mod1.so $(objpfx)order2mod2.so
2026 $(objpfx)order2-cmp.out: $(objpfx)order2.out
2027 (echo "12345" | cmp $< -) > $@; \
2028 $(evaluate-test)
2029 $(objpfx)order2mod1.so: $(objpfx)order2mod4.so
2030 $(objpfx)order2mod4.so: $(objpfx)order2mod3.so
2031 $(objpfx)order2mod2.so: $(objpfx)order2mod3.so
2032 order2mod2.so-no-z-defs = yes
2033 LDFLAGS-order2mod1.so = -Wl,--no-as-needed
2034 LDFLAGS-order2mod2.so = -Wl,--no-as-needed
2036 tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child"
2037 tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
2039 tst-ptrguard1-ARGS = --command "$(host-test-program-cmd) --child"
2040 # When built statically, the pointer guard interface uses
2041 # __pointer_chk_guard_local.
2042 CFLAGS-tst-ptrguard1-static.c += -DPTRGUARD_LOCAL
2043 tst-ptrguard1-static-ARGS = --command "$(objpfx)tst-ptrguard1-static --child"
2045 $(objpfx)tst-leaks1-mem.out: $(objpfx)tst-leaks1.out
2046 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1.mtrace > $@; \
2047 $(evaluate-test)
2049 tst-leaks1-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1.mtrace \
2050 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
2052 $(objpfx)tst-thrlock: $(shared-thread-library)
2053 $(objpfx)tst-thrlock.out: $(libm)
2054 $(objpfx)tst-noload.out: $(libm)
2056 tst-tst-dlopen-tlsmodid-no-pie = yes
2057 $(objpfx)tst-dlopen-tlsmodid: $(shared-thread-library)
2058 $(objpfx)tst-dlopen-tlsmodid.out: $(objpfx)tst-dlopen-self
2059 CFLAGS-tst-dlopen-tlsmodid-pie.c += $(pie-ccflag)
2060 $(objpfx)tst-dlopen-tlsmodid-pie: $(shared-thread-library)
2061 $(objpfx)tst-dlopen-tlsmodid-pie.out: $(objpfx)tst-dlopen-self-pie
2062 $(objpfx)tst-dlopen-tlsmodid-container: $(shared-thread-library)
2063 LDFLAGS-tst-dlopen-tlsmodid-container += -Wl,-rpath,\$$ORIGIN
2065 tst-tst-dlopen-self-no-pie = yes
2066 CFLAGS-tst-dlopen-self-pie.c += $(pie-ccflag)
2067 LDFLAGS-tst-dlopen-self-container += -Wl,-rpath,\$$ORIGIN
2069 CFLAGS-ifuncmain1pic.c += $(pic-ccflag)
2070 CFLAGS-ifuncmain1picstatic.c += $(pic-ccflag)
2071 CFLAGS-ifuncmain1staticpic.c += $(pic-ccflag)
2072 CFLAGS-ifuncdep1pic.c += $(pic-ccflag)
2073 CFLAGS-ifuncmain1vispic.c += $(pic-ccflag)
2074 CFLAGS-ifuncmain2pic.c += $(pic-ccflag)
2075 CFLAGS-ifuncmain2picstatic.c += $(pic-ccflag)
2076 CFLAGS-ifuncdep2pic.c += $(pic-ccflag)
2077 CFLAGS-ifuncmain4picstatic.c += $(pic-ccflag)
2078 CFLAGS-ifuncmain5pic.c += $(pic-ccflag)
2079 CFLAGS-ifuncmain5picstatic.c += $(pic-ccflag)
2080 CFLAGS-ifuncmain5staticpic.c += $(pic-ccflag)
2081 CFLAGS-ifuncdep5pic.c += $(pic-ccflag)
2082 CFLAGS-ifuncmain7pic.c += $(pic-ccflag)
2083 CFLAGS-ifuncmain7picstatic.c += $(pic-ccflag)
2084 CFLAGS-ifuncmain9pic.c += $(pic-ccflag)
2085 CFLAGS-ifuncmain9picstatic.c += $(pic-ccflag)
2087 LDFLAGS-ifuncmain3 = -Wl,-export-dynamic
2089 CFLAGS-ifuncmain1pie.c += $(pie-ccflag)
2090 CFLAGS-ifuncmain1vispie.c += $(pie-ccflag)
2091 CFLAGS-ifuncmain1staticpie.c += $(pie-ccflag)
2092 CFLAGS-ifuncmain5pie.c += $(pie-ccflag)
2093 CFLAGS-ifuncmain6pie.c += $(pie-ccflag)
2094 CFLAGS-ifuncmain7pie.c += $(pie-ccflag)
2095 CFLAGS-ifuncmain9pie.c += $(pie-ccflag)
2096 CFLAGS-tst-ifunc-textrel.c += $(pic-ccflag)
2098 LDFLAGS-ifuncmain6pie = -Wl,-z,lazy
2100 $(objpfx)ifuncmain1pie: $(objpfx)ifuncmod1.so
2101 $(objpfx)ifuncmain1staticpie: $(objpfx)ifuncdep1pic.o
2102 $(objpfx)ifuncmain1vispie: $(objpfx)ifuncmod1.so
2103 $(objpfx)ifuncmain5pie: $(objpfx)ifuncmod5.so
2104 $(objpfx)ifuncmain6pie: $(objpfx)ifuncmod6.so
2106 $(objpfx)ifuncmain1: $(addprefix $(objpfx),ifuncmod1.so)
2107 $(objpfx)ifuncmain1pic: $(addprefix $(objpfx),ifuncmod1.so)
2108 $(objpfx)ifuncmain1staticpic: $(addprefix $(objpfx),ifuncdep1pic.o)
2109 $(objpfx)ifuncmain1static: $(addprefix $(objpfx),ifuncdep1.o)
2110 $(objpfx)ifuncmain1picstatic: $(addprefix $(objpfx),ifuncdep1pic.o)
2111 $(objpfx)ifuncmain1vis: $(addprefix $(objpfx),ifuncmod1.so)
2112 $(objpfx)ifuncmain1vispic: $(addprefix $(objpfx),ifuncmod1.so)
2113 $(objpfx)ifuncmain2: $(addprefix $(objpfx),ifuncdep2.o)
2114 $(objpfx)ifuncmain2pic: $(addprefix $(objpfx),ifuncdep2pic.o)
2115 $(objpfx)ifuncmain2static: $(addprefix $(objpfx),ifuncdep2.o)
2116 $(objpfx)ifuncmain2picstatic: $(addprefix $(objpfx),ifuncdep2pic.o)
2118 $(objpfx)ifuncmain3.out: $(objpfx)ifuncmod3.so
2120 $(objpfx)ifuncmain5: $(addprefix $(objpfx),ifuncmod5.so)
2121 $(objpfx)ifuncmain5pic: $(addprefix $(objpfx),ifuncmod5.so)
2122 $(objpfx)ifuncmain5static: $(addprefix $(objpfx),ifuncdep5.o)
2123 $(objpfx)ifuncmain5staticpic: $(addprefix $(objpfx),ifuncdep5pic.o)
2124 $(objpfx)ifuncmain5picstatic: $(addprefix $(objpfx),ifuncdep5pic.o)
2126 LDFLAGS-tst-ifunc-fault-lazy = -Wl,-z,lazy
2127 LDFLAGS-tst-ifunc-fault-bindnow = -Wl,-z,now
2128 define tst-ifunc-fault-script
2129 ( $(test-wrapper) $(rtld-prefix) --verify $^ \
2130 && $(test-wrapper-env) LD_TRACE_LOADED_OBJECTS=1 $(rtld-prefix) $^ \
2131 && $(test-wrapper-env) LD_TRACE_LOADED_OBJECTS=1 LD_DEBUG=unused \
2132 $(rtld-prefix) $^ \
2133 ) > $@; $(evaluate-test)
2134 endef
2135 $(objpfx)tst-ifunc-fault-lazy.out: $(objpfx)tst-ifunc-fault-lazy $(objpfx)ld.so
2136 $(tst-ifunc-fault-script)
2137 $(objpfx)tst-ifunc-fault-bindnow.out: $(objpfx)tst-ifunc-fault-bindnow \
2138 $(objpfx)ld.so
2139 $(tst-ifunc-fault-script)
2141 $(objpfx)tst-unique1.out: $(objpfx)tst-unique1mod1.so \
2142 $(objpfx)tst-unique1mod2.so
2144 $(objpfx)tst-unique2: $(objpfx)tst-unique2mod1.so
2145 $(objpfx)tst-unique2.out: $(objpfx)tst-unique2mod2.so
2147 $(objpfx)tst-unique3: $(objpfx)tst-unique3lib.so
2148 $(objpfx)tst-unique3.out: $(objpfx)tst-unique3lib2.so
2150 $(objpfx)tst-unique4: $(objpfx)tst-unique4lib.so
2152 $(objpfx)tst-nodelete.out: $(objpfx)tst-nodelete-uniquemod.so \
2153 $(objpfx)tst-nodelete-rtldmod.so \
2154 $(objpfx)tst-nodelete-zmod.so
2156 LDFLAGS-tst-nodelete = -rdynamic
2157 LDFLAGS-tst-nodelete-zmod.so = -Wl,--enable-new-dtags,-z,nodelete
2159 $(objpfx)tst-nodelete2.out: $(objpfx)tst-nodelete2mod.so
2161 LDFLAGS-tst-nodelete2 = -rdynamic
2163 $(objpfx)tst-initorder-cmp.out: tst-initorder.exp $(objpfx)tst-initorder.out
2164 cmp $^ > $@; \
2165 $(evaluate-test)
2167 $(objpfx)tst-initorder2: $(objpfx)tst-initorder2a.so $(objpfx)tst-initorder2d.so $(objpfx)tst-initorder2c.so
2168 $(objpfx)tst-initorder2a.so: $(objpfx)tst-initorder2b.so
2169 $(objpfx)tst-initorder2b.so: $(objpfx)tst-initorder2c.so
2170 $(objpfx)tst-initorder2c.so: $(objpfx)tst-initorder2d.so
2171 LDFLAGS-tst-initorder2 = -Wl,--no-as-needed
2172 LDFLAGS-tst-initorder2a.so = -Wl,--no-as-needed
2173 LDFLAGS-tst-initorder2b.so = -Wl,--no-as-needed
2174 LDFLAGS-tst-initorder2c.so = -Wl,--no-as-needed
2175 define o-iterator-doit
2176 $(objpfx)tst-initorder2$o.os: tst-initorder2.c; \
2177 $$(compile-command.c) -DNAME=\"$o\"
2178 endef
2179 object-suffixes-left := a b c d
2180 include $(o-iterator)
2182 $(objpfx)tst-initorder2-cmp.out: tst-initorder2.exp $(objpfx)tst-initorder2.out
2183 cmp $^ > $@; \
2184 $(evaluate-test)
2186 $(objpfx)tst-relsort1mod1.so: $(libm) $(objpfx)tst-relsort1mod2.so
2187 $(objpfx)tst-relsort1mod2.so: $(libm)
2188 $(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
2189 $(objpfx)tst-relsort1mod2.so
2191 $(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so
2192 $(test-wrapper-env) \
2193 LD_TRACE_LOADED_OBJECTS=1 \
2194 LD_DEBUG=unused \
2195 LD_PRELOAD= \
2196 $(rtld-prefix) \
2197 $< > $@; \
2198 $(evaluate-test)
2200 $(objpfx)tst-unused-dep-cmp.out: $(objpfx)tst-unused-dep.out
2201 cmp $< /dev/null > $@; \
2202 $(evaluate-test)
2204 $(objpfx)tst-audit11.out: $(objpfx)tst-auditmod11.so $(objpfx)tst-audit11mod1.so
2205 tst-audit11-ENV = LD_AUDIT=$(objpfx)tst-auditmod11.so
2206 $(objpfx)tst-audit11mod1.so: $(objpfx)tst-audit11mod2.so
2207 LDFLAGS-tst-audit11mod2.so = -Wl,--version-script=tst-audit11mod2.map,-soname,tst-audit11mod2.so
2209 $(objpfx)tst-audit12.out: $(objpfx)tst-auditmod12.so $(objpfx)tst-audit12mod1.so $(objpfx)tst-audit12mod3.so
2210 tst-audit12-ENV = LD_AUDIT=$(objpfx)tst-auditmod12.so
2211 $(objpfx)tst-audit12mod1.so: $(objpfx)tst-audit12mod2.so
2212 LDFLAGS-tst-audit12mod2.so = -Wl,--version-script=tst-audit12mod2.map
2214 $(objpfx)tst-audit13.out: $(objpfx)tst-audit13mod1.so
2215 LDFLAGS-tst-audit13mod1.so = -Wl,-z,lazy
2216 tst-audit13-ENV = LD_AUDIT=$(objpfx)tst-audit13mod1.so
2218 $(objpfx)tst-auditmany.out: $(objpfx)tst-auditmanymod1.so \
2219 $(objpfx)tst-auditmanymod2.so $(objpfx)tst-auditmanymod3.so \
2220 $(objpfx)tst-auditmanymod4.so $(objpfx)tst-auditmanymod5.so \
2221 $(objpfx)tst-auditmanymod6.so $(objpfx)tst-auditmanymod7.so \
2222 $(objpfx)tst-auditmanymod8.so $(objpfx)tst-auditmanymod9.so
2223 tst-auditmany-ENV = \
2224 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
2226 LDFLAGS-tst-audit14 = -Wl,--audit=tst-auditlogmod-1.so,--disable-new-dtags
2227 $(objpfx)tst-auditlogmod-1.so: $(libsupport)
2228 $(objpfx)tst-audit14.out: $(objpfx)tst-auditlogmod-1.so
2229 LDFLAGS-tst-audit14a = -Wl,--audit=tst-auditlogmod-1.so,--enable-new-dtags
2230 $(objpfx)tst-audit14a.out: $(objpfx)tst-auditlogmod-1.so
2231 LDFLAGS-tst-audit15 = \
2232 -Wl,--audit=tst-auditlogmod-1.so,--depaudit=tst-auditlogmod-2.so
2233 $(objpfx)tst-auditlogmod-2.so: $(libsupport)
2234 $(objpfx)tst-audit15.out: \
2235 $(objpfx)tst-auditlogmod-1.so $(objpfx)tst-auditlogmod-2.so
2236 LDFLAGS-tst-audit16 = \
2237 -Wl,--audit=tst-auditlogmod-1.so:tst-auditlogmod-2.so \
2238 -Wl,--depaudit=tst-auditlogmod-3.so
2239 $(objpfx)tst-auditlogmod-3.so: $(libsupport)
2240 $(objpfx)tst-audit16.out: \
2241 $(objpfx)tst-auditlogmod-1.so $(objpfx)tst-auditlogmod-2.so \
2242 $(objpfx)tst-auditlogmod-3.so
2243 $(objpfx)tst-audit17.out: $(objpfx)tst-auditmod17.so
2244 # The test check if a audit library without libc.so on DT_NEEDED works as
2245 # intended, so it uses an explicit link rule.
2246 $(objpfx)tst-auditmod17.so: $(objpfx)tst-auditmod17.os
2247 $(CC) -nostdlib -nostartfiles -shared -o $@.new \
2248 $(filter-out $(map-file),$^)
2249 $(call after-link,$@.new)
2250 mv -f $@.new $@
2251 CFLAGS-.os += $(call elide-stack-protector,.os,tst-auditmod17)
2252 tst-audit17-ENV = LD_AUDIT=$(objpfx)tst-auditmod17.so
2254 $(objpfx)tst-audit14-cmp.out: tst-audit14.exp $(objpfx)tst-audit14.out
2255 cmp $^ > $@; \
2256 $(evaluate-test)
2257 $(objpfx)tst-audit14a-cmp.out: tst-audit14.exp $(objpfx)tst-audit14a.out
2258 cmp $^ > $@; \
2259 $(evaluate-test)
2260 $(objpfx)tst-audit15-cmp.out: tst-audit15.exp $(objpfx)tst-audit15.out
2261 cmp $^ > $@; \
2262 $(evaluate-test)
2263 $(objpfx)tst-audit16-cmp.out: tst-audit16.exp $(objpfx)tst-audit16.out
2264 cmp $^ > $@; \
2265 $(evaluate-test)
2267 $(objpfx)tst-audit18.out: $(objpfx)tst-auditmod18.so \
2268 $(objpfx)tst-audit18mod.so
2269 tst-audit18-ARGS = -- $(host-test-program-cmd)
2271 $(objpfx)tst-audit19a.out: $(objpfx)tst-auditmod19a.so
2272 tst-audit19a-ENV = LD_AUDIT=$(objpfx)tst-auditmod19a.so
2274 $(objpfx)tst-audit19b.out: $(objpfx)tst-auditmod19b.so
2275 $(objpfx)tst-audit19b: $(objpfx)tst-audit19bmod.so
2276 tst-audit19b-ARGS = -- $(host-test-program-cmd)
2278 $(objpfx)tst-audit20.out: $(objpfx)tst-auditmod20.so
2279 tst-audit20-ENV = LD_AUDIT=$(objpfx)tst-auditmod20.so
2281 $(objpfx)tst-audit21: $(shared-thread-library)
2282 $(objpfx)tst-audit21.out: $(objpfx)tst-auditmod21a.so
2283 $(objpfx)tst-auditmod21a.so: $(objpfx)tst-auditmod21b.so
2284 tst-audit21-ENV = LD_AUDIT=$(objpfx)tst-auditmod21a.so
2286 $(objpfx)tst-audit22.out: $(objpfx)tst-auditmod22.so
2287 tst-audit22-ARGS = -- $(host-test-program-cmd)
2289 $(objpfx)tst-audit23.out: $(objpfx)tst-auditmod23.so \
2290 $(objpfx)tst-audit23mod.so
2291 tst-audit23-ARGS = -- $(host-test-program-cmd)
2293 $(objpfx)tst-audit24a.out: $(objpfx)tst-auditmod24a.so
2294 $(objpfx)tst-audit24a: $(objpfx)tst-audit24amod1.so \
2295 $(objpfx)tst-audit24amod2.so
2296 tst-audit24a-ENV = LD_AUDIT=$(objpfx)tst-auditmod24a.so
2297 LDFLAGS-tst-audit24a = -Wl,-z,now
2299 $(objpfx)tst-audit24b.out: $(objpfx)tst-auditmod24b.so
2300 $(objpfx)tst-audit24b: $(objpfx)tst-audit24bmod1.so \
2301 $(objpfx)tst-audit24bmod2.so
2302 $(objpfx)tst-audit24bmod1: $(objpfx)tst-audit24bmod2.so
2303 # The test checks if a library without .gnu.version correctly calls the
2304 # audit callbacks. So it uses an explicit link rule to avoid linking
2305 # against libc.so.
2306 $(objpfx)tst-audit24bmod1.so: $(objpfx)tst-audit24bmod1.os
2307 $(CC) -nostdlib -nostartfiles -shared -o $@.new $(objpfx)tst-audit24bmod1.os \
2308 -Wl,-z,now
2309 $(call after-link,$@.new)
2310 mv -f $@.new $@
2311 CFLAGS-.os += $(call elide-stack-protector,.os,tst-audit24bmod1)
2312 $(objpfx)tst-audit24bmod2.so: $(objpfx)tst-audit24bmod2.os
2313 $(CC) -nostdlib -nostartfiles -shared -o $@.new $(objpfx)tst-audit24bmod2.os
2314 $(call after-link,$@.new)
2315 mv -f $@.new $@
2316 CFLAGS-.os += $(call elide-stack-protector,.os,tst-audit24bmod2)
2317 tst-audit24b-ENV = LD_AUDIT=$(objpfx)tst-auditmod24b.so
2318 LDFLAGS-tst-audit24b = -Wl,-z,now
2320 # Same as tst-audit24a, but tests LD_BIND_NOW
2321 $(objpfx)tst-audit24c.out: $(objpfx)tst-auditmod24c.so
2322 $(objpfx)tst-audit24c: $(objpfx)tst-audit24amod1.so \
2323 $(objpfx)tst-audit24amod2.so
2324 tst-audit24c-ENV = LD_BIND_NOW=1 LD_AUDIT=$(objpfx)tst-auditmod24c.so
2325 LDFLAGS-tst-audit24c = -Wl,-z,lazy
2327 $(objpfx)tst-audit24d.out: $(objpfx)tst-auditmod24d.so
2328 $(objpfx)tst-audit24d: $(objpfx)tst-audit24dmod1.so \
2329 $(objpfx)tst-audit24dmod2.so
2330 $(objpfx)tst-audit24dmod1.so: $(objpfx)tst-audit24dmod3.so
2331 LDFLAGS-tst-audit24dmod1.so = -Wl,-z,now
2332 $(objpfx)tst-audit24dmod2.so: $(objpfx)tst-audit24dmod4.so
2333 LDFLAGS-tst-audit24dmod2.so = -Wl,-z,lazy
2334 tst-audit24d-ENV = LD_AUDIT=$(objpfx)tst-auditmod24d.so
2335 LDFLAGS-tst-audit24d = -Wl,-z,lazy
2337 $(objpfx)tst-audit25a.out: $(objpfx)tst-auditmod25.so
2338 $(objpfx)tst-audit25a: $(objpfx)tst-audit25mod1.so \
2339 $(objpfx)tst-audit25mod2.so \
2340 $(objpfx)tst-audit25mod3.so \
2341 $(objpfx)tst-audit25mod4.so
2342 LDFLAGS-tst-audit25a = -Wl,-z,lazy
2343 $(objpfx)tst-audit25mod1.so: $(objpfx)tst-audit25mod3.so
2344 LDFLAGS-tst-audit25mod1.so = -Wl,-z,now
2345 $(objpfx)tst-audit25mod2.so: $(objpfx)tst-audit25mod4.so
2346 LDFLAGS-tst-audit25mod2.so = -Wl,-z,lazy
2347 tst-audit25a-ARGS = -- $(host-test-program-cmd)
2349 $(objpfx)tst-audit25b.out: $(objpfx)tst-auditmod25.so
2350 $(objpfx)tst-audit25b: $(objpfx)tst-audit25mod1.so \
2351 $(objpfx)tst-audit25mod2.so \
2352 $(objpfx)tst-audit25mod3.so \
2353 $(objpfx)tst-audit25mod4.so
2354 LDFLAGS-tst-audit25b = -Wl,-z,now
2355 tst-audit25b-ARGS = -- $(host-test-program-cmd)
2357 $(objpfx)tst-audit28.out: $(objpfx)tst-auditmod28.so
2358 $(objpfx)tst-auditmod28.so: $(libsupport)
2359 tst-audit28-ENV = LD_AUDIT=$(objpfx)tst-auditmod28.so
2361 # tst-sonamemove links against an older implementation of the library.
2362 LDFLAGS-tst-sonamemove-linkmod1.so = \
2363 -Wl,--version-script=tst-sonamemove-linkmod1.map \
2364 -Wl,-soname,tst-sonamemove-runmod1.so
2365 LDFLAGS-tst-sonamemove-runmod1.so = -Wl,--no-as-needed \
2366 -Wl,--version-script=tst-sonamemove-runmod1.map \
2367 -Wl,-soname,tst-sonamemove-runmod1.so
2368 LDFLAGS-tst-sonamemove-runmod2.so = \
2369 -Wl,--version-script=tst-sonamemove-runmod2.map \
2370 -Wl,-soname,tst-sonamemove-runmod2.so
2371 $(objpfx)tst-sonamemove-runmod1.so: $(objpfx)tst-sonamemove-runmod2.so
2372 # Link against the link module, but depend on the run-time modules
2373 # for execution.
2374 $(objpfx)tst-sonamemove-link: $(objpfx)tst-sonamemove-linkmod1.so
2375 $(objpfx)tst-sonamemove-link.out: \
2376 $(objpfx)tst-sonamemove-runmod1.so \
2377 $(objpfx)tst-sonamemove-runmod2.so
2378 $(objpfx)tst-sonamemove-dlopen.out: \
2379 $(objpfx)tst-sonamemove-runmod1.so \
2380 $(objpfx)tst-sonamemove-runmod2.so
2382 $(objpfx)tst-dlmopen-dlerror-mod.so: $(libsupport)
2383 $(objpfx)tst-dlmopen-dlerror.out: $(objpfx)tst-dlmopen-dlerror-mod.so
2385 # Override -z defs, so that we can reference an undefined symbol.
2386 # Force lazy binding for the same reason.
2387 LDFLAGS-tst-latepthreadmod.so = \
2388 -Wl,-z,lazy -Wl,--unresolved-symbols=ignore-all
2389 # Do not optimize sibling calls as the test relies on a JMP_SLOT relocation for
2390 # function this_function_is_not_defined.
2391 CFLAGS-tst-latepthreadmod.c += -fno-optimize-sibling-calls
2392 $(objpfx)tst-latepthreadmod.so: $(shared-thread-library)
2393 $(objpfx)tst-latepthread.out: $(objpfx)tst-latepthreadmod.so
2395 # The test modules are parameterized by preprocessor macros.
2396 $(patsubst %,$(objpfx)%.os,$(tst-tls-many-dynamic-modules)): \
2397 $(objpfx)tst-tls-manydynamic%mod.os : tst-tls-manydynamicmod.c
2398 $(compile-command.c) \
2399 -DNAME=tls_global_$* -DSETTER=set_value_$* -DGETTER=get_value_$*
2400 $(objpfx)tst-tls-manydynamic: $(shared-thread-library)
2401 $(objpfx)tst-tls-manydynamic.out: \
2402 $(patsubst %,$(objpfx)%.so,$(tst-tls-many-dynamic-modules))
2404 $(objpfx)tst-ldconfig-X.out : tst-ldconfig-X.sh $(objpfx)ldconfig
2405 $(SHELL) $< '$(common-objpfx)' '$(test-wrapper-env)' \
2406 '$(run-program-env)' > $@; \
2407 $(evaluate-test)
2409 $(objpfx)tst-ldconfig-p.out : tst-ldconfig-p.sh $(objpfx)ldconfig
2410 $(SHELL) $< '$(common-objpfx)' '$(test-wrapper-env)' \
2411 '$(run-program-env)' > $@; \
2412 $(evaluate-test)
2414 LDFLAGS-tst-ldconfig-soname-lib-with-soname.so = \
2415 -Wl,-soname,libtst-ldconfig-soname-lib-with-soname.so.1
2417 $(objpfx)tst-ldconfig-soname.out : tst-ldconfig-soname.sh \
2418 $(objpfx)ldconfig \
2419 $(objpfx)tst-ldconfig-soname-lib-with-soname.so \
2420 $(objpfx)tst-ldconfig-soname-lib-without-soname.so
2421 $(SHELL) $< '$(common-objpfx)' '$(test-wrapper-env)' \
2422 '$(run-program-env)' > $@; \
2423 $(evaluate-test)
2425 # Test static linking of all the libraries we can possibly link
2426 # together. Note that in some configurations this may be less than the
2427 # complete list of libraries we build but we try to maxmimize this list.
2428 ifeq ($(pthread-in-libc),no)
2429 $(objpfx)tst-linkall-static: \
2430 $(common-objpfx)resolv/libanl.a
2431 endif
2432 $(objpfx)tst-linkall-static: \
2433 $(common-objpfx)math/libm.a \
2434 $(common-objpfx)resolv/libresolv.a \
2435 $(common-objpfx)login/libutil.a \
2436 $(common-objpfx)rt/librt.a \
2437 $(static-thread-library)
2439 ifeq ($(build-crypt),yes)
2440 # If we are using NSS crypto and we have the ability to link statically
2441 # then we include libcrypt.a, otherwise we leave out libcrypt.a and
2442 # link as much as we can into the tst-linkall-static test. This assumes
2443 # that linking with libcrypt.a does everything required to include the
2444 # static NSS crypto library.
2445 ifeq (yesyes,$(nss-crypt)$(static-nss-crypt))
2446 $(objpfx)tst-linkall-static: \
2447 $(common-objpfx)crypt/libcrypt.a
2448 endif
2449 # If we are not using NSS crypto then we always have the ability to link
2450 # with libcrypt.a.
2451 ifeq (no,$(nss-crypt))
2452 $(objpfx)tst-linkall-static: \
2453 $(common-objpfx)crypt/libcrypt.a
2454 endif
2455 endif
2457 LDFLAGS-nextmod3.so = -Wl,--version-script=nextmod3.map
2459 # The application depends on the DSO, and the DSO loads the plugin.
2460 # The plugin also depends on the DSO. This creates the circular
2461 # dependency via dlopen that we're testing to make sure works.
2462 $(objpfx)tst-nodelete-dlclose-plugin.so: $(objpfx)tst-nodelete-dlclose-dso.so
2463 $(objpfx)tst-nodelete-dlclose: $(objpfx)tst-nodelete-dlclose-dso.so
2464 $(objpfx)tst-nodelete-dlclose.out: $(objpfx)tst-nodelete-dlclose-dso.so \
2465 $(objpfx)tst-nodelete-dlclose-plugin.so
2467 tst-env-setuid-ENV = MALLOC_CHECK_=2 MALLOC_MMAP_THRESHOLD_=4096 \
2468 LD_HWCAP_MASK=0x1
2470 $(objpfx)tst-debug1.out: $(objpfx)tst-debug1mod1.so
2472 $(objpfx)tst-debug1mod1.so: $(objpfx)testobj1.so
2473 $(OBJCOPY) --only-keep-debug $< $@
2475 $(objpfx)tst-main1: $(objpfx)tst-main1mod.so
2476 CRT-tst-main1 := $(csu-objpfx)crt1.o
2477 tst-main1-no-pie = yes
2478 LDLIBS-tst-main1 = $(libsupport)
2479 tst-main1mod.so-no-z-defs = yes
2481 LDLIBS-tst-absolute-sym-lib.so = tst-absolute-sym-lib.lds
2482 $(objpfx)tst-absolute-sym-lib.so: $(LDLIBS-tst-absolute-sym-lib.so)
2483 $(objpfx)tst-absolute-sym: $(objpfx)tst-absolute-sym-lib.so
2485 LDLIBS-tst-absolute-zero-lib.so = tst-absolute-zero-lib.lds
2486 $(objpfx)tst-absolute-zero-lib.so: $(LDLIBS-tst-absolute-zero-lib.so)
2487 $(objpfx)tst-absolute-zero: $(objpfx)tst-absolute-zero-lib.so
2489 $(objpfx)tst-big-note: $(objpfx)tst-big-note-lib.so
2490 # Avoid creating an ABI tag note, which may come before the
2491 # artificial, large note in tst-big-note-lib.o and invalidate the
2492 # test.
2493 $(objpfx)tst-big-note-lib.so: $(objpfx)tst-big-note-lib.o
2494 $(LINK.o) -shared -o $@ $(LDFLAGS.so) $(dt-relr-ldflag) $<
2496 $(objpfx)tst-unwind-ctor: $(objpfx)tst-unwind-ctor-lib.so
2498 CFLAGS-tst-unwind-main.c += -funwind-tables -DUSE_PTHREADS=0
2500 $(objpfx)tst-initfinilazyfail.out: \
2501 $(objpfx)tst-initlazyfailmod.so $(objpfx)tst-finilazyfailmod.so
2502 # Override -z defs, so that we can reference an undefined symbol.
2503 # Force lazy binding for the same reason.
2504 LDFLAGS-tst-initlazyfailmod.so = \
2505 -Wl,-z,lazy -Wl,--unresolved-symbols=ignore-all
2506 LDFLAGS-tst-finilazyfailmod.so = \
2507 -Wl,-z,lazy -Wl,--unresolved-symbols=ignore-all
2509 $(objpfx)tst-dlopenfail.out: \
2510 $(objpfx)tst-dlopenfailmod1.so $(objpfx)tst-dlopenfailmod2.so
2511 # Order matters here. tst-dlopenfaillinkmod.so's soname ensures a
2512 # run-time loader failure. --as-needed breaks this test because
2513 # nothing actually references tst-dlopenfailmod2.so (with its soname
2514 # tst-dlopenfail-missingmod.so).
2515 LDFLAGS-tst-dlopenfailmod1.so = -Wl,--no-as-needed
2516 $(objpfx)tst-dlopenfailmod1.so: \
2517 $(shared-thread-library) $(objpfx)tst-dlopenfaillinkmod.so
2518 LDFLAGS-tst-dlopenfaillinkmod.so = -Wl,-soname,tst-dlopenfail-missingmod.so
2519 $(objpfx)tst-dlopenfailmod2.so: $(objpfx)tst-dlopenfailnodelmod.so
2520 $(objpfx)tst-dlopenfail-2.out: \
2521 $(objpfx)tst-dlopenfailmod1.so $(objpfx)tst-dlopenfailmod2.so \
2522 $(objpfx)tst-dlopenfailmod3.so
2523 # tst-dlopenfailnodelmod.so emulates how libpthread was linked.
2524 $(objpfx)tst-dlopenfailnodelmod.so: $(libsupport)
2525 LDFLAGS-tst-dlopenfailnodelmod.so = \
2526 -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
2527 # tst-dlopenfail should export the libsupport symbols, so that
2528 # tst-dlopenfailnodelmod.so uses them for error reporting.
2529 LDFLAGS-tst-dlopenfail = -Wl,-E
2531 $(objpfx)tst-dlopen-nodelete-reloc.out: \
2532 $(objpfx)tst-dlopen-nodelete-reloc-mod1.so \
2533 $(objpfx)tst-dlopen-nodelete-reloc-mod2.so \
2534 $(objpfx)tst-dlopen-nodelete-reloc-mod3.so \
2535 $(objpfx)tst-dlopen-nodelete-reloc-mod4.so \
2536 $(objpfx)tst-dlopen-nodelete-reloc-mod5.so \
2537 $(objpfx)tst-dlopen-nodelete-reloc-mod6.so \
2538 $(objpfx)tst-dlopen-nodelete-reloc-mod7.so \
2539 $(objpfx)tst-dlopen-nodelete-reloc-mod8.so \
2540 $(objpfx)tst-dlopen-nodelete-reloc-mod9.so \
2541 $(objpfx)tst-dlopen-nodelete-reloc-mod10.so \
2542 $(objpfx)tst-dlopen-nodelete-reloc-mod11.so \
2543 $(objpfx)tst-dlopen-nodelete-reloc-mod12.so \
2544 $(objpfx)tst-dlopen-nodelete-reloc-mod13.so \
2545 $(objpfx)tst-dlopen-nodelete-reloc-mod14.so \
2546 $(objpfx)tst-dlopen-nodelete-reloc-mod15.so \
2547 $(objpfx)tst-dlopen-nodelete-reloc-mod16.so \
2548 $(objpfx)tst-dlopen-nodelete-reloc-mod17.so
2549 tst-dlopen-nodelete-reloc-mod2.so-no-z-defs = yes
2550 LDFLAGS-tst-dlopen-nodelete-reloc-mod2.so = -Wl,-z,nodelete
2551 $(objpfx)tst-dlopen-nodelete-reloc-mod4.so: \
2552 $(objpfx)tst-dlopen-nodelete-reloc-mod3.so
2553 LDFLAGS-tst-dlopen-nodelete-reloc-mod4.so = -Wl,--no-as-needed
2554 $(objpfx)tst-dlopen-nodelete-reloc-mod5.so: \
2555 $(objpfx)tst-dlopen-nodelete-reloc-mod4.so
2556 LDFLAGS-tst-dlopen-nodelete-reloc-mod5.so = -Wl,-z,nodelete,--no-as-needed
2557 tst-dlopen-nodelete-reloc-mod5.so-no-z-defs = yes
2558 tst-dlopen-nodelete-reloc-mod7.so-no-z-defs = yes
2559 tst-dlopen-nodelete-reloc-mod11.so-no-z-defs = yes
2560 $(objpfx)tst-dlopen-nodelete-reloc-mod13.so: \
2561 $(objpfx)tst-dlopen-nodelete-reloc-mod12.so
2562 $(objpfx)tst-dlopen-nodelete-reloc-mod15.so: \
2563 $(objpfx)tst-dlopen-nodelete-reloc-mod14.so
2564 tst-dlopen-nodelete-reloc-mod16.so-no-z-defs = yes
2565 $(objpfx)tst-dlopen-nodelete-reloc-mod16.so: \
2566 $(objpfx)tst-dlopen-nodelete-reloc-mod15.so
2567 LDFLAGS-tst-dlopen-nodelete-reloc-mod16.so = -Wl,--no-as-needed
2568 $(objpfx)tst-dlopen-nodelete-reloc-mod17.so: \
2569 $(objpfx)tst-dlopen-nodelete-reloc-mod15.so \
2570 $(objpfx)tst-dlopen-nodelete-reloc-mod16.so
2571 LDFLAGS-tst-dlopen-nodelete-reloc-mod17.so = -Wl,--no-as-needed
2573 $(objpfx)tst-ldconfig-ld_so_conf-update.out: $(objpfx)tst-ldconfig-ld-mod.so
2575 LDFLAGS-tst-filterobj-flt.so = -Wl,--filter=$(objpfx)tst-filterobj-filtee.so
2576 $(objpfx)tst-filterobj: $(objpfx)tst-filterobj-flt.so
2577 $(objpfx)tst-filterobj.out: $(objpfx)tst-filterobj-filtee.so
2578 $(objpfx)tst-filterobj-dlopen.out: $(objpfx)tst-filterobj-filtee.so
2580 LDFLAGS-tst-filterobj-aux.so = -Wl,--auxiliary=$(objpfx)tst-filterobj-filtee.so
2581 $(objpfx)tst-auxobj: $(objpfx)tst-filterobj-aux.so
2582 $(objpfx)tst-auxobj.out: $(objpfx)tst-filterobj-filtee.so
2583 $(objpfx)tst-auxobj-dlopen.out: $(objpfx)tst-filterobj-filtee.so
2585 $(objpfx)tst-single_threaded: $(objpfx)tst-single_threaded-mod1.so
2586 $(objpfx)tst-single_threaded.out: \
2587 $(objpfx)tst-single_threaded-mod2.so $(objpfx)tst-single_threaded-mod3.so
2588 $(objpfx)tst-single_threaded-static-dlopen: \
2589 $(objpfx)tst-single_threaded-mod1.o
2590 $(objpfx)tst-single_threaded-static-dlopen.out: \
2591 $(objpfx)tst-single_threaded-mod2.so
2592 $(objpfx)tst-single_threaded-pthread: \
2593 $(objpfx)tst-single_threaded-mod1.so $(shared-thread-library)
2594 $(objpfx)tst-single_threaded-pthread.out: \
2595 $(objpfx)tst-single_threaded-mod2.so $(objpfx)tst-single_threaded-mod3.so \
2596 $(objpfx)tst-single_threaded-mod4.so
2597 $(objpfx)tst-single_threaded-pthread-static: $(static-thread-library)
2599 $(objpfx)tst-tls-ie: $(shared-thread-library)
2600 $(objpfx)tst-tls-ie.out: \
2601 $(objpfx)tst-tls-ie-mod0.so \
2602 $(objpfx)tst-tls-ie-mod1.so \
2603 $(objpfx)tst-tls-ie-mod2.so \
2604 $(objpfx)tst-tls-ie-mod3.so \
2605 $(objpfx)tst-tls-ie-mod4.so \
2606 $(objpfx)tst-tls-ie-mod5.so \
2607 $(objpfx)tst-tls-ie-mod6.so
2609 $(objpfx)tst-tls-ie-dlmopen: $(shared-thread-library)
2610 $(objpfx)tst-tls-ie-dlmopen.out: \
2611 $(objpfx)tst-tls-ie-mod0.so \
2612 $(objpfx)tst-tls-ie-mod1.so \
2613 $(objpfx)tst-tls-ie-mod2.so \
2614 $(objpfx)tst-tls-ie-mod3.so \
2615 $(objpfx)tst-tls-ie-mod4.so \
2616 $(objpfx)tst-tls-ie-mod5.so \
2617 $(objpfx)tst-tls-ie-mod6.so
2619 $(objpfx)argv0test.out: tst-rtld-argv0.sh $(objpfx)ld.so \
2620 $(objpfx)argv0test
2621 $(SHELL) $< $(objpfx)ld.so $(objpfx)argv0test \
2622 '$(test-wrapper-env)' '$(run_program_env)' \
2623 '$(rpath-link)' 'test-argv0' > $@; \
2624 $(evaluate-test)
2626 # A list containing the name of the most likely searched subdirectory
2627 # of the glibc-hwcaps directory, for each supported architecture (in
2628 # other words, the oldest hardware level recognized by the
2629 # glibc-hwcaps mechanism for this architecture). Used to obtain test
2630 # coverage for some glibc-hwcaps tests for the widest possible range
2631 # of systems.
2632 glibc-hwcaps-first-subdirs-for-tests = power9 x86-64-v2 z13
2634 # The test modules are parameterized by preprocessor macros.
2635 LDFLAGS-libmarkermod1-1.so += -Wl,-soname,libmarkermod1.so
2636 LDFLAGS-libmarkermod2-1.so += -Wl,-soname,libmarkermod2.so
2637 LDFLAGS-libmarkermod3-1.so += -Wl,-soname,libmarkermod3.so
2638 LDFLAGS-libmarkermod4-1.so += -Wl,-soname,libmarkermod4.so
2639 LDFLAGS-libmarkermod5-1.so += -Wl,-soname,libmarkermod5.so
2640 $(objpfx)libmarkermod%.os : markermodMARKER-VALUE.c
2641 $(compile-command.c) \
2642 -DMARKER=marker$(firstword $(subst -, ,$*)) \
2643 -DVALUE=$(lastword $(subst -, ,$*))
2644 $(objpfx)libmarkermod1.so: $(objpfx)libmarkermod1-1.so
2645 cp $< $@
2646 $(objpfx)libmarkermod2.so: $(objpfx)libmarkermod2-1.so
2647 cp $< $@
2648 $(objpfx)libmarkermod3.so: $(objpfx)libmarkermod3-1.so
2649 cp $< $@
2650 $(objpfx)libmarkermod4.so: $(objpfx)libmarkermod4-1.so
2651 cp $< $@
2652 $(objpfx)libmarkermod5.so: $(objpfx)libmarkermod5-1.so
2653 cp $< $@
2655 # tst-glibc-hwcaps-prepend checks that --glibc-hwcaps-prepend is
2656 # preferred over auto-detected subdirectories.
2657 $(objpfx)tst-glibc-hwcaps-prepend: $(objpfx)libmarkermod1-1.so
2658 $(objpfx)glibc-hwcaps/prepend-markermod1/libmarkermod1.so: \
2659 $(objpfx)libmarkermod1-2.so
2660 $(make-target-directory)
2661 cp $< $@
2662 $(objpfx)glibc-hwcaps/%/libmarkermod1.so: $(objpfx)libmarkermod1-3.so
2663 $(make-target-directory)
2664 cp $< $@
2665 $(objpfx)tst-glibc-hwcaps-prepend.out: \
2666 $(objpfx)tst-glibc-hwcaps-prepend $(objpfx)libmarkermod1.so \
2667 $(patsubst %,$(objpfx)glibc-hwcaps/%/libmarkermod1.so,prepend-markermod1 \
2668 $(glibc-hwcaps-first-subdirs-for-tests))
2669 $(test-wrapper) $(rtld-prefix) \
2670 --glibc-hwcaps-prepend prepend-markermod1 \
2671 $< > $@; \
2672 $(evaluate-test)
2674 # Like tst-glibc-hwcaps-prepend, but uses a container and loads the
2675 # library via ld.so.cache. Test setup is contained in the test
2676 # itself.
2677 $(objpfx)tst-glibc-hwcaps-prepend-cache.out: \
2678 $(objpfx)tst-glibc-hwcaps-prepend-cache $(objpfx)libmarkermod1-1.so \
2679 $(objpfx)libmarkermod1-2.so $(objpfx)libmarkermod1-3.so
2681 # tst-glibc-hwcaps-mask checks that --glibc-hwcaps-mask can be used to
2682 # suppress all auto-detected subdirectories.
2683 $(objpfx)tst-glibc-hwcaps-mask: $(objpfx)libmarkermod1-1.so
2684 $(objpfx)tst-glibc-hwcaps-mask.out: \
2685 $(objpfx)tst-glibc-hwcaps-mask $(objpfx)libmarkermod1.so \
2686 $(patsubst %,$(objpfx)glibc-hwcaps/%/libmarkermod1.so,\
2687 $(glibc-hwcaps-first-subdirs-for-tests))
2688 $(test-wrapper) $(rtld-prefix) \
2689 --glibc-hwcaps-mask does-not-exist \
2690 $< > $@; \
2691 $(evaluate-test)
2693 # Generic dependency for sysdeps implementation of
2694 # tst-glibc-hwcaps-cache.
2695 $(objpfx)tst-glibc-hwcaps-cache.out: $(objpfx)tst-glibc-hwcaps
2697 $(objpfx)list-tunables.out: tst-rtld-list-tunables.sh $(objpfx)ld.so
2698 $(SHELL) $< $(objpfx)ld.so '$(test-wrapper-env)' \
2699 '$(run_program_env)' > $(objpfx)/tst-rtld-list-tunables.out
2700 cmp tst-rtld-list-tunables.exp \
2701 $(objpfx)/tst-rtld-list-tunables.out > $@; \
2702 $(evaluate-test)
2704 tst-dst-static-ENV = LD_LIBRARY_PATH='$$ORIGIN'
2706 $(objpfx)tst-rtld-help.out: $(objpfx)ld.so
2707 $(test-wrapper) $(rtld-prefix) --help > $@; \
2708 status=$$?; \
2709 echo "info: ld.so exit status: $$status" >> $@; \
2710 (exit $$status); \
2711 $(evaluate-test)
2713 # Reuses tst-tls-many-dynamic-modules
2714 $(patsubst %,$(objpfx)%.os,$(tst-tls-many-dynamic-modules-dep)): \
2715 $(objpfx)tst-tls-manydynamic%mod-dep.os : tst-tls-manydynamicmod.c
2716 $(compile-command.c) \
2717 -DNAME=tls_global_$* -DSETTER=set_value_$* -DGETTER=get_value_$*
2718 $(patsubst %,$(objpfx)%.os,$(tst-tls-many-dynamic-modules-dep-bad)): \
2719 $(objpfx)tst-tls-manydynamic%mod-dep-bad.os : tst-tls-manydynamicmod.c
2720 $(compile-command.c) \
2721 -DNAME=tls_global_$* -DSETTER=set_value_$* -DGETTER=get_value_$*
2722 tst-tls20mod-bad.so-no-z-defs = yes
2723 # Single dependency.
2724 $(objpfx)tst-tls-manydynamic0mod-dep.so: $(objpfx)tst-tls-manydynamic1mod-dep.so
2725 # Double dependencies.
2726 $(objpfx)tst-tls-manydynamic2mod-dep.so: $(objpfx)tst-tls-manydynamic3mod-dep.so \
2727 $(objpfx)tst-tls-manydynamic4mod-dep.so
2728 # Double dependencies with each dependency depent of another module.
2729 $(objpfx)tst-tls-manydynamic5mod-dep.so: $(objpfx)tst-tls-manydynamic6mod-dep.so \
2730 $(objpfx)tst-tls-manydynamic7mod-dep.so
2731 $(objpfx)tst-tls-manydynamic6mod-dep.so: $(objpfx)tst-tls-manydynamic8mod-dep.so
2732 $(objpfx)tst-tls-manydynamic7mod-dep.so: $(objpfx)tst-tls-manydynamic8mod-dep.so
2733 # Long chain with one double dependency in the middle
2734 $(objpfx)tst-tls-manydynamic9mod-dep.so: $(objpfx)tst-tls-manydynamic10mod-dep.so \
2735 $(objpfx)tst-tls-manydynamic11mod-dep.so
2736 $(objpfx)tst-tls-manydynamic10mod-dep.so: $(objpfx)tst-tls-manydynamic12mod-dep.so
2737 $(objpfx)tst-tls-manydynamic12mod-dep.so: $(objpfx)tst-tls-manydynamic13mod-dep.so
2738 # Long chain with two double depedencies in the middle
2739 $(objpfx)tst-tls-manydynamic14mod-dep.so: $(objpfx)tst-tls-manydynamic15mod-dep.so
2740 $(objpfx)tst-tls-manydynamic15mod-dep.so: $(objpfx)tst-tls-manydynamic16mod-dep.so \
2741 $(objpfx)tst-tls-manydynamic17mod-dep.so
2742 $(objpfx)tst-tls-manydynamic16mod-dep.so: $(objpfx)tst-tls-manydynamic18mod-dep.so \
2743 $(objpfx)tst-tls-manydynamic19mod-dep.so
2744 # Same but with an invalid module.
2745 # Single dependency.
2746 $(objpfx)tst-tls-manydynamic0mod-dep-bad.so: $(objpfx)tst-tls20mod-bad.so
2747 LDFLAGS-tst-tls-manydynamic0mod-dep-bad.so = -Wl,--no-as-needed
2748 # Double dependencies.
2749 $(objpfx)tst-tls-manydynamic1mod-dep-bad.so: $(objpfx)tst-tls-manydynamic2mod-dep-bad.so \
2750 $(objpfx)tst-tls20mod-bad.so
2751 LDFLAGS-tst-tls-manydynamic1mod-dep-bad.so = -Wl,--no-as-needed
2752 # Double dependencies with each dependency depent of another module.
2753 $(objpfx)tst-tls-manydynamic3mod-dep-bad.so: $(objpfx)tst-tls-manydynamic4mod-dep-bad.so \
2754 $(objpfx)tst-tls-manydynamic5mod-dep-bad.so
2755 LDFLAGS-tst-tls-manydynamic3mod-dep-bad.so = -Wl,--no-as-needed
2756 $(objpfx)tst-tls-manydynamic4mod-dep-bad.so: $(objpfx)tst-tls20mod-bad.so
2757 LDFLAGS-tst-tls-manydynamic4mod-dep-bad.so = -Wl,--no-as-needed
2758 $(objpfx)tst-tls-manydynamic5mod-dep-bad.so: $(objpfx)tst-tls20mod-bad.so
2759 LDFLAGS-tst-tls-manydynamic5mod-dep-bad.so = -Wl,--no-as-needed
2760 # Long chain with one double dependency in the middle
2761 $(objpfx)tst-tls-manydynamic6mod-dep-bad.so: $(objpfx)tst-tls-manydynamic7mod-dep-bad.so \
2762 $(objpfx)tst-tls-manydynamic8mod-dep-bad.so
2763 LDFLAGS-tst-tls-manydynamic6mod-dep-bad.so = -Wl,--no-as-needed
2764 $(objpfx)tst-tls-manydynamic7mod-dep-bad.so: $(objpfx)tst-tls-manydynamic9mod-dep-bad.so
2765 LDFLAGS-tst-tls-manydynamic7mod-dep-bad.so = -Wl,--no-as-needed
2766 $(objpfx)tst-tls-manydynamic9mod-dep-bad.so: $(objpfx)tst-tls20mod-bad.so
2767 LDFLAGS-tst-tls-manydynamic9mod-dep-bad.so = -Wl,--no-as-needed
2768 # Long chain with two double depedencies in the middle
2769 $(objpfx)tst-tls-manydynamic10mod-dep-bad.so: $(objpfx)tst-tls-manydynamic11mod-dep-bad.so
2770 LDFLAGS-tst-tls-manydynamic10mod-dep-bad.so = -Wl,--no-as-needed
2771 $(objpfx)tst-tls-manydynamic11mod-dep-bad.so: $(objpfx)tst-tls-manydynamic12mod-dep-bad.so \
2772 $(objpfx)tst-tls-manydynamic13mod-dep-bad.so
2773 LDFLAGS-tst-tls-manydynamic11mod-dep-bad.so = -Wl,--no-as-needed
2774 $(objpfx)tst-tls-manydynamic12mod-dep-bad.so: $(objpfx)tst-tls-manydynamic14mod-dep-bad.so \
2775 $(objpfx)tst-tls20mod-bad.so
2776 LDFLAGS-tst-tls-manydynamic12mod-dep-bad.so = -Wl,--no-as-needed
2777 $(objpfx)tst-tls20: $(shared-thread-library)
2778 $(objpfx)tst-tls20.out: $(objpfx)tst-tls20mod-bad.so \
2779 $(tst-tls-many-dynamic-modules:%=$(objpfx)%.so) \
2780 $(tst-tls-many-dynamic-modules-dep:%=$(objpfx)%.so) \
2781 $(tst-tls-many-dynamic-modules-dep-bad:%=$(objpfx)%.so) \
2783 # Reuses tst-tls-many-dynamic-modules
2784 $(objpfx)tst-tls21: $(shared-thread-library)
2785 $(objpfx)tst-tls21.out: $(objpfx)tst-tls21mod.so
2786 $(objpfx)tst-tls21mod.so: $(tst-tls-many-dynamic-modules:%=$(objpfx)%.so)
2788 $(objpfx)tst-getauxval-static.out: $(objpfx)tst-auxvalmod.so
2789 tst-getauxval-static-ENV = LD_LIBRARY_PATH=$(objpfx):$(common-objpfx)
2791 $(objpfx)tst-dlmopen-gethostbyname.out: $(objpfx)tst-dlmopen-gethostbyname-mod.so
2793 $(objpfx)tst-ro-dynamic: $(objpfx)tst-ro-dynamic-mod.so
2794 $(objpfx)tst-ro-dynamic-mod.so: $(objpfx)tst-ro-dynamic-mod.os \
2795 tst-ro-dynamic-mod.map
2796 $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
2797 $(dt-relr-ldflag) \
2798 -Wl,--script=tst-ro-dynamic-mod.map \
2799 $(objpfx)tst-ro-dynamic-mod.os
2801 $(objpfx)tst-rtld-run-static.out: $(objpfx)/ldconfig
2803 $(objpfx)tst-dl_find_object.out: \
2804 $(objpfx)tst-dl_find_object-mod1.so $(objpfx)tst-dl_find_object-mod2.so
2805 $(objpfx)tst-dl_find_object-static.out: \
2806 $(objpfx)tst-dl_find_object-mod1.so $(objpfx)tst-dl_find_object-mod2.so
2807 tst-dl_find_object-static-ENV = $(static-dlopen-environment)
2808 CFLAGS-tst-dl_find_object.c += -funwind-tables
2809 CFLAGS-tst-dl_find_object-static.c += -funwind-tables
2810 LDFLAGS-tst-dl_find_object-static += -Wl,--eh-frame-hdr
2811 CFLAGS-tst-dl_find_object-mod1.c += -funwind-tables
2812 CFLAGS-tst-dl_find_object-mod2.c += -funwind-tables
2813 LDFLAGS-tst-dl_find_object-mod2.so += -Wl,--enable-new-dtags,-z,nodelete
2814 $(objpfx)tst-dl_find_object-threads: $(shared-thread-library)
2815 CFLAGS-tst-dl_find_object-threads.c += -funwind-tables
2816 $(objpfx)tst-dl_find_object-threads.out: \
2817 $(objpfx)tst-dl_find_object-mod1.so \
2818 $(objpfx)tst-dl_find_object-mod2.so \
2819 $(objpfx)tst-dl_find_object-mod3.so \
2820 $(objpfx)tst-dl_find_object-mod4.so \
2821 $(objpfx)tst-dl_find_object-mod5.so \
2822 $(objpfx)tst-dl_find_object-mod6.so \
2823 $(objpfx)tst-dl_find_object-mod7.so \
2824 $(objpfx)tst-dl_find_object-mod8.so \
2825 $(objpfx)tst-dl_find_object-mod9.so
2826 CFLAGS-tst-dl_find_object-mod3.c += -funwind-tables
2827 CFLAGS-tst-dl_find_object-mod4.c += -funwind-tables
2828 CFLAGS-tst-dl_find_object-mod5.c += -funwind-tables
2829 CFLAGS-tst-dl_find_object-mod6.c += -funwind-tables
2830 CFLAGS-tst-dl_find_object-mod7.c += -funwind-tables
2831 CFLAGS-tst-dl_find_object-mod8.c += -funwind-tables
2832 CFLAGS-tst-dl_find_object-mod9.c += -funwind-tables
2834 $(objpfx)tst-p_alignmod-base.so: $(libsupport)
2835 LDFLAGS-tst-p_alignmod-base.so += -Wl,-z,max-page-size=0x200000
2837 $(objpfx)tst-p_align1: $(objpfx)tst-p_alignmod1.so
2839 # Make a copy of tst-p_alignmod-base.so and lower p_align of the first
2840 # PT_LOAD segment.
2841 $(objpfx)tst-p_alignmod1.so: $(objpfx)tst-p_alignmod-base.so
2842 rm -f $@
2843 cp $(objpfx)tst-p_alignmod-base.so $@
2844 $(PYTHON) $(..)scripts/tst-elf-edit.py -a half $@
2846 $(objpfx)tst-p_align2: $(objpfx)tst-p_alignmod2.so
2848 # Make a copy of tst-p_alignmod-base.so and update p_align of the first
2849 # PT_LOAD segment.
2850 $(objpfx)tst-p_alignmod2.so: $(objpfx)tst-p_alignmod-base.so
2851 rm -f $@
2852 cp $(objpfx)tst-p_alignmod-base.so $@
2853 $(PYTHON) $(..)scripts/tst-elf-edit.py -a 1 $@
2855 LDFLAGS-tst-p_alignmod3.so += -Wl,-z,max-page-size=0x100,-z,common-page-size=0x100
2857 $(objpfx)tst-p_align3: $(objpfx)tst-p_alignmod3.so
2858 $(objpfx)tst-p_align3.out: tst-p_align3.sh $(objpfx)tst-p_align3
2859 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \
2860 $(evaluate-test)
2862 $(objpfx)check-abi-version-libc.out: $(common-objpfx)libc.so
2863 LC_ALL=C $(READELF) -V -W $< \
2864 | sed -ne '/.gnu.version_d/, /.gnu.version_r/ p' \
2865 | grep GLIBC_ABI_DT_RELR > $@; \
2866 $(evaluate-test)
2868 $(objpfx)check-tst-relr-pie.out: $(objpfx)tst-relr-pie
2869 LC_ALL=C $(OBJDUMP) -p $< \
2870 | sed -ne '/required from libc.so/,$$ p' \
2871 | grep GLIBC_ABI_DT_RELR > $@; \
2872 $(evaluate-test)
2874 # The test checks if a DT_RELR shared library without DT_NEEDED works as
2875 # intended, so it uses an explicit link rule.
2876 $(objpfx)tst-relr2: $(objpfx)tst-relr-mod2.so
2877 $(objpfx)tst-relr-mod2.so: $(objpfx)tst-relr-mod2.os
2878 $(LINK.o) -nostdlib -nostartfiles -Wl,-z,pack-relative-relocs \
2879 $(LDFLAGS-soname-fname) \
2880 -shared -o $@.new $(filter-out $(map-file),$^)
2881 $(call after-link,$@.new)
2882 mv -f $@.new $@
2884 # The test checks if a DT_RELR shared library without DT_VERNEED works as
2885 # intended, so it uses an explicit link rule.
2886 $(objpfx)tst-relr3: $(objpfx)tst-relr-mod3a.so
2887 $(objpfx)tst-relr-mod3b.so: $(objpfx)tst-relr-mod3b.os
2888 $(LINK.o) -nostdlib -nostartfiles -Wl,-z,pack-relative-relocs \
2889 $(LDFLAGS-soname-fname) \
2890 -shared -o $@.new $(filter-out $(map-file),$^)
2891 $(call after-link,$@.new)
2892 mv -f $@.new $@
2894 $(objpfx)tst-relr-mod3a.so: $(objpfx)tst-relr-mod3a.os \
2895 $(objpfx)tst-relr-mod3b.so
2896 $(LINK.o) -nostdlib -nostartfiles -Wl,-z,pack-relative-relocs \
2897 $(LDFLAGS-soname-fname) $(LDFLAGS-rpath-ORIGIN) \
2898 -shared -o $@.new $(filter-out $(map-file),$^)
2899 $(call after-link,$@.new)
2900 mv -f $@.new $@
2902 # The test checks if a DT_RELR shared library without libc.so on DT_NEEDED
2903 # works as intended, so it uses an explicit link rule.
2904 $(objpfx)tst-relr4: $(objpfx)tst-relr-mod4a.so
2905 $(objpfx)tst-relr-mod4b.so: $(objpfx)tst-relr-mod4b.os
2906 $(LINK.o) -nostdlib -nostartfiles -Wl,-z,pack-relative-relocs \
2907 $(LDFLAGS-soname-fname) \
2908 -Wl,--version-script=tst-relr-mod4b.map \
2909 -shared -o $@.new $(filter-out $(map-file),$^)
2910 $(call after-link,$@.new)
2911 mv -f $@.new $@
2913 $(objpfx)tst-relr-mod4a.so: $(objpfx)tst-relr-mod4a.os \
2914 $(objpfx)tst-relr-mod4b.so
2915 $(LINK.o) -nostdlib -nostartfiles -Wl,-z,pack-relative-relocs \
2916 $(LDFLAGS-soname-fname) $(LDFLAGS-rpath-ORIGIN) \
2917 -shared -o $@.new $(filter-out $(map-file),$^)
2918 $(call after-link,$@.new)
2919 mv -f $@.new $@
2921 LDFLAGS-libtracemod1-1.so += -Wl,-soname,libtracemod1.so
2922 LDFLAGS-libtracemod2-1.so += -Wl,-soname,libtracemod2.so
2923 LDFLAGS-libtracemod3-1.so += -Wl,-soname,libtracemod3.so
2924 LDFLAGS-libtracemod4-1.so += -Wl,-soname,libtracemod4.so
2925 LDFLAGS-libtracemod5-1.so += -Wl,-soname,libtracemod5.so
2927 $(objpfx)libtracemod1-1.so: $(objpfx)libtracemod2-1.so \
2928 $(objpfx)libtracemod3-1.so
2929 $(objpfx)libtracemod2-1.so: $(objpfx)libtracemod4-1.so \
2930 $(objpfx)libtracemod5-1.so
2932 define libtracemod-x
2933 $(objpfx)libtracemod$(1)/libtracemod$(1).so: $(objpfx)libtracemod$(1)-1.so
2934 $$(make-target-directory)
2935 cp $$< $$@
2936 endef
2937 libtracemod-suffixes = 1 2 3 4 5
2938 $(foreach i,$(libtracemod-suffixes), $(eval $(call libtracemod-x,$(i))))
2940 define tst-trace-skeleton
2941 $(objpfx)tst-trace$(1).out: $(objpfx)libtracemod1/libtracemod1.so \
2942 $(objpfx)libtracemod2/libtracemod2.so \
2943 $(objpfx)libtracemod3/libtracemod3.so \
2944 $(objpfx)libtracemod4/libtracemod4.so \
2945 $(objpfx)libtracemod5/libtracemod5.so \
2946 $(..)scripts/tst-ld-trace.py \
2947 tst-trace$(1).exp
2948 ${ $(PYTHON) $(..)scripts/tst-ld-trace.py \
2949 "$(test-wrapper-env) $(elf-objpfx)$(rtld-installed-name) \
2950 --library-path $(common-objpfx):$(strip $(2)) \
2951 $(objpfx)libtracemod1/libtracemod1.so" tst-trace$(1).exp \
2952 } > $$@; $$(evaluate-test)
2953 endef
2955 $(eval $(call tst-trace-skeleton,1,))
2956 $(eval $(call tst-trace-skeleton,2,\
2957 $(objpfx)libtracemod2))
2958 $(eval $(call tst-trace-skeleton,3,\
2959 $(objpfx)libtracemod2:$(objpfx)libtracemod3))
2960 $(eval $(call tst-trace-skeleton,4,\
2961 $(objpfx)libtracemod2:$(objpfx)libtracemod3:$(objpfx)libtracemod4))
2962 $(eval $(call tst-trace-skeleton,5,\
2963 $(objpfx)libtracemod2:$(objpfx)libtracemod3:$(objpfx)libtracemod4:$(objpfx)libtracemod5))
2965 $(objpfx)tst-tls-allocation-failure-static-patched: \
2966 $(objpfx)tst-tls-allocation-failure-static $(..)scripts/tst-elf-edit.py
2967 cp $< $@
2968 $(PYTHON) $(..)scripts/tst-elf-edit.py --maximize-tls-size $@
2970 $(objpfx)tst-tls-allocation-failure-static-patched.out: \
2971 $(objpfx)tst-tls-allocation-failure-static-patched
2972 $< > $@ 2>&1; echo "status: $$?" >> $@
2973 grep -q '^Fatal glibc error: Cannot allocate TLS block$$' $@ \
2974 && grep -q '^status: 127$$' $@; \
2975 $(evaluate-test)
2977 $(objpfx)tst-audit-tlsdesc: $(objpfx)tst-audit-tlsdesc-mod1.so \
2978 $(objpfx)tst-audit-tlsdesc-mod2.so \
2979 $(shared-thread-library)
2980 ifeq (yes,$(have-mtls-dialect-gnu2))
2981 # The test is valid for all TLS types, but we want to exercise GNU2
2982 # TLS if possible.
2983 CFLAGS-tst-audit-tlsdesc-mod1.c += -mtls-dialect=gnu2
2984 CFLAGS-tst-audit-tlsdesc-mod2.c += -mtls-dialect=gnu2
2985 endif
2986 $(objpfx)tst-audit-tlsdesc-dlopen: $(shared-thread-library)
2987 $(objpfx)tst-audit-tlsdesc-dlopen.out: $(objpfx)tst-audit-tlsdesc-mod1.so \
2988 $(objpfx)tst-audit-tlsdesc-mod2.so
2989 $(objpfx)tst-audit-tlsdesc-mod1.so: $(objpfx)tst-audit-tlsdesc-mod2.so
2990 $(objpfx)tst-audit-tlsdesc.out: $(objpfx)tst-auditmod-tlsdesc.so
2991 tst-audit-tlsdesc-ENV = LD_AUDIT=$(objpfx)tst-auditmod-tlsdesc.so
2992 $(objpfx)tst-audit-tlsdesc-dlopen.out: $(objpfx)tst-auditmod-tlsdesc.so
2993 tst-audit-tlsdesc-dlopen-ENV = LD_AUDIT=$(objpfx)tst-auditmod-tlsdesc.so
2995 $(objpfx)tst-dlmopen-twice.out: \
2996 $(objpfx)tst-dlmopen-twice-mod1.so \
2997 $(objpfx)tst-dlmopen-twice-mod2.so