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