Update libc.pot for 2.37 release.
[glibc.git] / elf / Makefile
blobb509b3eada1fb77bf81e2a0ca5740b94ad185764
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-leaks1-mem.out \
630 $(objpfx)tst-rtld-help.out \
631 # tests-special
632 endif
633 tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
634 tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
635 tlsmod17a-modules = $(addprefix tst-tlsmod17a, $(tlsmod17a-suffixes))
636 tlsmod18a-modules = $(addprefix tst-tlsmod18a, $(tlsmod17a-suffixes))
637 one-hundred = $(foreach x,0 1 2 3 4 5 6 7 8 9, \
638 0$x 1$x 2$x 3$x 4$x 5$x 6$x 7$x 8$x 9$x)
639 tst-tls-many-dynamic-modules := \
640 $(foreach n,$(one-hundred),tst-tls-manydynamic$(n)mod)
641 tst-tls-many-dynamic-modules-dep-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 \
642 14 15 16 17 18 19
643 tst-tls-many-dynamic-modules-dep = \
644 $(foreach n,$(tst-tls-many-dynamic-modules-dep-suffixes),tst-tls-manydynamic$(n)mod-dep)
645 tst-tls-many-dynamic-modules-dep-bad-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
646 tst-tls-many-dynamic-modules-dep-bad = \
647 $(foreach n,$(tst-tls-many-dynamic-modules-dep-bad-suffixes),tst-tls-manydynamic$(n)mod-dep-bad)
648 extra-test-objs += \
649 $(tlsmod17a-modules:=.os) \
650 $(tlsmod18a-modules:=.os) \
651 tst-tlsalign-vars.o \
652 # extra-test-objs
653 test-extras += \
654 tst-tlsalign-vars \
655 tst-tlsmod17a \
656 tst-tlsmod18a \
657 # test-extras
658 modules-names += \
659 circlemod1 \
660 circlemod1a \
661 circlemod2 \
662 circlemod2a \
663 circlemod3 \
664 circlemod3a \
665 constload2 \
666 constload3 \
667 dblloadmod1 \
668 dblloadmod2 \
669 dblloadmod3 \
670 dep1 \
671 dep2 \
672 dep3 \
673 dep4 \
674 failobj \
675 filtmod1 \
676 filtmod2 \
677 firstobj \
678 globalmod1 \
679 libmarkermod1-1 \
680 libmarkermod1-2 \
681 libmarkermod1-3 \
682 libmarkermod2-1 \
683 libmarkermod2-2 \
684 libmarkermod3-1 \
685 libmarkermod3-2 \
686 libmarkermod3-3 \
687 libmarkermod4-1 \
688 libmarkermod4-2 \
689 libmarkermod4-3 \
690 libmarkermod4-4 \
691 libmarkermod5-1 \
692 libmarkermod5-2 \
693 libmarkermod5-3 \
694 libmarkermod5-4 \
695 libmarkermod5-5 \
696 libtracemod1-1 \
697 libtracemod2-1 \
698 libtracemod3-1 \
699 libtracemod4-1 \
700 libtracemod5-1 \
701 ltglobmod1 \
702 ltglobmod2 \
703 neededobj1 \
704 neededobj2 \
705 neededobj3 \
706 neededobj4 \
707 neededobj5 \
708 neededobj6 \
709 nextmod1 \
710 nextmod2 \
711 nextmod3 \
712 nodel2mod1 \
713 nodel2mod2 \
714 nodel2mod3 \
715 nodelmod1 \
716 nodelmod2 \
717 nodelmod3 \
718 nodelmod4 \
719 nodlopenmod \
720 nodlopenmod2 \
721 order2mod1 \
722 order2mod2 \
723 order2mod3 \
724 order2mod4 \
725 pathoptobj \
726 reldep4mod1 \
727 reldep4mod2 \
728 reldep4mod3 \
729 reldep4mod4 \
730 reldep6mod0 \
731 reldep6mod1 \
732 reldep6mod2 \
733 reldep6mod3 \
734 reldep6mod4 \
735 reldep7mod1 \
736 reldep7mod2 \
737 reldep8mod1 \
738 reldep8mod2 \
739 reldep8mod3 \
740 reldep9mod1 \
741 reldep9mod2 \
742 reldep9mod3 \
743 reldepmod1 \
744 reldepmod2 \
745 reldepmod3 \
746 reldepmod4 \
747 reldepmod5 \
748 reldepmod6 \
749 testobj1 \
750 testobj1_1 \
751 testobj2 \
752 testobj3 \
753 testobj4 \
754 testobj5 \
755 testobj6 \
756 tst-absolute-sym-lib \
757 tst-absolute-zero-lib \
758 tst-alignmod \
759 tst-alignmod2 \
760 tst-alignmod3 \
761 tst-array2dep \
762 tst-array5dep \
763 tst-audit-tlsdesc-mod1 \
764 tst-audit-tlsdesc-mod2 \
765 tst-audit11mod1 \
766 tst-audit11mod2 \
767 tst-audit12mod1 \
768 tst-audit12mod2 \
769 tst-audit12mod3 \
770 tst-audit13mod1 \
771 tst-audit18mod \
772 tst-audit19bmod \
773 tst-audit23mod \
774 tst-audit24amod1 \
775 tst-audit24amod2 \
776 tst-audit24bmod1 \
777 tst-audit24bmod2 \
778 tst-audit24dmod1 \
779 tst-audit24dmod2 \
780 tst-audit24dmod3 \
781 tst-audit24dmod4 \
782 tst-audit25mod1 \
783 tst-audit25mod2 \
784 tst-audit25mod3 \
785 tst-audit25mod4 \
786 tst-auditlogmod-1 \
787 tst-auditlogmod-2 \
788 tst-auditlogmod-3 \
789 tst-auditmanymod1 \
790 tst-auditmanymod2 \
791 tst-auditmanymod3 \
792 tst-auditmanymod4 \
793 tst-auditmanymod5 \
794 tst-auditmanymod6 \
795 tst-auditmanymod7 \
796 tst-auditmanymod8 \
797 tst-auditmanymod9 \
798 tst-auditmod-tlsdesc \
799 tst-auditmod1 \
800 tst-auditmod9a \
801 tst-auditmod9b \
802 tst-auditmod11 \
803 tst-auditmod12 \
804 tst-auditmod18 \
805 tst-auditmod19a \
806 tst-auditmod19b \
807 tst-auditmod20 \
808 tst-auditmod21a \
809 tst-auditmod21b \
810 tst-auditmod22 \
811 tst-auditmod23 \
812 tst-auditmod24a \
813 tst-auditmod24b \
814 tst-auditmod24c \
815 tst-auditmod24d \
816 tst-auditmod25 \
817 tst-auditmod28 \
818 tst-auxvalmod \
819 tst-big-note-lib \
820 tst-deep1mod1 \
821 tst-deep1mod2 \
822 tst-deep1mod3 \
823 tst-dl_find_object-mod1 \
824 tst-dl_find_object-mod2 \
825 tst-dl_find_object-mod3 \
826 tst-dl_find_object-mod4 \
827 tst-dl_find_object-mod5 \
828 tst-dl_find_object-mod6 \
829 tst-dl_find_object-mod7 \
830 tst-dl_find_object-mod8 \
831 tst-dl_find_object-mod9 \
832 tst-dlmopen1mod \
833 tst-dlmopen-dlerror-mod \
834 tst-dlmopen-gethostbyname-mod \
835 tst-dlmopen-twice-mod1 \
836 tst-dlmopen-twice-mod2 \
837 tst-dlopenfaillinkmod \
838 tst-dlopenfailmod1 \
839 tst-dlopenfailmod2 \
840 tst-dlopenfailmod3 \
841 tst-dlopenfailnodelmod \
842 tst-dlopenrpathmod \
843 tst-filterobj-aux \
844 tst-filterobj-filtee \
845 tst-filterobj-flt \
846 tst-finilazyfailmod \
847 tst-globalmod2 \
848 tst-initlazyfailmod \
849 tst-initorder2a \
850 tst-initorder2b \
851 tst-initorder2c \
852 tst-initorder2d \
853 tst-initordera1 \
854 tst-initordera2 \
855 tst-initordera3 \
856 tst-initordera4 \
857 tst-initorderb1 \
858 tst-initorderb2 \
859 tst-latepthreadmod \
860 tst-ldconfig-ld-mod \
861 tst-main1mod \
862 tst-nodelete2mod \
863 tst-nodelete-dlclose-dso \
864 tst-nodelete-dlclose-plugin \
865 tst-nodelete-opened-lib \
866 tst-null-argv-lib \
867 tst-p_alignmod-base \
868 tst-p_alignmod3 \
869 tst-relsort1mod1 \
870 tst-relsort1mod2 \
871 tst-ro-dynamic-mod \
872 tst-single_threaded-mod1 \
873 tst-single_threaded-mod2 \
874 tst-single_threaded-mod3 \
875 tst-single_threaded-mod4 \
876 tst-sonamemove-linkmod1 \
877 tst-sonamemove-runmod1 \
878 tst-sonamemove-runmod2 \
879 tst-tls19mod1 \
880 tst-tls19mod2 \
881 tst-tls19mod3 \
882 tst-tls20mod-bad \
883 tst-tls21mod \
884 tst-tlsalign-lib \
885 tst-tls-ie-mod0 \
886 tst-tls-ie-mod1 \
887 tst-tls-ie-mod2 \
888 tst-tls-ie-mod3 \
889 tst-tls-ie-mod4 \
890 tst-tls-ie-mod5 \
891 tst-tls-ie-mod6 \
892 tst-tlsmod1 \
893 tst-tlsmod10 \
894 tst-tlsmod11 \
895 tst-tlsmod12 \
896 tst-tlsmod13 \
897 tst-tlsmod13a \
898 tst-tlsmod14a \
899 tst-tlsmod14b \
900 tst-tlsmod15a \
901 tst-tlsmod15b \
902 tst-tlsmod16a \
903 tst-tlsmod16b \
904 tst-tlsmod17b \
905 tst-tlsmod2 \
906 tst-tlsmod3 \
907 tst-tlsmod4 \
908 tst-tlsmod5 \
909 tst-tlsmod6 \
910 tst-tlsmod7 \
911 tst-tlsmod8 \
912 tst-tlsmod9 \
913 tst-unique1mod1 \
914 tst-unique1mod2 \
915 tst-unique2mod1 \
916 tst-unique2mod2 \
917 tst-unwind-ctor-lib \
918 unload2dep \
919 unload2mod \
920 unload3mod1 \
921 unload3mod2 \
922 unload3mod3 \
923 unload3mod4 \
924 unload4mod1 \
925 unload4mod2 \
926 unload4mod3 \
927 unload4mod4 \
928 unload6mod1 \
929 unload6mod2 \
930 unload6mod3 \
931 unload7mod1 \
932 unload7mod2 \
933 unload8mod1 \
934 unload8mod1x \
935 unload8mod2 \
936 unload8mod3 \
937 unloadmod \
938 vismod1 \
939 vismod2 \
940 vismod3 \
941 # modules-names
943 modules-names-cxx = \
944 tst-dlopen-nodelete-reloc-mod1 \
945 tst-dlopen-nodelete-reloc-mod10 \
946 tst-dlopen-nodelete-reloc-mod11 \
947 tst-dlopen-nodelete-reloc-mod12 \
948 tst-dlopen-nodelete-reloc-mod13 \
949 tst-dlopen-nodelete-reloc-mod14 \
950 tst-dlopen-nodelete-reloc-mod15 \
951 tst-dlopen-nodelete-reloc-mod16 \
952 tst-dlopen-nodelete-reloc-mod17 \
953 tst-dlopen-nodelete-reloc-mod2 \
954 tst-dlopen-nodelete-reloc-mod3 \
955 tst-dlopen-nodelete-reloc-mod4 \
956 tst-dlopen-nodelete-reloc-mod5 \
957 tst-dlopen-nodelete-reloc-mod6 \
958 tst-dlopen-nodelete-reloc-mod7 \
959 tst-dlopen-nodelete-reloc-mod8 \
960 tst-dlopen-nodelete-reloc-mod9 \
961 tst-nodelete-rtldmod \
962 tst-nodelete-uniquemod \
963 tst-nodelete-zmod \
964 tst-unique3lib \
965 tst-unique3lib2 \
966 tst-unique4lib \
967 # modules-names-cxx
969 modules-names += \
970 $(if $(CXX),$(modules-names-cxx)) \
971 $(modules-execstack-$(have-z-execstack)) \
972 $(tlsmod17a-modules) \
973 $(tlsmod18a-modules) \
974 $(tst-tls-many-dynamic-modules) \
975 $(tst-tls-many-dynamic-modules-dep) \
976 $(tst-tls-many-dynamic-modules-dep-bad) \
977 # modules-names
979 # Most modules build with _ISOMAC defined, but those filtered out
980 # depend on internal headers.
981 modules-names-tests = $(filter-out ifuncmod% tst-tlsmod%,\
982 $(modules-names))
984 # For +depfiles in Makerules.
985 extra-test-objs += tst-auditmod17.os
987 ifeq (yes,$(have-mtls-dialect-gnu2))
988 tests += tst-gnu2-tls1
989 modules-names += tst-gnu2-tls1mod
990 $(objpfx)tst-gnu2-tls1: $(objpfx)tst-gnu2-tls1mod.so
991 tst-gnu2-tls1mod.so-no-z-defs = yes
992 CFLAGS-tst-gnu2-tls1mod.c += -mtls-dialect=gnu2
993 endif # $(have-mtls-dialect-gnu2)
995 ifeq (yes,$(have-protected-data))
996 modules-names += tst-protected1moda tst-protected1modb
997 tests += tst-protected1a tst-protected1b
998 $(objpfx)tst-protected1a: $(addprefix $(objpfx),tst-protected1moda.so tst-protected1modb.so)
999 $(objpfx)tst-protected1b: $(addprefix $(objpfx),tst-protected1modb.so tst-protected1moda.so)
1000 tst-protected1modb.so-no-z-defs = yes
1001 # These tests fail with GCC versions prior to 5.1 and with some versions
1002 # of binutils. See https://sourceware.org/bugzilla/show_bug.cgi?id=17709
1003 # and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248 for details.
1004 # Perhaps in future we can make these XFAILs conditional on some detection
1005 # of compiler/linker behavior/version.
1006 test-xfail-tst-protected1a = yes
1007 test-xfail-tst-protected1b = yes
1008 endif
1009 ifeq (yesyes,$(have-fpie)$(build-shared))
1010 modules-names += tst-piemod1
1011 tests += tst-pie1 tst-pie2 tst-dlopen-pie tst-dlopen-tlsmodid-pie \
1012 tst-dlopen-self-pie
1013 tests-pie += tst-pie1 tst-pie2 tst-dlopen-tlsmodid-pie tst-dlopen-self-pie
1014 ifeq (yes,$(have-protected-data))
1015 tests += vismain
1016 tests-pie += vismain
1017 CFLAGS-vismain.c += $(PIE-ccflag)
1018 endif
1019 endif
1020 modules-execstack-yes = tst-execstack-mod
1021 extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
1023 # filtmod1.so, tst-big-note-lib.so, tst-ro-dynamic-mod.so have special
1024 # rules.
1025 modules-names-nobuild += \
1026 filtmod1 \
1027 tst-audit24bmod1 \
1028 tst-audit24bmod2 \
1029 tst-big-note-lib \
1030 tst-ro-dynamic-mod \
1031 # modules-names-nobuild
1033 tests += $(tests-static)
1035 ifeq (yes,$(have-ifunc))
1036 tests-ifuncstatic := \
1037 ifuncmain1static \
1038 ifuncmain1picstatic \
1039 ifuncmain2static \
1040 ifuncmain2picstatic \
1041 ifuncmain4static \
1042 ifuncmain4picstatic \
1043 ifuncmain5static \
1044 ifuncmain5picstatic \
1045 ifuncmain7static \
1046 ifuncmain7picstatic \
1047 # tests-ifuncstatic
1048 ifeq (yes,$(have-gcc-ifunc))
1049 tests-ifuncstatic += ifuncmain9static ifuncmain9picstatic
1050 endif
1051 tests-static += $(tests-ifuncstatic)
1052 tests-internal += $(tests-ifuncstatic)
1053 ifeq (yes,$(build-shared))
1054 tests += \
1055 tst-ifunc-fault-bindnow \
1056 tst-ifunc-fault-lazy \
1057 # tests
1058 # Note: sysdeps/x86_64/ifuncmain8.c uses ifuncmain8.
1059 tests-internal += \
1060 ifuncmain1pic \
1061 ifuncmain1staticpic \
1062 ifuncmain1vis \
1063 ifuncmain1vispic \
1064 ifuncmain2 \
1065 ifuncmain2pic \
1066 ifuncmain3 \
1067 ifuncmain4 \
1068 ifuncmain5staticpic \
1069 ifuncmain7 \
1070 ifuncmain7pic \
1071 # tests-internal
1072 ifeq (no,$(with-lld))
1073 tests-internal += \
1074 ifuncmain1 \
1075 ifuncmain5 \
1076 ifuncmain5pic \
1077 # tests-internal
1078 endif
1079 ifeq (yes,$(have-gcc-ifunc))
1080 tests-internal += \
1081 ifuncmain9 \
1082 ifuncmain9pic \
1083 # tests-internal
1084 endif
1085 ifunc-test-modules = \
1086 ifuncdep1 \
1087 ifuncdep1pic \
1088 ifuncdep2 \
1089 ifuncdep2pic \
1090 ifuncdep5 \
1091 ifuncdep5pic \
1092 # ifunc-test-modules
1093 extra-test-objs += $(ifunc-test-modules:=.o)
1094 test-internal-extras += $(ifunc-test-modules)
1095 ifeq (yes,$(have-fpie))
1096 ifunc-pie-tests = \
1097 ifuncmain1pie \
1098 ifuncmain1staticpie \
1099 ifuncmain1vispie \
1100 ifuncmain6pie \
1101 ifuncmain7pie \
1102 # ifunc-pie-tests
1103 ifeq (yes,$(have-gcc-ifunc))
1104 ifunc-pie-tests += ifuncmain9pie
1105 endif
1106 ifeq (no,$(with-lld))
1107 ifunc-pie-tests += ifuncmain5pie
1108 endif
1109 ifeq (yes,$(have-textrel_ifunc))
1110 ifunc-pie-tests += tst-ifunc-textrel
1111 endif
1112 tests-internal += $(ifunc-pie-tests)
1113 tests-pie += $(ifunc-pie-tests)
1114 endif
1115 modules-names += \
1116 ifuncmod1 \
1117 ifuncmod3 \
1118 ifuncmod6 \
1119 # module-names
1120 ifeq (no,$(with-lld))
1121 modules-names += ifuncmod5
1122 endif
1123 endif
1124 endif
1126 ifeq (yes,$(build-shared))
1127 ifeq ($(run-built-tests),yes)
1128 tests-special += \
1129 $(objpfx)argv0test.out \
1130 $(objpfx)tst-pathopt.out \
1131 $(objpfx)tst-rtld-help.out \
1132 $(objpfx)tst-rtld-load-self.out \
1133 $(objpfx)tst-rtld-preload.out \
1134 # tests-special
1135 endif
1136 tests-special += \
1137 $(objpfx)check-execstack.out \
1138 $(objpfx)check-initfini.out \
1139 $(objpfx)check-localplt.out \
1140 $(objpfx)check-textrel.out \
1141 $(objpfx)check-wx-segment.out \
1142 # tests-special
1143 endif
1145 ifeq ($(run-built-tests),yes)
1146 tests-special += \
1147 $(objpfx)order-cmp.out \
1148 $(objpfx)order2-cmp.out \
1149 $(objpfx)tst-array1-cmp.out \
1150 $(objpfx)tst-array1-static-cmp.out \
1151 $(objpfx)tst-array2-cmp.out \
1152 $(objpfx)tst-array3-cmp.out \
1153 $(objpfx)tst-array4-cmp.out \
1154 $(objpfx)tst-array5-cmp.out \
1155 $(objpfx)tst-array5-static-cmp.out \
1156 $(objpfx)tst-initorder-cmp.out \
1157 $(objpfx)tst-initorder2-cmp.out \
1158 $(objpfx)tst-unused-dep-cmp.out \
1159 $(objpfx)tst-unused-dep.out \
1160 $(objpfx)tst-trace1.out \
1161 $(objpfx)tst-trace2.out \
1162 $(objpfx)tst-trace3.out \
1163 $(objpfx)tst-trace4.out \
1164 $(objpfx)tst-trace5.out \
1165 # tests-special
1166 endif
1168 ifndef avoid-generated
1169 # DSO sorting tests:
1170 # The dso-ordering-test.py script generates testcase source files in $(objpfx),
1171 # creating a $(objpfx)<testcase-name>-dir for each testcase, and creates a
1172 # Makefile fragment to be included.
1173 define include_dsosort_tests
1174 $(objpfx)$(1).generated-makefile: $(1)
1175 $(PYTHON) $(..)scripts/dso-ordering-test.py \
1176 --description-file $$< --objpfx $(objpfx) --output-makefile $$@T
1177 mv $$@T $$@
1178 -include $(objpfx)$(1).generated-makefile
1179 endef
1180 endif
1182 postclean-generated += $(objpfx)/dso-sort-tests-2.generated-makefile \
1183 $(objpfx)/dso-sort-tests-2.generated-makefile
1185 # Generate from each testcase description file
1186 ifeq (yes,$(have-tunables))
1187 $(eval $(call include_dsosort_tests,dso-sort-tests-1.def))
1188 $(eval $(call include_dsosort_tests,dso-sort-tests-2.def))
1189 endif
1191 check-abi: $(objpfx)check-abi-ld.out \
1192 $(objpfx)check-abi-version-libc.out
1193 tests-special += \
1194 $(objpfx)check-abi-ld.out \
1195 $(objpfx)check-abi-version-libc.out \
1196 # tests-special
1197 update-abi: update-abi-ld
1198 update-all-abi: update-all-abi-ld
1200 tests-special += $(objpfx)tst-glibcelf.out
1201 $(objpfx)tst-glibcelf.out: tst-glibcelf.py elf.h $(..)/scripts/glibcelf.py \
1202 $(..)/scripts/glibcextract.py
1203 PYTHONPATH=$(..)scripts $(PYTHON) tst-glibcelf.py \
1204 --cc="$(CC) $(patsubst -DMODULE_NAME=%,-DMODULE_NAME=testsuite,$(CPPFLAGS))" \
1205 < /dev/null > $@ 2>&1; $(evaluate-test)
1207 ifeq ($(run-built-tests),yes)
1208 tests-special += $(objpfx)tst-tls-allocation-failure-static-patched.out
1209 endif
1211 # The test requires shared _and_ PIE because the executable
1212 # unit test driver must be able to link with the shared object
1213 # that is going to eventually go into an installed DSO.
1214 ifeq (yesyes,$(have-fpie)$(build-shared))
1215 tests-internal += tst-_dl_addr_inside_object
1216 tests-pie += tst-_dl_addr_inside_object
1217 $(objpfx)tst-_dl_addr_inside_object: $(objpfx)dl-addr-obj.os
1218 CFLAGS-tst-_dl_addr_inside_object.c += $(PIE-ccflag)
1219 endif
1221 # We can only test static libcrypt use if libcrypt has been built,
1222 # and either NSS crypto is not in use, or static NSS libraries are
1223 # available.
1224 ifeq ($(build-crypt),no)
1225 CFLAGS-tst-linkall-static.c += -DUSE_CRYPT=0
1226 else
1227 ifeq ($(nss-crypt),no)
1228 CFLAGS-tst-linkall-static.c += -DUSE_CRYPT=1
1229 else
1230 ifeq ($(static-nss-crypt),no)
1231 CFLAGS-tst-linkall-static.c += -DUSE_CRYPT=0
1232 else
1233 CFLAGS-tst-linkall-static.c += -DUSE_CRYPT=1
1234 endif
1235 endif
1236 endif
1238 include ../Rules
1240 ifeq (yes,$(build-shared))
1241 # Make sure these things are built in the `make lib' pass so they can be used
1242 # to run programs during the `make others' pass.
1243 lib-noranlib: $(objpfx)$(rtld-installed-name) \
1244 $(addprefix $(objpfx),$(extra-objs))
1245 endif
1247 # Command to link into a larger single relocatable object.
1248 reloc-link = $(LINK.o) -nostdlib -nostartfiles -r
1250 $(objpfx)sotruss-lib.so: $(shlib-lds)
1252 $(objpfx)dl-allobjs.os: $(all-rtld-routines:%=$(objpfx)%.os)
1253 $(reloc-link) -o $@ $^
1255 # Link together the dynamic linker into a single relocatable object.
1256 # First we do a link against libc_pic.a just to get a link map,
1257 # and discard the object produced by that link. From the link map
1258 # we can glean all the libc modules that need to go into the dynamic
1259 # linker. Then we do a recursive make that goes into all the subdirs
1260 # those modules come from and builds special rtld-foo.os versions that
1261 # are compiled with special flags, and puts these modules into rtld-libc.a
1262 # for us. Then we do the real link using rtld-libc.a instead of libc_pic.a.
1264 # These symbols need to be stubbed out during symbol discovery because
1265 # their implementation is provided differently in rtld, and the symbol
1266 # discovery mechanism is not compatible with the libc implementation
1267 # when compiled for libc.
1268 rtld-stubbed-symbols = \
1269 __GI___pthread_disable_asynccancel \
1270 __GI___pthread_enable_asynccancel \
1271 __libc_assert_fail \
1272 __pthread_disable_asynccancel \
1273 __pthread_enable_asynccancel \
1274 calloc \
1275 free \
1276 malloc \
1277 realloc \
1278 # rtld-stubbed-symbols
1280 ifeq ($(have-ssp),yes)
1281 # rtld is not built with the stack protector, so these references will
1282 # go away in the rebuilds.
1283 rtld-stubbed-symbols += __stack_chk_fail __stack_chk_fail_local
1284 endif
1286 $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
1287 @-rm -f $@T
1288 for symbol in $(rtld-stubbed-symbols); do \
1289 echo ".globl $$symbol"; \
1290 echo "$$symbol:"; \
1291 done | $(CC) -o $@T.o $(ASFLAGS) -c -x assembler -
1292 $(reloc-link) -o $@.o $@T.o '-Wl,-(' $^ -lgcc '-Wl,-)' -Wl,-Map,$@T
1293 rm -f %@T.o $@.o
1294 mv -f $@T $@
1296 # For lld, skip preceding addresses and values before matching the archive and the member.
1297 $(objpfx)librtld.mk: $(objpfx)librtld.map Makefile
1298 LC_ALL=C \
1299 sed -n 's@^[0-9a-f ]*$(common-objpfx)\([^(]*\)(\([^)]*\.os\)) *.*$$@\1 \2@p' \
1300 $< | \
1301 while read lib file; do \
1302 case $$lib in \
1303 libc_pic.a) \
1304 LC_ALL=C grep -F -l /$$file \
1305 $(common-objpfx)stamp.os $(common-objpfx)*/stamp.os | \
1306 LC_ALL=C \
1307 sed 's@^$(common-objpfx)\([^/]*\)/stamp\.os$$@rtld-\1'" +=$$file@"\
1308 ;; \
1309 */*.a) \
1310 echo rtld-$${lib%%/*} += $$file ;; \
1311 *) echo "Wasn't expecting $$lib($$file)" >&2; exit 1 ;; \
1312 esac; \
1313 done > $@T
1314 echo rtld-subdirs = `LC_ALL=C sed 's/^rtld-\([^ ]*\).*$$/\1/' $@T \
1315 | LC_ALL=C sort -u` >> $@T
1316 mv -f $@T $@
1318 $(objpfx)rtld-libc.a: $(objpfx)librtld.mk FORCE
1319 $(MAKE) -f $< -f rtld-Rules
1321 $(objpfx)librtld.os: $(objpfx)dl-allobjs.os $(objpfx)rtld-libc.a
1322 $(LINK.o) -nostdlib -nostartfiles -r -o $@ '-Wl,-(' $^ -lgcc '-Wl,-)' \
1323 -Wl,-Map,$@.map
1325 generated += librtld.map librtld.mk rtld-libc.a librtld.os.map
1327 z-now-yes = -Wl,-z,now
1329 $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
1330 # Link into a temporary file so that we don't touch $@ at all
1331 # if the sanity check below fails.
1332 $(LINK.o) -nostdlib -nostartfiles -shared -o $@.new \
1333 $(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \
1334 $(dt-relr-ldflag) \
1335 $(filter-out $(map-file),$^) $(load-map-file) \
1336 -Wl,-soname=$(rtld-installed-name)
1337 $(call after-link,$@.new)
1338 $(READELF) -s $@.new \
1339 | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
1340 mv -f $@.new $@
1342 ifeq (yes,$(build-shared))
1343 # interp.c exists just to get the runtime linker path into libc.so.
1344 $(objpfx)interp.os: $(common-objpfx)runtime-linker.h
1345 endif
1347 ifneq (ld.so,$(rtld-installed-name))
1348 # Make sure ld.so.1 exists in the build directory so we can link
1349 # against it.
1350 $(objpfx)$(rtld-installed-name): $(objpfx)ld.so
1351 $(make-link)
1352 generated += $(rtld-installed-name)
1353 endif
1355 # Build a file mentioning all trustworthy directories to look for shared
1356 # libraries when using LD_LIBRARY_PATH in a setuid program. The user can
1357 # add directories to the list by defining $(user-defined-trusted-dirs)
1358 # before starting make.
1359 $(objpfx)trusted-dirs.h: $(objpfx)trusted-dirs.st; @:
1360 $(objpfx)trusted-dirs.st: Makefile $(..)Makeconfig
1361 $(make-target-directory)
1362 echo "$(subst :, ,$(default-rpath) $(user-defined-trusted-dirs))" \
1363 | $(AWK) -f gen-trusted-dirs.awk > ${@:st=T};
1364 echo '#define DL_DST_LIB "$(notdir $(slibdir))"' >> ${@:st=T}
1365 $(move-if-change) ${@:st=T} ${@:st=h}
1366 touch $@
1367 CPPFLAGS-dl-load.c += -I$(objpfx). -I$(csu-objpfx).
1369 ifeq (yes,$(build-shared))
1370 $(inst_rtlddir)/$(rtld-installed-name): $(objpfx)ld.so $(+force)
1371 $(make-target-directory)
1372 $(do-install-program)
1374 # Creates the relative /usr/bin/ld.so symbolic link.
1375 $(inst_bindir)/ld.so: $(inst_rtlddir)/$(rtld-installed-name)
1376 $(make-target-directory)
1377 $(make-link)
1379 # Special target called by parent to install just the dynamic linker.
1380 .PHONY: ldso_install
1381 ldso_install: $(inst_rtlddir)/$(rtld-installed-name)
1382 endif # $(build-shared)
1385 # Workarounds for ${exec_prefix} expansion in configure variables.
1386 # config.status cannot be used directly for processing ldd.bash.in or
1387 # expanding variables such as sysconfdir because the expansion
1388 # contains the literal string ${exec_prefix}, which is not valid in C
1389 # headers or installed shell scripts.
1391 ldd-rewrite = -e 's%@RTLD@%$(rtlddir)/$(rtld-installed-name)%g' \
1392 -e 's%@VERSION@%$(version)%g' \
1393 -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
1394 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' \
1395 -e 's%@TEXTDOMAINDIR@%$(localedir)%g'
1397 ifeq ($(ldd-rewrite-script),no)
1398 define gen-ldd
1399 LC_ALL=C sed $(ldd-rewrite) < $< > $@.new
1400 endef
1401 else
1402 define gen-ldd
1403 LC_ALL=C sed $(ldd-rewrite) < $< \
1404 | LC_ALL=C sed -f $(patsubst $(..)/%,/%,$(..)$(ldd-rewrite-script)) > $@.new
1405 endef
1406 endif
1408 $(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \
1409 $(common-objpfx)config.make
1410 $(gen-ldd)
1411 chmod 555 $@.new
1412 mv -f $@.new $@
1414 $(objpfx)sln: $(sln-modules:%=$(objpfx)%.o)
1416 $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
1418 SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
1419 CFLAGS-ldconfig.c += $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
1420 -D'SLIBDIR="$(slibdir)"'
1421 libof-ldconfig = ldconfig
1422 CFLAGS-dl-cache.c += $(SYSCONF-FLAGS)
1423 CFLAGS-cache.c += $(SYSCONF-FLAGS)
1424 CFLAGS-rtld.c += $(SYSCONF-FLAGS)
1425 CFLAGS-dl-usage.c += $(SYSCONF-FLAGS) \
1426 -D'RTLD="$(rtlddir)/$(rtld-installed-name)"'
1427 CFLAGS-dl-diagnostics.c += $(SYSCONF-FLAGS) \
1428 -D'PREFIX="$(prefix)"' \
1429 -D'RTLD="$(rtlddir)/$(rtld-installed-name)"'
1431 cpp-srcs-left := $(all-rtld-routines:=.os)
1432 lib := rtld
1433 include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
1435 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
1436 generated += $(addsuffix .so,$(strip $(modules-names)))
1438 $(objpfx)testobj1_1.so: $(objpfx)testobj1.so
1439 $(objpfx)testobj2.so: $(objpfx)testobj1.so
1440 $(objpfx)testobj6.so: $(objpfx)testobj1.so $(objpfx)testobj2.so
1441 $(objpfx)failobj.so: $(objpfx)testobj6.so
1442 $(objpfx)dep1.so: $(objpfx)dep2.so $(objpfx)dep4.so
1443 $(objpfx)dep2.so: $(objpfx)dep3.so $(objpfx)dep4.so
1444 $(objpfx)dep4.so: $(objpfx)dep3.so
1445 $(objpfx)nodelmod3.so: $(objpfx)nodelmod4.so
1446 $(objpfx)neededobj2.so: $(objpfx)neededobj1.so
1447 $(objpfx)neededobj3.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so
1448 $(objpfx)neededobj4.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
1449 $(objpfx)neededobj3.so
1450 $(objpfx)neededobj6.so: $(objpfx)neededobj5.so
1451 $(objpfx)unload2mod.so: $(objpfx)unload2dep.so
1452 $(objpfx)firstobj.so: $(shared-thread-library)
1453 $(objpfx)reldep4mod1.so: $(objpfx)reldep4mod3.so
1454 $(objpfx)reldep4mod2.so: $(objpfx)reldep4mod4.so
1455 $(objpfx)dblloadmod1.so: $(objpfx)dblloadmod3.so
1456 $(objpfx)dblloadmod2.so: $(objpfx)dblloadmod3.so
1457 $(objpfx)reldepmod5.so: $(objpfx)reldepmod2.so
1458 $(objpfx)reldepmod6.so: $(objpfx)reldepmod2.so
1459 $(objpfx)reldep6mod1.so: $(objpfx)reldep6mod0.so
1460 $(objpfx)reldep6mod2.so: $(objpfx)reldep6mod1.so
1461 $(objpfx)reldep6mod3.so: $(objpfx)reldep6mod2.so
1462 $(objpfx)reldep6mod4.so: $(objpfx)reldep6mod1.so
1463 $(objpfx)tst-tlsmod3.so: $(objpfx)tst-tlsmod2.so
1464 $(objpfx)tst-tlsmod8.so: $(objpfx)tst-tlsmod7.so
1465 $(objpfx)tst-tlsmod10.so: $(objpfx)tst-tlsmod9.so
1466 $(objpfx)tst-tlsmod12.so: $(objpfx)tst-tlsmod11.so
1467 $(objpfx)tst-tlsmod13a.so: $(objpfx)tst-tlsmod13.so
1468 # For tst-tls9-static, make sure the modules it dlopens have libc.so in DT_NEEDED
1469 $(objpfx)tst-tlsmod5.so: $(common-objpfx)libc.so
1470 $(objpfx)tst-tlsmod6.so: $(common-objpfx)libc.so
1471 $(objpfx)tst-tls19mod1.so: $(objpfx)tst-tls19mod2.so $(objpfx)tst-tls19mod3.so
1472 $(objpfx)tst-tls19mod3.so: $(objpfx)ld.so
1473 $(objpfx)reldep8mod3.so: $(objpfx)reldep8mod1.so $(objpfx)reldep8mod2.so
1474 $(objpfx)nodel2mod3.so: $(objpfx)nodel2mod1.so $(objpfx)nodel2mod2.so
1475 $(objpfx)reldep9mod2.so: $(objpfx)reldep9mod1.so
1476 $(objpfx)reldep9mod3.so: $(objpfx)reldep9mod1.so $(objpfx)reldep9mod2.so
1477 $(objpfx)unload3mod1.so: $(objpfx)unload3mod3.so
1478 $(objpfx)unload3mod2.so: $(objpfx)unload3mod3.so
1479 $(objpfx)unload3mod3.so: $(objpfx)unload3mod4.so
1480 $(objpfx)unload4mod1.so: $(objpfx)unload4mod2.so $(objpfx)unload4mod3.so
1481 $(objpfx)unload4mod2.so: $(objpfx)unload4mod4.so $(objpfx)unload4mod3.so
1482 $(objpfx)unload7mod2.so: $(objpfx)unload7mod1.so
1483 $(objpfx)unload8mod1.so: $(objpfx)unload8mod2.so
1484 $(objpfx)unload8mod2.so: $(objpfx)unload8mod3.so
1485 $(objpfx)tst-initordera2.so: $(objpfx)tst-initordera1.so
1486 $(objpfx)tst-initorderb2.so: $(objpfx)tst-initorderb1.so $(objpfx)tst-initordera2.so
1487 $(objpfx)tst-initordera3.so: $(objpfx)tst-initorderb2.so $(objpfx)tst-initorderb1.so
1488 $(objpfx)tst-initordera4.so: $(objpfx)tst-initordera3.so
1489 $(objpfx)tst-initorder: $(objpfx)tst-initordera4.so $(objpfx)tst-initordera1.so $(objpfx)tst-initorderb2.so
1490 $(objpfx)tst-null-argv: $(objpfx)tst-null-argv-lib.so
1491 $(objpfx)tst-tlsalign: $(objpfx)tst-tlsalign-lib.so
1492 $(objpfx)tst-nodelete-opened.out: $(objpfx)tst-nodelete-opened-lib.so
1494 $(objpfx)tst-tlsalign-extern: $(objpfx)tst-tlsalign-vars.o
1495 $(objpfx)tst-tlsalign-extern-static: $(objpfx)tst-tlsalign-vars.o
1497 tst-null-argv-ENV = LD_DEBUG=all LD_DEBUG_OUTPUT=$(objpfx)tst-null-argv.debug.out
1498 LDFLAGS-nodel2mod3.so = -Wl,--no-as-needed
1499 LDFLAGS-reldepmod5.so = -Wl,--no-as-needed
1500 LDFLAGS-reldep6mod1.so = -Wl,--no-as-needed
1501 LDFLAGS-reldep6mod4.so = -Wl,--no-as-needed
1502 LDFLAGS-reldep8mod3.so = -Wl,--no-as-needed
1503 LDFLAGS-unload4mod1.so = -Wl,--no-as-needed
1504 LDFLAGS-unload4mod2.so = -Wl,--no-as-needed
1505 LDFLAGS-tst-initorder = -Wl,--no-as-needed
1506 LDFLAGS-tst-initordera2.so = -Wl,--no-as-needed
1507 LDFLAGS-tst-initordera3.so = -Wl,--no-as-needed
1508 LDFLAGS-tst-initordera4.so = -Wl,--no-as-needed
1509 LDFLAGS-tst-initorderb2.so = -Wl,--no-as-needed
1510 LDFLAGS-tst-tlsmod5.so = -nostdlib -Wl,--no-as-needed
1511 LDFLAGS-tst-tlsmod6.so = -nostdlib -Wl,--no-as-needed
1513 testobj1.so-no-z-defs = yes
1514 testobj3.so-no-z-defs = yes
1515 testobj4.so-no-z-defs = yes
1516 testobj5.so-no-z-defs = yes
1517 testobj6.so-no-z-defs = yes
1518 failobj.so-no-z-defs = yes
1519 constload2.so-no-z-defs = yes
1520 constload3.so-no-z-defs = yes
1521 nodelmod1.so-no-z-defs = yes
1522 nodelmod2.so-no-z-defs = yes
1523 nodelmod4.so-no-z-defs = yes
1524 nodel2mod2.so-no-z-defs = yes
1525 reldepmod2.so-no-z-defs = yes
1526 reldepmod3.so-no-z-defs = yes
1527 reldepmod4.so-no-z-defs = yes
1528 reldep4mod4.so-no-z-defs = yes
1529 reldep4mod2.so-no-z-defs = yes
1530 ltglobmod2.so-no-z-defs = yes
1531 dblloadmod3.so-no-z-defs = yes
1532 tst-tlsmod1.so-no-z-defs = yes
1533 tst-tlsmod2.so-no-z-defs = yes
1534 tst-tlsmod3.so-no-z-defs = yes
1535 tst-tlsmod4.so-no-z-defs = yes
1536 tst-tlsmod7.so-no-z-defs = yes
1537 tst-tlsmod8.so-no-z-defs = yes
1538 tst-tlsmod9.so-no-z-defs = yes
1539 tst-tlsmod10.so-no-z-defs = yes
1540 tst-tlsmod12.so-no-z-defs = yes
1541 tst-tlsmod14a.so-no-z-defs = yes
1542 tst-tlsmod14b.so-no-z-defs = yes
1543 tst-tlsmod15a.so-no-z-defs = yes
1544 tst-tlsmod16b.so-no-z-defs = yes
1545 circlemod2.so-no-z-defs = yes
1546 circlemod3.so-no-z-defs = yes
1547 circlemod3a.so-no-z-defs = yes
1548 reldep8mod2.so-no-z-defs = yes
1549 reldep9mod1.so-no-z-defs = yes
1550 unload3mod4.so-no-z-defs = yes
1551 unload4mod1.so-no-z-defs = yes
1552 ifuncmod1.so-no-z-defs = yes
1553 ifuncmod5.so-no-z-defs = yes
1554 ifuncmod6.so-no-z-defs = yes
1555 tst-auditmod9a.so-no-z-defs = yes
1556 tst-auditmod9b.so-no-z-defs = yes
1557 tst-nodelete-uniquemod.so-no-z-defs = yes
1558 tst-nodelete-rtldmod.so-no-z-defs = yes
1559 tst-nodelete-zmod.so-no-z-defs = yes
1560 tst-nodelete2mod.so-no-z-defs = yes
1562 ifeq ($(build-shared),yes)
1563 # Build all the modules even when not actually running test programs.
1564 tests: $(test-modules)
1565 endif
1567 LDFLAGS-loadtest = -rdynamic
1569 $(objpfx)loadtest.out: $(test-modules)
1571 $(objpfx)neededtest.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
1572 $(objpfx)neededobj3.so
1574 $(objpfx)neededtest2.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
1575 $(objpfx)neededobj3.so
1577 $(objpfx)neededtest3.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
1578 $(objpfx)neededobj3.so $(objpfx)neededobj4.so
1580 $(objpfx)neededtest4: $(objpfx)neededobj1.so
1581 $(objpfx)neededtest4.out: $(objpfx)neededobj5.so $(objpfx)neededobj6.so
1583 $(objpfx)restest1: $(objpfx)testobj1.so $(objpfx)testobj1_1.so
1584 LDFLAGS-restest1 = -rdynamic
1586 LDFLAGS-restest2 = -rdynamic
1588 $(objpfx)restest1.out: $(test-modules)
1590 preloadtest-preloads = testobj1 testobj2 testobj3 testobj4 testobj5
1591 $(objpfx)preloadtest: $(objpfx)testobj6.so
1592 LDFLAGS-preloadtest = -rdynamic
1593 $(objpfx)preloadtest.out: $(preloadtest-preloads:%=$(objpfx)%.so)
1594 preloadtest-ENV = \
1595 LD_PRELOAD=$(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
1597 LDFLAGS-loadfail = -rdynamic
1599 $(objpfx)loadfail.out: $(objpfx)failobj.so $(objpfx)testobj1.so \
1600 $(objpfx)testobj2.so $(objpfx)testobj3.so \
1601 $(objpfx)testobj4.so $(objpfx)testobj5.so
1603 LDFLAGS-multiload = -rdynamic
1604 CFLAGS-multiload.c += -DOBJDIR=\"$(elf-objpfx)\"
1606 $(objpfx)multiload.out: $(objpfx)testobj1.so
1608 LDFLAGS-origtest = -rdynamic
1609 $(objpfx)origtest.out: $(objpfx)testobj1.so
1611 ifeq ($(have-thread-library),yes)
1612 $(objpfx)resolvfail: $(shared-thread-library)
1613 endif
1615 $(objpfx)constload1.out: $(objpfx)constload2.so $(objpfx)constload3.so
1617 $(objpfx)circleload1.out: $(objpfx)circlemod1.so \
1618 $(objpfx)circlemod1a.so
1620 $(objpfx)circlemod1.so: $(objpfx)circlemod2.so
1621 $(objpfx)circlemod2.so: $(objpfx)circlemod3.so
1622 $(objpfx)circlemod1a.so: $(objpfx)circlemod2a.so
1623 $(objpfx)circlemod2a.so: $(objpfx)circlemod3a.so
1625 $(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so)
1627 $(objpfx)order-cmp.out: $(objpfx)order.out
1628 (echo "0123456789" | cmp $< -) > $@; \
1629 $(evaluate-test)
1631 $(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so)
1632 $(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
1633 vismain-ENV = LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
1635 $(objpfx)noload: $(objpfx)testobj1.so
1636 LDFLAGS-noload = -rdynamic -Wl,--no-as-needed
1637 $(objpfx)noload.out: $(objpfx)testobj5.so
1639 $(objpfx)noload-mem.out: $(objpfx)noload.out
1640 $(common-objpfx)malloc/mtrace $(objpfx)noload.mtrace > $@; \
1641 $(evaluate-test)
1642 noload-ENV = MALLOC_TRACE=$(objpfx)noload.mtrace \
1643 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
1645 LDFLAGS-nodelete = -rdynamic
1646 LDFLAGS-nodelmod1.so = -Wl,--enable-new-dtags,-z,nodelete
1647 LDFLAGS-nodelmod4.so = -Wl,--enable-new-dtags,-z,nodelete
1648 $(objpfx)nodelete.out: $(objpfx)nodelmod1.so $(objpfx)nodelmod2.so \
1649 $(objpfx)nodelmod3.so
1651 LDFLAGS-nodlopenmod.so = -Wl,--enable-new-dtags,-z,nodlopen
1652 $(objpfx)nodlopen.out: $(objpfx)nodlopenmod.so
1654 $(objpfx)nodlopenmod2.so: $(objpfx)nodlopenmod.so
1655 $(objpfx)nodlopen2.out: $(objpfx)nodlopenmod2.so
1657 $(objpfx)filtmod1.so: $(objpfx)filtmod1.os $(objpfx)filtmod2.so
1658 $(LINK.o) -shared -o $@ -B$(csu-objpfx) $(LDFLAGS.so) \
1659 $(dt-relr-ldflag) \
1660 -L$(subst :, -L,$(rpath-link)) \
1661 -Wl,-rpath-link=$(rpath-link) \
1662 $< -Wl,-F,$(objpfx)filtmod2.so
1663 $(objpfx)filter: $(objpfx)filtmod1.so
1665 # This does not link against libc.
1666 CFLAGS-filtmod1.c += $(no-stack-protector)
1668 $(objpfx)unload.out: $(objpfx)unloadmod.so
1670 $(objpfx)reldep.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod2.so
1672 $(objpfx)reldep2.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod3.so
1674 $(objpfx)reldep3.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
1676 $(objpfx)reldep4.out: $(objpfx)reldep4mod1.so $(objpfx)reldep4mod2.so
1678 $(objpfx)next: $(objpfx)nextmod1.so $(objpfx)nextmod2.so
1679 LDFLAGS-next = -Wl,--no-as-needed
1681 $(objpfx)tst-next-ver: $(objpfx)nextmod3.so
1682 LDFLAGS-tst-next-ver = -Wl,--no-as-needed
1684 $(objpfx)unload2.out: $(objpfx)unload2mod.so $(objpfx)unload2dep.so
1686 $(objpfx)lateglobal.out: $(objpfx)ltglobmod1.so $(objpfx)ltglobmod2.so
1688 $(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \
1689 $(objpfx)pathoptobj.so
1690 $(SHELL) $< $(common-objpfx) '$(test-wrapper-env)' \
1691 '$(run-program-env)'; \
1692 $(evaluate-test)
1694 $(objpfx)tst-rtld-load-self.out: tst-rtld-load-self.sh $(objpfx)ld.so
1695 $(SHELL) $^ '$(test-wrapper)' '$(test-wrapper-env)' > $@; \
1696 $(evaluate-test)
1698 tst-rtld-preload-OBJS = $(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
1699 $(objpfx)tst-rtld-preload.out: tst-rtld-preload.sh $(objpfx)ld.so \
1700 $(objpfx)preloadtest \
1701 $(preloadtest-preloads:%=$(objpfx)%.so)
1702 $(SHELL) $< $(objpfx)ld.so $(objpfx)preloadtest \
1703 '$(test-wrapper-env)' '$(run_program_env)' \
1704 '$(rpath-link)' '$(tst-rtld-preload-OBJS)' > $@; \
1705 $(evaluate-test)
1707 $(objpfx)initfirst.out: $(objpfx)firstobj.so
1709 $(objpfx)global: $(objpfx)globalmod1.so
1710 $(objpfx)global.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
1712 $(objpfx)dblload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
1714 $(objpfx)dblunload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
1716 $(objpfx)reldep5.out: $(objpfx)reldepmod5.so $(objpfx)reldepmod6.so
1718 $(objpfx)reldep6.out: $(objpfx)reldep6mod3.so $(objpfx)reldep6mod4.so
1720 $(objpfx)reldep7.out: $(objpfx)reldep7mod1.so $(objpfx)reldep7mod2.so
1722 $(objpfx)reldep8.out: $(objpfx)reldep8mod3.so
1724 LDFLAGS-nodel2mod2.so = -Wl,--enable-new-dtags,-z,nodelete
1725 $(objpfx)nodelete2.out: $(objpfx)nodel2mod3.so
1727 $(objpfx)reldep9.out: $(objpfx)reldep9mod3.so
1729 $(objpfx)tst-tls3: $(objpfx)tst-tlsmod1.so
1731 $(objpfx)tst-tls4.out: $(objpfx)tst-tlsmod2.so
1733 $(objpfx)tst-tls5.out: $(objpfx)tst-tlsmod2.so
1735 $(objpfx)tst-tls6.out: $(objpfx)tst-tlsmod2.so
1737 $(objpfx)tst-tls7.out: $(objpfx)tst-tlsmod3.so
1739 $(objpfx)tst-tls8.out: $(objpfx)tst-tlsmod3.so $(objpfx)tst-tlsmod4.so
1741 $(objpfx)tst-tls9.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
1743 $(objpfx)tst-tls10: $(objpfx)tst-tlsmod8.so $(objpfx)tst-tlsmod7.so
1745 $(objpfx)tst-tls11: $(objpfx)tst-tlsmod10.so $(objpfx)tst-tlsmod9.so
1747 $(objpfx)tst-tls12: $(objpfx)tst-tlsmod12.so $(objpfx)tst-tlsmod11.so
1749 $(objpfx)tst-tls13.out: $(objpfx)tst-tlsmod13a.so
1751 $(objpfx)tst-tls14: $(objpfx)tst-tlsmod14a.so
1752 $(objpfx)tst-tls14.out: $(objpfx)tst-tlsmod14b.so
1754 $(objpfx)tst-tls15.out: $(objpfx)tst-tlsmod15a.so $(objpfx)tst-tlsmod15b.so
1756 $(objpfx)tst-tls-dlinfo.out: $(objpfx)tst-tlsmod2.so
1760 $(objpfx)tst-tls16.out: $(objpfx)tst-tlsmod16a.so $(objpfx)tst-tlsmod16b.so
1762 $(objpfx)tst-tls17.out: $(objpfx)tst-tlsmod17b.so
1763 $(patsubst %,$(objpfx)%.os,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.os: tst-tlsmod17a.c
1764 $(compile-command.c) -DN=$*
1765 $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.so: $(objpfx)ld.so
1766 $(objpfx)tst-tlsmod17b.so: $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules))
1768 $(objpfx)tst-tls18.out: $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules))
1769 $(patsubst %,$(objpfx)%.os,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.os : tst-tlsmod18a.c
1770 $(compile-command.c) -DN=$*
1771 $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.so: $(objpfx)ld.so
1773 $(objpfx)tst-tls19.out: $(objpfx)tst-tls19mod1.so
1775 CFLAGS-tst-align.c += $(stack-align-test-flags)
1776 CFLAGS-tst-align2.c += $(stack-align-test-flags)
1777 CFLAGS-tst-alignmod.c += $(stack-align-test-flags)
1778 CFLAGS-tst-alignmod2.c += $(stack-align-test-flags)
1779 $(objpfx)tst-align.out: $(objpfx)tst-alignmod.so
1780 $(objpfx)tst-align2: $(objpfx)tst-alignmod2.so
1781 $(objpfx)tst-align3: $(objpfx)tst-alignmod3.so
1782 ifeq (yes,$(have-fpie))
1783 CFLAGS-tst-align3.c += $(PIE-ccflag)
1784 endif
1785 LDFLAGS-tst-align3 += -Wl,-z,max-page-size=0x200000
1786 LDFLAGS-tst-alignmod3.so += -Wl,-z,max-page-size=0x200000
1787 $(objpfx)tst-alignmod3.so: $(libsupport)
1789 $(objpfx)unload3.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
1790 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
1792 $(objpfx)unload4.out: $(objpfx)unload4mod1.so $(objpfx)unload4mod3.so
1794 $(objpfx)unload5.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
1795 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
1797 $(objpfx)unload6.out: $(objpfx)unload6mod1.so $(objpfx)unload6mod2.so \
1798 $(objpfx)unload6mod3.so
1800 $(objpfx)unload7.out: $(objpfx)unload7mod1.so $(objpfx)unload7mod2.so
1801 unload7-ENV = MALLOC_PERTURB_=85
1803 $(objpfx)unload8.out: $(objpfx)unload8mod1.so $(objpfx)unload8mod1x.so
1805 $(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
1807 ifeq ($(have-z-execstack),yes)
1808 $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
1809 CPPFLAGS-tst-execstack.c += -DUSE_PTHREADS=0
1810 LDFLAGS-tst-execstack = -Wl,-z,noexecstack
1811 LDFLAGS-tst-execstack-mod.so = -Wl,-z,execstack
1813 $(objpfx)tst-execstack-needed: $(objpfx)tst-execstack-mod.so
1814 LDFLAGS-tst-execstack-needed = -Wl,-z,noexecstack
1816 LDFLAGS-tst-execstack-prog = -Wl,-z,execstack
1817 CFLAGS-tst-execstack-prog.c += -Wno-trampolines
1818 CFLAGS-tst-execstack-mod.c += -Wno-trampolines
1819 endif
1821 LDFLAGS-tst-array2 = -Wl,--no-as-needed
1822 LDFLAGS-tst-array5 = -Wl,--no-as-needed
1824 $(objpfx)tst-array1-cmp.out: tst-array1.exp $(objpfx)tst-array1.out
1825 cmp $^ > $@; \
1826 $(evaluate-test)
1828 $(objpfx)tst-array1-static-cmp.out: tst-array1.exp \
1829 $(objpfx)tst-array1-static.out
1830 cmp $^ > $@; \
1831 $(evaluate-test)
1833 $(objpfx)tst-array2: $(objpfx)tst-array2dep.so
1834 $(objpfx)tst-array2-cmp.out: tst-array2.exp $(objpfx)tst-array2.out
1835 cmp $^ > $@; \
1836 $(evaluate-test)
1838 $(objpfx)tst-array3-cmp.out: tst-array1.exp $(objpfx)tst-array3.out
1839 cmp $^ > $@; \
1840 $(evaluate-test)
1842 $(objpfx)tst-array4.out: $(objpfx)tst-array2dep.so
1843 $(objpfx)tst-array4-cmp.out: tst-array4.exp $(objpfx)tst-array4.out
1844 cmp $^ > $@; \
1845 $(evaluate-test)
1847 $(objpfx)tst-array5: $(objpfx)tst-array5dep.so
1848 $(objpfx)tst-array5-cmp.out: tst-array5.exp $(objpfx)tst-array5.out
1849 cmp $^ > $@; \
1850 $(evaluate-test)
1852 $(objpfx)tst-array5-static-cmp.out: tst-array5-static.exp \
1853 $(objpfx)tst-array5-static.out
1854 cmp $^ > $@; \
1855 $(evaluate-test)
1857 CFLAGS-tst-pie1.c += $(pie-ccflag)
1858 CFLAGS-tst-pie2.c += $(pie-ccflag)
1860 $(objpfx)tst-piemod1.so: $(libsupport)
1861 $(objpfx)tst-pie1: $(objpfx)tst-piemod1.so
1862 $(objpfx)tst-dlopen-pie.out: $(objpfx)tst-pie1
1864 ifeq (yes,$(build-shared))
1865 # NB: Please keep cet-built-dso in sysdeps/x86/Makefile in sync with
1866 # all-built-dso here.
1867 all-built-dso := $(common-objpfx)elf/ld.so $(common-objpfx)libc.so \
1868 $(filter-out $(common-objpfx)linkobj/libc.so, \
1869 $(sort $(wildcard $(addprefix $(common-objpfx), \
1870 */lib*.so \
1871 iconvdata/*.so))))
1873 $(all-built-dso:=.dyn): %.dyn: %
1874 @rm -f $@T
1875 LC_ALL=C $(READELF) -W -d $< > $@T
1876 test -s $@T
1877 mv -f $@T $@
1878 common-generated += $(all-built-dso:$(common-objpfx)%=%.dyn)
1880 $(objpfx)check-textrel.out: $(..)scripts/check-textrel.awk \
1881 $(all-built-dso:=.dyn)
1882 LC_ALL=C $(AWK) -f $^ > $@; \
1883 $(evaluate-test)
1884 generated += check-textrel.out
1886 $(objpfx)execstack-default: $(first-word $(wildcard $(sysdirs:%=%/stackinfo.h)))
1887 $(make-target-directory)
1888 { echo '#include <elf.h>'; \
1889 echo '#include <stackinfo.h>'; \
1890 echo '#if (DEFAULT_STACK_PERMS & PF_X) == 0'; \
1891 echo '@@@execstack-no@@@'; \
1892 echo '#else'; \
1893 echo '@@@execstack-yes@@@'; \
1894 echo '#endif'; } | \
1895 $(CC) $(CFLAGS) $(CPPFLAGS) -E -x c-header - | \
1896 sed -n -e 's/^@@@\(.*\)@@@/\1/p' > $@T
1897 mv -f $@T $@
1898 generated += execstack-default
1900 $(all-built-dso:=.phdr): %.phdr: %
1901 @rm -f $@T
1902 LC_ALL=C $(READELF) -W -l $< > $@T
1903 test -s $@T
1904 mv -f $@T $@
1905 common-generated += $(all-built-dso:$(common-objpfx)%=%.phdr)
1907 $(objpfx)check-execstack.out: $(..)scripts/check-execstack.awk \
1908 $(objpfx)execstack-default \
1909 $(all-built-dso:=.phdr)
1910 LC_ALL=C $(AWK) -v "xfail=$(check-execstack-xfail)" -f $^ > $@; \
1911 $(evaluate-test)
1912 generated += check-execstack.out
1914 $(objpfx)check-wx-segment.out: $(..)scripts/check-wx-segment.py \
1915 $(all-built-dso:=.phdr)
1916 $(PYTHON) $^ --xfail="$(check-wx-segment-xfail)" > $@; \
1917 $(evaluate-test)
1918 generated += check-wx-segment.out
1920 $(objpfx)tst-dlmodcount.out: $(test-modules)
1922 $(all-built-dso:=.jmprel): %.jmprel: % Makefile
1923 @rm -f $@T
1924 LC_ALL=C $(READELF) -W -S -d -r $< > $@T
1925 test -s $@T
1926 mv -f $@T $@
1927 common-generated += $(all-built-dso:$(common-objpfx)%=%.jmprel)
1929 localplt-built-dso := $(addprefix $(common-objpfx),\
1930 libc.so \
1931 elf/ld.so \
1932 math/libm.so \
1933 dlfcn/libdl.so \
1934 resolv/libresolv.so \
1936 ifeq ($(build-mathvec),yes)
1937 localplt-built-dso += $(addprefix $(common-objpfx), mathvec/libmvec.so)
1938 endif
1939 ifeq ($(have-thread-library),yes)
1940 localplt-built-dso += $(filter-out %_nonshared.a, $(shared-thread-library))
1941 endif
1942 ifeq ($(build-crypt),yes)
1943 localplt-built-dso += $(addprefix $(common-objpfx), crypt/libcrypt.so)
1944 endif
1945 ifneq ($(pthread-in-libc),yes)
1946 localplt-built-dso += $(addprefix $(common-objpfx), rt/librt.so)
1947 endif
1949 vpath localplt.data $(+sysdep_dirs)
1951 $(objpfx)check-localplt.out: $(..)scripts/check-localplt.awk \
1952 $(..)scripts/localplt.awk \
1953 $(localplt-built-dso:=.jmprel) \
1954 localplt.data
1955 LC_ALL=C $(AWK) -f $(filter-out $< %localplt.data,$^) | \
1956 LC_ALL=C $(AWK) -f $< $(filter %localplt.data,$^) - \
1957 > $@; \
1958 $(evaluate-test)
1959 endif
1961 $(all-built-dso:=.dynsym): %.dynsym: %
1962 @rm -f $@T
1963 LC_ALL=C $(READELF) -W --dyn-syms $< > $@T
1964 test -s $@T
1965 mv -f $@T $@
1966 common-generated += $(all-built-dso:$(common-objpfx)%=%.dynsym)
1968 $(objpfx)check-initfini.out: $(..)scripts/check-initfini.awk \
1969 $(all-built-dso:=.dynsym)
1970 LC_ALL=C $(AWK) -f $^ > $@; \
1971 $(evaluate-test)
1972 generated += check-initfini.out
1974 $(objpfx)tst-dlopenrpath: $(objpfx)tst-dlopenrpathmod.so
1975 CFLAGS-tst-dlopenrpath.c += -DPFX=\"$(objpfx)\"
1976 LDFLAGS-tst-dlopenrpathmod.so += -Wl,-rpath,\$$ORIGIN/test-subdir
1977 $(objpfx)tst-dlopenrpath.out: $(objpfx)firstobj.so
1979 $(objpfx)tst-deep1mod2.so: $(objpfx)tst-deep1mod3.so
1980 $(objpfx)tst-deep1: $(objpfx)tst-deep1mod1.so
1981 $(objpfx)tst-deep1.out: $(objpfx)tst-deep1mod2.so
1982 LDFLAGS-tst-deep1 += -rdynamic
1983 tst-deep1mod3.so-no-z-defs = yes
1985 $(objpfx)tst-dlmopen1.out: $(objpfx)tst-dlmopen1mod.so
1987 $(objpfx)tst-dlmopen2.out: $(objpfx)tst-dlmopen1mod.so
1989 $(objpfx)tst-dlmopen3.out: $(objpfx)tst-dlmopen1mod.so
1991 $(objpfx)tst-dlmopen4.out: $(objpfx)tst-dlmopen1mod.so
1993 $(objpfx)tst-audit1.out: $(objpfx)tst-auditmod1.so
1994 tst-audit1-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1996 $(objpfx)tst-audit2.out: $(objpfx)tst-auditmod1.so $(objpfx)tst-auditmod9b.so
1997 # Prevent GCC-5 from translating a malloc/memset pair into calloc
1998 CFLAGS-tst-audit2.c += -fno-builtin
1999 tst-audit2-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
2001 $(objpfx)tst-audit9.out: $(objpfx)tst-auditmod9a.so $(objpfx)tst-auditmod9b.so
2002 tst-audit9-ENV = LD_AUDIT=$(objpfx)tst-auditmod9a.so
2004 $(objpfx)tst-audit8: $(libm)
2005 $(objpfx)tst-audit8.out: $(objpfx)tst-auditmod1.so
2006 tst-audit8-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
2008 $(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
2010 $(objpfx)tst-global2: $(objpfx)tst-globalmod2.so
2011 $(objpfx)tst-global2.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
2012 LDFLAGS-tst-global2 = -Wl,--enable-new-dtags
2013 LDFLAGS-tst-globalmod2.so = -Wl,--enable-new-dtags
2015 $(objpfx)order2.out: $(objpfx)order2mod1.so $(objpfx)order2mod2.so
2016 $(objpfx)order2-cmp.out: $(objpfx)order2.out
2017 (echo "12345" | cmp $< -) > $@; \
2018 $(evaluate-test)
2019 $(objpfx)order2mod1.so: $(objpfx)order2mod4.so
2020 $(objpfx)order2mod4.so: $(objpfx)order2mod3.so
2021 $(objpfx)order2mod2.so: $(objpfx)order2mod3.so
2022 order2mod2.so-no-z-defs = yes
2023 LDFLAGS-order2mod1.so = -Wl,--no-as-needed
2024 LDFLAGS-order2mod2.so = -Wl,--no-as-needed
2026 tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child"
2027 tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
2029 tst-ptrguard1-ARGS = --command "$(host-test-program-cmd) --child"
2030 # When built statically, the pointer guard interface uses
2031 # __pointer_chk_guard_local.
2032 CFLAGS-tst-ptrguard1-static.c += -DPTRGUARD_LOCAL
2033 tst-ptrguard1-static-ARGS = --command "$(objpfx)tst-ptrguard1-static --child"
2035 $(objpfx)tst-leaks1-mem.out: $(objpfx)tst-leaks1.out
2036 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1.mtrace > $@; \
2037 $(evaluate-test)
2039 tst-leaks1-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1.mtrace \
2040 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
2042 $(objpfx)tst-thrlock: $(shared-thread-library)
2043 $(objpfx)tst-thrlock.out: $(libm)
2044 $(objpfx)tst-noload.out: $(libm)
2046 tst-tst-dlopen-tlsmodid-no-pie = yes
2047 $(objpfx)tst-dlopen-tlsmodid: $(shared-thread-library)
2048 $(objpfx)tst-dlopen-tlsmodid.out: $(objpfx)tst-dlopen-self
2049 CFLAGS-tst-dlopen-tlsmodid-pie.c += $(pie-ccflag)
2050 $(objpfx)tst-dlopen-tlsmodid-pie: $(shared-thread-library)
2051 $(objpfx)tst-dlopen-tlsmodid-pie.out: $(objpfx)tst-dlopen-self-pie
2052 $(objpfx)tst-dlopen-tlsmodid-container: $(shared-thread-library)
2053 LDFLAGS-tst-dlopen-tlsmodid-container += -Wl,-rpath,\$$ORIGIN
2055 tst-tst-dlopen-self-no-pie = yes
2056 CFLAGS-tst-dlopen-self-pie.c += $(pie-ccflag)
2057 LDFLAGS-tst-dlopen-self-container += -Wl,-rpath,\$$ORIGIN
2059 CFLAGS-ifuncmain1pic.c += $(pic-ccflag)
2060 CFLAGS-ifuncmain1picstatic.c += $(pic-ccflag)
2061 CFLAGS-ifuncmain1staticpic.c += $(pic-ccflag)
2062 CFLAGS-ifuncdep1pic.c += $(pic-ccflag)
2063 CFLAGS-ifuncmain1vispic.c += $(pic-ccflag)
2064 CFLAGS-ifuncmain2pic.c += $(pic-ccflag)
2065 CFLAGS-ifuncmain2picstatic.c += $(pic-ccflag)
2066 CFLAGS-ifuncdep2pic.c += $(pic-ccflag)
2067 CFLAGS-ifuncmain4picstatic.c += $(pic-ccflag)
2068 CFLAGS-ifuncmain5pic.c += $(pic-ccflag)
2069 CFLAGS-ifuncmain5picstatic.c += $(pic-ccflag)
2070 CFLAGS-ifuncmain5staticpic.c += $(pic-ccflag)
2071 CFLAGS-ifuncdep5pic.c += $(pic-ccflag)
2072 CFLAGS-ifuncmain7pic.c += $(pic-ccflag)
2073 CFLAGS-ifuncmain7picstatic.c += $(pic-ccflag)
2074 CFLAGS-ifuncmain9pic.c += $(pic-ccflag)
2075 CFLAGS-ifuncmain9picstatic.c += $(pic-ccflag)
2077 LDFLAGS-ifuncmain3 = -Wl,-export-dynamic
2079 CFLAGS-ifuncmain1pie.c += $(pie-ccflag)
2080 CFLAGS-ifuncmain1vispie.c += $(pie-ccflag)
2081 CFLAGS-ifuncmain1staticpie.c += $(pie-ccflag)
2082 CFLAGS-ifuncmain5pie.c += $(pie-ccflag)
2083 CFLAGS-ifuncmain6pie.c += $(pie-ccflag)
2084 CFLAGS-ifuncmain7pie.c += $(pie-ccflag)
2085 CFLAGS-ifuncmain9pie.c += $(pie-ccflag)
2086 CFLAGS-tst-ifunc-textrel.c += $(pic-ccflag)
2088 LDFLAGS-ifuncmain6pie = -Wl,-z,lazy
2090 $(objpfx)ifuncmain1pie: $(objpfx)ifuncmod1.so
2091 $(objpfx)ifuncmain1staticpie: $(objpfx)ifuncdep1pic.o
2092 $(objpfx)ifuncmain1vispie: $(objpfx)ifuncmod1.so
2093 $(objpfx)ifuncmain5pie: $(objpfx)ifuncmod5.so
2094 $(objpfx)ifuncmain6pie: $(objpfx)ifuncmod6.so
2096 $(objpfx)ifuncmain1: $(addprefix $(objpfx),ifuncmod1.so)
2097 $(objpfx)ifuncmain1pic: $(addprefix $(objpfx),ifuncmod1.so)
2098 $(objpfx)ifuncmain1staticpic: $(addprefix $(objpfx),ifuncdep1pic.o)
2099 $(objpfx)ifuncmain1static: $(addprefix $(objpfx),ifuncdep1.o)
2100 $(objpfx)ifuncmain1picstatic: $(addprefix $(objpfx),ifuncdep1pic.o)
2101 $(objpfx)ifuncmain1vis: $(addprefix $(objpfx),ifuncmod1.so)
2102 $(objpfx)ifuncmain1vispic: $(addprefix $(objpfx),ifuncmod1.so)
2103 $(objpfx)ifuncmain2: $(addprefix $(objpfx),ifuncdep2.o)
2104 $(objpfx)ifuncmain2pic: $(addprefix $(objpfx),ifuncdep2pic.o)
2105 $(objpfx)ifuncmain2static: $(addprefix $(objpfx),ifuncdep2.o)
2106 $(objpfx)ifuncmain2picstatic: $(addprefix $(objpfx),ifuncdep2pic.o)
2108 $(objpfx)ifuncmain3.out: $(objpfx)ifuncmod3.so
2110 $(objpfx)ifuncmain5: $(addprefix $(objpfx),ifuncmod5.so)
2111 $(objpfx)ifuncmain5pic: $(addprefix $(objpfx),ifuncmod5.so)
2112 $(objpfx)ifuncmain5static: $(addprefix $(objpfx),ifuncdep5.o)
2113 $(objpfx)ifuncmain5staticpic: $(addprefix $(objpfx),ifuncdep5pic.o)
2114 $(objpfx)ifuncmain5picstatic: $(addprefix $(objpfx),ifuncdep5pic.o)
2116 LDFLAGS-tst-ifunc-fault-lazy = -Wl,-z,lazy
2117 LDFLAGS-tst-ifunc-fault-bindnow = -Wl,-z,now
2118 define tst-ifunc-fault-script
2119 ( $(test-wrapper) $(rtld-prefix) --verify $^ \
2120 && $(test-wrapper-env) LD_TRACE_LOADED_OBJECTS=1 $(rtld-prefix) $^ \
2121 && $(test-wrapper-env) LD_TRACE_LOADED_OBJECTS=1 LD_DEBUG=unused \
2122 $(rtld-prefix) $^ \
2123 ) > $@; $(evaluate-test)
2124 endef
2125 $(objpfx)tst-ifunc-fault-lazy.out: $(objpfx)tst-ifunc-fault-lazy $(objpfx)ld.so
2126 $(tst-ifunc-fault-script)
2127 $(objpfx)tst-ifunc-fault-bindnow.out: $(objpfx)tst-ifunc-fault-bindnow \
2128 $(objpfx)ld.so
2129 $(tst-ifunc-fault-script)
2131 $(objpfx)tst-unique1.out: $(objpfx)tst-unique1mod1.so \
2132 $(objpfx)tst-unique1mod2.so
2134 $(objpfx)tst-unique2: $(objpfx)tst-unique2mod1.so
2135 $(objpfx)tst-unique2.out: $(objpfx)tst-unique2mod2.so
2137 $(objpfx)tst-unique3: $(objpfx)tst-unique3lib.so
2138 $(objpfx)tst-unique3.out: $(objpfx)tst-unique3lib2.so
2140 $(objpfx)tst-unique4: $(objpfx)tst-unique4lib.so
2142 $(objpfx)tst-nodelete.out: $(objpfx)tst-nodelete-uniquemod.so \
2143 $(objpfx)tst-nodelete-rtldmod.so \
2144 $(objpfx)tst-nodelete-zmod.so
2146 LDFLAGS-tst-nodelete = -rdynamic
2147 LDFLAGS-tst-nodelete-zmod.so = -Wl,--enable-new-dtags,-z,nodelete
2149 $(objpfx)tst-nodelete2.out: $(objpfx)tst-nodelete2mod.so
2151 LDFLAGS-tst-nodelete2 = -rdynamic
2153 $(objpfx)tst-initorder-cmp.out: tst-initorder.exp $(objpfx)tst-initorder.out
2154 cmp $^ > $@; \
2155 $(evaluate-test)
2157 $(objpfx)tst-initorder2: $(objpfx)tst-initorder2a.so $(objpfx)tst-initorder2d.so $(objpfx)tst-initorder2c.so
2158 $(objpfx)tst-initorder2a.so: $(objpfx)tst-initorder2b.so
2159 $(objpfx)tst-initorder2b.so: $(objpfx)tst-initorder2c.so
2160 $(objpfx)tst-initorder2c.so: $(objpfx)tst-initorder2d.so
2161 LDFLAGS-tst-initorder2 = -Wl,--no-as-needed
2162 LDFLAGS-tst-initorder2a.so = -Wl,--no-as-needed
2163 LDFLAGS-tst-initorder2b.so = -Wl,--no-as-needed
2164 LDFLAGS-tst-initorder2c.so = -Wl,--no-as-needed
2165 define o-iterator-doit
2166 $(objpfx)tst-initorder2$o.os: tst-initorder2.c; \
2167 $$(compile-command.c) -DNAME=\"$o\"
2168 endef
2169 object-suffixes-left := a b c d
2170 include $(o-iterator)
2172 $(objpfx)tst-initorder2-cmp.out: tst-initorder2.exp $(objpfx)tst-initorder2.out
2173 cmp $^ > $@; \
2174 $(evaluate-test)
2176 $(objpfx)tst-relsort1mod1.so: $(libm) $(objpfx)tst-relsort1mod2.so
2177 $(objpfx)tst-relsort1mod2.so: $(libm)
2178 $(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
2179 $(objpfx)tst-relsort1mod2.so
2181 $(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so
2182 $(test-wrapper-env) \
2183 LD_TRACE_LOADED_OBJECTS=1 \
2184 LD_DEBUG=unused \
2185 LD_PRELOAD= \
2186 $(rtld-prefix) \
2187 $< > $@; \
2188 $(evaluate-test)
2190 $(objpfx)tst-unused-dep-cmp.out: $(objpfx)tst-unused-dep.out
2191 cmp $< /dev/null > $@; \
2192 $(evaluate-test)
2194 $(objpfx)tst-audit11.out: $(objpfx)tst-auditmod11.so $(objpfx)tst-audit11mod1.so
2195 tst-audit11-ENV = LD_AUDIT=$(objpfx)tst-auditmod11.so
2196 $(objpfx)tst-audit11mod1.so: $(objpfx)tst-audit11mod2.so
2197 LDFLAGS-tst-audit11mod2.so = -Wl,--version-script=tst-audit11mod2.map,-soname,tst-audit11mod2.so
2199 $(objpfx)tst-audit12.out: $(objpfx)tst-auditmod12.so $(objpfx)tst-audit12mod1.so $(objpfx)tst-audit12mod3.so
2200 tst-audit12-ENV = LD_AUDIT=$(objpfx)tst-auditmod12.so
2201 $(objpfx)tst-audit12mod1.so: $(objpfx)tst-audit12mod2.so
2202 LDFLAGS-tst-audit12mod2.so = -Wl,--version-script=tst-audit12mod2.map
2204 $(objpfx)tst-audit13.out: $(objpfx)tst-audit13mod1.so
2205 LDFLAGS-tst-audit13mod1.so = -Wl,-z,lazy
2206 tst-audit13-ENV = LD_AUDIT=$(objpfx)tst-audit13mod1.so
2208 $(objpfx)tst-auditmany.out: $(objpfx)tst-auditmanymod1.so \
2209 $(objpfx)tst-auditmanymod2.so $(objpfx)tst-auditmanymod3.so \
2210 $(objpfx)tst-auditmanymod4.so $(objpfx)tst-auditmanymod5.so \
2211 $(objpfx)tst-auditmanymod6.so $(objpfx)tst-auditmanymod7.so \
2212 $(objpfx)tst-auditmanymod8.so $(objpfx)tst-auditmanymod9.so
2213 tst-auditmany-ENV = \
2214 LD_AUDIT=tst-auditmanymod1.so:tst-auditmanymod2.so:tst-auditmanymod3.so:tst-auditmanymod4.so:tst-auditmanymod5.so:tst-auditmanymod6.so:tst-auditmanymod7.so:tst-auditmanymod8.so:tst-auditmanymod9.so
2216 LDFLAGS-tst-audit14 = -Wl,--audit=tst-auditlogmod-1.so,--disable-new-dtags
2217 $(objpfx)tst-auditlogmod-1.so: $(libsupport)
2218 $(objpfx)tst-audit14.out: $(objpfx)tst-auditlogmod-1.so
2219 LDFLAGS-tst-audit14a = -Wl,--audit=tst-auditlogmod-1.so,--enable-new-dtags
2220 $(objpfx)tst-audit14a.out: $(objpfx)tst-auditlogmod-1.so
2221 LDFLAGS-tst-audit15 = \
2222 -Wl,--audit=tst-auditlogmod-1.so,--depaudit=tst-auditlogmod-2.so
2223 $(objpfx)tst-auditlogmod-2.so: $(libsupport)
2224 $(objpfx)tst-audit15.out: \
2225 $(objpfx)tst-auditlogmod-1.so $(objpfx)tst-auditlogmod-2.so
2226 LDFLAGS-tst-audit16 = \
2227 -Wl,--audit=tst-auditlogmod-1.so:tst-auditlogmod-2.so \
2228 -Wl,--depaudit=tst-auditlogmod-3.so
2229 $(objpfx)tst-auditlogmod-3.so: $(libsupport)
2230 $(objpfx)tst-audit16.out: \
2231 $(objpfx)tst-auditlogmod-1.so $(objpfx)tst-auditlogmod-2.so \
2232 $(objpfx)tst-auditlogmod-3.so
2233 $(objpfx)tst-audit17.out: $(objpfx)tst-auditmod17.so
2234 # The test check if a audit library without libc.so on DT_NEEDED works as
2235 # intended, so it uses an explicit link rule.
2236 $(objpfx)tst-auditmod17.so: $(objpfx)tst-auditmod17.os
2237 $(CC) -nostdlib -nostartfiles -shared -o $@.new \
2238 $(filter-out $(map-file),$^)
2239 $(call after-link,$@.new)
2240 mv -f $@.new $@
2241 CFLAGS-.os += $(call elide-stack-protector,.os,tst-auditmod17)
2242 tst-audit17-ENV = LD_AUDIT=$(objpfx)tst-auditmod17.so
2244 $(objpfx)tst-audit14-cmp.out: tst-audit14.exp $(objpfx)tst-audit14.out
2245 cmp $^ > $@; \
2246 $(evaluate-test)
2247 $(objpfx)tst-audit14a-cmp.out: tst-audit14.exp $(objpfx)tst-audit14a.out
2248 cmp $^ > $@; \
2249 $(evaluate-test)
2250 $(objpfx)tst-audit15-cmp.out: tst-audit15.exp $(objpfx)tst-audit15.out
2251 cmp $^ > $@; \
2252 $(evaluate-test)
2253 $(objpfx)tst-audit16-cmp.out: tst-audit16.exp $(objpfx)tst-audit16.out
2254 cmp $^ > $@; \
2255 $(evaluate-test)
2257 $(objpfx)tst-audit18.out: $(objpfx)tst-auditmod18.so \
2258 $(objpfx)tst-audit18mod.so
2259 tst-audit18-ARGS = -- $(host-test-program-cmd)
2261 $(objpfx)tst-audit19a.out: $(objpfx)tst-auditmod19a.so
2262 tst-audit19a-ENV = LD_AUDIT=$(objpfx)tst-auditmod19a.so
2264 $(objpfx)tst-audit19b.out: $(objpfx)tst-auditmod19b.so
2265 $(objpfx)tst-audit19b: $(objpfx)tst-audit19bmod.so
2266 tst-audit19b-ARGS = -- $(host-test-program-cmd)
2268 $(objpfx)tst-audit20.out: $(objpfx)tst-auditmod20.so
2269 tst-audit20-ENV = LD_AUDIT=$(objpfx)tst-auditmod20.so
2271 $(objpfx)tst-audit21: $(shared-thread-library)
2272 $(objpfx)tst-audit21.out: $(objpfx)tst-auditmod21a.so
2273 $(objpfx)tst-auditmod21a.so: $(objpfx)tst-auditmod21b.so
2274 tst-audit21-ENV = LD_AUDIT=$(objpfx)tst-auditmod21a.so
2276 $(objpfx)tst-audit22.out: $(objpfx)tst-auditmod22.so
2277 tst-audit22-ARGS = -- $(host-test-program-cmd)
2279 $(objpfx)tst-audit23.out: $(objpfx)tst-auditmod23.so \
2280 $(objpfx)tst-audit23mod.so
2281 tst-audit23-ARGS = -- $(host-test-program-cmd)
2283 $(objpfx)tst-audit24a.out: $(objpfx)tst-auditmod24a.so
2284 $(objpfx)tst-audit24a: $(objpfx)tst-audit24amod1.so \
2285 $(objpfx)tst-audit24amod2.so
2286 tst-audit24a-ENV = LD_AUDIT=$(objpfx)tst-auditmod24a.so
2287 LDFLAGS-tst-audit24a = -Wl,-z,now
2289 $(objpfx)tst-audit24b.out: $(objpfx)tst-auditmod24b.so
2290 $(objpfx)tst-audit24b: $(objpfx)tst-audit24bmod1.so \
2291 $(objpfx)tst-audit24bmod2.so
2292 $(objpfx)tst-audit24bmod1: $(objpfx)tst-audit24bmod2.so
2293 # The test checks if a library without .gnu.version correctly calls the
2294 # audit callbacks. So it uses an explicit link rule to avoid linking
2295 # against libc.so.
2296 $(objpfx)tst-audit24bmod1.so: $(objpfx)tst-audit24bmod1.os
2297 $(CC) -nostdlib -nostartfiles -shared -o $@.new $(objpfx)tst-audit24bmod1.os \
2298 -Wl,-z,now
2299 $(call after-link,$@.new)
2300 mv -f $@.new $@
2301 CFLAGS-.os += $(call elide-stack-protector,.os,tst-audit24bmod1)
2302 $(objpfx)tst-audit24bmod2.so: $(objpfx)tst-audit24bmod2.os
2303 $(CC) -nostdlib -nostartfiles -shared -o $@.new $(objpfx)tst-audit24bmod2.os
2304 $(call after-link,$@.new)
2305 mv -f $@.new $@
2306 CFLAGS-.os += $(call elide-stack-protector,.os,tst-audit24bmod2)
2307 tst-audit24b-ENV = LD_AUDIT=$(objpfx)tst-auditmod24b.so
2308 LDFLAGS-tst-audit24b = -Wl,-z,now
2310 # Same as tst-audit24a, but tests LD_BIND_NOW
2311 $(objpfx)tst-audit24c.out: $(objpfx)tst-auditmod24c.so
2312 $(objpfx)tst-audit24c: $(objpfx)tst-audit24amod1.so \
2313 $(objpfx)tst-audit24amod2.so
2314 tst-audit24c-ENV = LD_BIND_NOW=1 LD_AUDIT=$(objpfx)tst-auditmod24c.so
2315 LDFLAGS-tst-audit24c = -Wl,-z,lazy
2317 $(objpfx)tst-audit24d.out: $(objpfx)tst-auditmod24d.so
2318 $(objpfx)tst-audit24d: $(objpfx)tst-audit24dmod1.so \
2319 $(objpfx)tst-audit24dmod2.so
2320 $(objpfx)tst-audit24dmod1.so: $(objpfx)tst-audit24dmod3.so
2321 LDFLAGS-tst-audit24dmod1.so = -Wl,-z,now
2322 $(objpfx)tst-audit24dmod2.so: $(objpfx)tst-audit24dmod4.so
2323 LDFLAGS-tst-audit24dmod2.so = -Wl,-z,lazy
2324 tst-audit24d-ENV = LD_AUDIT=$(objpfx)tst-auditmod24d.so
2325 LDFLAGS-tst-audit24d = -Wl,-z,lazy
2327 $(objpfx)tst-audit25a.out: $(objpfx)tst-auditmod25.so
2328 $(objpfx)tst-audit25a: $(objpfx)tst-audit25mod1.so \
2329 $(objpfx)tst-audit25mod2.so \
2330 $(objpfx)tst-audit25mod3.so \
2331 $(objpfx)tst-audit25mod4.so
2332 LDFLAGS-tst-audit25a = -Wl,-z,lazy
2333 $(objpfx)tst-audit25mod1.so: $(objpfx)tst-audit25mod3.so
2334 LDFLAGS-tst-audit25mod1.so = -Wl,-z,now
2335 $(objpfx)tst-audit25mod2.so: $(objpfx)tst-audit25mod4.so
2336 LDFLAGS-tst-audit25mod2.so = -Wl,-z,lazy
2337 tst-audit25a-ARGS = -- $(host-test-program-cmd)
2339 $(objpfx)tst-audit25b.out: $(objpfx)tst-auditmod25.so
2340 $(objpfx)tst-audit25b: $(objpfx)tst-audit25mod1.so \
2341 $(objpfx)tst-audit25mod2.so \
2342 $(objpfx)tst-audit25mod3.so \
2343 $(objpfx)tst-audit25mod4.so
2344 LDFLAGS-tst-audit25b = -Wl,-z,now
2345 tst-audit25b-ARGS = -- $(host-test-program-cmd)
2347 $(objpfx)tst-audit28.out: $(objpfx)tst-auditmod28.so
2348 $(objpfx)tst-auditmod28.so: $(libsupport)
2349 tst-audit28-ENV = LD_AUDIT=$(objpfx)tst-auditmod28.so
2351 # tst-sonamemove links against an older implementation of the library.
2352 LDFLAGS-tst-sonamemove-linkmod1.so = \
2353 -Wl,--version-script=tst-sonamemove-linkmod1.map \
2354 -Wl,-soname,tst-sonamemove-runmod1.so
2355 LDFLAGS-tst-sonamemove-runmod1.so = -Wl,--no-as-needed \
2356 -Wl,--version-script=tst-sonamemove-runmod1.map \
2357 -Wl,-soname,tst-sonamemove-runmod1.so
2358 LDFLAGS-tst-sonamemove-runmod2.so = \
2359 -Wl,--version-script=tst-sonamemove-runmod2.map \
2360 -Wl,-soname,tst-sonamemove-runmod2.so
2361 $(objpfx)tst-sonamemove-runmod1.so: $(objpfx)tst-sonamemove-runmod2.so
2362 # Link against the link module, but depend on the run-time modules
2363 # for execution.
2364 $(objpfx)tst-sonamemove-link: $(objpfx)tst-sonamemove-linkmod1.so
2365 $(objpfx)tst-sonamemove-link.out: \
2366 $(objpfx)tst-sonamemove-runmod1.so \
2367 $(objpfx)tst-sonamemove-runmod2.so
2368 $(objpfx)tst-sonamemove-dlopen.out: \
2369 $(objpfx)tst-sonamemove-runmod1.so \
2370 $(objpfx)tst-sonamemove-runmod2.so
2372 $(objpfx)tst-dlmopen-dlerror-mod.so: $(libsupport)
2373 $(objpfx)tst-dlmopen-dlerror.out: $(objpfx)tst-dlmopen-dlerror-mod.so
2375 # Override -z defs, so that we can reference an undefined symbol.
2376 # Force lazy binding for the same reason.
2377 LDFLAGS-tst-latepthreadmod.so = \
2378 -Wl,-z,lazy -Wl,--unresolved-symbols=ignore-all
2379 # Do not optimize sibling calls as the test relies on a JMP_SLOT relocation for
2380 # function this_function_is_not_defined.
2381 CFLAGS-tst-latepthreadmod.c += -fno-optimize-sibling-calls
2382 $(objpfx)tst-latepthreadmod.so: $(shared-thread-library)
2383 $(objpfx)tst-latepthread.out: $(objpfx)tst-latepthreadmod.so
2385 # The test modules are parameterized by preprocessor macros.
2386 $(patsubst %,$(objpfx)%.os,$(tst-tls-many-dynamic-modules)): \
2387 $(objpfx)tst-tls-manydynamic%mod.os : tst-tls-manydynamicmod.c
2388 $(compile-command.c) \
2389 -DNAME=tls_global_$* -DSETTER=set_value_$* -DGETTER=get_value_$*
2390 $(objpfx)tst-tls-manydynamic: $(shared-thread-library)
2391 $(objpfx)tst-tls-manydynamic.out: \
2392 $(patsubst %,$(objpfx)%.so,$(tst-tls-many-dynamic-modules))
2394 $(objpfx)tst-ldconfig-X.out : tst-ldconfig-X.sh $(objpfx)ldconfig
2395 $(SHELL) $< '$(common-objpfx)' '$(test-wrapper-env)' \
2396 '$(run-program-env)' > $@; \
2397 $(evaluate-test)
2399 # Test static linking of all the libraries we can possibly link
2400 # together. Note that in some configurations this may be less than the
2401 # complete list of libraries we build but we try to maxmimize this list.
2402 ifeq ($(pthread-in-libc),no)
2403 $(objpfx)tst-linkall-static: \
2404 $(common-objpfx)resolv/libanl.a
2405 endif
2406 $(objpfx)tst-linkall-static: \
2407 $(common-objpfx)math/libm.a \
2408 $(common-objpfx)resolv/libresolv.a \
2409 $(common-objpfx)login/libutil.a \
2410 $(common-objpfx)rt/librt.a \
2411 $(static-thread-library)
2413 ifeq ($(build-crypt),yes)
2414 # If we are using NSS crypto and we have the ability to link statically
2415 # then we include libcrypt.a, otherwise we leave out libcrypt.a and
2416 # link as much as we can into the tst-linkall-static test. This assumes
2417 # that linking with libcrypt.a does everything required to include the
2418 # static NSS crypto library.
2419 ifeq (yesyes,$(nss-crypt)$(static-nss-crypt))
2420 $(objpfx)tst-linkall-static: \
2421 $(common-objpfx)crypt/libcrypt.a
2422 endif
2423 # If we are not using NSS crypto then we always have the ability to link
2424 # with libcrypt.a.
2425 ifeq (no,$(nss-crypt))
2426 $(objpfx)tst-linkall-static: \
2427 $(common-objpfx)crypt/libcrypt.a
2428 endif
2429 endif
2431 LDFLAGS-nextmod3.so = -Wl,--version-script=nextmod3.map
2433 # The application depends on the DSO, and the DSO loads the plugin.
2434 # The plugin also depends on the DSO. This creates the circular
2435 # dependency via dlopen that we're testing to make sure works.
2436 $(objpfx)tst-nodelete-dlclose-plugin.so: $(objpfx)tst-nodelete-dlclose-dso.so
2437 $(objpfx)tst-nodelete-dlclose: $(objpfx)tst-nodelete-dlclose-dso.so
2438 $(objpfx)tst-nodelete-dlclose.out: $(objpfx)tst-nodelete-dlclose-dso.so \
2439 $(objpfx)tst-nodelete-dlclose-plugin.so
2441 tst-env-setuid-ENV = MALLOC_CHECK_=2 MALLOC_MMAP_THRESHOLD_=4096 \
2442 LD_HWCAP_MASK=0x1
2444 $(objpfx)tst-debug1.out: $(objpfx)tst-debug1mod1.so
2446 $(objpfx)tst-debug1mod1.so: $(objpfx)testobj1.so
2447 $(OBJCOPY) --only-keep-debug $< $@
2449 $(objpfx)tst-main1: $(objpfx)tst-main1mod.so
2450 CRT-tst-main1 := $(csu-objpfx)crt1.o
2451 tst-main1-no-pie = yes
2452 LDLIBS-tst-main1 = $(libsupport)
2453 tst-main1mod.so-no-z-defs = yes
2455 LDLIBS-tst-absolute-sym-lib.so = tst-absolute-sym-lib.lds
2456 $(objpfx)tst-absolute-sym-lib.so: $(LDLIBS-tst-absolute-sym-lib.so)
2457 $(objpfx)tst-absolute-sym: $(objpfx)tst-absolute-sym-lib.so
2459 LDLIBS-tst-absolute-zero-lib.so = tst-absolute-zero-lib.lds
2460 $(objpfx)tst-absolute-zero-lib.so: $(LDLIBS-tst-absolute-zero-lib.so)
2461 $(objpfx)tst-absolute-zero: $(objpfx)tst-absolute-zero-lib.so
2463 $(objpfx)tst-big-note: $(objpfx)tst-big-note-lib.so
2464 # Avoid creating an ABI tag note, which may come before the
2465 # artificial, large note in tst-big-note-lib.o and invalidate the
2466 # test.
2467 $(objpfx)tst-big-note-lib.so: $(objpfx)tst-big-note-lib.o
2468 $(LINK.o) -shared -o $@ $(LDFLAGS.so) $(dt-relr-ldflag) $<
2470 $(objpfx)tst-unwind-ctor: $(objpfx)tst-unwind-ctor-lib.so
2472 CFLAGS-tst-unwind-main.c += -funwind-tables -DUSE_PTHREADS=0
2474 $(objpfx)tst-initfinilazyfail.out: \
2475 $(objpfx)tst-initlazyfailmod.so $(objpfx)tst-finilazyfailmod.so
2476 # Override -z defs, so that we can reference an undefined symbol.
2477 # Force lazy binding for the same reason.
2478 LDFLAGS-tst-initlazyfailmod.so = \
2479 -Wl,-z,lazy -Wl,--unresolved-symbols=ignore-all
2480 LDFLAGS-tst-finilazyfailmod.so = \
2481 -Wl,-z,lazy -Wl,--unresolved-symbols=ignore-all
2483 $(objpfx)tst-dlopenfail.out: \
2484 $(objpfx)tst-dlopenfailmod1.so $(objpfx)tst-dlopenfailmod2.so
2485 # Order matters here. tst-dlopenfaillinkmod.so's soname ensures a
2486 # run-time loader failure. --as-needed breaks this test because
2487 # nothing actually references tst-dlopenfailmod2.so (with its soname
2488 # tst-dlopenfail-missingmod.so).
2489 LDFLAGS-tst-dlopenfailmod1.so = -Wl,--no-as-needed
2490 $(objpfx)tst-dlopenfailmod1.so: \
2491 $(shared-thread-library) $(objpfx)tst-dlopenfaillinkmod.so
2492 LDFLAGS-tst-dlopenfaillinkmod.so = -Wl,-soname,tst-dlopenfail-missingmod.so
2493 $(objpfx)tst-dlopenfailmod2.so: $(objpfx)tst-dlopenfailnodelmod.so
2494 $(objpfx)tst-dlopenfail-2.out: \
2495 $(objpfx)tst-dlopenfailmod1.so $(objpfx)tst-dlopenfailmod2.so \
2496 $(objpfx)tst-dlopenfailmod3.so
2497 # tst-dlopenfailnodelmod.so emulates how libpthread was linked.
2498 $(objpfx)tst-dlopenfailnodelmod.so: $(libsupport)
2499 LDFLAGS-tst-dlopenfailnodelmod.so = \
2500 -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
2501 # tst-dlopenfail should export the libsupport symbols, so that
2502 # tst-dlopenfailnodelmod.so uses them for error reporting.
2503 LDFLAGS-tst-dlopenfail = -Wl,-E
2505 $(objpfx)tst-dlopen-nodelete-reloc.out: \
2506 $(objpfx)tst-dlopen-nodelete-reloc-mod1.so \
2507 $(objpfx)tst-dlopen-nodelete-reloc-mod2.so \
2508 $(objpfx)tst-dlopen-nodelete-reloc-mod3.so \
2509 $(objpfx)tst-dlopen-nodelete-reloc-mod4.so \
2510 $(objpfx)tst-dlopen-nodelete-reloc-mod5.so \
2511 $(objpfx)tst-dlopen-nodelete-reloc-mod6.so \
2512 $(objpfx)tst-dlopen-nodelete-reloc-mod7.so \
2513 $(objpfx)tst-dlopen-nodelete-reloc-mod8.so \
2514 $(objpfx)tst-dlopen-nodelete-reloc-mod9.so \
2515 $(objpfx)tst-dlopen-nodelete-reloc-mod10.so \
2516 $(objpfx)tst-dlopen-nodelete-reloc-mod11.so \
2517 $(objpfx)tst-dlopen-nodelete-reloc-mod12.so \
2518 $(objpfx)tst-dlopen-nodelete-reloc-mod13.so \
2519 $(objpfx)tst-dlopen-nodelete-reloc-mod14.so \
2520 $(objpfx)tst-dlopen-nodelete-reloc-mod15.so \
2521 $(objpfx)tst-dlopen-nodelete-reloc-mod16.so \
2522 $(objpfx)tst-dlopen-nodelete-reloc-mod17.so
2523 tst-dlopen-nodelete-reloc-mod2.so-no-z-defs = yes
2524 LDFLAGS-tst-dlopen-nodelete-reloc-mod2.so = -Wl,-z,nodelete
2525 $(objpfx)tst-dlopen-nodelete-reloc-mod4.so: \
2526 $(objpfx)tst-dlopen-nodelete-reloc-mod3.so
2527 LDFLAGS-tst-dlopen-nodelete-reloc-mod4.so = -Wl,--no-as-needed
2528 $(objpfx)tst-dlopen-nodelete-reloc-mod5.so: \
2529 $(objpfx)tst-dlopen-nodelete-reloc-mod4.so
2530 LDFLAGS-tst-dlopen-nodelete-reloc-mod5.so = -Wl,-z,nodelete,--no-as-needed
2531 tst-dlopen-nodelete-reloc-mod5.so-no-z-defs = yes
2532 tst-dlopen-nodelete-reloc-mod7.so-no-z-defs = yes
2533 tst-dlopen-nodelete-reloc-mod11.so-no-z-defs = yes
2534 $(objpfx)tst-dlopen-nodelete-reloc-mod13.so: \
2535 $(objpfx)tst-dlopen-nodelete-reloc-mod12.so
2536 $(objpfx)tst-dlopen-nodelete-reloc-mod15.so: \
2537 $(objpfx)tst-dlopen-nodelete-reloc-mod14.so
2538 tst-dlopen-nodelete-reloc-mod16.so-no-z-defs = yes
2539 $(objpfx)tst-dlopen-nodelete-reloc-mod16.so: \
2540 $(objpfx)tst-dlopen-nodelete-reloc-mod15.so
2541 LDFLAGS-tst-dlopen-nodelete-reloc-mod16.so = -Wl,--no-as-needed
2542 $(objpfx)tst-dlopen-nodelete-reloc-mod17.so: \
2543 $(objpfx)tst-dlopen-nodelete-reloc-mod15.so \
2544 $(objpfx)tst-dlopen-nodelete-reloc-mod16.so
2545 LDFLAGS-tst-dlopen-nodelete-reloc-mod17.so = -Wl,--no-as-needed
2547 $(objpfx)tst-ldconfig-ld_so_conf-update.out: $(objpfx)tst-ldconfig-ld-mod.so
2549 LDFLAGS-tst-filterobj-flt.so = -Wl,--filter=$(objpfx)tst-filterobj-filtee.so
2550 $(objpfx)tst-filterobj: $(objpfx)tst-filterobj-flt.so
2551 $(objpfx)tst-filterobj.out: $(objpfx)tst-filterobj-filtee.so
2552 $(objpfx)tst-filterobj-dlopen.out: $(objpfx)tst-filterobj-filtee.so
2554 LDFLAGS-tst-filterobj-aux.so = -Wl,--auxiliary=$(objpfx)tst-filterobj-filtee.so
2555 $(objpfx)tst-auxobj: $(objpfx)tst-filterobj-aux.so
2556 $(objpfx)tst-auxobj.out: $(objpfx)tst-filterobj-filtee.so
2557 $(objpfx)tst-auxobj-dlopen.out: $(objpfx)tst-filterobj-filtee.so
2559 $(objpfx)tst-single_threaded: $(objpfx)tst-single_threaded-mod1.so
2560 $(objpfx)tst-single_threaded.out: \
2561 $(objpfx)tst-single_threaded-mod2.so $(objpfx)tst-single_threaded-mod3.so
2562 $(objpfx)tst-single_threaded-static-dlopen: \
2563 $(objpfx)tst-single_threaded-mod1.o
2564 $(objpfx)tst-single_threaded-static-dlopen.out: \
2565 $(objpfx)tst-single_threaded-mod2.so
2566 $(objpfx)tst-single_threaded-pthread: \
2567 $(objpfx)tst-single_threaded-mod1.so $(shared-thread-library)
2568 $(objpfx)tst-single_threaded-pthread.out: \
2569 $(objpfx)tst-single_threaded-mod2.so $(objpfx)tst-single_threaded-mod3.so \
2570 $(objpfx)tst-single_threaded-mod4.so
2571 $(objpfx)tst-single_threaded-pthread-static: $(static-thread-library)
2573 $(objpfx)tst-tls-ie: $(shared-thread-library)
2574 $(objpfx)tst-tls-ie.out: \
2575 $(objpfx)tst-tls-ie-mod0.so \
2576 $(objpfx)tst-tls-ie-mod1.so \
2577 $(objpfx)tst-tls-ie-mod2.so \
2578 $(objpfx)tst-tls-ie-mod3.so \
2579 $(objpfx)tst-tls-ie-mod4.so \
2580 $(objpfx)tst-tls-ie-mod5.so \
2581 $(objpfx)tst-tls-ie-mod6.so
2583 $(objpfx)tst-tls-ie-dlmopen: $(shared-thread-library)
2584 $(objpfx)tst-tls-ie-dlmopen.out: \
2585 $(objpfx)tst-tls-ie-mod0.so \
2586 $(objpfx)tst-tls-ie-mod1.so \
2587 $(objpfx)tst-tls-ie-mod2.so \
2588 $(objpfx)tst-tls-ie-mod3.so \
2589 $(objpfx)tst-tls-ie-mod4.so \
2590 $(objpfx)tst-tls-ie-mod5.so \
2591 $(objpfx)tst-tls-ie-mod6.so
2593 $(objpfx)argv0test.out: tst-rtld-argv0.sh $(objpfx)ld.so \
2594 $(objpfx)argv0test
2595 $(SHELL) $< $(objpfx)ld.so $(objpfx)argv0test \
2596 '$(test-wrapper-env)' '$(run_program_env)' \
2597 '$(rpath-link)' 'test-argv0' > $@; \
2598 $(evaluate-test)
2600 # A list containing the name of the most likely searched subdirectory
2601 # of the glibc-hwcaps directory, for each supported architecture (in
2602 # other words, the oldest hardware level recognized by the
2603 # glibc-hwcaps mechanism for this architecture). Used to obtain test
2604 # coverage for some glibc-hwcaps tests for the widest possible range
2605 # of systems.
2606 glibc-hwcaps-first-subdirs-for-tests = power9 x86-64-v2 z13
2608 # The test modules are parameterized by preprocessor macros.
2609 LDFLAGS-libmarkermod1-1.so += -Wl,-soname,libmarkermod1.so
2610 LDFLAGS-libmarkermod2-1.so += -Wl,-soname,libmarkermod2.so
2611 LDFLAGS-libmarkermod3-1.so += -Wl,-soname,libmarkermod3.so
2612 LDFLAGS-libmarkermod4-1.so += -Wl,-soname,libmarkermod4.so
2613 LDFLAGS-libmarkermod5-1.so += -Wl,-soname,libmarkermod5.so
2614 $(objpfx)libmarkermod%.os : markermodMARKER-VALUE.c
2615 $(compile-command.c) \
2616 -DMARKER=marker$(firstword $(subst -, ,$*)) \
2617 -DVALUE=$(lastword $(subst -, ,$*))
2618 $(objpfx)libmarkermod1.so: $(objpfx)libmarkermod1-1.so
2619 cp $< $@
2620 $(objpfx)libmarkermod2.so: $(objpfx)libmarkermod2-1.so
2621 cp $< $@
2622 $(objpfx)libmarkermod3.so: $(objpfx)libmarkermod3-1.so
2623 cp $< $@
2624 $(objpfx)libmarkermod4.so: $(objpfx)libmarkermod4-1.so
2625 cp $< $@
2626 $(objpfx)libmarkermod5.so: $(objpfx)libmarkermod5-1.so
2627 cp $< $@
2629 # tst-glibc-hwcaps-prepend checks that --glibc-hwcaps-prepend is
2630 # preferred over auto-detected subdirectories.
2631 $(objpfx)tst-glibc-hwcaps-prepend: $(objpfx)libmarkermod1-1.so
2632 $(objpfx)glibc-hwcaps/prepend-markermod1/libmarkermod1.so: \
2633 $(objpfx)libmarkermod1-2.so
2634 $(make-target-directory)
2635 cp $< $@
2636 $(objpfx)glibc-hwcaps/%/libmarkermod1.so: $(objpfx)libmarkermod1-3.so
2637 $(make-target-directory)
2638 cp $< $@
2639 $(objpfx)tst-glibc-hwcaps-prepend.out: \
2640 $(objpfx)tst-glibc-hwcaps-prepend $(objpfx)libmarkermod1.so \
2641 $(patsubst %,$(objpfx)glibc-hwcaps/%/libmarkermod1.so,prepend-markermod1 \
2642 $(glibc-hwcaps-first-subdirs-for-tests))
2643 $(test-wrapper) $(rtld-prefix) \
2644 --glibc-hwcaps-prepend prepend-markermod1 \
2645 $< > $@; \
2646 $(evaluate-test)
2648 # Like tst-glibc-hwcaps-prepend, but uses a container and loads the
2649 # library via ld.so.cache. Test setup is contained in the test
2650 # itself.
2651 $(objpfx)tst-glibc-hwcaps-prepend-cache.out: \
2652 $(objpfx)tst-glibc-hwcaps-prepend-cache $(objpfx)libmarkermod1-1.so \
2653 $(objpfx)libmarkermod1-2.so $(objpfx)libmarkermod1-3.so
2655 # tst-glibc-hwcaps-mask checks that --glibc-hwcaps-mask can be used to
2656 # suppress all auto-detected subdirectories.
2657 $(objpfx)tst-glibc-hwcaps-mask: $(objpfx)libmarkermod1-1.so
2658 $(objpfx)tst-glibc-hwcaps-mask.out: \
2659 $(objpfx)tst-glibc-hwcaps-mask $(objpfx)libmarkermod1.so \
2660 $(patsubst %,$(objpfx)glibc-hwcaps/%/libmarkermod1.so,\
2661 $(glibc-hwcaps-first-subdirs-for-tests))
2662 $(test-wrapper) $(rtld-prefix) \
2663 --glibc-hwcaps-mask does-not-exist \
2664 $< > $@; \
2665 $(evaluate-test)
2667 # Generic dependency for sysdeps implementation of
2668 # tst-glibc-hwcaps-cache.
2669 $(objpfx)tst-glibc-hwcaps-cache.out: $(objpfx)tst-glibc-hwcaps
2671 $(objpfx)list-tunables.out: tst-rtld-list-tunables.sh $(objpfx)ld.so
2672 $(SHELL) $< $(objpfx)ld.so '$(test-wrapper-env)' \
2673 '$(run_program_env)' > $(objpfx)/tst-rtld-list-tunables.out
2674 cmp tst-rtld-list-tunables.exp \
2675 $(objpfx)/tst-rtld-list-tunables.out > $@; \
2676 $(evaluate-test)
2678 tst-dst-static-ENV = LD_LIBRARY_PATH='$$ORIGIN'
2680 $(objpfx)tst-rtld-help.out: $(objpfx)ld.so
2681 $(test-wrapper) $(rtld-prefix) --help > $@; \
2682 status=$$?; \
2683 echo "info: ld.so exit status: $$status" >> $@; \
2684 (exit $$status); \
2685 $(evaluate-test)
2687 # Reuses tst-tls-many-dynamic-modules
2688 $(patsubst %,$(objpfx)%.os,$(tst-tls-many-dynamic-modules-dep)): \
2689 $(objpfx)tst-tls-manydynamic%mod-dep.os : tst-tls-manydynamicmod.c
2690 $(compile-command.c) \
2691 -DNAME=tls_global_$* -DSETTER=set_value_$* -DGETTER=get_value_$*
2692 $(patsubst %,$(objpfx)%.os,$(tst-tls-many-dynamic-modules-dep-bad)): \
2693 $(objpfx)tst-tls-manydynamic%mod-dep-bad.os : tst-tls-manydynamicmod.c
2694 $(compile-command.c) \
2695 -DNAME=tls_global_$* -DSETTER=set_value_$* -DGETTER=get_value_$*
2696 tst-tls20mod-bad.so-no-z-defs = yes
2697 # Single dependency.
2698 $(objpfx)tst-tls-manydynamic0mod-dep.so: $(objpfx)tst-tls-manydynamic1mod-dep.so
2699 # Double dependencies.
2700 $(objpfx)tst-tls-manydynamic2mod-dep.so: $(objpfx)tst-tls-manydynamic3mod-dep.so \
2701 $(objpfx)tst-tls-manydynamic4mod-dep.so
2702 # Double dependencies with each dependency depent of another module.
2703 $(objpfx)tst-tls-manydynamic5mod-dep.so: $(objpfx)tst-tls-manydynamic6mod-dep.so \
2704 $(objpfx)tst-tls-manydynamic7mod-dep.so
2705 $(objpfx)tst-tls-manydynamic6mod-dep.so: $(objpfx)tst-tls-manydynamic8mod-dep.so
2706 $(objpfx)tst-tls-manydynamic7mod-dep.so: $(objpfx)tst-tls-manydynamic8mod-dep.so
2707 # Long chain with one double dependency in the middle
2708 $(objpfx)tst-tls-manydynamic9mod-dep.so: $(objpfx)tst-tls-manydynamic10mod-dep.so \
2709 $(objpfx)tst-tls-manydynamic11mod-dep.so
2710 $(objpfx)tst-tls-manydynamic10mod-dep.so: $(objpfx)tst-tls-manydynamic12mod-dep.so
2711 $(objpfx)tst-tls-manydynamic12mod-dep.so: $(objpfx)tst-tls-manydynamic13mod-dep.so
2712 # Long chain with two double depedencies in the middle
2713 $(objpfx)tst-tls-manydynamic14mod-dep.so: $(objpfx)tst-tls-manydynamic15mod-dep.so
2714 $(objpfx)tst-tls-manydynamic15mod-dep.so: $(objpfx)tst-tls-manydynamic16mod-dep.so \
2715 $(objpfx)tst-tls-manydynamic17mod-dep.so
2716 $(objpfx)tst-tls-manydynamic16mod-dep.so: $(objpfx)tst-tls-manydynamic18mod-dep.so \
2717 $(objpfx)tst-tls-manydynamic19mod-dep.so
2718 # Same but with an invalid module.
2719 # Single dependency.
2720 $(objpfx)tst-tls-manydynamic0mod-dep-bad.so: $(objpfx)tst-tls20mod-bad.so
2721 LDFLAGS-tst-tls-manydynamic0mod-dep-bad.so = -Wl,--no-as-needed
2722 # Double dependencies.
2723 $(objpfx)tst-tls-manydynamic1mod-dep-bad.so: $(objpfx)tst-tls-manydynamic2mod-dep-bad.so \
2724 $(objpfx)tst-tls20mod-bad.so
2725 LDFLAGS-tst-tls-manydynamic1mod-dep-bad.so = -Wl,--no-as-needed
2726 # Double dependencies with each dependency depent of another module.
2727 $(objpfx)tst-tls-manydynamic3mod-dep-bad.so: $(objpfx)tst-tls-manydynamic4mod-dep-bad.so \
2728 $(objpfx)tst-tls-manydynamic5mod-dep-bad.so
2729 LDFLAGS-tst-tls-manydynamic3mod-dep-bad.so = -Wl,--no-as-needed
2730 $(objpfx)tst-tls-manydynamic4mod-dep-bad.so: $(objpfx)tst-tls20mod-bad.so
2731 LDFLAGS-tst-tls-manydynamic4mod-dep-bad.so = -Wl,--no-as-needed
2732 $(objpfx)tst-tls-manydynamic5mod-dep-bad.so: $(objpfx)tst-tls20mod-bad.so
2733 LDFLAGS-tst-tls-manydynamic5mod-dep-bad.so = -Wl,--no-as-needed
2734 # Long chain with one double dependency in the middle
2735 $(objpfx)tst-tls-manydynamic6mod-dep-bad.so: $(objpfx)tst-tls-manydynamic7mod-dep-bad.so \
2736 $(objpfx)tst-tls-manydynamic8mod-dep-bad.so
2737 LDFLAGS-tst-tls-manydynamic6mod-dep-bad.so = -Wl,--no-as-needed
2738 $(objpfx)tst-tls-manydynamic7mod-dep-bad.so: $(objpfx)tst-tls-manydynamic9mod-dep-bad.so
2739 LDFLAGS-tst-tls-manydynamic7mod-dep-bad.so = -Wl,--no-as-needed
2740 $(objpfx)tst-tls-manydynamic9mod-dep-bad.so: $(objpfx)tst-tls20mod-bad.so
2741 LDFLAGS-tst-tls-manydynamic9mod-dep-bad.so = -Wl,--no-as-needed
2742 # Long chain with two double depedencies in the middle
2743 $(objpfx)tst-tls-manydynamic10mod-dep-bad.so: $(objpfx)tst-tls-manydynamic11mod-dep-bad.so
2744 LDFLAGS-tst-tls-manydynamic10mod-dep-bad.so = -Wl,--no-as-needed
2745 $(objpfx)tst-tls-manydynamic11mod-dep-bad.so: $(objpfx)tst-tls-manydynamic12mod-dep-bad.so \
2746 $(objpfx)tst-tls-manydynamic13mod-dep-bad.so
2747 LDFLAGS-tst-tls-manydynamic11mod-dep-bad.so = -Wl,--no-as-needed
2748 $(objpfx)tst-tls-manydynamic12mod-dep-bad.so: $(objpfx)tst-tls-manydynamic14mod-dep-bad.so \
2749 $(objpfx)tst-tls20mod-bad.so
2750 LDFLAGS-tst-tls-manydynamic12mod-dep-bad.so = -Wl,--no-as-needed
2751 $(objpfx)tst-tls20: $(shared-thread-library)
2752 $(objpfx)tst-tls20.out: $(objpfx)tst-tls20mod-bad.so \
2753 $(tst-tls-many-dynamic-modules:%=$(objpfx)%.so) \
2754 $(tst-tls-many-dynamic-modules-dep:%=$(objpfx)%.so) \
2755 $(tst-tls-many-dynamic-modules-dep-bad:%=$(objpfx)%.so) \
2757 # Reuses tst-tls-many-dynamic-modules
2758 $(objpfx)tst-tls21: $(shared-thread-library)
2759 $(objpfx)tst-tls21.out: $(objpfx)tst-tls21mod.so
2760 $(objpfx)tst-tls21mod.so: $(tst-tls-many-dynamic-modules:%=$(objpfx)%.so)
2762 $(objpfx)tst-getauxval-static.out: $(objpfx)tst-auxvalmod.so
2763 tst-getauxval-static-ENV = LD_LIBRARY_PATH=$(objpfx):$(common-objpfx)
2765 $(objpfx)tst-dlmopen-gethostbyname.out: $(objpfx)tst-dlmopen-gethostbyname-mod.so
2767 $(objpfx)tst-ro-dynamic: $(objpfx)tst-ro-dynamic-mod.so
2768 $(objpfx)tst-ro-dynamic-mod.so: $(objpfx)tst-ro-dynamic-mod.os \
2769 tst-ro-dynamic-mod.map
2770 $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
2771 $(dt-relr-ldflag) \
2772 -Wl,--script=tst-ro-dynamic-mod.map \
2773 $(objpfx)tst-ro-dynamic-mod.os
2775 $(objpfx)tst-rtld-run-static.out: $(objpfx)/ldconfig
2777 $(objpfx)tst-dl_find_object.out: \
2778 $(objpfx)tst-dl_find_object-mod1.so $(objpfx)tst-dl_find_object-mod2.so
2779 $(objpfx)tst-dl_find_object-static.out: \
2780 $(objpfx)tst-dl_find_object-mod1.so $(objpfx)tst-dl_find_object-mod2.so
2781 tst-dl_find_object-static-ENV = $(static-dlopen-environment)
2782 CFLAGS-tst-dl_find_object.c += -funwind-tables
2783 CFLAGS-tst-dl_find_object-static.c += -funwind-tables
2784 LDFLAGS-tst-dl_find_object-static += -Wl,--eh-frame-hdr
2785 CFLAGS-tst-dl_find_object-mod1.c += -funwind-tables
2786 CFLAGS-tst-dl_find_object-mod2.c += -funwind-tables
2787 LDFLAGS-tst-dl_find_object-mod2.so += -Wl,--enable-new-dtags,-z,nodelete
2788 $(objpfx)tst-dl_find_object-threads: $(shared-thread-library)
2789 CFLAGS-tst-dl_find_object-threads.c += -funwind-tables
2790 $(objpfx)tst-dl_find_object-threads.out: \
2791 $(objpfx)tst-dl_find_object-mod1.so \
2792 $(objpfx)tst-dl_find_object-mod2.so \
2793 $(objpfx)tst-dl_find_object-mod3.so \
2794 $(objpfx)tst-dl_find_object-mod4.so \
2795 $(objpfx)tst-dl_find_object-mod5.so \
2796 $(objpfx)tst-dl_find_object-mod6.so \
2797 $(objpfx)tst-dl_find_object-mod7.so \
2798 $(objpfx)tst-dl_find_object-mod8.so \
2799 $(objpfx)tst-dl_find_object-mod9.so
2800 CFLAGS-tst-dl_find_object-mod3.c += -funwind-tables
2801 CFLAGS-tst-dl_find_object-mod4.c += -funwind-tables
2802 CFLAGS-tst-dl_find_object-mod5.c += -funwind-tables
2803 CFLAGS-tst-dl_find_object-mod6.c += -funwind-tables
2804 CFLAGS-tst-dl_find_object-mod7.c += -funwind-tables
2805 CFLAGS-tst-dl_find_object-mod8.c += -funwind-tables
2806 CFLAGS-tst-dl_find_object-mod9.c += -funwind-tables
2808 $(objpfx)tst-p_alignmod-base.so: $(libsupport)
2809 LDFLAGS-tst-p_alignmod-base.so += -Wl,-z,max-page-size=0x200000
2811 $(objpfx)tst-p_align1: $(objpfx)tst-p_alignmod1.so
2813 # Make a copy of tst-p_alignmod-base.so and lower p_align of the first
2814 # PT_LOAD segment.
2815 $(objpfx)tst-p_alignmod1.so: $(objpfx)tst-p_alignmod-base.so
2816 rm -f $@
2817 cp $(objpfx)tst-p_alignmod-base.so $@
2818 $(PYTHON) $(..)scripts/tst-elf-edit.py -a half $@
2820 $(objpfx)tst-p_align2: $(objpfx)tst-p_alignmod2.so
2822 # Make a copy of tst-p_alignmod-base.so and update p_align of the first
2823 # PT_LOAD segment.
2824 $(objpfx)tst-p_alignmod2.so: $(objpfx)tst-p_alignmod-base.so
2825 rm -f $@
2826 cp $(objpfx)tst-p_alignmod-base.so $@
2827 $(PYTHON) $(..)scripts/tst-elf-edit.py -a 1 $@
2829 LDFLAGS-tst-p_alignmod3.so += -Wl,-z,max-page-size=0x100,-z,common-page-size=0x100
2831 $(objpfx)tst-p_align3: $(objpfx)tst-p_alignmod3.so
2832 $(objpfx)tst-p_align3.out: tst-p_align3.sh $(objpfx)tst-p_align3
2833 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \
2834 $(evaluate-test)
2836 $(objpfx)check-abi-version-libc.out: $(common-objpfx)libc.so
2837 LC_ALL=C $(READELF) -V -W $< \
2838 | sed -ne '/.gnu.version_d/, /.gnu.version_r/ p' \
2839 | grep GLIBC_ABI_DT_RELR > $@; \
2840 $(evaluate-test)
2842 $(objpfx)check-tst-relr-pie.out: $(objpfx)tst-relr-pie
2843 LC_ALL=C $(OBJDUMP) -p $< \
2844 | sed -ne '/required from libc.so/,$$ p' \
2845 | grep GLIBC_ABI_DT_RELR > $@; \
2846 $(evaluate-test)
2848 # The test checks if a DT_RELR shared library without DT_NEEDED works as
2849 # intended, so it uses an explicit link rule.
2850 $(objpfx)tst-relr2: $(objpfx)tst-relr-mod2.so
2851 $(objpfx)tst-relr-mod2.so: $(objpfx)tst-relr-mod2.os
2852 $(LINK.o) -nostdlib -nostartfiles -Wl,-z,pack-relative-relocs \
2853 $(LDFLAGS-soname-fname) \
2854 -shared -o $@.new $(filter-out $(map-file),$^)
2855 $(call after-link,$@.new)
2856 mv -f $@.new $@
2858 # The test checks if a DT_RELR shared library without DT_VERNEED works as
2859 # intended, so it uses an explicit link rule.
2860 $(objpfx)tst-relr3: $(objpfx)tst-relr-mod3a.so
2861 $(objpfx)tst-relr-mod3b.so: $(objpfx)tst-relr-mod3b.os
2862 $(LINK.o) -nostdlib -nostartfiles -Wl,-z,pack-relative-relocs \
2863 $(LDFLAGS-soname-fname) \
2864 -shared -o $@.new $(filter-out $(map-file),$^)
2865 $(call after-link,$@.new)
2866 mv -f $@.new $@
2868 $(objpfx)tst-relr-mod3a.so: $(objpfx)tst-relr-mod3a.os \
2869 $(objpfx)tst-relr-mod3b.so
2870 $(LINK.o) -nostdlib -nostartfiles -Wl,-z,pack-relative-relocs \
2871 $(LDFLAGS-soname-fname) $(LDFLAGS-rpath-ORIGIN) \
2872 -shared -o $@.new $(filter-out $(map-file),$^)
2873 $(call after-link,$@.new)
2874 mv -f $@.new $@
2876 # The test checks if a DT_RELR shared library without libc.so on DT_NEEDED
2877 # works as intended, so it uses an explicit link rule.
2878 $(objpfx)tst-relr4: $(objpfx)tst-relr-mod4a.so
2879 $(objpfx)tst-relr-mod4b.so: $(objpfx)tst-relr-mod4b.os
2880 $(LINK.o) -nostdlib -nostartfiles -Wl,-z,pack-relative-relocs \
2881 $(LDFLAGS-soname-fname) \
2882 -Wl,--version-script=tst-relr-mod4b.map \
2883 -shared -o $@.new $(filter-out $(map-file),$^)
2884 $(call after-link,$@.new)
2885 mv -f $@.new $@
2887 $(objpfx)tst-relr-mod4a.so: $(objpfx)tst-relr-mod4a.os \
2888 $(objpfx)tst-relr-mod4b.so
2889 $(LINK.o) -nostdlib -nostartfiles -Wl,-z,pack-relative-relocs \
2890 $(LDFLAGS-soname-fname) $(LDFLAGS-rpath-ORIGIN) \
2891 -shared -o $@.new $(filter-out $(map-file),$^)
2892 $(call after-link,$@.new)
2893 mv -f $@.new $@
2895 LDFLAGS-libtracemod1-1.so += -Wl,-soname,libtracemod1.so
2896 LDFLAGS-libtracemod2-1.so += -Wl,-soname,libtracemod2.so
2897 LDFLAGS-libtracemod3-1.so += -Wl,-soname,libtracemod3.so
2898 LDFLAGS-libtracemod4-1.so += -Wl,-soname,libtracemod4.so
2899 LDFLAGS-libtracemod5-1.so += -Wl,-soname,libtracemod5.so
2901 $(objpfx)libtracemod1-1.so: $(objpfx)libtracemod2-1.so \
2902 $(objpfx)libtracemod3-1.so
2903 $(objpfx)libtracemod2-1.so: $(objpfx)libtracemod4-1.so \
2904 $(objpfx)libtracemod5-1.so
2906 define libtracemod-x
2907 $(objpfx)libtracemod$(1)/libtracemod$(1).so: $(objpfx)libtracemod$(1)-1.so
2908 $$(make-target-directory)
2909 cp $$< $$@
2910 endef
2911 libtracemod-suffixes = 1 2 3 4 5
2912 $(foreach i,$(libtracemod-suffixes), $(eval $(call libtracemod-x,$(i))))
2914 define tst-trace-skeleton
2915 $(objpfx)tst-trace$(1).out: $(objpfx)libtracemod1/libtracemod1.so \
2916 $(objpfx)libtracemod2/libtracemod2.so \
2917 $(objpfx)libtracemod3/libtracemod3.so \
2918 $(objpfx)libtracemod4/libtracemod4.so \
2919 $(objpfx)libtracemod5/libtracemod5.so \
2920 $(..)scripts/tst-ld-trace.py \
2921 tst-trace$(1).exp
2922 ${ $(PYTHON) $(..)scripts/tst-ld-trace.py \
2923 "$(test-wrapper-env) $(elf-objpfx)$(rtld-installed-name) \
2924 --library-path $(common-objpfx):$(strip $(2)) \
2925 $(objpfx)libtracemod1/libtracemod1.so" tst-trace$(1).exp \
2926 } > $$@; $$(evaluate-test)
2927 endef
2929 $(eval $(call tst-trace-skeleton,1,))
2930 $(eval $(call tst-trace-skeleton,2,\
2931 $(objpfx)libtracemod2))
2932 $(eval $(call tst-trace-skeleton,3,\
2933 $(objpfx)libtracemod2:$(objpfx)libtracemod3))
2934 $(eval $(call tst-trace-skeleton,4,\
2935 $(objpfx)libtracemod2:$(objpfx)libtracemod3:$(objpfx)libtracemod4))
2936 $(eval $(call tst-trace-skeleton,5,\
2937 $(objpfx)libtracemod2:$(objpfx)libtracemod3:$(objpfx)libtracemod4:$(objpfx)libtracemod5))
2939 $(objpfx)tst-tls-allocation-failure-static-patched: \
2940 $(objpfx)tst-tls-allocation-failure-static $(..)scripts/tst-elf-edit.py
2941 cp $< $@
2942 $(PYTHON) $(..)scripts/tst-elf-edit.py --maximize-tls-size $@
2944 $(objpfx)tst-tls-allocation-failure-static-patched.out: \
2945 $(objpfx)tst-tls-allocation-failure-static-patched
2946 $< > $@ 2>&1; echo "status: $$?" >> $@
2947 grep -q '^Fatal glibc error: Cannot allocate TLS block$$' $@ \
2948 && grep -q '^status: 127$$' $@; \
2949 $(evaluate-test)
2951 $(objpfx)tst-audit-tlsdesc: $(objpfx)tst-audit-tlsdesc-mod1.so \
2952 $(objpfx)tst-audit-tlsdesc-mod2.so \
2953 $(shared-thread-library)
2954 ifeq (yes,$(have-mtls-dialect-gnu2))
2955 # The test is valid for all TLS types, but we want to exercise GNU2
2956 # TLS if possible.
2957 CFLAGS-tst-audit-tlsdesc-mod1.c += -mtls-dialect=gnu2
2958 CFLAGS-tst-audit-tlsdesc-mod2.c += -mtls-dialect=gnu2
2959 endif
2960 $(objpfx)tst-audit-tlsdesc-dlopen: $(shared-thread-library)
2961 $(objpfx)tst-audit-tlsdesc-dlopen.out: $(objpfx)tst-audit-tlsdesc-mod1.so \
2962 $(objpfx)tst-audit-tlsdesc-mod2.so
2963 $(objpfx)tst-audit-tlsdesc-mod1.so: $(objpfx)tst-audit-tlsdesc-mod2.so
2964 $(objpfx)tst-audit-tlsdesc.out: $(objpfx)tst-auditmod-tlsdesc.so
2965 tst-audit-tlsdesc-ENV = LD_AUDIT=$(objpfx)tst-auditmod-tlsdesc.so
2966 $(objpfx)tst-audit-tlsdesc-dlopen.out: $(objpfx)tst-auditmod-tlsdesc.so
2967 tst-audit-tlsdesc-dlopen-ENV = LD_AUDIT=$(objpfx)tst-auditmod-tlsdesc.so
2969 $(objpfx)tst-dlmopen-twice.out: \
2970 $(objpfx)tst-dlmopen-twice-mod1.so \
2971 $(objpfx)tst-dlmopen-twice-mod2.so