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