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