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