]> git.ipfire.org Git - thirdparty/glibc.git/blame - elf/Makefile
elf: Fix tst-linkall-static link when pthread is not in libc
[thirdparty/glibc.git] / elf / Makefile
CommitLineData
581c785b 1# Copyright (C) 1995-2022 Free Software Foundation, Inc.
01cc0be6
RM
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
41bdb6e2
AJ
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.
01cc0be6
RM
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
41bdb6e2 12# Lesser General Public License for more details.
01cc0be6 13
41bdb6e2 14# You should have received a copy of the GNU Lesser General Public
59ba27a6 15# License along with the GNU C Library; if not, see
5a82c748 16# <https://www.gnu.org/licenses/>.
01cc0be6 17
3db52d94
UD
18# Makefile for elf subdirectory of GNU C Library.
19
d66e34cd
RM
20subdir := elf
21
f57f8055
RM
22include ../Makeconfig
23
54816ae9 24headers = elf.h bits/elfclass.h link.h bits/link.h bits/link_lavcurrent.h
ac9e0e5e 25routines = $(all-dl-routines) dl-support dl-iteratephdr \
d61ef735 26 dl-addr dl-addr-obj enbl-secure dl-profstub \
9d7a3741 27 dl-origin dl-libc dl-sym dl-sysdep dl-error \
5d28a896
FW
28 dl-reloc-static-pie libc_early_init rtld_static_init \
29 libc-dl_find_object
266180eb
RM
30
31# The core dynamic linking functions are in libc for the static and
32# profiled libraries.
56f8d442 33dl-routines = $(addprefix dl-,load lookup object reloc deps \
9e78f6f6 34 runtime init fini debug misc \
eb73083e 35 version profile tls origin scope \
52a01100 36 execstack open close trampoline \
ec935dea 37 exception sort-maps lookup-direct \
1daccf40 38 call-libc-early-init write \
a93d9e03 39 thread_gscope_wait tls_init_tp \
5d28a896
FW
40 debug-symbols minimal-malloc \
41 find_object)
f57f8055
RM
42ifeq (yes,$(use-ldconfig))
43dl-routines += dl-cache
44endif
67e58f39 45
6765d5d3 46ifneq (no,$(have-tunables))
67e58f39 47dl-routines += dl-tunables
6765d5d3 48tunables-type = $(addprefix TUNABLES_FRONTEND_,$(have-tunables))
36975e8e 49CPPFLAGS-dl-tunables.c += -DTUNABLES_FRONTEND=$(tunables-type)
9dd409a5 50
86f65dff
L
51ifeq (yesyes,$(build-shared)$(run-built-tests))
52tests-special += $(objpfx)list-tunables.out
53endif
54
9dd409a5
SP
55# Make sure that the compiler does not insert any library calls in tunables
56# code paths.
57ifeq (yes,$(have-loop-to-function))
36975e8e 58CFLAGS-dl-tunables.c += -fno-tree-loop-distribute-patterns
9dd409a5 59endif
67e58f39
SP
60endif
61
b79f74cd 62all-dl-routines = $(dl-routines) $(sysdep-dl-routines)
266180eb 63# But they are absent from the shared libc, because that code is in ld.so.
368a8dec 64elide-routines.os = $(all-dl-routines) dl-support enbl-secure dl-origin \
1daccf40 65 dl-sysdep dl-exception dl-reloc-static-pie \
78b31cc8 66 thread_gscope_wait rtld_static_init
266180eb 67
5d28a896
FW
68# These object files are only included in the dynamically-linked libc.
69shared-only-routines = libc-dl_find_object
70
266180eb
RM
71# ld.so uses those routines, plus some special stuff for being the program
72# interpreter and operating independent of libc.
9e78f6f6 73rtld-routines = rtld $(all-dl-routines) dl-sysdep dl-environ dl-minimal \
dad90d52 74 dl-error-minimal dl-conflict dl-hwcaps dl-hwcaps_split dl-hwcaps-subdirs \
d6163dfd 75 dl-usage dl-diagnostics dl-diagnostics-kernel dl-diagnostics-cpu \
aee6e90f 76 dl-mutex dl-libc_freeres dl-audit
e39e6956 77all-rtld-routines = $(rtld-routines) $(sysdep-rtld-routines)
b79f74cd 78
36975e8e
L
79CFLAGS-dl-runtime.c += -fexceptions -fasynchronous-unwind-tables
80CFLAGS-dl-lookup.c += -fexceptions -fasynchronous-unwind-tables
e7b2a561 81CFLAGS-dl-iteratephdr.c += $(uses-callbacks)
80b54217 82
b05fae4d
AZ
83# Called during static library initialization, so turn stack-protection
84# off for non-shared builds.
85CFLAGS-dl-minimal-malloc.o = $(no-stack-protector)
86CFLAGS-dl-minimal-malloc.op = $(no-stack-protector)
87
c72e5cd8
SL
88# On targets without __builtin_memset, rtld.c uses a hand-coded loop
89# in _dl_start. Make sure this isn't turned into a call to regular memset.
90ifeq (yes,$(have-loop-to-function))
91CFLAGS-rtld.c += -fno-tree-loop-distribute-patterns
92endif
93
995635f9
NA
94# Compile rtld itself without stack protection.
95# Also compile all routines in the static library that are elided from
96# the shared libc because they are in libc.a in the same way.
97
995635f9
NA
98CFLAGS-.o += $(call elide-stack-protector,.o,$(elide-routines.os))
99CFLAGS-.op += $(call elide-stack-protector,.op,$(elide-routines.os))
100CFLAGS-.os += $(call elide-stack-protector,.os,$(all-rtld-routines))
101
74bd2300 102ifeq ($(unwind-find-fde),yes)
a0dcb689 103routines += unwind-dw2-fde-glibc
44094580 104shared-only-routines += unwind-dw2-fde-glibc
74bd2300
UD
105endif
106
f08e9a26
RM
107before-compile += $(objpfx)trusted-dirs.h
108generated += trusted-dirs.h trusted-dirs.st for-renamed/renamed.so
109generated-dirs += for-renamed
fd26970f 110
3f2e46a4 111ifeq ($(build-shared),yes)
a0edd63e 112ld-map = $(common-objpfx)ld.map
bdd421cc
UD
113endif
114
d66e34cd 115ifeq (yes,$(build-shared))
ce12fc71 116extra-objs = $(all-rtld-routines:%=%.os) sofini.os interp.os
40c4c9b5 117generated += librtld.os dl-allobjs.os ld.so ldd
2e75604f 118install-others = $(inst_rtlddir)/$(rtld-installed-name) $(inst_bindir)/ld.so
6c3ebebd 119install-bin-script = ldd
f49bc43f 120endif
86d2c878 121
fe658845
RM
122others = sprof sln
123install-bin = sprof
9d141cae
UD
124others-static = sln
125install-rootsbin = sln
95f5a9a8
JM
126sln-modules := static-stubs
127extra-objs += $(sln-modules:=.o)
ae828bc6 128
591e1ffb 129ifeq (yes,$(use-ldconfig))
99ac5e47 130ifeq (yes,$(build-shared))
e1586792 131others-static += ldconfig
da2d1bc5 132others += ldconfig
9d141cae 133install-rootsbin += ldconfig
591e1ffb 134
73b6e50a
FW
135ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon static-stubs \
136 stringtable
591e1ffb 137extra-objs += $(ldconfig-modules:=.o)
7b3ce395 138others-extras = $(ldconfig-modules)
6103ae3b
TS
139endif
140endif
591e1ffb
UD
141
142# To find xmalloc.c and xstrdup.c
143vpath %.c ../locale/programs
144
b93834ef 145ifeq ($(build-shared),yes)
a9171047
UD
146extra-objs += sotruss-lib.os sotruss-lib.so
147install-others += $(inst_auditdir)/sotruss-lib.so
b0316e56 148install-bin-script += sotruss
a9171047 149generated += sotruss
9a484857 150libof-sotruss-lib = extramodules
c57afec0 151LDFLAGS-sotruss-lib.so += $(z-now-$(bind-now))
a6928d51 152$(objpfx)sotruss-lib.so: $(objpfx)sotruss-lib.os
a9171047
UD
153 $(build-module-asneeded)
154$(objpfx)sotruss-lib.so: $(common-objpfx)libc.so $(objpfx)ld.so \
155 $(common-objpfx)libc_nonshared.a
156
b93834ef 157$(objpfx)sotruss: sotruss.sh $(common-objpfx)config.make
5188a9d0 158 sed -e 's%@VERSION@%$(version)%g' \
314f6dee 159 -e 's%@TEXTDOMAINDIR@%$(localedir)%g' \
8b748aed
JM
160 -e 's%@PREFIX@%$(prefix)%g' \
161 -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
162 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' \
163 < $< > $@.new
a9171047
UD
164 chmod 555 $@.new
165 mv -f $@.new $@
166$(inst_auditdir)/sotruss-lib.so: $(objpfx)sotruss-lib.so $(+force)
167 $(do-install-program)
168endif
169
2d2d9f2b 170tests-static-normal := tst-array1-static tst-array5-static \
7c3018f9 171 tst-dl-iter-static \
a0f83f0b 172 tst-tlsalign-static tst-tlsalign-extern-static \
706ad1e7 173 tst-linkall-static tst-env-setuid tst-env-setuid-tunables \
33242131 174 tst-single_threaded-static tst-single_threaded-pthread-static \
78b31cc8 175 tst-dst-static tst-getauxval-static
706ad1e7 176
33c50ef4 177tests-static-internal := tst-tls1-static \
2000067a 178 tst-ptrguard1-static tst-stackguard1-static \
5d28a896
FW
179 tst-tls1-static-non-pie \
180 tst-dl_find_object-static
2000067a 181
a67029ff 182CRT-tst-tls1-static-non-pie := $(csu-objpfx)crt1.o
9d7a3741 183tst-tls1-static-non-pie-no-pie = yes
7c3018f9 184
591236f1
AH
185tests-container := \
186 tst-ldconfig-bad-aux-cache \
187 tst-ldconfig-ld_so_conf-update
481c30cb 188
600d9e0c
FW
189ifeq (no,$(build-hardcoded-path-in-tests))
190# This is an ld.so.cache test, and RPATH/RUNPATH in the executable
191# interferes with its test objectives.
192tests-container += tst-glibc-hwcaps-prepend-cache
193endif
194
7c3018f9
ZW
195tests := tst-tls9 tst-leaks1 \
196 tst-array1 tst-array2 tst-array3 tst-array4 tst-array5 \
785969a0 197 tst-auxv tst-stringtable
33c50ef4 198tests-internal := tst-tls1 $(tests-static-internal)
7c3018f9
ZW
199tests-static := $(tests-static-normal) $(tests-static-internal)
200
2119dcfa 201ifeq (yes,$(build-shared))
706ad1e7
FW
202tests-static += tst-tls9-static tst-single_threaded-static-dlopen
203static-dlopen-environment = \
3dbbd2ff 204 LD_LIBRARY_PATH=$(ld-library-path):$(common-objpfx)dlfcn
706ad1e7
FW
205tst-tls9-static-ENV = $(static-dlopen-environment)
206tst-single_threaded-static-dlopen-ENV = $(static-dlopen-environment)
7c3018f9 207
28713c06
L
208tests += \
209 argv0test \
210 constload1 \
211 dblload \
212 dblunload \
213 filter \
214 global \
215 initfirst \
216 lateglobal \
217 loadfail \
218 multiload \
219 next \
220 nodelete \
221 nodelete2 \
222 nodlopen \
223 nodlopen2 \
224 noload \
225 order \
226 order2 \
227 origtest \
228 preloadtest \
229 reldep \
230 reldep2 \
231 reldep3 \
232 reldep4 \
233 reldep5 \
234 reldep6 \
235 reldep7 \
236 reldep8 \
237 resolvfail \
238 restest1 \
239 restest2 \
240 tst-absolute-sym \
241 tst-absolute-zero \
242 tst-addr1 \
243 tst-align \
244 tst-align2 \
245 tst-align3 \
246 tst-audit1 \
247 tst-audit2 \
248 tst-audit8 \
249 tst-audit9 \
250 tst-audit11 \
251 tst-audit12 \
252 tst-audit13 \
253 tst-audit18 \
254 tst-audit19b \
255 tst-audit20 \
256 tst-audit22 \
257 tst-auditmany \
258 tst-auxobj \
259 tst-auxobj-dlopen \
260 tst-big-note \
261 tst-debug1 \
262 tst-deep1 \
263 tst-dl-is_dso \
264 tst-dlmodcount \
265 tst-dlmopen1 \
266 tst-dlmopen3 \
267 tst-dlmopen4 \
268 tst-dlmopen-dlerror \
269 tst-dlmopen-gethostbyname \
270 tst-dlopenfail \
271 tst-dlopenfail-2 \
272 tst-dlopenrpath \
273 tst-dlopen-self \
274 tst-dlopen-tlsmodid \
275 tst-dlsym-error \
276 tst-filterobj \
277 tst-filterobj-dlopen \
278 tst-glibc-hwcaps \
279 tst-glibc-hwcaps-mask \
280 tst-glibc-hwcaps-prepend \
281 tst-global1 \
282 tst-initfinilazyfail \
283 tst-initorder \
284 tst-initorder2 \
285 tst-latepthread \
286 tst-main1 \
287 tst-nodelete2 \
288 tst-nodelete-dlclose \
289 tst-nodelete-opened \
290 tst-noload \
291 tst-null-argv \
292 tst-relsort1 \
293 tst-ro-dynamic \
294 tst-rtld-run-static \
295 tst-single_threaded \
296 tst-single_threaded-pthread \
297 tst-sonamemove-dlopen \
298 tst-sonamemove-link \
299 tst-thrlock \
300 tst-tls10 \
301 tst-tls11 \
302 tst-tls12 \
303 tst-tls13 \
304 tst-tls14 \
305 tst-tls15 \
306 tst-tls16 \
307 tst-tls17 \
308 tst-tls18 \
309 tst-tls19 \
310 tst-tls20 \
311 tst-tls21 \
312 tst-tls4 \
313 tst-tls5 \
314 tst-tlsalign \
315 tst-tlsalign-extern \
316 tst-tls-dlinfo \
317 tst-tls-ie \
318 tst-tls-ie-dlmopen \
319 tst-tls-manydynamic \
320 tst-unique1 \
321 tst-unique2 \
322 tst-unwind-ctor \
323 tst-unwind-main \
324 unload3 \
325 unload4 \
326 unload5 \
327 unload6 \
328 unload7 \
329 unload8 \
aff4519d 330# reldep9
28713c06
L
331tests-cxx = \
332 tst-dlopen-nodelete-reloc \
333 tst-nodelete \
334 tst-unique3 \
335 tst-unique4 \
336
337tests += $(if $(CXX),$(tests-cxx))
7c3018f9
ZW
338tests-internal += loadtest unload unload2 circleload1 \
339 neededtest neededtest2 neededtest3 neededtest4 \
340 tst-tls3 tst-tls6 tst-tls7 tst-tls8 tst-dlmopen2 \
7a5db2e8 341 tst-ptrguard1 tst-stackguard1 \
063f9ba2 342 tst-create_format1 tst-tls-surplus tst-dl-hwcaps_split \
5d28a896
FW
343 tst-audit19a \
344 tst-dl_find_object tst-dl_find_object-threads
7d3db434 345tests-container += tst-pldd tst-dlopen-tlsmodid-container \
9ffa50b2 346 tst-dlopen-self-container tst-preload-pthread-libc
5a384a91 347test-srcs = tst-pathopt
fc2334ab
L
348ifeq (yes,$(have-fpie))
349tests-pie += tst-align3
350endif
33f85a3f
UD
351selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
352ifneq ($(selinux-enabled),1)
c70ba488 353tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
33f85a3f 354endif
9926f6e2
FS
355ifeq ($(have-depaudit),yes)
356tests += tst-audit14 tst-audit15 tst-audit16
171ab1af
SH
357ifeq ($(run-built-tests),yes)
358tests-special += $(objpfx)tst-audit14-cmp.out $(objpfx)tst-audit15-cmp.out \
359 $(objpfx)tst-audit16-cmp.out
360endif
9926f6e2 361endif
2f512715 362endif
b8114edd 363tests += $(tests-execstack-$(have-z-execstack))
03ac099f 364ifeq ($(run-built-tests),yes)
0b20a9e8 365tests-special += $(objpfx)tst-leaks1-mem.out \
2d2d9f2b 366 $(objpfx)noload-mem.out \
4e6db99c 367 $(objpfx)tst-ldconfig-X.out $(objpfx)tst-rtld-help.out
6d5c57fa 368endif
60a23f5a 369tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
41e25904 370tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
1f20b93a
AS
371tlsmod17a-modules = $(addprefix tst-tlsmod17a, $(tlsmod17a-suffixes))
372tlsmod18a-modules = $(addprefix tst-tlsmod18a, $(tlsmod17a-suffixes))
01b23a30
FW
373one-hundred = $(foreach x,0 1 2 3 4 5 6 7 8 9, \
374 0$x 1$x 2$x 3$x 4$x 5$x 6$x 7$x 8$x 9$x)
375tst-tls-many-dynamic-modules := \
376 $(foreach n,$(one-hundred),tst-tls-manydynamic$(n)mod)
ba33937b
AZ
377tst-tls-many-dynamic-modules-dep-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 \
378 14 15 16 17 18 19
379tst-tls-many-dynamic-modules-dep = \
380 $(foreach n,$(tst-tls-many-dynamic-modules-dep-suffixes),tst-tls-manydynamic$(n)mod-dep)
381tst-tls-many-dynamic-modules-dep-bad-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
382tst-tls-many-dynamic-modules-dep-bad = \
383 $(foreach n,$(tst-tls-many-dynamic-modules-dep-bad-suffixes),tst-tls-manydynamic$(n)mod-dep-bad)
b4bcb3ae
AS
384extra-test-objs += $(tlsmod17a-modules:=.os) $(tlsmod18a-modules:=.os) \
385 tst-tlsalign-vars.o
386test-extras += tst-tlsmod17a tst-tlsmod18a tst-tlsalign-vars
28713c06
L
387modules-names = \
388 circlemod1 \
389 circlemod1a \
390 circlemod2 \
391 circlemod2a \
392 circlemod3 \
393 circlemod3a \
394 constload2 \
395 constload3 \
396 dblloadmod1 \
397 dblloadmod2 \
398 dblloadmod3 \
399 dep1 \
400 dep2 \
401 dep3 \
402 dep4 \
403 failobj \
404 filtmod1 \
405 filtmod2 \
406 firstobj \
407 globalmod1 \
408 libmarkermod1-1 \
409 libmarkermod1-2 \
410 libmarkermod1-3 \
411 libmarkermod2-1 \
412 libmarkermod2-2 \
413 libmarkermod3-1 \
414 libmarkermod3-2 \
415 libmarkermod3-3 \
416 libmarkermod4-1 \
417 libmarkermod4-2 \
418 libmarkermod4-3 \
419 libmarkermod4-4 \
420 ltglobmod1 \
421 ltglobmod2 \
422 neededobj1 \
423 neededobj2 \
424 neededobj3 \
425 neededobj4 \
426 neededobj5 \
427 neededobj6 \
428 nextmod1 \
429 nextmod2 \
430 nodel2mod1 \
431 nodel2mod2 \
432 nodel2mod3 \
433 nodelmod1 \
434 nodelmod2 \
435 nodelmod3 \
436 nodelmod4 \
437 nodlopenmod \
438 nodlopenmod2 \
439 order2mod1 \
440 order2mod2 \
441 order2mod3 \
442 order2mod4 \
443 pathoptobj \
444 reldep4mod1 \
445 reldep4mod2 \
446 reldep4mod3 \
447 reldep4mod4 \
448 reldep6mod0 \
449 reldep6mod1 \
450 reldep6mod2 \
451 reldep6mod3 \
452 reldep6mod4 \
453 reldep7mod1 \
454 reldep7mod2 \
455 reldep8mod1 \
456 reldep8mod2 \
457 reldep8mod3 \
458 reldep9mod1 \
459 reldep9mod2 \
460 reldep9mod3 \
461 reldepmod1 \
462 reldepmod2 \
463 reldepmod3 \
464 reldepmod4 \
465 reldepmod5 \
466 reldepmod6 \
467 testobj1 \
468 testobj1_1 \
469 testobj2 \
470 testobj3 \
471 testobj4 \
472 testobj5 \
473 testobj6 \
474 tst-absolute-sym-lib \
475 tst-absolute-zero-lib \
476 tst-alignmod \
477 tst-alignmod2 \
478 tst-alignmod3 \
479 tst-array2dep \
480 tst-array5dep \
481 tst-audit11mod1 \
482 tst-audit11mod2 \
483 tst-audit12mod1 \
484 tst-audit12mod2 \
485 tst-audit12mod3 \
486 tst-audit13mod1 \
487 tst-audit18mod \
488 tst-audit19bmod \
489 tst-auditlogmod-1 \
490 tst-auditlogmod-2 \
491 tst-auditlogmod-3 \
492 tst-auditmanymod1 \
493 tst-auditmanymod2 \
494 tst-auditmanymod3 \
495 tst-auditmanymod4 \
496 tst-auditmanymod5 \
497 tst-auditmanymod6 \
498 tst-auditmanymod7 \
499 tst-auditmanymod8 \
500 tst-auditmanymod9 \
501 tst-auditmod1 \
502 tst-auditmod9a \
503 tst-auditmod9b \
504 tst-auditmod11 \
505 tst-auditmod12 \
506 tst-auditmod18 \
507 tst-auditmod19a \
508 tst-auditmod19b \
509 tst-auditmod20 \
510 tst-auditmod22 \
511 tst-auxvalmod \
512 tst-big-note-lib \
513 tst-deep1mod1 \
514 tst-deep1mod2 \
515 tst-deep1mod3 \
516 tst-dl_find_object-mod1 \
517 tst-dl_find_object-mod2 \
518 tst-dl_find_object-mod3 \
519 tst-dl_find_object-mod4 \
520 tst-dl_find_object-mod5 \
521 tst-dl_find_object-mod6 \
522 tst-dl_find_object-mod7 \
523 tst-dl_find_object-mod8 \
524 tst-dl_find_object-mod9 \
525 tst-dlmopen1mod \
526 tst-dlmopen-dlerror-mod \
527 tst-dlmopen-gethostbyname-mod \
528 tst-dlopenfaillinkmod \
529 tst-dlopenfailmod1 \
530 tst-dlopenfailmod2 \
531 tst-dlopenfailmod3 \
532 tst-dlopenfailnodelmod \
533 tst-dlopenrpathmod \
534 tst-filterobj-aux \
535 tst-filterobj-filtee \
536 tst-filterobj-flt \
537 tst-finilazyfailmod \
538 tst-initlazyfailmod \
539 tst-initorder2a \
540 tst-initorder2b \
541 tst-initorder2c \
542 tst-initorder2d \
543 tst-initordera1 \
544 tst-initordera2 \
545 tst-initordera3 \
546 tst-initordera4 \
547 tst-initorderb1 \
548 tst-initorderb2 \
549 tst-latepthreadmod \
550 tst-ldconfig-ld-mod \
551 tst-main1mod \
552 tst-nodelete2mod \
553 tst-nodelete-dlclose-dso \
554 tst-nodelete-dlclose-plugin \
555 tst-nodelete-opened-lib \
556 tst-null-argv-lib \
557 tst-relsort1mod1 \
558 tst-relsort1mod2 \
559 tst-ro-dynamic-mod \
560 tst-single_threaded-mod1 \
561 tst-single_threaded-mod2 \
562 tst-single_threaded-mod3 \
563 tst-single_threaded-mod4 \
564 tst-sonamemove-linkmod1 \
565 tst-sonamemove-runmod1 \
566 tst-sonamemove-runmod2 \
567 tst-tls19mod1 \
568 tst-tls19mod2 \
569 tst-tls19mod3 \
570 tst-tls20mod-bad \
571 tst-tls21mod \
572 tst-tlsalign-lib \
573 tst-tls-ie-mod0 \
574 tst-tls-ie-mod1 \
575 tst-tls-ie-mod2 \
576 tst-tls-ie-mod3 \
577 tst-tls-ie-mod4 \
578 tst-tls-ie-mod5 \
579 tst-tls-ie-mod6 \
580 tst-tlsmod1 \
581 tst-tlsmod10 \
582 tst-tlsmod11 \
583 tst-tlsmod12 \
584 tst-tlsmod13 \
585 tst-tlsmod13a \
586 tst-tlsmod14a \
587 tst-tlsmod14b \
588 tst-tlsmod15a \
589 tst-tlsmod15b \
590 tst-tlsmod16a \
591 tst-tlsmod16b \
592 tst-tlsmod17b \
593 tst-tlsmod2 \
594 tst-tlsmod3 \
595 tst-tlsmod4 \
596 tst-tlsmod5 \
597 tst-tlsmod6 \
598 tst-tlsmod7 \
599 tst-tlsmod8 \
600 tst-tlsmod9 \
601 tst-unique1mod1 \
602 tst-unique1mod2 \
603 tst-unique2mod1 \
604 tst-unique2mod2 \
605 tst-unwind-ctor-lib \
606 unload2dep \
607 unload2mod \
608 unload3mod1 \
609 unload3mod2 \
610 unload3mod3 \
611 unload3mod4 \
612 unload4mod1 \
613 unload4mod2 \
614 unload4mod3 \
615 unload4mod4 \
616 unload6mod1 \
617 unload6mod2 \
618 unload6mod3 \
619 unload7mod1 \
620 unload7mod2 \
621 unload8mod1 \
622 unload8mod1x \
623 unload8mod2 \
624 unload8mod3 \
625 unloadmod \
626 vismod1 \
627 vismod2 \
628 vismod3 \
629
630modules-names-cxx = \
631 tst-dlopen-nodelete-reloc-mod1 \
632 tst-dlopen-nodelete-reloc-mod10 \
633 tst-dlopen-nodelete-reloc-mod11 \
634 tst-dlopen-nodelete-reloc-mod12 \
635 tst-dlopen-nodelete-reloc-mod13 \
636 tst-dlopen-nodelete-reloc-mod14 \
637 tst-dlopen-nodelete-reloc-mod15 \
638 tst-dlopen-nodelete-reloc-mod16 \
639 tst-dlopen-nodelete-reloc-mod17 \
640 tst-dlopen-nodelete-reloc-mod2 \
641 tst-dlopen-nodelete-reloc-mod3 \
642 tst-dlopen-nodelete-reloc-mod4 \
643 tst-dlopen-nodelete-reloc-mod5 \
644 tst-dlopen-nodelete-reloc-mod6 \
645 tst-dlopen-nodelete-reloc-mod7 \
646 tst-dlopen-nodelete-reloc-mod8 \
647 tst-dlopen-nodelete-reloc-mod9 \
648 tst-nodelete-rtldmod \
649 tst-nodelete-uniquemod \
650 tst-nodelete-zmod \
651 tst-unique3lib \
652 tst-unique3lib2 \
653 tst-unique4lib \
654
655modules-names += \
656 $(if $(CXX),$(modules-names-cxx)) \
657 $(modules-execstack-$(have-z-execstack)) \
658 $(tst-tls-many-dynamic-modules) \
659 $(tst-tls-many-dynamic-modules-dep) \
660 $(tst-tls-many-dynamic-modules-dep-bad) \
661 $(tlsmod17a-modules) \
662 $(tlsmod18a-modules) \
ffb17e7b 663
221e4bab
JM
664# Most modules build with _ISOMAC defined, but those filtered out
665# depend on internal headers.
7a5db2e8 666modules-names-tests = $(filter-out ifuncmod% tst-tlsmod%,\
221e4bab 667 $(modules-names))
0065aaaa 668
61655555
L
669ifeq (yes,$(have-mtls-dialect-gnu2))
670tests += tst-gnu2-tls1
671modules-names += tst-gnu2-tls1mod
672$(objpfx)tst-gnu2-tls1: $(objpfx)tst-gnu2-tls1mod.so
673tst-gnu2-tls1mod.so-no-z-defs = yes
674CFLAGS-tst-gnu2-tls1mod.c += -mtls-dialect=gnu2
d1b38173
AZ
675
676tests += tst-audit-tlsdesc tst-audit-tlsdesc-dlopen
677modules-names += tst-audit-tlsdesc-mod1 tst-audit-tlsdesc-mod2 tst-auditmod-tlsdesc
678$(objpfx)tst-audit-tlsdesc: $(objpfx)tst-audit-tlsdesc-mod1.so \
679 $(objpfx)tst-audit-tlsdesc-mod2.so \
680 $(shared-thread-library)
681CFLAGS-tst-audit-tlsdesc-mod1.c += -mtls-dialect=gnu2
682CFLAGS-tst-audit-tlsdesc-mod2.c += -mtls-dialect=gnu2
683$(objpfx)tst-audit-tlsdesc-dlopen: $(shared-thread-library)
684$(objpfx)tst-audit-tlsdesc-dlopen.out: $(objpfx)tst-audit-tlsdesc-mod1.so \
685 $(objpfx)tst-audit-tlsdesc-mod2.so
686$(objpfx)tst-audit-tlsdesc-mod1.so: $(objpfx)tst-audit-tlsdesc-mod2.so
687$(objpfx)tst-audit-tlsdesc.out: $(objpfx)tst-auditmod-tlsdesc.so
688tst-audit-tlsdesc-ENV = LD_AUDIT=$(objpfx)tst-auditmod-tlsdesc.so
689$(objpfx)tst-audit-tlsdesc-dlopen.out: $(objpfx)tst-auditmod-tlsdesc.so
690tst-audit-tlsdesc-dlopen-ENV = LD_AUDIT=$(objpfx)tst-auditmod-tlsdesc.so
61655555 691endif
83569fb8
L
692ifeq (yes,$(have-protected-data))
693modules-names += tst-protected1moda tst-protected1modb
694tests += tst-protected1a tst-protected1b
695$(objpfx)tst-protected1a: $(addprefix $(objpfx),tst-protected1moda.so tst-protected1modb.so)
696$(objpfx)tst-protected1b: $(addprefix $(objpfx),tst-protected1modb.so tst-protected1moda.so)
697tst-protected1modb.so-no-z-defs = yes
0092d4da
RM
698# These tests fail with GCC versions prior to 5.1 and with some versions
699# of binutils. See https://sourceware.org/bugzilla/show_bug.cgi?id=17709
700# and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248 for details.
701# Perhaps in future we can make these XFAILs conditional on some detection
702# of compiler/linker behavior/version.
703test-xfail-tst-protected1a = yes
704test-xfail-tst-protected1b = yes
83569fb8 705endif
f17ed1a9
UD
706ifeq (yesyes,$(have-fpie)$(build-shared))
707modules-names += tst-piemod1
7d3db434
FW
708tests += tst-pie1 tst-pie2 tst-dlopen-pie tst-dlopen-tlsmodid-pie \
709 tst-dlopen-self-pie
710tests-pie += tst-pie1 tst-pie2 tst-dlopen-tlsmodid-pie tst-dlopen-self-pie
3093fd5e 711ifeq (yes,$(have-protected-data))
ef4ad06f
L
712tests += vismain
713tests-pie += vismain
36975e8e 714CFLAGS-vismain.c += $(PIE-ccflag)
f17ed1a9 715endif
3093fd5e 716endif
2abf9ff1 717modules-execstack-yes = tst-execstack-mod
376e973a 718extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
dc18d4d8 719
15e6d678
L
720# filtmod1.so, tst-big-note-lib.so, tst-ro-dynamic-mod.so have special
721# rules.
722modules-names-nobuild := filtmod1 tst-big-note-lib tst-ro-dynamic-mod
aed48a2a 723
7c3018f9
ZW
724tests += $(tests-static)
725
92ad88fe 726ifeq (yes,$(have-ifunc))
7c3018f9 727tests-ifuncstatic := ifuncmain1static ifuncmain1picstatic \
2f083d75 728 ifuncmain2static ifuncmain2picstatic \
3c30afc8
L
729 ifuncmain4static ifuncmain4picstatic \
730 ifuncmain5static ifuncmain5picstatic \
16b59780
ST
731 ifuncmain7static ifuncmain7picstatic
732ifeq (yes,$(have-gcc-ifunc))
733tests-ifuncstatic += ifuncmain9static ifuncmain9picstatic
734endif
7c3018f9
ZW
735tests-static += $(tests-ifuncstatic)
736tests-internal += $(tests-ifuncstatic)
2f083d75 737ifeq (yes,$(build-shared))
4db71d2f 738tests += tst-ifunc-fault-lazy tst-ifunc-fault-bindnow
cc3e573c 739# Note: sysdeps/x86_64/ifuncmain8.c uses ifuncmain8.
7c3018f9 740tests-internal += \
66a273d1 741 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \
2f083d75 742 ifuncmain1staticpic \
3c30afc8 743 ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \
66a273d1 744 ifuncmain5staticpic \
16b59780 745 ifuncmain7 ifuncmain7pic
66a273d1
AZ
746ifeq (no,$(with-lld))
747tests-internal += ifuncmain1 ifuncmain5 ifuncmain5pic
748endif
16b59780
ST
749ifeq (yes,$(have-gcc-ifunc))
750tests-internal += ifuncmain9 ifuncmain9pic
751endif
1f20b93a
AS
752ifunc-test-modules = ifuncdep1 ifuncdep1pic ifuncdep2 ifuncdep2pic \
753 ifuncdep5 ifuncdep5pic
754extra-test-objs += $(ifunc-test-modules:=.o)
7c3018f9 755test-internal-extras += $(ifunc-test-modules)
2f083d75 756ifeq (yes,$(have-fpie))
1f20b93a 757ifunc-pie-tests = ifuncmain1pie ifuncmain1vispie ifuncmain1staticpie \
66a273d1 758 ifuncmain6pie ifuncmain7pie
16b59780
ST
759ifeq (yes,$(have-gcc-ifunc))
760ifunc-pie-tests += ifuncmain9pie
761endif
66a273d1
AZ
762ifeq (no,$(with-lld))
763ifunc-pie-tests += ifuncmain5pie
764endif
b5c45e83
AZ
765ifeq (yes,$(have-textrel_ifunc))
766ifunc-pie-tests += tst-ifunc-textrel
767endif
7c3018f9 768tests-internal += $(ifunc-pie-tests)
da62f81b 769tests-pie += $(ifunc-pie-tests)
2f083d75 770endif
66a273d1
AZ
771modules-names += ifuncmod1 ifuncmod3 ifuncmod6
772ifeq (no,$(with-lld))
773modules-names += ifuncmod5
774endif
2f083d75
L
775endif
776endif
777
f214606a
JM
778ifeq (yes,$(build-shared))
779ifeq ($(run-built-tests),yes)
8692ebdb 780tests-special += $(objpfx)tst-pathopt.out $(objpfx)tst-rtld-load-self.out \
4e6db99c
FW
781 $(objpfx)tst-rtld-preload.out $(objpfx)argv0test.out \
782 $(objpfx)tst-rtld-help.out
f214606a
JM
783endif
784tests-special += $(objpfx)check-textrel.out $(objpfx)check-execstack.out \
0499a353 785 $(objpfx)check-wx-segment.out \
67c05796 786 $(objpfx)check-localplt.out $(objpfx)check-initfini.out
f214606a 787endif
aed48a2a 788
f214606a
JM
789ifeq ($(run-built-tests),yes)
790tests-special += $(objpfx)order-cmp.out $(objpfx)tst-array1-cmp.out \
791 $(objpfx)tst-array1-static-cmp.out \
792 $(objpfx)tst-array2-cmp.out $(objpfx)tst-array3-cmp.out \
793 $(objpfx)tst-array4-cmp.out $(objpfx)tst-array5-cmp.out \
794 $(objpfx)tst-array5-static-cmp.out $(objpfx)order2-cmp.out \
795 $(objpfx)tst-initorder-cmp.out \
796 $(objpfx)tst-initorder2-cmp.out $(objpfx)tst-unused-dep.out \
797 $(objpfx)tst-unused-dep-cmp.out
798endif
d66e34cd 799
1f67d828 800ifndef avoid-generated
e6fd79f3
CLT
801# DSO sorting tests:
802# The dso-ordering-test.py script generates testcase source files in $(objpfx),
803# creating a $(objpfx)<testcase-name>-dir for each testcase, and creates a
804# Makefile fragment to be included.
805define include_dsosort_tests
806$(objpfx)$(1).generated-makefile: $(1)
807 $(PYTHON) $(..)scripts/dso-ordering-test.py \
1f67d828
L
808 --description-file $$< --objpfx $(objpfx) --output-makefile $$@T
809 mv $$@T $$@
810-include $(objpfx)$(1).generated-makefile
e6fd79f3 811endef
1f67d828
L
812endif
813
814postclean-generated += $(objpfx)/dso-sort-tests-2.generated-makefile \
815 $(objpfx)/dso-sort-tests-2.generated-makefile
e6fd79f3
CLT
816
817# Generate from each testcase description file
d3bf2f59 818ifeq (yes,$(have-tunables))
e6fd79f3
CLT
819$(eval $(call include_dsosort_tests,dso-sort-tests-1.def))
820$(eval $(call include_dsosort_tests,dso-sort-tests-2.def))
d3bf2f59 821endif
e6fd79f3 822
1b6dd3f1 823check-abi: $(objpfx)check-abi-ld.out
f214606a 824tests-special += $(objpfx)check-abi-ld.out
fd54683c 825update-abi: update-abi-ld
c100dca3 826update-all-abi: update-all-abi-ld
fd54683c 827
89569c8b
L
828ifeq ($(have-glob-dat-reloc),yes)
829tests += tst-prelink
01cdcf78 830tests-internal += tst-prelink-cmp
e13daad7
L
831# Don't compile tst-prelink.c with PIE for GLOB_DAT relocation.
832CFLAGS-tst-prelink.c += -fno-pie
ce16eb52 833tst-prelink-no-pie = yes
89569c8b
L
834endif
835
d61ef735
CD
836# The test requires shared _and_ PIE because the executable
837# unit test driver must be able to link with the shared object
838# that is going to eventually go into an installed DSO.
839ifeq (yesyes,$(have-fpie)$(build-shared))
7c3018f9 840tests-internal += tst-_dl_addr_inside_object
d61ef735
CD
841tests-pie += tst-_dl_addr_inside_object
842$(objpfx)tst-_dl_addr_inside_object: $(objpfx)dl-addr-obj.os
843CFLAGS-tst-_dl_addr_inside_object.c += $(PIE-ccflag)
844endif
845
e69d994a
ZW
846# We can only test static libcrypt use if libcrypt has been built,
847# and either NSS crypto is not in use, or static NSS libraries are
848# available.
849ifeq ($(build-crypt),no)
850CFLAGS-tst-linkall-static.c += -DUSE_CRYPT=0
851else
852ifeq ($(nss-crypt),no)
853CFLAGS-tst-linkall-static.c += -DUSE_CRYPT=1
854else
855ifeq ($(static-nss-crypt),no)
856CFLAGS-tst-linkall-static.c += -DUSE_CRYPT=0
857else
36975e8e 858CFLAGS-tst-linkall-static.c += -DUSE_CRYPT=1
e69d994a
ZW
859endif
860endif
84aa7516
CD
861endif
862
f214606a
JM
863include ../Rules
864
1ef32c3d 865ifeq (yes,$(build-shared))
a89d30d4
RM
866# Make sure these things are built in the `make lib' pass so they can be used
867# to run programs during the `make others' pass.
868lib-noranlib: $(objpfx)$(rtld-installed-name) \
869 $(addprefix $(objpfx),$(extra-objs))
870endif
871
db2286f6 872# Command to link into a larger single relocatable object.
b350afab 873reloc-link = $(LINK.o) -nostdlib -nostartfiles -r
db2286f6 874
a6928d51
RM
875$(objpfx)sotruss-lib.so: $(shlib-lds)
876
b79f74cd 877$(objpfx)dl-allobjs.os: $(all-rtld-routines:%=$(objpfx)%.os)
ce460d04 878 $(reloc-link) -o $@ $^
db2286f6 879
86d2c878 880# Link together the dynamic linker into a single relocatable object.
ce460d04
RM
881# First we do a link against libc_pic.a just to get a link map,
882# and discard the object produced by that link. From the link map
883# we can glean all the libc modules that need to go into the dynamic
884# linker. Then we do a recursive make that goes into all the subdirs
885# those modules come from and builds special rtld-foo.os versions that
886# are compiled with special flags, and puts these modules into rtld-libc.a
887# for us. Then we do the real link using rtld-libc.a instead of libc_pic.a.
888
abcc039d
FW
889# These symbols need to be stubbed out during symbol discovery because
890# their implementation is provided differently in rtld, and the symbol
891# discovery mechanism is not compatible with the libc implementation
892# when compiled for libc.
3a0ecccb 893rtld-stubbed-symbols = \
ce0b7961
FW
894 __GI___pthread_disable_asynccancel \
895 __GI___pthread_enable_asynccancel \
896 __pthread_disable_asynccancel \
897 __pthread_enable_asynccancel \
3a0ecccb
FW
898 calloc \
899 free \
900 malloc \
901 realloc \
abcc039d 902
bc174f20 903ifeq ($(have-ssp),yes)
abcc039d
FW
904# rtld is not built with the stack protector, so these references will
905# go away in the rebuilds.
906rtld-stubbed-symbols += __stack_chk_fail __stack_chk_fail_local
bc174f20
NA
907endif
908
ce460d04 909$(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
240e87c2 910 @-rm -f $@T
02d393f2
FS
911 for symbol in $(rtld-stubbed-symbols); do \
912 echo ".globl $$symbol"; \
913 echo "$$symbol:"; \
914 done | $(CC) -o $@T.o $(ASFLAGS) -c -x assembler -
915 $(reloc-link) -o $@.o $@T.o '-Wl,-(' $^ -lgcc '-Wl,-)' -Wl,-Map,$@T
916 rm -f %@T.o $@.o
240e87c2 917 mv -f $@T $@
ce460d04 918
eb06601b 919# For lld, skip preceding addresses and values before matching the archive and the member.
ce460d04 920$(objpfx)librtld.mk: $(objpfx)librtld.map Makefile
b61c8aba 921 LC_ALL=C \
eb06601b 922 sed -n 's@^[0-9a-f ]*$(common-objpfx)\([^(]*\)(\([^)]*\.os\)) *.*$$@\1 \2@p' \
6461e577 923 $< | \
ce460d04
RM
924 while read lib file; do \
925 case $$lib in \
926 libc_pic.a) \
b61c8aba 927 LC_ALL=C fgrep -l /$$file \
ce460d04 928 $(common-objpfx)stamp.os $(common-objpfx)*/stamp.os | \
b61c8aba 929 LC_ALL=C \
ce460d04
RM
930 sed 's@^$(common-objpfx)\([^/]*\)/stamp\.os$$@rtld-\1'" +=$$file@"\
931 ;; \
932 */*.a) \
933 echo rtld-$${lib%%/*} += $$file ;; \
934 *) echo "Wasn't expecting $$lib($$file)" >&2; exit 1 ;; \
935 esac; \
936 done > $@T
b61c8aba
UD
937 echo rtld-subdirs = `LC_ALL=C sed 's/^rtld-\([^ ]*\).*$$/\1/' $@T \
938 | LC_ALL=C sort -u` >> $@T
ce460d04
RM
939 mv -f $@T $@
940
941$(objpfx)rtld-libc.a: $(objpfx)librtld.mk FORCE
942 $(MAKE) -f $< -f rtld-Rules
943
ce460d04 944$(objpfx)librtld.os: $(objpfx)dl-allobjs.os $(objpfx)rtld-libc.a
b350afab 945 $(LINK.o) -nostdlib -nostartfiles -r -o $@ '-Wl,-(' $^ -lgcc '-Wl,-)' \
5896ffa8
UD
946 -Wl,-Map,$@.map
947
948generated += librtld.map librtld.mk rtld-libc.a librtld.os.map
d66e34cd 949
4df8c11d
UD
950z-now-yes = -Wl,-z,now
951
32e6df36 952$(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
f4a29fba
RM
953# Link into a temporary file so that we don't touch $@ at all
954# if the sanity check below fails.
955 $(LINK.o) -nostdlib -nostartfiles -shared -o $@.new \
4df8c11d 956 $(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \
32e6df36 957 $(filter-out $(map-file),$^) $(load-map-file) \
4e34ac6a
RM
958 -Wl,-soname=$(rtld-installed-name) \
959 -Wl,-defsym=_begin=0
04f5a636 960 $(call after-link,$@.new)
f4a29fba 961 $(READELF) -s $@.new \
0a80eb74 962 | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
f4a29fba 963 mv -f $@.new $@
266180eb 964
ac63a078 965ifeq (yes,$(build-shared))
d330b980 966# interp.c exists just to get the runtime linker path into libc.so.
ac63a078
DL
967$(objpfx)interp.os: $(common-objpfx)runtime-linker.h
968endif
c7562c74 969
1ef32c3d 970ifneq (ld.so,$(rtld-installed-name))
afd4eb37 971# Make sure ld.so.1 exists in the build directory so we can link
852fc4b9
RM
972# against it.
973$(objpfx)$(rtld-installed-name): $(objpfx)ld.so
85ee9a0d 974 $(make-link)
da2d1bc5 975generated += $(rtld-installed-name)
852fc4b9
RM
976endif
977
fd26970f
UD
978# Build a file mentioning all trustworthy directories to look for shared
979# libraries when using LD_LIBRARY_PATH in a setuid program. The user can
980# add directories to the list by defining $(user-defined-trusted-dirs)
981# before starting make.
6598ac30
UD
982$(objpfx)trusted-dirs.h: $(objpfx)trusted-dirs.st; @:
983$(objpfx)trusted-dirs.st: Makefile $(..)Makeconfig
1ef32c3d 984 $(make-target-directory)
ab7eb292
UD
985 echo "$(subst :, ,$(default-rpath) $(user-defined-trusted-dirs))" \
986 | $(AWK) -f gen-trusted-dirs.awk > ${@:st=T};
ce460d04 987 echo '#define DL_DST_LIB "$(notdir $(slibdir))"' >> ${@:st=T}
6598ac30
UD
988 $(move-if-change) ${@:st=T} ${@:st=h}
989 touch $@
36975e8e 990CPPFLAGS-dl-load.c += -I$(objpfx). -I$(csu-objpfx).
86d2c878 991
9f2a9248 992ifeq (yes,$(build-shared))
8208be38 993$(inst_rtlddir)/$(rtld-installed-name): $(objpfx)ld.so $(+force)
460adbb8 994 $(make-target-directory)
925e31d9 995 $(do-install-program)
1ef32c3d 996
2e75604f
FW
997# Creates the relative /usr/bin/ld.so symbolic link.
998$(inst_bindir)/ld.so: $(inst_rtlddir)/$(rtld-installed-name)
999 $(make-target-directory)
1000 $(make-link)
1001
5148d49f
UD
1002# Special target called by parent to install just the dynamic linker.
1003.PHONY: ldso_install
aaa8cb4b 1004ldso_install: $(inst_rtlddir)/$(rtld-installed-name)
8208be38 1005endif # $(build-shared)
5148d49f 1006
cb343854 1007
9590a71a
FW
1008# Workarounds for ${exec_prefix} expansion in configure variables.
1009# config.status cannot be used directly for processing ldd.bash.in or
1010# expanding variables such as sysconfdir because the expansion
1011# contains the literal string ${exec_prefix}, which is not valid in C
1012# headers or installed shell scripts.
1013
43ca83ec
MF
1014ldd-rewrite = -e 's%@RTLD@%$(rtlddir)/$(rtld-installed-name)%g' \
1015 -e 's%@VERSION@%$(version)%g' \
1016 -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
1017 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' \
314f6dee 1018 -e 's%@TEXTDOMAINDIR@%$(localedir)%g'
cb343854
UD
1019
1020ifeq ($(ldd-rewrite-script),no)
1021define gen-ldd
43ca83ec 1022LC_ALL=C sed $(ldd-rewrite) < $< > $@.new
cb343854 1023endef
84384f5b 1024else
cb343854 1025define gen-ldd
43ca83ec 1026LC_ALL=C sed $(ldd-rewrite) < $< \
52d4fef8 1027| LC_ALL=C sed -f $(patsubst $(..)/%,/%,$(..)$(ldd-rewrite-script)) > $@.new
cb343854
UD
1028endef
1029endif
1030
926e512f 1031$(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \
ee74a442 1032 $(common-objpfx)config.make
cb343854 1033 $(gen-ldd)
84384f5b
UD
1034 chmod 555 $@.new
1035 mv -f $@.new $@
cb343854 1036
95f5a9a8
JM
1037$(objpfx)sln: $(sln-modules:%=$(objpfx)%.o)
1038
591e1ffb 1039$(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
11988f8f 1040
8ca91b36 1041SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
36975e8e 1042CFLAGS-ldconfig.c += $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
4f41c682 1043 -D'SLIBDIR="$(slibdir)"'
9cd47470 1044libof-ldconfig = ldconfig
36975e8e
L
1045CFLAGS-dl-cache.c += $(SYSCONF-FLAGS)
1046CFLAGS-cache.c += $(SYSCONF-FLAGS)
1047CFLAGS-rtld.c += $(SYSCONF-FLAGS)
db03874d
FW
1048CFLAGS-dl-usage.c += $(SYSCONF-FLAGS) \
1049 -D'RTLD="$(rtlddir)/$(rtld-installed-name)"'
851f32cf
FW
1050CFLAGS-dl-diagnostics.c += $(SYSCONF-FLAGS) \
1051 -D'PREFIX="$(prefix)"' \
1052 -D'RTLD="$(rtlddir)/$(rtld-installed-name)"'
591e1ffb 1053
9cd47470
SP
1054cpp-srcs-left := $(all-rtld-routines:=.os)
1055lib := rtld
2bfdaedd 1056include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
9cd47470 1057
9b014809
UD
1058test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
1059generated += $(addsuffix .so,$(strip $(modules-names)))
482eec0d 1060
6f1c7010
FW
1061$(objpfx)testobj1_1.so: $(objpfx)testobj1.so
1062$(objpfx)testobj2.so: $(objpfx)testobj1.so
1063$(objpfx)testobj6.so: $(objpfx)testobj1.so $(objpfx)testobj2.so
e18db2b0 1064$(objpfx)failobj.so: $(objpfx)testobj6.so
84ddc586
UD
1065$(objpfx)dep1.so: $(objpfx)dep2.so $(objpfx)dep4.so
1066$(objpfx)dep2.so: $(objpfx)dep3.so $(objpfx)dep4.so
1067$(objpfx)dep4.so: $(objpfx)dep3.so
2cb8cefb 1068$(objpfx)nodelmod3.so: $(objpfx)nodelmod4.so
6f1c7010
FW
1069$(objpfx)neededobj2.so: $(objpfx)neededobj1.so
1070$(objpfx)neededobj3.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so
8edd9172 1071$(objpfx)neededobj4.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
6f1c7010 1072 $(objpfx)neededobj3.so
c77a4478 1073$(objpfx)neededobj6.so: $(objpfx)neededobj5.so
f6de2239 1074$(objpfx)unload2mod.so: $(objpfx)unload2dep.so
b71e7ce8 1075$(objpfx)firstobj.so: $(shared-thread-library)
1826d793
UD
1076$(objpfx)reldep4mod1.so: $(objpfx)reldep4mod3.so
1077$(objpfx)reldep4mod2.so: $(objpfx)reldep4mod4.so
3fac0001
UD
1078$(objpfx)dblloadmod1.so: $(objpfx)dblloadmod3.so
1079$(objpfx)dblloadmod2.so: $(objpfx)dblloadmod3.so
c4bb124a
UD
1080$(objpfx)reldepmod5.so: $(objpfx)reldepmod2.so
1081$(objpfx)reldepmod6.so: $(objpfx)reldepmod2.so
c47e78b1
UD
1082$(objpfx)reldep6mod1.so: $(objpfx)reldep6mod0.so
1083$(objpfx)reldep6mod2.so: $(objpfx)reldep6mod1.so
1084$(objpfx)reldep6mod3.so: $(objpfx)reldep6mod2.so
1085$(objpfx)reldep6mod4.so: $(objpfx)reldep6mod1.so
fc093be1 1086$(objpfx)tst-tlsmod3.so: $(objpfx)tst-tlsmod2.so
94c24227
UD
1087$(objpfx)tst-tlsmod8.so: $(objpfx)tst-tlsmod7.so
1088$(objpfx)tst-tlsmod10.so: $(objpfx)tst-tlsmod9.so
1089$(objpfx)tst-tlsmod12.so: $(objpfx)tst-tlsmod11.so
541765b6 1090$(objpfx)tst-tlsmod13a.so: $(objpfx)tst-tlsmod13.so
aff4519d
UD
1091# For tst-tls9-static, make sure the modules it dlopens have libc.so in DT_NEEDED
1092$(objpfx)tst-tlsmod5.so: $(common-objpfx)libc.so
1093$(objpfx)tst-tlsmod6.so: $(common-objpfx)libc.so
d26dfc60
MG
1094$(objpfx)tst-tls19mod1.so: $(objpfx)tst-tls19mod2.so $(objpfx)tst-tls19mod3.so
1095$(objpfx)tst-tls19mod3.so: $(objpfx)ld.so
556224ab 1096$(objpfx)reldep8mod3.so: $(objpfx)reldep8mod1.so $(objpfx)reldep8mod2.so
aff4519d
UD
1097$(objpfx)nodel2mod3.so: $(objpfx)nodel2mod1.so $(objpfx)nodel2mod2.so
1098$(objpfx)reldep9mod2.so: $(objpfx)reldep9mod1.so
1099$(objpfx)reldep9mod3.so: $(objpfx)reldep9mod1.so $(objpfx)reldep9mod2.so
fab0abb4
UD
1100$(objpfx)unload3mod1.so: $(objpfx)unload3mod3.so
1101$(objpfx)unload3mod2.so: $(objpfx)unload3mod3.so
1102$(objpfx)unload3mod3.so: $(objpfx)unload3mod4.so
20fe49b9
UD
1103$(objpfx)unload4mod1.so: $(objpfx)unload4mod2.so $(objpfx)unload4mod3.so
1104$(objpfx)unload4mod2.so: $(objpfx)unload4mod4.so $(objpfx)unload4mod3.so
1ee2ff20 1105$(objpfx)unload7mod2.so: $(objpfx)unload7mod1.so
39dd69df
AS
1106$(objpfx)unload8mod1.so: $(objpfx)unload8mod2.so
1107$(objpfx)unload8mod2.so: $(objpfx)unload8mod3.so
968dad0a
UD
1108$(objpfx)tst-initordera2.so: $(objpfx)tst-initordera1.so
1109$(objpfx)tst-initorderb2.so: $(objpfx)tst-initorderb1.so $(objpfx)tst-initordera2.so
1110$(objpfx)tst-initordera3.so: $(objpfx)tst-initorderb2.so $(objpfx)tst-initorderb1.so
1111$(objpfx)tst-initordera4.so: $(objpfx)tst-initordera3.so
1112$(objpfx)tst-initorder: $(objpfx)tst-initordera4.so $(objpfx)tst-initordera1.so $(objpfx)tst-initorderb2.so
b9375348 1113$(objpfx)tst-null-argv: $(objpfx)tst-null-argv-lib.so
b5fe8ec8 1114$(objpfx)tst-tlsalign: $(objpfx)tst-tlsalign-lib.so
b632bdd3 1115$(objpfx)tst-nodelete-opened.out: $(objpfx)tst-nodelete-opened-lib.so
b5fe8ec8 1116
1a1a6bde
RM
1117$(objpfx)tst-tlsalign-extern: $(objpfx)tst-tlsalign-vars.o
1118$(objpfx)tst-tlsalign-extern-static: $(objpfx)tst-tlsalign-vars.o
1119
b9375348 1120tst-null-argv-ENV = LD_DEBUG=all LD_DEBUG_OUTPUT=$(objpfx)tst-null-argv.debug.out
8b196ac4
FW
1121LDFLAGS-nodel2mod3.so = -Wl,--no-as-needed
1122LDFLAGS-reldepmod5.so = -Wl,--no-as-needed
1123LDFLAGS-reldep6mod1.so = -Wl,--no-as-needed
1124LDFLAGS-reldep6mod4.so = -Wl,--no-as-needed
1125LDFLAGS-reldep8mod3.so = -Wl,--no-as-needed
1126LDFLAGS-unload4mod1.so = -Wl,--no-as-needed
1127LDFLAGS-unload4mod2.so = -Wl,--no-as-needed
1128LDFLAGS-tst-initorder = -Wl,--no-as-needed
1129LDFLAGS-tst-initordera2.so = -Wl,--no-as-needed
1130LDFLAGS-tst-initordera3.so = -Wl,--no-as-needed
1131LDFLAGS-tst-initordera4.so = -Wl,--no-as-needed
1132LDFLAGS-tst-initorderb2.so = -Wl,--no-as-needed
1133LDFLAGS-tst-tlsmod5.so = -nostdlib -Wl,--no-as-needed
1134LDFLAGS-tst-tlsmod6.so = -nostdlib -Wl,--no-as-needed
6ef518c3 1135
1a379ea0
UD
1136testobj1.so-no-z-defs = yes
1137testobj3.so-no-z-defs = yes
1138testobj4.so-no-z-defs = yes
1139testobj5.so-no-z-defs = yes
1140testobj6.so-no-z-defs = yes
1141failobj.so-no-z-defs = yes
1142constload2.so-no-z-defs = yes
1143constload3.so-no-z-defs = yes
1144nodelmod1.so-no-z-defs = yes
1145nodelmod2.so-no-z-defs = yes
1146nodelmod4.so-no-z-defs = yes
1147nodel2mod2.so-no-z-defs = yes
1148reldepmod2.so-no-z-defs = yes
1149reldepmod3.so-no-z-defs = yes
1150reldepmod4.so-no-z-defs = yes
1151reldep4mod4.so-no-z-defs = yes
1152reldep4mod2.so-no-z-defs = yes
1153ltglobmod2.so-no-z-defs = yes
1154dblloadmod3.so-no-z-defs = yes
1155tst-tlsmod1.so-no-z-defs = yes
1156tst-tlsmod2.so-no-z-defs = yes
1157tst-tlsmod3.so-no-z-defs = yes
1158tst-tlsmod4.so-no-z-defs = yes
1159tst-tlsmod7.so-no-z-defs = yes
1160tst-tlsmod8.so-no-z-defs = yes
1161tst-tlsmod9.so-no-z-defs = yes
1162tst-tlsmod10.so-no-z-defs = yes
1163tst-tlsmod12.so-no-z-defs = yes
99fe3b0e
UD
1164tst-tlsmod14a.so-no-z-defs = yes
1165tst-tlsmod14b.so-no-z-defs = yes
167d5acc 1166tst-tlsmod15a.so-no-z-defs = yes
4c533566 1167tst-tlsmod16b.so-no-z-defs = yes
1a379ea0
UD
1168circlemod2.so-no-z-defs = yes
1169circlemod3.so-no-z-defs = yes
1170circlemod3a.so-no-z-defs = yes
1171reldep8mod2.so-no-z-defs = yes
1172reldep9mod1.so-no-z-defs = yes
fab0abb4 1173unload3mod4.so-no-z-defs = yes
20fe49b9 1174unload4mod1.so-no-z-defs = yes
2f083d75 1175ifuncmod1.so-no-z-defs = yes
3c30afc8
L
1176ifuncmod5.so-no-z-defs = yes
1177ifuncmod6.so-no-z-defs = yes
d0503676
CD
1178tst-auditmod9a.so-no-z-defs = yes
1179tst-auditmod9b.so-no-z-defs = yes
02d5e5d9
PK
1180tst-nodelete-uniquemod.so-no-z-defs = yes
1181tst-nodelete-rtldmod.so-no-z-defs = yes
1182tst-nodelete-zmod.so-no-z-defs = yes
f25238ff 1183tst-nodelete2mod.so-no-z-defs = yes
a334319f 1184
5181d776
RM
1185ifeq ($(build-shared),yes)
1186# Build all the modules even when not actually running test programs.
1187tests: $(test-modules)
1188endif
1189
482eec0d
UD
1190LDFLAGS-loadtest = -rdynamic
1191
1192$(objpfx)loadtest.out: $(test-modules)
6bd06384 1193
ceb579a3 1194$(objpfx)neededtest.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
8edd9172 1195 $(objpfx)neededobj3.so
ceb579a3 1196
9807e540 1197$(objpfx)neededtest2.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
8edd9172
UD
1198 $(objpfx)neededobj3.so
1199
8edd9172
UD
1200$(objpfx)neededtest3.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
1201 $(objpfx)neededobj3.so $(objpfx)neededobj4.so
9807e540 1202
6f1c7010 1203$(objpfx)neededtest4: $(objpfx)neededobj1.so
c77a4478
UD
1204$(objpfx)neededtest4.out: $(objpfx)neededobj5.so $(objpfx)neededobj6.so
1205
6f1c7010 1206$(objpfx)restest1: $(objpfx)testobj1.so $(objpfx)testobj1_1.so
e18db2b0 1207LDFLAGS-restest1 = -rdynamic
6bd06384 1208
2373b30e
UD
1209LDFLAGS-restest2 = -rdynamic
1210
6bd06384 1211$(objpfx)restest1.out: $(test-modules)
3d91edb2 1212
e18db2b0 1213preloadtest-preloads = testobj1 testobj2 testobj3 testobj4 testobj5
10584d2e 1214$(objpfx)preloadtest: $(objpfx)testobj6.so
10584d2e 1215LDFLAGS-preloadtest = -rdynamic
e18db2b0
UD
1216$(objpfx)preloadtest.out: $(preloadtest-preloads:%=$(objpfx)%.so)
1217preloadtest-ENV = \
1218 LD_PRELOAD=$(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
1e262312 1219
1e262312
UD
1220LDFLAGS-loadfail = -rdynamic
1221
61e0617a
UD
1222$(objpfx)loadfail.out: $(objpfx)failobj.so
1223
61e0617a 1224LDFLAGS-multiload = -rdynamic
36975e8e 1225CFLAGS-multiload.c += -DOBJDIR=\"$(elf-objpfx)\"
61e0617a
UD
1226
1227$(objpfx)multiload.out: $(objpfx)testobj1.so
dc5efe83 1228
394679eb 1229LDFLAGS-origtest = -rdynamic
dc5efe83 1230$(objpfx)origtest.out: $(objpfx)testobj1.so
ff5fad16
UD
1231
1232ifeq ($(have-thread-library),yes)
6f1c7010 1233$(objpfx)resolvfail: $(shared-thread-library)
ff5fad16 1234endif
19cf43be 1235
19cf43be 1236$(objpfx)constload1.out: $(objpfx)constload2.so $(objpfx)constload3.so
84ddc586 1237
6d78cd00
UD
1238$(objpfx)circleload1.out: $(objpfx)circlemod1.so \
1239 $(objpfx)circlemod1a.so
1240
1241$(objpfx)circlemod1.so: $(objpfx)circlemod2.so
1242$(objpfx)circlemod2.so: $(objpfx)circlemod3.so
1243$(objpfx)circlemod1a.so: $(objpfx)circlemod2a.so
1244$(objpfx)circlemod2a.so: $(objpfx)circlemod3a.so
1245
84ddc586
UD
1246$(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so)
1247
6e89caf1 1248$(objpfx)order-cmp.out: $(objpfx)order.out
f0881698
JM
1249 (echo "0123456789" | cmp $< -) > $@; \
1250 $(evaluate-test)
c1025c19
UD
1251
1252$(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so)
1253$(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
1254vismain-ENV = LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
5e61ef88 1255
6f1c7010 1256$(objpfx)noload: $(objpfx)testobj1.so
8b196ac4 1257LDFLAGS-noload = -rdynamic -Wl,--no-as-needed
5e61ef88 1258$(objpfx)noload.out: $(objpfx)testobj5.so
0fb7851f 1259
0b20a9e8 1260$(objpfx)noload-mem.out: $(objpfx)noload.out
f0881698
JM
1261 $(common-objpfx)malloc/mtrace $(objpfx)noload.mtrace > $@; \
1262 $(evaluate-test)
2d2d9f2b
SP
1263noload-ENV = MALLOC_TRACE=$(objpfx)noload.mtrace \
1264 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
4bff6e01 1265
ad7534c8 1266LDFLAGS-nodelete = -rdynamic
0fb7851f 1267LDFLAGS-nodelmod1.so = -Wl,--enable-new-dtags,-z,nodelete
2cb8cefb 1268LDFLAGS-nodelmod4.so = -Wl,--enable-new-dtags,-z,nodelete
2cb8cefb
UD
1269$(objpfx)nodelete.out: $(objpfx)nodelmod1.so $(objpfx)nodelmod2.so \
1270 $(objpfx)nodelmod3.so
2f54c82d
UD
1271
1272LDFLAGS-nodlopenmod.so = -Wl,--enable-new-dtags,-z,nodlopen
2f54c82d 1273$(objpfx)nodlopen.out: $(objpfx)nodlopenmod.so
fcacb36a 1274
87837aac 1275$(objpfx)nodlopenmod2.so: $(objpfx)nodlopenmod.so
87837aac
UD
1276$(objpfx)nodlopen2.out: $(objpfx)nodlopenmod2.so
1277
137bca87
UD
1278$(objpfx)filtmod1.so: $(objpfx)filtmod1.os $(objpfx)filtmod2.so
1279 $(LINK.o) -shared -o $@ -B$(csu-objpfx) $(LDFLAGS.so) \
1280 -L$(subst :, -L,$(rpath-link)) \
1281 -Wl,-rpath-link=$(rpath-link) \
1282 $< -Wl,-F,$(objpfx)filtmod2.so
fcacb36a 1283$(objpfx)filter: $(objpfx)filtmod1.so
2b7238dd 1284
7cbb738d 1285# This does not link against libc.
36975e8e 1286CFLAGS-filtmod1.c += $(no-stack-protector)
7cbb738d 1287
2b7238dd
UD
1288$(objpfx)unload.out: $(objpfx)unloadmod.so
1289
2b7238dd
UD
1290$(objpfx)reldep.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod2.so
1291
2b7238dd
UD
1292$(objpfx)reldep2.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod3.so
1293
2b7238dd 1294$(objpfx)reldep3.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
917fd061 1295
1826d793
UD
1296$(objpfx)reldep4.out: $(objpfx)reldep4mod1.so $(objpfx)reldep4mod2.so
1297
6f1c7010 1298$(objpfx)next: $(objpfx)nextmod1.so $(objpfx)nextmod2.so
8b196ac4 1299LDFLAGS-next = -Wl,--no-as-needed
f6de2239 1300
f6de2239 1301$(objpfx)unload2.out: $(objpfx)unload2mod.so $(objpfx)unload2dep.so
d785c366 1302
d785c366 1303$(objpfx)lateglobal.out: $(objpfx)ltglobmod1.so $(objpfx)ltglobmod2.so
5a384a91 1304
5a384a91
UD
1305$(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \
1306 $(objpfx)pathoptobj.so
8540f6d2 1307 $(SHELL) $< $(common-objpfx) '$(test-wrapper-env)' \
8f8052c2 1308 '$(run-program-env)'; \
f0881698 1309 $(evaluate-test)
b71e7ce8 1310
f3fd569c 1311$(objpfx)tst-rtld-load-self.out: tst-rtld-load-self.sh $(objpfx)ld.so
f0881698
JM
1312 $(SHELL) $^ '$(test-wrapper)' '$(test-wrapper-env)' > $@; \
1313 $(evaluate-test)
f3fd569c 1314
8692ebdb
DN
1315tst-rtld-preload-OBJS = $(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
1316$(objpfx)tst-rtld-preload.out: tst-rtld-preload.sh $(objpfx)ld.so \
1317 $(objpfx)preloadtest \
1318 $(preloadtest-preloads:%=$(objpfx)%.so)
1319 $(SHELL) $< $(objpfx)ld.so $(objpfx)preloadtest \
d01fd5f0 1320 '$(test-wrapper-env)' '$(run_program_env)' \
8692ebdb
DN
1321 '$(rpath-link)' '$(tst-rtld-preload-OBJS)' > $@; \
1322 $(evaluate-test)
1323
b71e7ce8 1324$(objpfx)initfirst.out: $(objpfx)firstobj.so
273a3cfb
UD
1325
1326$(objpfx)global: $(objpfx)globalmod1.so
f9b152c8 1327$(objpfx)global.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
3fac0001 1328
3fac0001
UD
1329$(objpfx)dblload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
1330
3fac0001 1331$(objpfx)dblunload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
c4bb124a 1332
ac2d6e9b 1333$(objpfx)reldep5.out: $(objpfx)reldepmod5.so $(objpfx)reldepmod6.so
c47e78b1 1334
c47e78b1 1335$(objpfx)reldep6.out: $(objpfx)reldep6mod3.so $(objpfx)reldep6mod4.so
2e36cb48 1336
a41d8a74
UD
1337$(objpfx)reldep7.out: $(objpfx)reldep7mod1.so $(objpfx)reldep7mod2.so
1338
cfaf5e56
UD
1339$(objpfx)reldep8.out: $(objpfx)reldep8mod3.so
1340
aff4519d 1341LDFLAGS-nodel2mod2.so = -Wl,--enable-new-dtags,-z,nodelete
aff4519d
UD
1342$(objpfx)nodelete2.out: $(objpfx)nodel2mod3.so
1343
aff4519d
UD
1344$(objpfx)reldep9.out: $(objpfx)reldep9mod3.so
1345
2e36cb48 1346$(objpfx)tst-tls3: $(objpfx)tst-tlsmod1.so
aed283dd 1347
aed283dd
UD
1348$(objpfx)tst-tls4.out: $(objpfx)tst-tlsmod2.so
1349
aed283dd 1350$(objpfx)tst-tls5.out: $(objpfx)tst-tlsmod2.so
bb4cb252 1351
bb4cb252 1352$(objpfx)tst-tls6.out: $(objpfx)tst-tlsmod2.so
fc093be1 1353
fc093be1 1354$(objpfx)tst-tls7.out: $(objpfx)tst-tlsmod3.so
ebda6173 1355
ebda6173 1356$(objpfx)tst-tls8.out: $(objpfx)tst-tlsmod3.so $(objpfx)tst-tlsmod4.so
6ef518c3 1357
6ef518c3
RM
1358$(objpfx)tst-tls9.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
1359
702e8f14 1360$(objpfx)tst-tls10: $(objpfx)tst-tlsmod8.so $(objpfx)tst-tlsmod7.so
94c24227 1361
702e8f14 1362$(objpfx)tst-tls11: $(objpfx)tst-tlsmod10.so $(objpfx)tst-tlsmod9.so
94c24227 1363
702e8f14 1364$(objpfx)tst-tls12: $(objpfx)tst-tlsmod12.so $(objpfx)tst-tlsmod11.so
94c24227 1365
541765b6
UD
1366$(objpfx)tst-tls13.out: $(objpfx)tst-tlsmod13a.so
1367
6f1c7010 1368$(objpfx)tst-tls14: $(objpfx)tst-tlsmod14a.so
167d5acc
UD
1369$(objpfx)tst-tls14.out: $(objpfx)tst-tlsmod14b.so
1370
167d5acc 1371$(objpfx)tst-tls15.out: $(objpfx)tst-tlsmod15a.so $(objpfx)tst-tlsmod15b.so
99fe3b0e 1372
d78efd9f
RM
1373$(objpfx)tst-tls-dlinfo.out: $(objpfx)tst-tlsmod2.so
1374
1375
1376
4c533566
UD
1377$(objpfx)tst-tls16.out: $(objpfx)tst-tlsmod16a.so $(objpfx)tst-tlsmod16b.so
1378
60a23f5a 1379$(objpfx)tst-tls17.out: $(objpfx)tst-tlsmod17b.so
1f20b93a
AS
1380$(patsubst %,$(objpfx)%.os,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.os: tst-tlsmod17a.c
1381 $(compile-command.c) -DN=$*
1382$(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.so: $(objpfx)ld.so
1383$(objpfx)tst-tlsmod17b.so: $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules))
60a23f5a 1384
1f20b93a
AS
1385$(objpfx)tst-tls18.out: $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules))
1386$(patsubst %,$(objpfx)%.os,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.os : tst-tlsmod18a.c
1387 $(compile-command.c) -DN=$*
1388$(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.so: $(objpfx)ld.so
41e25904 1389
d26dfc60
MG
1390$(objpfx)tst-tls19.out: $(objpfx)tst-tls19mod1.so
1391
36975e8e
L
1392CFLAGS-tst-align.c += $(stack-align-test-flags)
1393CFLAGS-tst-align2.c += $(stack-align-test-flags)
1394CFLAGS-tst-alignmod.c += $(stack-align-test-flags)
1395CFLAGS-tst-alignmod2.c += $(stack-align-test-flags)
06f6ca90 1396$(objpfx)tst-align.out: $(objpfx)tst-alignmod.so
be184b1d 1397$(objpfx)tst-align2: $(objpfx)tst-alignmod2.so
fc2334ab
L
1398$(objpfx)tst-align3: $(objpfx)tst-alignmod3.so
1399ifeq (yes,$(have-fpie))
1400CFLAGS-tst-align3.c += $(PIE-ccflag)
1401endif
1402LDFLAGS-tst-align3 += -Wl,-z,max-page-size=0x200000
1403LDFLAGS-tst-alignmod3.so += -Wl,-z,max-page-size=0x200000
1404$(objpfx)tst-alignmod3.so: $(libsupport)
06f6ca90 1405
fab0abb4
UD
1406$(objpfx)unload3.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
1407 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
1408
20fe49b9
UD
1409$(objpfx)unload4.out: $(objpfx)unload4mod1.so $(objpfx)unload4mod3.so
1410
20fe49b9
UD
1411$(objpfx)unload5.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
1412 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
1413
bfc832cc
UD
1414$(objpfx)unload6.out: $(objpfx)unload6mod1.so $(objpfx)unload6mod2.so \
1415 $(objpfx)unload6mod3.so
1416
1ee2ff20
UD
1417$(objpfx)unload7.out: $(objpfx)unload7mod1.so $(objpfx)unload7mod2.so
1418unload7-ENV = MALLOC_PERTURB_=85
1419
39dd69df
AS
1420$(objpfx)unload8.out: $(objpfx)unload8mod1.so $(objpfx)unload8mod1x.so
1421
6ef518c3 1422$(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
dfe4c900 1423
2abf9ff1 1424ifeq ($(have-z-execstack),yes)
2abf9ff1 1425$(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
36975e8e 1426CPPFLAGS-tst-execstack.c += -DUSE_PTHREADS=0
2abf9ff1 1427LDFLAGS-tst-execstack = -Wl,-z,noexecstack
41432ebe 1428LDFLAGS-tst-execstack-mod.so = -Wl,-z,execstack
2abf9ff1
RM
1429
1430$(objpfx)tst-execstack-needed: $(objpfx)tst-execstack-mod.so
1431LDFLAGS-tst-execstack-needed = -Wl,-z,noexecstack
c70ba488
RM
1432
1433LDFLAGS-tst-execstack-prog = -Wl,-z,execstack
b9205857
RH
1434CFLAGS-tst-execstack-prog.c += -Wno-trampolines
1435CFLAGS-tst-execstack-mod.c += -Wno-trampolines
2abf9ff1
RM
1436endif
1437
8b196ac4
FW
1438LDFLAGS-tst-array2 = -Wl,--no-as-needed
1439LDFLAGS-tst-array5 = -Wl,--no-as-needed
5655a0b5 1440
6e89caf1 1441$(objpfx)tst-array1-cmp.out: tst-array1.exp $(objpfx)tst-array1.out
f0881698
JM
1442 cmp $^ > $@; \
1443 $(evaluate-test)
6e89caf1
JM
1444
1445$(objpfx)tst-array1-static-cmp.out: tst-array1.exp \
1446 $(objpfx)tst-array1-static.out
f0881698
JM
1447 cmp $^ > $@; \
1448 $(evaluate-test)
43c59a70 1449
dfe4c900 1450$(objpfx)tst-array2: $(objpfx)tst-array2dep.so
6e89caf1 1451$(objpfx)tst-array2-cmp.out: tst-array2.exp $(objpfx)tst-array2.out
f0881698
JM
1452 cmp $^ > $@; \
1453 $(evaluate-test)
dfe4c900 1454
6e89caf1 1455$(objpfx)tst-array3-cmp.out: tst-array1.exp $(objpfx)tst-array3.out
f0881698
JM
1456 cmp $^ > $@; \
1457 $(evaluate-test)
efd56f53 1458
6e89caf1
JM
1459$(objpfx)tst-array4.out: $(objpfx)tst-array2dep.so
1460$(objpfx)tst-array4-cmp.out: tst-array4.exp $(objpfx)tst-array4.out
f0881698
JM
1461 cmp $^ > $@; \
1462 $(evaluate-test)
efd56f53 1463
04395c90 1464$(objpfx)tst-array5: $(objpfx)tst-array5dep.so
6e89caf1 1465$(objpfx)tst-array5-cmp.out: tst-array5.exp $(objpfx)tst-array5.out
f0881698
JM
1466 cmp $^ > $@; \
1467 $(evaluate-test)
04395c90 1468
6e89caf1
JM
1469$(objpfx)tst-array5-static-cmp.out: tst-array5-static.exp \
1470 $(objpfx)tst-array5-static.out
f0881698
JM
1471 cmp $^ > $@; \
1472 $(evaluate-test)
04395c90 1473
7b91359b 1474CFLAGS-tst-pie1.c += $(pie-ccflag)
798212a0 1475CFLAGS-tst-pie2.c += $(pie-ccflag)
f17ed1a9 1476
c23de0aa 1477$(objpfx)tst-piemod1.so: $(libsupport)
da62f81b 1478$(objpfx)tst-pie1: $(objpfx)tst-piemod1.so
2c75b545 1479$(objpfx)tst-dlopen-pie.out: $(objpfx)tst-pie1
f17ed1a9 1480
efd56f53 1481ifeq (yes,$(build-shared))
f753fa7d
L
1482# NB: Please keep cet-built-dso in sysdeps/x86/Makefile in sync with
1483# all-built-dso here.
da53d6db 1484all-built-dso := $(common-objpfx)elf/ld.so $(common-objpfx)libc.so \
82a79e7d
RM
1485 $(filter-out $(common-objpfx)linkobj/libc.so, \
1486 $(sort $(wildcard $(addprefix $(common-objpfx), \
1487 */lib*.so \
1488 iconvdata/*.so))))
1f20b93a 1489
82a79e7d
RM
1490$(all-built-dso:=.dyn): %.dyn: %
1491 @rm -f $@T
1492 LC_ALL=C $(READELF) -W -d $< > $@T
1493 test -s $@T
1494 mv -f $@T $@
d3dfcc41 1495common-generated += $(all-built-dso:$(common-objpfx)%=%.dyn)
82a79e7d
RM
1496
1497$(objpfx)check-textrel.out: $(..)scripts/check-textrel.awk \
1498 $(all-built-dso:=.dyn)
f0881698
JM
1499 LC_ALL=C $(AWK) -f $^ > $@; \
1500 $(evaluate-test)
82a79e7d 1501generated += check-textrel.out
bed12f78 1502
82397ed6
RM
1503$(objpfx)execstack-default: $(first-word $(wildcard $(sysdirs:%=%/stackinfo.h)))
1504 $(make-target-directory)
1505 { echo '#include <elf.h>'; \
1506 echo '#include <stackinfo.h>'; \
1507 echo '#if (DEFAULT_STACK_PERMS & PF_X) == 0'; \
1508 echo '@@@execstack-no@@@'; \
1509 echo '#else'; \
1510 echo '@@@execstack-yes@@@'; \
1511 echo '#endif'; } | \
1512 $(CC) $(CFLAGS) $(CPPFLAGS) -E -x c-header - | \
1513 sed -n -e 's/^@@@\(.*\)@@@/\1/p' > $@T
1514 mv -f $@T $@
1515generated += execstack-default
1516
1517$(all-built-dso:=.phdr): %.phdr: %
1518 @rm -f $@T
1519 LC_ALL=C $(READELF) -W -l $< > $@T
1520 test -s $@T
1521 mv -f $@T $@
d3dfcc41 1522common-generated += $(all-built-dso:$(common-objpfx)%=%.phdr)
82397ed6
RM
1523
1524$(objpfx)check-execstack.out: $(..)scripts/check-execstack.awk \
1525 $(objpfx)execstack-default \
1526 $(all-built-dso:=.phdr)
2d5c41de 1527 LC_ALL=C $(AWK) -v "xfail=$(check-execstack-xfail)" -f $^ > $@; \
f0881698 1528 $(evaluate-test)
82397ed6 1529generated += check-execstack.out
774f5a30 1530
0499a353
FW
1531$(objpfx)check-wx-segment.out: $(..)scripts/check-wx-segment.py \
1532 $(all-built-dso:=.phdr)
1533 $(PYTHON) $^ --xfail="$(check-wx-segment-xfail)" > $@; \
1534 $(evaluate-test)
1535generated += check-wx-segment.out
1536
bed12f78
UD
1537$(objpfx)tst-dlmodcount.out: $(test-modules)
1538
90fe4186
RM
1539$(all-built-dso:=.jmprel): %.jmprel: % Makefile
1540 @rm -f $@T
1541 LC_ALL=C $(READELF) -W -S -d -r $< > $@T
1542 test -s $@T
1543 mv -f $@T $@
d3dfcc41 1544common-generated += $(all-built-dso:$(common-objpfx)%=%.jmprel)
90fe4186 1545
90fe4186
RM
1546localplt-built-dso := $(addprefix $(common-objpfx),\
1547 libc.so \
da53d6db 1548 elf/ld.so \
90fe4186 1549 math/libm.so \
90fe4186
RM
1550 dlfcn/libdl.so \
1551 resolv/libresolv.so \
90fe4186 1552 )
829a679f
AS
1553ifeq ($(build-mathvec),yes)
1554localplt-built-dso += $(addprefix $(common-objpfx), mathvec/libmvec.so)
1555endif
d9266ea0 1556ifeq ($(have-thread-library),yes)
90fe4186 1557localplt-built-dso += $(filter-out %_nonshared.a, $(shared-thread-library))
d9266ea0 1558endif
e69d994a
ZW
1559ifeq ($(build-crypt),yes)
1560localplt-built-dso += $(addprefix $(common-objpfx), crypt/libcrypt.so)
1561endif
30639e79
FW
1562ifneq ($(pthread-in-libc),yes)
1563localplt-built-dso += $(addprefix $(common-objpfx), rt/librt.so)
1564endif
d9266ea0 1565
0f48659e
JM
1566vpath localplt.data $(+sysdep_dirs)
1567
90fe4186
RM
1568$(objpfx)check-localplt.out: $(..)scripts/check-localplt.awk \
1569 $(..)scripts/localplt.awk \
1570 $(localplt-built-dso:=.jmprel) \
0f48659e
JM
1571 localplt.data
1572 LC_ALL=C $(AWK) -f $(filter-out $< %localplt.data,$^) | \
1573 LC_ALL=C $(AWK) -f $< $(filter %localplt.data,$^) - \
f0881698
JM
1574 > $@; \
1575 $(evaluate-test)
3baf2e9b 1576endif
28977c2c 1577
67c05796
L
1578$(all-built-dso:=.dynsym): %.dynsym: %
1579 @rm -f $@T
1580 LC_ALL=C $(READELF) -W --dyn-syms $< > $@T
1581 test -s $@T
1582 mv -f $@T $@
1583common-generated += $(all-built-dso:$(common-objpfx)%=%.dynsym)
1584
1585$(objpfx)check-initfini.out: $(..)scripts/check-initfini.awk \
1586 $(all-built-dso:=.dynsym)
1587 LC_ALL=C $(AWK) -f $^ > $@; \
1588 $(evaluate-test)
1589generated += check-initfini.out
1590
6f1c7010 1591$(objpfx)tst-dlopenrpath: $(objpfx)tst-dlopenrpathmod.so
28977c2c
UD
1592CFLAGS-tst-dlopenrpath.c += -DPFX=\"$(objpfx)\"
1593LDFLAGS-tst-dlopenrpathmod.so += -Wl,-rpath,\$$ORIGIN/test-subdir
1594$(objpfx)tst-dlopenrpath.out: $(objpfx)firstobj.so
1fc07491
UD
1595
1596$(objpfx)tst-deep1mod2.so: $(objpfx)tst-deep1mod3.so
6f1c7010 1597$(objpfx)tst-deep1: $(objpfx)tst-deep1mod1.so
1fc07491
UD
1598$(objpfx)tst-deep1.out: $(objpfx)tst-deep1mod2.so
1599LDFLAGS-tst-deep1 += -rdynamic
1600tst-deep1mod3.so-no-z-defs = yes
c0f62c56 1601
c0f62c56
UD
1602$(objpfx)tst-dlmopen1.out: $(objpfx)tst-dlmopen1mod.so
1603
c0f62c56 1604$(objpfx)tst-dlmopen2.out: $(objpfx)tst-dlmopen1mod.so
b1f68750 1605
b1f68750 1606$(objpfx)tst-dlmopen3.out: $(objpfx)tst-dlmopen1mod.so
9dcafc55 1607
a93d9e03
L
1608$(objpfx)tst-dlmopen4.out: $(objpfx)tst-dlmopen1mod.so
1609
9dcafc55
UD
1610$(objpfx)tst-audit1.out: $(objpfx)tst-auditmod1.so
1611tst-audit1-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
fab0abb4 1612
58007e9e 1613$(objpfx)tst-audit2.out: $(objpfx)tst-auditmod1.so $(objpfx)tst-auditmod9b.so
51225803
AS
1614# Prevent GCC-5 from translating a malloc/memset pair into calloc
1615CFLAGS-tst-audit2.c += -fno-builtin
cafdfdb6
RM
1616tst-audit2-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1617
d0503676
CD
1618$(objpfx)tst-audit9.out: $(objpfx)tst-auditmod9a.so $(objpfx)tst-auditmod9b.so
1619tst-audit9-ENV = LD_AUDIT=$(objpfx)tst-auditmod9a.so
1620
79520f4b 1621$(objpfx)tst-audit8: $(libm)
2e64d265
L
1622$(objpfx)tst-audit8.out: $(objpfx)tst-auditmod1.so
1623tst-audit8-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1624
fab0abb4 1625$(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
3d786f19 1626
6e89caf1
JM
1627$(objpfx)order2.out: $(objpfx)order2mod1.so $(objpfx)order2mod2.so
1628$(objpfx)order2-cmp.out: $(objpfx)order2.out
f0881698
JM
1629 (echo "12345" | cmp $< -) > $@; \
1630 $(evaluate-test)
3d786f19
UD
1631$(objpfx)order2mod1.so: $(objpfx)order2mod4.so
1632$(objpfx)order2mod4.so: $(objpfx)order2mod3.so
1633$(objpfx)order2mod2.so: $(objpfx)order2mod3.so
1634order2mod2.so-no-z-defs = yes
8b196ac4
FW
1635LDFLAGS-order2mod1.so = -Wl,--no-as-needed
1636LDFLAGS-order2mod2.so = -Wl,--no-as-needed
35f1e827 1637
740b3dbe 1638tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child"
35f1e827 1639tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
2e0fc40c 1640
c61b4d41 1641tst-ptrguard1-ARGS = --command "$(host-test-program-cmd) --child"
0b1f8e35
CD
1642# When built statically, the pointer guard interface uses
1643# __pointer_chk_guard_local.
36975e8e 1644CFLAGS-tst-ptrguard1-static.c += -DPTRGUARD_LOCAL
c61b4d41
CD
1645tst-ptrguard1-static-ARGS = --command "$(objpfx)tst-ptrguard1-static --child"
1646
0b20a9e8 1647$(objpfx)tst-leaks1-mem.out: $(objpfx)tst-leaks1.out
f0881698
JM
1648 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1.mtrace > $@; \
1649 $(evaluate-test)
2e0fc40c 1650
2d2d9f2b
SP
1651tst-leaks1-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1.mtrace \
1652 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
93b53ca2 1653
6f1c7010 1654$(objpfx)tst-thrlock: $(shared-thread-library)
5ceb1630
SP
1655$(objpfx)tst-thrlock.out: $(libm)
1656$(objpfx)tst-noload.out: $(libm)
77523d5e 1657
7d3db434 1658tst-tst-dlopen-tlsmodid-no-pie = yes
6f1c7010 1659$(objpfx)tst-dlopen-tlsmodid: $(shared-thread-library)
7d3db434
FW
1660$(objpfx)tst-dlopen-tlsmodid.out: $(objpfx)tst-dlopen-self
1661CFLAGS-tst-dlopen-tlsmodid-pie.c += $(pie-ccflag)
6f1c7010 1662$(objpfx)tst-dlopen-tlsmodid-pie: $(shared-thread-library)
7d3db434 1663$(objpfx)tst-dlopen-tlsmodid-pie.out: $(objpfx)tst-dlopen-self-pie
6f1c7010 1664$(objpfx)tst-dlopen-tlsmodid-container: $(shared-thread-library)
7d3db434
FW
1665LDFLAGS-tst-dlopen-tlsmodid-container += -Wl,-rpath,\$$ORIGIN
1666
1667tst-tst-dlopen-self-no-pie = yes
7d3db434 1668CFLAGS-tst-dlopen-self-pie.c += $(pie-ccflag)
7d3db434 1669LDFLAGS-tst-dlopen-self-container += -Wl,-rpath,\$$ORIGIN
2f083d75
L
1670
1671CFLAGS-ifuncmain1pic.c += $(pic-ccflag)
1672CFLAGS-ifuncmain1picstatic.c += $(pic-ccflag)
1673CFLAGS-ifuncmain1staticpic.c += $(pic-ccflag)
1674CFLAGS-ifuncdep1pic.c += $(pic-ccflag)
1675CFLAGS-ifuncmain1vispic.c += $(pic-ccflag)
1676CFLAGS-ifuncmain2pic.c += $(pic-ccflag)
1677CFLAGS-ifuncmain2picstatic.c += $(pic-ccflag)
1678CFLAGS-ifuncdep2pic.c += $(pic-ccflag)
1679CFLAGS-ifuncmain4picstatic.c += $(pic-ccflag)
3c30afc8
L
1680CFLAGS-ifuncmain5pic.c += $(pic-ccflag)
1681CFLAGS-ifuncmain5picstatic.c += $(pic-ccflag)
1682CFLAGS-ifuncmain5staticpic.c += $(pic-ccflag)
1683CFLAGS-ifuncdep5pic.c += $(pic-ccflag)
1684CFLAGS-ifuncmain7pic.c += $(pic-ccflag)
1685CFLAGS-ifuncmain7picstatic.c += $(pic-ccflag)
cc3e573c
FW
1686CFLAGS-ifuncmain9pic.c += $(pic-ccflag)
1687CFLAGS-ifuncmain9picstatic.c += $(pic-ccflag)
2f083d75
L
1688
1689LDFLAGS-ifuncmain3 = -Wl,-export-dynamic
1690
2f083d75
L
1691CFLAGS-ifuncmain1pie.c += $(pie-ccflag)
1692CFLAGS-ifuncmain1vispie.c += $(pie-ccflag)
3c30afc8
L
1693CFLAGS-ifuncmain1staticpie.c += $(pie-ccflag)
1694CFLAGS-ifuncmain5pie.c += $(pie-ccflag)
1695CFLAGS-ifuncmain6pie.c += $(pie-ccflag)
1696CFLAGS-ifuncmain7pie.c += $(pie-ccflag)
cc3e573c 1697CFLAGS-ifuncmain9pie.c += $(pie-ccflag)
b5c45e83 1698CFLAGS-tst-ifunc-textrel.c += $(pic-ccflag)
2f083d75 1699
7137d682
L
1700LDFLAGS-ifuncmain6pie = -Wl,-z,lazy
1701
da62f81b
AS
1702$(objpfx)ifuncmain1pie: $(objpfx)ifuncmod1.so
1703$(objpfx)ifuncmain1staticpie: $(objpfx)ifuncdep1pic.o
1704$(objpfx)ifuncmain1vispie: $(objpfx)ifuncmod1.so
1705$(objpfx)ifuncmain5pie: $(objpfx)ifuncmod5.so
1706$(objpfx)ifuncmain6pie: $(objpfx)ifuncmod6.so
2f083d75
L
1707
1708$(objpfx)ifuncmain1: $(addprefix $(objpfx),ifuncmod1.so)
1709$(objpfx)ifuncmain1pic: $(addprefix $(objpfx),ifuncmod1.so)
1710$(objpfx)ifuncmain1staticpic: $(addprefix $(objpfx),ifuncdep1pic.o)
1711$(objpfx)ifuncmain1static: $(addprefix $(objpfx),ifuncdep1.o)
1712$(objpfx)ifuncmain1picstatic: $(addprefix $(objpfx),ifuncdep1pic.o)
1713$(objpfx)ifuncmain1vis: $(addprefix $(objpfx),ifuncmod1.so)
1714$(objpfx)ifuncmain1vispic: $(addprefix $(objpfx),ifuncmod1.so)
1715$(objpfx)ifuncmain2: $(addprefix $(objpfx),ifuncdep2.o)
1716$(objpfx)ifuncmain2pic: $(addprefix $(objpfx),ifuncdep2pic.o)
1717$(objpfx)ifuncmain2static: $(addprefix $(objpfx),ifuncdep2.o)
1718$(objpfx)ifuncmain2picstatic: $(addprefix $(objpfx),ifuncdep2pic.o)
1719
2f083d75 1720$(objpfx)ifuncmain3.out: $(objpfx)ifuncmod3.so
3c30afc8
L
1721
1722$(objpfx)ifuncmain5: $(addprefix $(objpfx),ifuncmod5.so)
1723$(objpfx)ifuncmain5pic: $(addprefix $(objpfx),ifuncmod5.so)
1724$(objpfx)ifuncmain5static: $(addprefix $(objpfx),ifuncdep5.o)
1725$(objpfx)ifuncmain5staticpic: $(addprefix $(objpfx),ifuncdep5pic.o)
1726$(objpfx)ifuncmain5picstatic: $(addprefix $(objpfx),ifuncdep5pic.o)
415ac3df 1727
4db71d2f
FW
1728LDFLAGS-tst-ifunc-fault-lazy = -Wl,-z,lazy
1729LDFLAGS-tst-ifunc-fault-bindnow = -Wl,-z,now
1730define tst-ifunc-fault-script
00167b53
JM
1731( $(test-wrapper) $(rtld-prefix) --verify $^ \
1732 && $(test-wrapper-env) LD_TRACE_LOADED_OBJECTS=1 $(rtld-prefix) $^ \
1733 && $(test-wrapper-env) LD_TRACE_LOADED_OBJECTS=1 LD_DEBUG=unused \
1734 $(rtld-prefix) $^ \
4db71d2f
FW
1735) > $@; $(evaluate-test)
1736endef
1737$(objpfx)tst-ifunc-fault-lazy.out: $(objpfx)tst-ifunc-fault-lazy $(objpfx)ld.so
1738 $(tst-ifunc-fault-script)
1739$(objpfx)tst-ifunc-fault-bindnow.out: $(objpfx)tst-ifunc-fault-bindnow \
1740 $(objpfx)ld.so
1741 $(tst-ifunc-fault-script)
1742
415ac3df
UD
1743$(objpfx)tst-unique1.out: $(objpfx)tst-unique1mod1.so \
1744 $(objpfx)tst-unique1mod2.so
1745
6f1c7010 1746$(objpfx)tst-unique2: $(objpfx)tst-unique2mod1.so
415ac3df 1747$(objpfx)tst-unique2.out: $(objpfx)tst-unique2mod2.so
b0ecde3a 1748
6f1c7010 1749$(objpfx)tst-unique3: $(objpfx)tst-unique3lib.so
028478fa 1750$(objpfx)tst-unique3.out: $(objpfx)tst-unique3lib2.so
33f85a3f 1751
320a5dc0
PB
1752$(objpfx)tst-unique4: $(objpfx)tst-unique4lib.so
1753
02d5e5d9
PK
1754$(objpfx)tst-nodelete.out: $(objpfx)tst-nodelete-uniquemod.so \
1755 $(objpfx)tst-nodelete-rtldmod.so \
1756 $(objpfx)tst-nodelete-zmod.so
1757
1758LDFLAGS-tst-nodelete = -rdynamic
1759LDFLAGS-tst-nodelete-zmod.so = -Wl,--enable-new-dtags,-z,nodelete
1760
f25238ff
MO
1761$(objpfx)tst-nodelete2.out: $(objpfx)tst-nodelete2mod.so
1762
1763LDFLAGS-tst-nodelete2 = -rdynamic
1764
6e89caf1 1765$(objpfx)tst-initorder-cmp.out: tst-initorder.exp $(objpfx)tst-initorder.out
f0881698
JM
1766 cmp $^ > $@; \
1767 $(evaluate-test)
968dad0a 1768
e888bcbe
AS
1769$(objpfx)tst-initorder2: $(objpfx)tst-initorder2a.so $(objpfx)tst-initorder2d.so $(objpfx)tst-initorder2c.so
1770$(objpfx)tst-initorder2a.so: $(objpfx)tst-initorder2b.so
1771$(objpfx)tst-initorder2b.so: $(objpfx)tst-initorder2c.so
1772$(objpfx)tst-initorder2c.so: $(objpfx)tst-initorder2d.so
8b196ac4
FW
1773LDFLAGS-tst-initorder2 = -Wl,--no-as-needed
1774LDFLAGS-tst-initorder2a.so = -Wl,--no-as-needed
1775LDFLAGS-tst-initorder2b.so = -Wl,--no-as-needed
1776LDFLAGS-tst-initorder2c.so = -Wl,--no-as-needed
e888bcbe
AS
1777define o-iterator-doit
1778$(objpfx)tst-initorder2$o.os: tst-initorder2.c; \
1779$$(compile-command.c) -DNAME=\"$o\"
1780endef
1781object-suffixes-left := a b c d
1782include $(o-iterator)
1783
6e89caf1 1784$(objpfx)tst-initorder2-cmp.out: tst-initorder2.exp $(objpfx)tst-initorder2.out
f0881698
JM
1785 cmp $^ > $@; \
1786 $(evaluate-test)
e888bcbe 1787
6ee65ed6
UD
1788$(objpfx)tst-relsort1mod1.so: $(libm) $(objpfx)tst-relsort1mod2.so
1789$(objpfx)tst-relsort1mod2.so: $(libm)
1790$(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
1791 $(objpfx)tst-relsort1mod2.so
1f393a11 1792
1f393a11 1793$(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so
cc1290d0 1794 $(test-wrapper-env) \
1f393a11
MP
1795 LD_TRACE_LOADED_OBJECTS=1 \
1796 LD_DEBUG=unused \
1797 LD_PRELOAD= \
85d89278 1798 $(rtld-prefix) \
f0881698
JM
1799 $< > $@; \
1800 $(evaluate-test)
6e89caf1
JM
1801
1802$(objpfx)tst-unused-dep-cmp.out: $(objpfx)tst-unused-dep.out
f0881698
JM
1803 cmp $< /dev/null > $@; \
1804 $(evaluate-test)
a1b85ae8
FW
1805
1806$(objpfx)tst-audit11.out: $(objpfx)tst-auditmod11.so $(objpfx)tst-audit11mod1.so
a1b85ae8
FW
1807tst-audit11-ENV = LD_AUDIT=$(objpfx)tst-auditmod11.so
1808$(objpfx)tst-audit11mod1.so: $(objpfx)tst-audit11mod2.so
1809LDFLAGS-tst-audit11mod2.so = -Wl,--version-script=tst-audit11mod2.map,-soname,tst-audit11mod2.so
1810
1811$(objpfx)tst-audit12.out: $(objpfx)tst-auditmod12.so $(objpfx)tst-audit12mod1.so $(objpfx)tst-audit12mod3.so
a1b85ae8
FW
1812tst-audit12-ENV = LD_AUDIT=$(objpfx)tst-auditmod12.so
1813$(objpfx)tst-audit12mod1.so: $(objpfx)tst-audit12mod2.so
1814LDFLAGS-tst-audit12mod2.so = -Wl,--version-script=tst-audit12mod2.map
89569c8b 1815
b3fbfe81
AZ
1816$(objpfx)tst-audit13.out: $(objpfx)tst-audit13mod1.so
1817LDFLAGS-tst-audit13mod1.so = -Wl,-z,lazy
1818tst-audit13-ENV = LD_AUDIT=$(objpfx)tst-audit13mod1.so
1819
c7bf5cea
FW
1820$(objpfx)tst-auditmany.out: $(objpfx)tst-auditmanymod1.so \
1821 $(objpfx)tst-auditmanymod2.so $(objpfx)tst-auditmanymod3.so \
1822 $(objpfx)tst-auditmanymod4.so $(objpfx)tst-auditmanymod5.so \
1823 $(objpfx)tst-auditmanymod6.so $(objpfx)tst-auditmanymod7.so \
1824 $(objpfx)tst-auditmanymod8.so $(objpfx)tst-auditmanymod9.so
1825tst-auditmany-ENV = \
1826 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
1827
8f7a75d7
FW
1828LDFLAGS-tst-audit14 = -Wl,--audit=tst-auditlogmod-1.so
1829$(objpfx)tst-auditlogmod-1.so: $(libsupport)
1830$(objpfx)tst-audit14.out: $(objpfx)tst-auditlogmod-1.so
1831LDFLAGS-tst-audit15 = \
1832 -Wl,--audit=tst-auditlogmod-1.so,--depaudit=tst-auditlogmod-2.so
1833$(objpfx)tst-auditlogmod-2.so: $(libsupport)
1834$(objpfx)tst-audit15.out: \
1835 $(objpfx)tst-auditlogmod-1.so $(objpfx)tst-auditlogmod-2.so
1836LDFLAGS-tst-audit16 = \
1837 -Wl,--audit=tst-auditlogmod-1.so:tst-auditlogmod-2.so \
1838 -Wl,--depaudit=tst-auditlogmod-3.so
1839$(objpfx)tst-auditlogmod-3.so: $(libsupport)
1840$(objpfx)tst-audit16.out: \
1841 $(objpfx)tst-auditlogmod-1.so $(objpfx)tst-auditlogmod-2.so \
1842 $(objpfx)tst-auditlogmod-3.so
3908fa93
AZ
1843$(objpfx)tst-audit17.out: $(objpfx)tst-auditmod17.so
1844# The test check if a audit library without libc.so on DT_NEEDED works as
1845# intended, so it uses an explicit link rule.
1846$(objpfx)tst-auditmod17.so: $(objpfx)tst-auditmod17.os
1847 $(CC) -nostdlib -nostartfiles -shared -o $@.new \
1848 $(filter-out $(map-file),$^)
1849 $(call after-link,$@.new)
1850 mv -f $@.new $@
1851CFLAGS-.os += $(call elide-stack-protector,.os,tst-auditmod17)
1852tst-audit17-ENV = LD_AUDIT=$(objpfx)tst-auditmod17.so
8f7a75d7 1853
171ab1af
SH
1854$(objpfx)tst-audit14-cmp.out: tst-audit14.exp $(objpfx)tst-audit14.out
1855 cmp $^ > $@; \
1856 $(evaluate-test)
1857$(objpfx)tst-audit15-cmp.out: tst-audit15.exp $(objpfx)tst-audit15.out
1858 cmp $^ > $@; \
1859 $(evaluate-test)
1860$(objpfx)tst-audit16-cmp.out: tst-audit16.exp $(objpfx)tst-audit16.out
1861 cmp $^ > $@; \
1862 $(evaluate-test)
1863
ed3ce71f
AZ
1864$(objpfx)tst-audit18.out: $(objpfx)tst-auditmod18.so \
1865 $(objpfx)tst-audit18mod.so
1866tst-audit18-ARGS = -- $(host-test-program-cmd)
063f9ba2
AZ
1867
1868$(objpfx)tst-audit19a.out: $(objpfx)tst-auditmod19a.so
1869tst-audit19a-ENV = LD_AUDIT=$(objpfx)tst-auditmod19a.so
1870
1871$(objpfx)tst-audit19b.out: $(objpfx)tst-auditmod19b.so
1872$(objpfx)tst-audit19b: $(objpfx)tst-audit19bmod.so
1873tst-audit19b-ARGS = -- $(host-test-program-cmd)
f0e23d34 1874
484e672d
AZ
1875$(objpfx)tst-audit20.out: $(objpfx)tst-auditmod20.so
1876tst-audit20-ENV = LD_AUDIT=$(objpfx)tst-auditmod20.so
1877
f0e23d34
AZ
1878$(objpfx)tst-audit22.out: $(objpfx)tst-auditmod22.so
1879tst-audit22-ARGS = -- $(host-test-program-cmd)
ed3ce71f 1880
f0b2132b
FW
1881# tst-sonamemove links against an older implementation of the library.
1882LDFLAGS-tst-sonamemove-linkmod1.so = \
1883 -Wl,--version-script=tst-sonamemove-linkmod1.map \
1884 -Wl,-soname,tst-sonamemove-runmod1.so
1885LDFLAGS-tst-sonamemove-runmod1.so = -Wl,--no-as-needed \
1886 -Wl,--version-script=tst-sonamemove-runmod1.map \
1887 -Wl,-soname,tst-sonamemove-runmod1.so
1888LDFLAGS-tst-sonamemove-runmod2.so = \
1889 -Wl,--version-script=tst-sonamemove-runmod2.map \
1890 -Wl,-soname,tst-sonamemove-runmod2.so
1891$(objpfx)tst-sonamemove-runmod1.so: $(objpfx)tst-sonamemove-runmod2.so
1892# Link against the link module, but depend on the run-time modules
1893# for execution.
1894$(objpfx)tst-sonamemove-link: $(objpfx)tst-sonamemove-linkmod1.so
1895$(objpfx)tst-sonamemove-link.out: \
1896 $(objpfx)tst-sonamemove-runmod1.so \
1897 $(objpfx)tst-sonamemove-runmod2.so
f0b2132b
FW
1898$(objpfx)tst-sonamemove-dlopen.out: \
1899 $(objpfx)tst-sonamemove-runmod1.so \
1900 $(objpfx)tst-sonamemove-runmod2.so
1901
6f1c7010 1902$(objpfx)tst-dlmopen-dlerror-mod.so: $(libsupport)
b2964eb1
FW
1903$(objpfx)tst-dlmopen-dlerror.out: $(objpfx)tst-dlmopen-dlerror-mod.so
1904
9e78f6f6
FW
1905# Override -z defs, so that we can reference an undefined symbol.
1906# Force lazy binding for the same reason.
1907LDFLAGS-tst-latepthreadmod.so = \
1908 -Wl,-z,lazy -Wl,--unresolved-symbols=ignore-all
f91d3fd6
SL
1909# Do not optimize sibling calls as the test relies on a JMP_SLOT relocation for
1910# function this_function_is_not_defined.
36975e8e 1911CFLAGS-tst-latepthreadmod.c += -fno-optimize-sibling-calls
9e78f6f6 1912$(objpfx)tst-latepthreadmod.so: $(shared-thread-library)
9e78f6f6
FW
1913$(objpfx)tst-latepthread.out: $(objpfx)tst-latepthreadmod.so
1914
01b23a30
FW
1915# The test modules are parameterized by preprocessor macros.
1916$(patsubst %,$(objpfx)%.os,$(tst-tls-many-dynamic-modules)): \
1917 $(objpfx)tst-tls-manydynamic%mod.os : tst-tls-manydynamicmod.c
1918 $(compile-command.c) \
1919 -DNAME=tls_global_$* -DSETTER=set_value_$* -DGETTER=get_value_$*
6f1c7010 1920$(objpfx)tst-tls-manydynamic: $(shared-thread-library)
01b23a30
FW
1921$(objpfx)tst-tls-manydynamic.out: \
1922 $(patsubst %,$(objpfx)%.so,$(tst-tls-many-dynamic-modules))
1923
89569c8b
L
1924tst-prelink-ENV = LD_TRACE_PRELINKING=1
1925
1926$(objpfx)tst-prelink-conflict.out: $(objpfx)tst-prelink.out
1927 grep stdout $< | grep conflict | $(AWK) '{ print $$10, $$11 }' > $@
1928
01cdcf78 1929$(objpfx)tst-prelink-cmp.out: $(objpfx)tst-prelink-conflict.out
920b35c9
FW
1930
1931$(objpfx)tst-ldconfig-X.out : tst-ldconfig-X.sh $(objpfx)ldconfig
d4d629e6
JM
1932 $(SHELL) $< '$(common-objpfx)' '$(test-wrapper-env)' \
1933 '$(run-program-env)' > $@; \
920b35c9 1934 $(evaluate-test)
7d45c163 1935
84aa7516
CD
1936# Test static linking of all the libraries we can possibly link
1937# together. Note that in some configurations this may be less than the
1938# complete list of libraries we build but we try to maxmimize this list.
7ac2bee4
ST
1939ifeq ($(pthread-in-libc),no)
1940$(objpfx)tst-linkall-static: \
1941 $(common-objpfx)resolv/libanl.a
1942endif
a0f83f0b
FW
1943$(objpfx)tst-linkall-static: \
1944 $(common-objpfx)math/libm.a \
a0f83f0b 1945 $(common-objpfx)resolv/libresolv.a \
a0f83f0b
FW
1946 $(common-objpfx)login/libutil.a \
1947 $(common-objpfx)rt/librt.a \
84aa7516
CD
1948 $(static-thread-library)
1949
e69d994a 1950ifeq ($(build-crypt),yes)
84aa7516
CD
1951# If we are using NSS crypto and we have the ability to link statically
1952# then we include libcrypt.a, otherwise we leave out libcrypt.a and
1953# link as much as we can into the tst-linkall-static test. This assumes
1954# that linking with libcrypt.a does everything required to include the
1955# static NSS crypto library.
1956ifeq (yesyes,$(nss-crypt)$(static-nss-crypt))
1957$(objpfx)tst-linkall-static: \
1958 $(common-objpfx)crypt/libcrypt.a
1959endif
1960# If we are not using NSS crypto then we always have the ability to link
1961# with libcrypt.a.
1962ifeq (no,$(nss-crypt))
1963$(objpfx)tst-linkall-static: \
1964 $(common-objpfx)crypt/libcrypt.a
1965endif
e69d994a 1966endif
57707b7f
CD
1967
1968# The application depends on the DSO, and the DSO loads the plugin.
1969# The plugin also depends on the DSO. This creates the circular
1970# dependency via dlopen that we're testing to make sure works.
57707b7f
CD
1971$(objpfx)tst-nodelete-dlclose-plugin.so: $(objpfx)tst-nodelete-dlclose-dso.so
1972$(objpfx)tst-nodelete-dlclose: $(objpfx)tst-nodelete-dlclose-dso.so
1973$(objpfx)tst-nodelete-dlclose.out: $(objpfx)tst-nodelete-dlclose-dso.so \
1974 $(objpfx)tst-nodelete-dlclose-plugin.so
8b9e9c3c 1975
1c1243b6 1976tst-env-setuid-ENV = MALLOC_CHECK_=2 MALLOC_MMAP_THRESHOLD_=4096 \
ce79740b 1977 LD_HWCAP_MASK=0x1
592d5c75 1978
592d5c75
L
1979$(objpfx)tst-debug1.out: $(objpfx)tst-debug1mod1.so
1980
1981$(objpfx)tst-debug1mod1.so: $(objpfx)testobj1.so
1982 $(OBJCOPY) --only-keep-debug $< $@
5dba84b3
L
1983
1984$(objpfx)tst-main1: $(objpfx)tst-main1mod.so
1985CRT-tst-main1 := $(csu-objpfx)crt1.o
ce16eb52 1986tst-main1-no-pie = yes
5dba84b3
L
1987LDLIBS-tst-main1 = $(libsupport)
1988tst-main1mod.so-no-z-defs = yes
82eef55f 1989
e7feec37
MR
1990LDLIBS-tst-absolute-sym-lib.so = tst-absolute-sym-lib.lds
1991$(objpfx)tst-absolute-sym-lib.so: $(LDLIBS-tst-absolute-sym-lib.so)
1992$(objpfx)tst-absolute-sym: $(objpfx)tst-absolute-sym-lib.so
1993
bac15a72
MR
1994LDLIBS-tst-absolute-zero-lib.so = tst-absolute-zero-lib.lds
1995$(objpfx)tst-absolute-zero-lib.so: $(LDLIBS-tst-absolute-zero-lib.so)
1996$(objpfx)tst-absolute-zero: $(objpfx)tst-absolute-zero-lib.so
1997
0065aaaa 1998$(objpfx)tst-big-note: $(objpfx)tst-big-note-lib.so
c259196b
FW
1999# Avoid creating an ABI tag note, which may come before the
2000# artificial, large note in tst-big-note-lib.o and invalidate the
2001# test.
2002$(objpfx)tst-big-note-lib.so: $(objpfx)tst-big-note-lib.o
2003 $(LINK.o) -shared -o $@ $(LDFLAGS.so) $<
6ca8284e
AS
2004
2005$(objpfx)tst-unwind-ctor: $(objpfx)tst-unwind-ctor-lib.so
2dd12baa 2006
85bd1ddb 2007CFLAGS-tst-unwind-main.c += -funwind-tables -DUSE_PTHREADS=0
79e0cd7b 2008
79e0cd7b
FW
2009$(objpfx)tst-initfinilazyfail.out: \
2010 $(objpfx)tst-initlazyfailmod.so $(objpfx)tst-finilazyfailmod.so
2011# Override -z defs, so that we can reference an undefined symbol.
2012# Force lazy binding for the same reason.
2013LDFLAGS-tst-initlazyfailmod.so = \
2014 -Wl,-z,lazy -Wl,--unresolved-symbols=ignore-all
2015LDFLAGS-tst-finilazyfailmod.so = \
2016 -Wl,-z,lazy -Wl,--unresolved-symbols=ignore-all
f63b7381 2017
f63b7381
FW
2018$(objpfx)tst-dlopenfail.out: \
2019 $(objpfx)tst-dlopenfailmod1.so $(objpfx)tst-dlopenfailmod2.so
61a7c9df
FW
2020# Order matters here. tst-dlopenfaillinkmod.so's soname ensures a
2021# run-time loader failure. --as-needed breaks this test because
2022# nothing actually references tst-dlopenfailmod2.so (with its soname
2023# tst-dlopenfail-missingmod.so).
2024LDFLAGS-tst-dlopenfailmod1.so = -Wl,--no-as-needed
f63b7381
FW
2025$(objpfx)tst-dlopenfailmod1.so: \
2026 $(shared-thread-library) $(objpfx)tst-dlopenfaillinkmod.so
2027LDFLAGS-tst-dlopenfaillinkmod.so = -Wl,-soname,tst-dlopenfail-missingmod.so
7862ff8e 2028$(objpfx)tst-dlopenfailmod2.so: $(objpfx)tst-dlopenfailnodelmod.so
1bb8d05b 2029$(objpfx)tst-dlopenfail-2.out: \
a332bd15
FW
2030 $(objpfx)tst-dlopenfailmod1.so $(objpfx)tst-dlopenfailmod2.so \
2031 $(objpfx)tst-dlopenfailmod3.so
7862ff8e
FW
2032# tst-dlopenfailnodelmod.so emulates how libpthread was linked.
2033$(objpfx)tst-dlopenfailnodelmod.so: $(libsupport)
2034LDFLAGS-tst-dlopenfailnodelmod.so = \
2035 -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
2036# tst-dlopenfail should export the libsupport symbols, so that
2037# tst-dlopenfailnodelmod.so uses them for error reporting.
2038LDFLAGS-tst-dlopenfail = -Wl,-E
365624e2 2039
365624e2
FW
2040$(objpfx)tst-dlopen-nodelete-reloc.out: \
2041 $(objpfx)tst-dlopen-nodelete-reloc-mod1.so \
2042 $(objpfx)tst-dlopen-nodelete-reloc-mod2.so \
2043 $(objpfx)tst-dlopen-nodelete-reloc-mod3.so \
2044 $(objpfx)tst-dlopen-nodelete-reloc-mod4.so \
2045 $(objpfx)tst-dlopen-nodelete-reloc-mod5.so \
2046 $(objpfx)tst-dlopen-nodelete-reloc-mod6.so \
2047 $(objpfx)tst-dlopen-nodelete-reloc-mod7.so \
2048 $(objpfx)tst-dlopen-nodelete-reloc-mod8.so \
2049 $(objpfx)tst-dlopen-nodelete-reloc-mod9.so \
2050 $(objpfx)tst-dlopen-nodelete-reloc-mod10.so \
2051 $(objpfx)tst-dlopen-nodelete-reloc-mod11.so \
2052 $(objpfx)tst-dlopen-nodelete-reloc-mod12.so \
2053 $(objpfx)tst-dlopen-nodelete-reloc-mod13.so \
2054 $(objpfx)tst-dlopen-nodelete-reloc-mod14.so \
2055 $(objpfx)tst-dlopen-nodelete-reloc-mod15.so \
2056 $(objpfx)tst-dlopen-nodelete-reloc-mod16.so \
2057 $(objpfx)tst-dlopen-nodelete-reloc-mod17.so
2058tst-dlopen-nodelete-reloc-mod2.so-no-z-defs = yes
2059LDFLAGS-tst-dlopen-nodelete-reloc-mod2.so = -Wl,-z,nodelete
2060$(objpfx)tst-dlopen-nodelete-reloc-mod4.so: \
2061 $(objpfx)tst-dlopen-nodelete-reloc-mod3.so
2062LDFLAGS-tst-dlopen-nodelete-reloc-mod4.so = -Wl,--no-as-needed
2063$(objpfx)tst-dlopen-nodelete-reloc-mod5.so: \
2064 $(objpfx)tst-dlopen-nodelete-reloc-mod4.so
2065LDFLAGS-tst-dlopen-nodelete-reloc-mod5.so = -Wl,-z,nodelete,--no-as-needed
2066tst-dlopen-nodelete-reloc-mod5.so-no-z-defs = yes
2067tst-dlopen-nodelete-reloc-mod7.so-no-z-defs = yes
365624e2
FW
2068tst-dlopen-nodelete-reloc-mod11.so-no-z-defs = yes
2069$(objpfx)tst-dlopen-nodelete-reloc-mod13.so: \
2070 $(objpfx)tst-dlopen-nodelete-reloc-mod12.so
2071$(objpfx)tst-dlopen-nodelete-reloc-mod15.so: \
2072 $(objpfx)tst-dlopen-nodelete-reloc-mod14.so
2073tst-dlopen-nodelete-reloc-mod16.so-no-z-defs = yes
2074$(objpfx)tst-dlopen-nodelete-reloc-mod16.so: \
2075 $(objpfx)tst-dlopen-nodelete-reloc-mod15.so
2076LDFLAGS-tst-dlopen-nodelete-reloc-mod16.so = -Wl,--no-as-needed
2077$(objpfx)tst-dlopen-nodelete-reloc-mod17.so: \
2078 $(objpfx)tst-dlopen-nodelete-reloc-mod15.so \
2079 $(objpfx)tst-dlopen-nodelete-reloc-mod16.so
2080LDFLAGS-tst-dlopen-nodelete-reloc-mod17.so = -Wl,--no-as-needed
591236f1
AH
2081
2082$(objpfx)tst-ldconfig-ld_so_conf-update.out: $(objpfx)tst-ldconfig-ld-mod.so
eb447b7b
DK
2083
2084LDFLAGS-tst-filterobj-flt.so = -Wl,--filter=$(objpfx)tst-filterobj-filtee.so
2085$(objpfx)tst-filterobj: $(objpfx)tst-filterobj-flt.so
eb447b7b
DK
2086$(objpfx)tst-filterobj.out: $(objpfx)tst-filterobj-filtee.so
2087$(objpfx)tst-filterobj-dlopen.out: $(objpfx)tst-filterobj-filtee.so
2088
2089LDFLAGS-tst-filterobj-aux.so = -Wl,--auxiliary=$(objpfx)tst-filterobj-filtee.so
2090$(objpfx)tst-auxobj: $(objpfx)tst-filterobj-aux.so
eb447b7b
DK
2091$(objpfx)tst-auxobj.out: $(objpfx)tst-filterobj-filtee.so
2092$(objpfx)tst-auxobj-dlopen.out: $(objpfx)tst-filterobj-filtee.so
706ad1e7 2093
6f1c7010 2094$(objpfx)tst-single_threaded: $(objpfx)tst-single_threaded-mod1.so
706ad1e7
FW
2095$(objpfx)tst-single_threaded.out: \
2096 $(objpfx)tst-single_threaded-mod2.so $(objpfx)tst-single_threaded-mod3.so
2097$(objpfx)tst-single_threaded-static-dlopen: \
69936179 2098 $(objpfx)tst-single_threaded-mod1.o
706ad1e7
FW
2099$(objpfx)tst-single_threaded-static-dlopen.out: \
2100 $(objpfx)tst-single_threaded-mod2.so
2101$(objpfx)tst-single_threaded-pthread: \
6f1c7010 2102 $(objpfx)tst-single_threaded-mod1.so $(shared-thread-library)
706ad1e7
FW
2103$(objpfx)tst-single_threaded-pthread.out: \
2104 $(objpfx)tst-single_threaded-mod2.so $(objpfx)tst-single_threaded-mod3.so \
2105 $(objpfx)tst-single_threaded-mod4.so
2106$(objpfx)tst-single_threaded-pthread-static: $(static-thread-library)
ffb17e7b 2107
6f1c7010 2108$(objpfx)tst-tls-ie: $(shared-thread-library)
ffb17e7b
SN
2109$(objpfx)tst-tls-ie.out: \
2110 $(objpfx)tst-tls-ie-mod0.so \
2111 $(objpfx)tst-tls-ie-mod1.so \
2112 $(objpfx)tst-tls-ie-mod2.so \
2113 $(objpfx)tst-tls-ie-mod3.so \
2114 $(objpfx)tst-tls-ie-mod4.so \
2115 $(objpfx)tst-tls-ie-mod5.so \
2116 $(objpfx)tst-tls-ie-mod6.so
2117
6f1c7010 2118$(objpfx)tst-tls-ie-dlmopen: $(shared-thread-library)
ffb17e7b
SN
2119$(objpfx)tst-tls-ie-dlmopen.out: \
2120 $(objpfx)tst-tls-ie-mod0.so \
2121 $(objpfx)tst-tls-ie-mod1.so \
2122 $(objpfx)tst-tls-ie-mod2.so \
2123 $(objpfx)tst-tls-ie-mod3.so \
2124 $(objpfx)tst-tls-ie-mod4.so \
2125 $(objpfx)tst-tls-ie-mod5.so \
2126 $(objpfx)tst-tls-ie-mod6.so
07ed32f9 2127
c6702789
VM
2128$(objpfx)argv0test.out: tst-rtld-argv0.sh $(objpfx)ld.so \
2129 $(objpfx)argv0test
2130 $(SHELL) $< $(objpfx)ld.so $(objpfx)argv0test \
2131 '$(test-wrapper-env)' '$(run_program_env)' \
2132 '$(rpath-link)' 'test-argv0' > $@; \
2133 $(evaluate-test)
dad90d52
FW
2134
2135# A list containing the name of the most likely searched subdirectory
2136# of the glibc-hwcaps directory, for each supported architecture (in
2137# other words, the oldest hardware level recognized by the
2138# glibc-hwcaps mechanism for this architecture). Used to obtain test
2139# coverage for some glibc-hwcaps tests for the widest possible range
2140# of systems.
fdf8fbca 2141glibc-hwcaps-first-subdirs-for-tests = power9 x86-64-v2 z13
dad90d52
FW
2142
2143# The test modules are parameterized by preprocessor macros.
2144LDFLAGS-libmarkermod1-1.so += -Wl,-soname,libmarkermod1.so
2145LDFLAGS-libmarkermod2-1.so += -Wl,-soname,libmarkermod2.so
2146LDFLAGS-libmarkermod3-1.so += -Wl,-soname,libmarkermod3.so
2147LDFLAGS-libmarkermod4-1.so += -Wl,-soname,libmarkermod4.so
2148$(objpfx)libmarkermod%.os : markermodMARKER-VALUE.c
2149 $(compile-command.c) \
2150 -DMARKER=marker$(firstword $(subst -, ,$*)) \
2151 -DVALUE=$(lastword $(subst -, ,$*))
2152$(objpfx)libmarkermod1.so: $(objpfx)libmarkermod1-1.so
2153 cp $< $@
2154$(objpfx)libmarkermod2.so: $(objpfx)libmarkermod2-1.so
2155 cp $< $@
2156$(objpfx)libmarkermod3.so: $(objpfx)libmarkermod3-1.so
2157 cp $< $@
2158$(objpfx)libmarkermod4.so: $(objpfx)libmarkermod4-1.so
2159 cp $< $@
2160
2161# tst-glibc-hwcaps-prepend checks that --glibc-hwcaps-prepend is
2162# preferred over auto-detected subdirectories.
2163$(objpfx)tst-glibc-hwcaps-prepend: $(objpfx)libmarkermod1-1.so
2164$(objpfx)glibc-hwcaps/prepend-markermod1/libmarkermod1.so: \
2165 $(objpfx)libmarkermod1-2.so
2166 $(make-target-directory)
2167 cp $< $@
2168$(objpfx)glibc-hwcaps/%/libmarkermod1.so: $(objpfx)libmarkermod1-3.so
2169 $(make-target-directory)
2170 cp $< $@
2171$(objpfx)tst-glibc-hwcaps-prepend.out: \
2172 $(objpfx)tst-glibc-hwcaps-prepend $(objpfx)libmarkermod1.so \
2173 $(patsubst %,$(objpfx)glibc-hwcaps/%/libmarkermod1.so,prepend-markermod1 \
2174 $(glibc-hwcaps-first-subdirs-for-tests))
2175 $(test-wrapper) $(rtld-prefix) \
2176 --glibc-hwcaps-prepend prepend-markermod1 \
2177 $< > $@; \
2178 $(evaluate-test)
2179
600d9e0c
FW
2180# Like tst-glibc-hwcaps-prepend, but uses a container and loads the
2181# library via ld.so.cache. Test setup is contained in the test
2182# itself.
600d9e0c
FW
2183$(objpfx)tst-glibc-hwcaps-prepend-cache.out: \
2184 $(objpfx)tst-glibc-hwcaps-prepend-cache $(objpfx)libmarkermod1-1.so \
2185 $(objpfx)libmarkermod1-2.so $(objpfx)libmarkermod1-3.so
2186
dad90d52
FW
2187# tst-glibc-hwcaps-mask checks that --glibc-hwcaps-mask can be used to
2188# suppress all auto-detected subdirectories.
2189$(objpfx)tst-glibc-hwcaps-mask: $(objpfx)libmarkermod1-1.so
2190$(objpfx)tst-glibc-hwcaps-mask.out: \
2191 $(objpfx)tst-glibc-hwcaps-mask $(objpfx)libmarkermod1.so \
2192 $(patsubst %,$(objpfx)glibc-hwcaps/%/libmarkermod1.so,\
2193 $(glibc-hwcaps-first-subdirs-for-tests))
2194 $(test-wrapper) $(rtld-prefix) \
2195 --glibc-hwcaps-mask does-not-exist \
2196 $< > $@; \
2197 $(evaluate-test)
600d9e0c
FW
2198
2199# Generic dependency for sysdeps implementation of
2200# tst-glibc-hwcaps-cache.
2201$(objpfx)tst-glibc-hwcaps-cache.out: $(objpfx)tst-glibc-hwcaps
86f65dff
L
2202
2203$(objpfx)list-tunables.out: tst-rtld-list-tunables.sh $(objpfx)ld.so
2204 $(SHELL) $< $(objpfx)ld.so '$(test-wrapper-env)' \
2205 '$(run_program_env)' > $(objpfx)/tst-rtld-list-tunables.out
2206 cmp tst-rtld-list-tunables.exp \
2207 $(objpfx)/tst-rtld-list-tunables.out > $@; \
2208 $(evaluate-test)
33242131
CD
2209
2210tst-dst-static-ENV = LD_LIBRARY_PATH='$$ORIGIN'
4e6db99c
FW
2211
2212$(objpfx)tst-rtld-help.out: $(objpfx)ld.so
2213 $(test-wrapper) $(rtld-prefix) --help > $@; \
2214 status=$$?; \
2215 echo "info: ld.so exit status: $$status" >> $@; \
2216 if ! grep -q 'Legacy HWCAP subdirectories under library search path directories' $@; then \
2217 echo "error: missing subdirectory pattern" >> $@; \
2218 if test $$status -eq 0; then \
2219 status=1; \
2220 fi; \
2221 fi; \
2222 (exit $$status); \
2223 $(evaluate-test)
8f85075a
SN
2224
2225# Reuses tst-tls-many-dynamic-modules
ba33937b
AZ
2226$(patsubst %,$(objpfx)%.os,$(tst-tls-many-dynamic-modules-dep)): \
2227 $(objpfx)tst-tls-manydynamic%mod-dep.os : tst-tls-manydynamicmod.c
2228 $(compile-command.c) \
2229 -DNAME=tls_global_$* -DSETTER=set_value_$* -DGETTER=get_value_$*
2230$(patsubst %,$(objpfx)%.os,$(tst-tls-many-dynamic-modules-dep-bad)): \
2231 $(objpfx)tst-tls-manydynamic%mod-dep-bad.os : tst-tls-manydynamicmod.c
2232 $(compile-command.c) \
2233 -DNAME=tls_global_$* -DSETTER=set_value_$* -DGETTER=get_value_$*
8f85075a 2234tst-tls20mod-bad.so-no-z-defs = yes
ba33937b
AZ
2235# Single dependency.
2236$(objpfx)tst-tls-manydynamic0mod-dep.so: $(objpfx)tst-tls-manydynamic1mod-dep.so
2237# Double dependencies.
2238$(objpfx)tst-tls-manydynamic2mod-dep.so: $(objpfx)tst-tls-manydynamic3mod-dep.so \
2239 $(objpfx)tst-tls-manydynamic4mod-dep.so
2240# Double dependencies with each dependency depent of another module.
2241$(objpfx)tst-tls-manydynamic5mod-dep.so: $(objpfx)tst-tls-manydynamic6mod-dep.so \
2242 $(objpfx)tst-tls-manydynamic7mod-dep.so
2243$(objpfx)tst-tls-manydynamic6mod-dep.so: $(objpfx)tst-tls-manydynamic8mod-dep.so
2244$(objpfx)tst-tls-manydynamic7mod-dep.so: $(objpfx)tst-tls-manydynamic8mod-dep.so
2245# Long chain with one double dependency in the middle
2246$(objpfx)tst-tls-manydynamic9mod-dep.so: $(objpfx)tst-tls-manydynamic10mod-dep.so \
2247 $(objpfx)tst-tls-manydynamic11mod-dep.so
2248$(objpfx)tst-tls-manydynamic10mod-dep.so: $(objpfx)tst-tls-manydynamic12mod-dep.so
2249$(objpfx)tst-tls-manydynamic12mod-dep.so: $(objpfx)tst-tls-manydynamic13mod-dep.so
2250# Long chain with two double depedencies in the middle
2251$(objpfx)tst-tls-manydynamic14mod-dep.so: $(objpfx)tst-tls-manydynamic15mod-dep.so
2252$(objpfx)tst-tls-manydynamic15mod-dep.so: $(objpfx)tst-tls-manydynamic16mod-dep.so \
2253 $(objpfx)tst-tls-manydynamic17mod-dep.so
2254$(objpfx)tst-tls-manydynamic16mod-dep.so: $(objpfx)tst-tls-manydynamic18mod-dep.so \
2255 $(objpfx)tst-tls-manydynamic19mod-dep.so
2256# Same but with an invalid module.
2257# Single dependency.
2258$(objpfx)tst-tls-manydynamic0mod-dep-bad.so: $(objpfx)tst-tls20mod-bad.so
3a0253ac 2259LDFLAGS-tst-tls-manydynamic0mod-dep-bad.so = -Wl,--no-as-needed
ba33937b
AZ
2260# Double dependencies.
2261$(objpfx)tst-tls-manydynamic1mod-dep-bad.so: $(objpfx)tst-tls-manydynamic2mod-dep-bad.so \
2262 $(objpfx)tst-tls20mod-bad.so
3a0253ac 2263LDFLAGS-tst-tls-manydynamic1mod-dep-bad.so = -Wl,--no-as-needed
ba33937b
AZ
2264# Double dependencies with each dependency depent of another module.
2265$(objpfx)tst-tls-manydynamic3mod-dep-bad.so: $(objpfx)tst-tls-manydynamic4mod-dep-bad.so \
2266 $(objpfx)tst-tls-manydynamic5mod-dep-bad.so
3a0253ac 2267LDFLAGS-tst-tls-manydynamic3mod-dep-bad.so = -Wl,--no-as-needed
ba33937b 2268$(objpfx)tst-tls-manydynamic4mod-dep-bad.so: $(objpfx)tst-tls20mod-bad.so
3a0253ac 2269LDFLAGS-tst-tls-manydynamic4mod-dep-bad.so = -Wl,--no-as-needed
ba33937b 2270$(objpfx)tst-tls-manydynamic5mod-dep-bad.so: $(objpfx)tst-tls20mod-bad.so
3a0253ac 2271LDFLAGS-tst-tls-manydynamic5mod-dep-bad.so = -Wl,--no-as-needed
ba33937b
AZ
2272# Long chain with one double dependency in the middle
2273$(objpfx)tst-tls-manydynamic6mod-dep-bad.so: $(objpfx)tst-tls-manydynamic7mod-dep-bad.so \
2274 $(objpfx)tst-tls-manydynamic8mod-dep-bad.so
3a0253ac 2275LDFLAGS-tst-tls-manydynamic6mod-dep-bad.so = -Wl,--no-as-needed
ba33937b 2276$(objpfx)tst-tls-manydynamic7mod-dep-bad.so: $(objpfx)tst-tls-manydynamic9mod-dep-bad.so
3a0253ac 2277LDFLAGS-tst-tls-manydynamic7mod-dep-bad.so = -Wl,--no-as-needed
ba33937b 2278$(objpfx)tst-tls-manydynamic9mod-dep-bad.so: $(objpfx)tst-tls20mod-bad.so
3a0253ac 2279LDFLAGS-tst-tls-manydynamic9mod-dep-bad.so = -Wl,--no-as-needed
ba33937b
AZ
2280# Long chain with two double depedencies in the middle
2281$(objpfx)tst-tls-manydynamic10mod-dep-bad.so: $(objpfx)tst-tls-manydynamic11mod-dep-bad.so
3a0253ac 2282LDFLAGS-tst-tls-manydynamic10mod-dep-bad.so = -Wl,--no-as-needed
ba33937b
AZ
2283$(objpfx)tst-tls-manydynamic11mod-dep-bad.so: $(objpfx)tst-tls-manydynamic12mod-dep-bad.so \
2284 $(objpfx)tst-tls-manydynamic13mod-dep-bad.so
3a0253ac 2285LDFLAGS-tst-tls-manydynamic11mod-dep-bad.so = -Wl,--no-as-needed
ba33937b
AZ
2286$(objpfx)tst-tls-manydynamic12mod-dep-bad.so: $(objpfx)tst-tls-manydynamic14mod-dep-bad.so \
2287 $(objpfx)tst-tls20mod-bad.so
3a0253ac 2288LDFLAGS-tst-tls-manydynamic12mod-dep-bad.so = -Wl,--no-as-needed
6f1c7010 2289$(objpfx)tst-tls20: $(shared-thread-library)
8f85075a 2290$(objpfx)tst-tls20.out: $(objpfx)tst-tls20mod-bad.so \
ba33937b
AZ
2291 $(tst-tls-many-dynamic-modules:%=$(objpfx)%.so) \
2292 $(tst-tls-many-dynamic-modules-dep:%=$(objpfx)%.so) \
2293 $(tst-tls-many-dynamic-modules-dep-bad:%=$(objpfx)%.so) \
9d0e3032
SN
2294
2295# Reuses tst-tls-many-dynamic-modules
6f1c7010 2296$(objpfx)tst-tls21: $(shared-thread-library)
9d0e3032
SN
2297$(objpfx)tst-tls21.out: $(objpfx)tst-tls21mod.so
2298$(objpfx)tst-tls21mod.so: $(tst-tls-many-dynamic-modules:%=$(objpfx)%.so)
78b31cc8 2299
78b31cc8
FW
2300$(objpfx)tst-getauxval-static.out: $(objpfx)tst-auxvalmod.so
2301tst-getauxval-static-ENV = LD_LIBRARY_PATH=$(objpfx):$(common-objpfx)
c2059edc
FW
2302
2303$(objpfx)tst-dlmopen-gethostbyname.out: $(objpfx)tst-dlmopen-gethostbyname-mod.so
b413280c
L
2304
2305$(objpfx)tst-ro-dynamic: $(objpfx)tst-ro-dynamic-mod.so
2306$(objpfx)tst-ro-dynamic-mod.so: $(objpfx)tst-ro-dynamic-mod.os \
2307 tst-ro-dynamic-mod.map
2308 $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
2309 -Wl,--script=tst-ro-dynamic-mod.map \
2310 $(objpfx)tst-ro-dynamic-mod.os
c1cb2dee
FW
2311
2312$(objpfx)tst-rtld-run-static.out: $(objpfx)/ldconfig
5d28a896
FW
2313
2314$(objpfx)tst-dl_find_object.out: \
2315 $(objpfx)tst-dl_find_object-mod1.so $(objpfx)tst-dl_find_object-mod2.so
2316$(objpfx)tst-dl_find_object-static.out: \
2317 $(objpfx)tst-dl_find_object-mod1.so $(objpfx)tst-dl_find_object-mod2.so
2318tst-dl_find_object-static-ENV = $(static-dlopen-environment)
2319CFLAGS-tst-dl_find_object.c += -funwind-tables
2320CFLAGS-tst-dl_find_object-static.c += -funwind-tables
2321LDFLAGS-tst-dl_find_object-static += -Wl,--eh-frame-hdr
2322CFLAGS-tst-dl_find_object-mod1.c += -funwind-tables
2323CFLAGS-tst-dl_find_object-mod2.c += -funwind-tables
2324LDFLAGS-tst-dl_find_object-mod2.so += -Wl,--enable-new-dtags,-z,nodelete
2325$(objpfx)tst-dl_find_object-threads: $(shared-thread-library)
2326CFLAGS-tst-dl_find_object-threads.c += -funwind-tables
2327$(objpfx)tst-dl_find_object-threads.out: \
2328 $(objpfx)tst-dl_find_object-mod1.so \
2329 $(objpfx)tst-dl_find_object-mod2.so \
2330 $(objpfx)tst-dl_find_object-mod3.so \
2331 $(objpfx)tst-dl_find_object-mod4.so \
2332 $(objpfx)tst-dl_find_object-mod5.so \
2333 $(objpfx)tst-dl_find_object-mod6.so \
2334 $(objpfx)tst-dl_find_object-mod7.so \
2335 $(objpfx)tst-dl_find_object-mod8.so \
2336 $(objpfx)tst-dl_find_object-mod9.so
2337CFLAGS-tst-dl_find_object-mod3.c += -funwind-tables
2338CFLAGS-tst-dl_find_object-mod4.c += -funwind-tables
2339CFLAGS-tst-dl_find_object-mod5.c += -funwind-tables
2340CFLAGS-tst-dl_find_object-mod6.c += -funwind-tables
2341CFLAGS-tst-dl_find_object-mod7.c += -funwind-tables
2342CFLAGS-tst-dl_find_object-mod8.c += -funwind-tables
2343CFLAGS-tst-dl_find_object-mod9.c += -funwind-tables