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