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