Debian Codegraph @

elf/Makefile

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