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