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