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