Fix failing nss/tst-nss-files-hosts-long with local resolver
[glibc.git] / elf / Makefile
blob9f3fadc37e81dce216892b913d5d81d3c02bcc97
1 # Copyright (C) 1995-2021 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, see
16 # <https://www.gnu.org/licenses/>.
18 # Makefile for elf subdirectory of GNU C Library.
20 subdir := elf
22 include ../Makeconfig
24 headers = elf.h bits/elfclass.h link.h bits/link.h
25 routines = $(all-dl-routines) dl-support dl-iteratephdr \
26 dl-addr dl-addr-obj enbl-secure dl-profstub \
27 dl-origin dl-libc dl-sym dl-sysdep dl-error \
28 dl-reloc-static-pie libc_early_init rtld_static_init
30 # The core dynamic linking functions are in libc for the static and
31 # profiled libraries.
32 dl-routines = $(addprefix dl-,load lookup object reloc deps \
33 runtime init fini debug misc \
34 version profile tls origin scope \
35 execstack open close trampoline \
36 exception sort-maps lookup-direct \
37 call-libc-early-init write \
38 thread_gscope_wait tls_init_tp)
39 ifeq (yes,$(use-ldconfig))
40 dl-routines += dl-cache
41 endif
43 ifneq (no,$(have-tunables))
44 dl-routines += dl-tunables
45 tunables-type = $(addprefix TUNABLES_FRONTEND_,$(have-tunables))
46 CPPFLAGS-dl-tunables.c += -DTUNABLES_FRONTEND=$(tunables-type)
48 ifeq (yesyes,$(build-shared)$(run-built-tests))
49 tests-special += $(objpfx)list-tunables.out
50 endif
52 # Make sure that the compiler does not insert any library calls in tunables
53 # code paths.
54 ifeq (yes,$(have-loop-to-function))
55 CFLAGS-dl-tunables.c += -fno-tree-loop-distribute-patterns
56 endif
57 endif
59 all-dl-routines = $(dl-routines) $(sysdep-dl-routines)
60 # But they are absent from the shared libc, because that code is in ld.so.
61 elide-routines.os = $(all-dl-routines) dl-support enbl-secure dl-origin \
62 dl-sysdep dl-exception dl-reloc-static-pie \
63 thread_gscope_wait rtld_static_init
65 # ld.so uses those routines, plus some special stuff for being the program
66 # interpreter and operating independent of libc.
67 rtld-routines = rtld $(all-dl-routines) dl-sysdep dl-environ dl-minimal \
68 dl-error-minimal dl-conflict dl-hwcaps dl-hwcaps_split dl-hwcaps-subdirs \
69 dl-usage dl-diagnostics dl-diagnostics-kernel dl-diagnostics-cpu \
70 dl-mutex
71 all-rtld-routines = $(rtld-routines) $(sysdep-rtld-routines)
73 CFLAGS-dl-runtime.c += -fexceptions -fasynchronous-unwind-tables
74 CFLAGS-dl-lookup.c += -fexceptions -fasynchronous-unwind-tables
75 CFLAGS-dl-iteratephdr.c += $(uses-callbacks)
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.
79 ifeq (yes,$(have-loop-to-function))
80 CFLAGS-rtld.c += -fno-tree-loop-distribute-patterns
81 endif
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.
87 CFLAGS-.o += $(call elide-stack-protector,.o,$(elide-routines.os))
88 CFLAGS-.op += $(call elide-stack-protector,.op,$(elide-routines.os))
89 CFLAGS-.os += $(call elide-stack-protector,.os,$(all-rtld-routines))
91 ifeq ($(unwind-find-fde),yes)
92 routines += unwind-dw2-fde-glibc
93 shared-only-routines += unwind-dw2-fde-glibc
94 endif
96 before-compile += $(objpfx)trusted-dirs.h
97 generated += trusted-dirs.h trusted-dirs.st for-renamed/renamed.so
98 generated-dirs += for-renamed
100 ifeq ($(build-shared),yes)
101 ld-map = $(common-objpfx)ld.map
102 endif
104 ifeq (yes,$(build-shared))
105 extra-objs = $(all-rtld-routines:%=%.os) sofini.os interp.os
106 generated += librtld.os dl-allobjs.os ld.so ldd
107 install-others = $(inst_rtlddir)/$(rtld-installed-name)
108 install-bin-script = ldd
109 endif
111 others = sprof sln
112 install-bin = sprof
113 others-static = sln
114 install-rootsbin = sln
115 sln-modules := static-stubs
116 extra-objs += $(sln-modules:=.o)
118 ifeq (yes,$(use-ldconfig))
119 ifeq (yes,$(build-shared))
120 others-static += ldconfig
121 others += ldconfig
122 install-rootsbin += ldconfig
124 ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon static-stubs \
125 stringtable
126 extra-objs += $(ldconfig-modules:=.o)
127 others-extras = $(ldconfig-modules)
128 endif
129 endif
131 # To find xmalloc.c and xstrdup.c
132 vpath %.c ../locale/programs
134 ifeq ($(build-shared),yes)
135 extra-objs += sotruss-lib.os sotruss-lib.so
136 install-others += $(inst_auditdir)/sotruss-lib.so
137 install-bin-script += sotruss
138 generated += sotruss
139 libof-sotruss-lib = extramodules
140 LDFLAGS-sotruss-lib.so += $(z-now-$(bind-now))
141 $(objpfx)sotruss-lib.so: $(objpfx)sotruss-lib.os
142 $(build-module-asneeded)
143 $(objpfx)sotruss-lib.so: $(common-objpfx)libc.so $(objpfx)ld.so \
144 $(common-objpfx)libc_nonshared.a
146 $(objpfx)sotruss: sotruss.sh $(common-objpfx)config.make
147 sed -e 's%@VERSION@%$(version)%g' \
148 -e 's%@TEXTDOMAINDIR@%$(localedir)%g' \
149 -e 's%@PREFIX@%$(prefix)%g' \
150 -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
151 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' \
152 < $< > $@.new
153 chmod 555 $@.new
154 mv -f $@.new $@
155 $(inst_auditdir)/sotruss-lib.so: $(objpfx)sotruss-lib.so $(+force)
156 $(do-install-program)
157 endif
159 tests-static-normal := tst-array1-static tst-array5-static \
160 tst-dl-iter-static \
161 tst-tlsalign-static tst-tlsalign-extern-static \
162 tst-linkall-static tst-env-setuid tst-env-setuid-tunables \
163 tst-single_threaded-static tst-single_threaded-pthread-static \
164 tst-dst-static tst-getauxval-static
166 tests-static-internal := tst-tls1-static \
167 tst-ptrguard1-static tst-stackguard1-static \
168 tst-tls1-static-non-pie
170 CRT-tst-tls1-static-non-pie := $(csu-objpfx)crt1.o
171 tst-tls1-static-non-pie-no-pie = yes
173 tests-container := \
174 tst-ldconfig-bad-aux-cache \
175 tst-ldconfig-ld_so_conf-update
177 ifeq (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.
180 tests-container += tst-glibc-hwcaps-prepend-cache
181 endif
183 tests := tst-tls9 tst-leaks1 \
184 tst-array1 tst-array2 tst-array3 tst-array4 tst-array5 \
185 tst-auxv tst-stringtable
186 tests-internal := tst-tls1 $(tests-static-internal)
187 tests-static := $(tests-static-normal) $(tests-static-internal)
189 ifeq (yes,$(build-shared))
190 tests-static += tst-tls9-static tst-single_threaded-static-dlopen
191 static-dlopen-environment = \
192 LD_LIBRARY_PATH=$(ld-library-path):$(common-objpfx)dlfcn
193 tst-tls9-static-ENV = $(static-dlopen-environment)
194 tst-single_threaded-static-dlopen-ENV = $(static-dlopen-environment)
196 tests += restest1 preloadtest loadfail multiload origtest resolvfail \
197 constload1 order noload filter \
198 reldep reldep2 reldep3 reldep4 nodelete nodelete2 \
199 nodlopen nodlopen2 lateglobal initfirst global \
200 restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
201 tst-tls4 tst-tls5 \
202 tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-tls15 \
203 tst-tls16 tst-tls17 tst-tls18 tst-tls19 tst-tls-dlinfo \
204 tst-align tst-align2 \
205 tst-dlmodcount tst-dlopenrpath tst-deep1 \
206 tst-dlmopen1 tst-dlmopen3 \
207 unload3 unload4 unload5 unload6 unload7 unload8 tst-global1 order2 \
208 tst-audit1 tst-audit2 tst-audit8 tst-audit9 \
209 tst-addr1 tst-thrlock \
210 tst-unique1 tst-unique2 $(if $(CXX),tst-unique3 tst-unique4 \
211 tst-nodelete tst-dlopen-nodelete-reloc) \
212 tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \
213 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
214 tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error tst-noload \
215 tst-latepthread tst-tls-manydynamic tst-nodelete-dlclose \
216 tst-debug1 tst-main1 tst-absolute-sym tst-absolute-zero tst-big-note \
217 tst-unwind-ctor tst-unwind-main tst-audit13 \
218 tst-sonamemove-link tst-sonamemove-dlopen tst-dlopen-tlsmodid \
219 tst-dlopen-self tst-auditmany tst-initfinilazyfail tst-dlopenfail \
220 tst-dlopenfail-2 \
221 tst-filterobj tst-filterobj-dlopen tst-auxobj tst-auxobj-dlopen \
222 tst-single_threaded tst-single_threaded-pthread \
223 tst-tls-ie tst-tls-ie-dlmopen argv0test \
224 tst-glibc-hwcaps tst-glibc-hwcaps-prepend tst-glibc-hwcaps-mask \
225 tst-tls20 tst-tls21 tst-dlmopen-dlerror tst-dlmopen-gethostbyname \
226 tst-dl-is_dso
227 # reldep9
228 tests-internal += loadtest unload unload2 circleload1 \
229 neededtest neededtest2 neededtest3 neededtest4 \
230 tst-tls3 tst-tls6 tst-tls7 tst-tls8 tst-dlmopen2 \
231 tst-ptrguard1 tst-stackguard1 \
232 tst-create_format1 tst-tls-surplus tst-dl-hwcaps_split
233 tests-container += tst-pldd tst-dlopen-tlsmodid-container \
234 tst-dlopen-self-container tst-preload-pthread-libc
235 test-srcs = tst-pathopt
236 selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
237 ifneq ($(selinux-enabled),1)
238 tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
239 endif
240 ifeq ($(have-depaudit),yes)
241 tests += tst-audit14 tst-audit15 tst-audit16
242 endif
243 endif
244 tests += $(tests-execstack-$(have-z-execstack))
245 ifeq ($(run-built-tests),yes)
246 tests-special += $(objpfx)tst-leaks1-mem.out \
247 $(objpfx)noload-mem.out \
248 $(objpfx)tst-ldconfig-X.out $(objpfx)tst-rtld-help.out
249 endif
250 tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
251 tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
252 tlsmod17a-modules = $(addprefix tst-tlsmod17a, $(tlsmod17a-suffixes))
253 tlsmod18a-modules = $(addprefix tst-tlsmod18a, $(tlsmod17a-suffixes))
254 one-hundred = $(foreach x,0 1 2 3 4 5 6 7 8 9, \
255 0$x 1$x 2$x 3$x 4$x 5$x 6$x 7$x 8$x 9$x)
256 tst-tls-many-dynamic-modules := \
257 $(foreach n,$(one-hundred),tst-tls-manydynamic$(n)mod)
258 tst-tls-many-dynamic-modules-dep-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 \
259 14 15 16 17 18 19
260 tst-tls-many-dynamic-modules-dep = \
261 $(foreach n,$(tst-tls-many-dynamic-modules-dep-suffixes),tst-tls-manydynamic$(n)mod-dep)
262 tst-tls-many-dynamic-modules-dep-bad-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
263 tst-tls-many-dynamic-modules-dep-bad = \
264 $(foreach n,$(tst-tls-many-dynamic-modules-dep-bad-suffixes),tst-tls-manydynamic$(n)mod-dep-bad)
265 extra-test-objs += $(tlsmod17a-modules:=.os) $(tlsmod18a-modules:=.os) \
266 tst-tlsalign-vars.o
267 test-extras += tst-tlsmod17a tst-tlsmod18a tst-tlsalign-vars
268 modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
269 testobj1_1 failobj constload2 constload3 unloadmod \
270 dep1 dep2 dep3 dep4 vismod1 vismod2 vismod3 \
271 nodelmod1 nodelmod2 nodelmod3 nodelmod4 \
272 nodel2mod1 nodel2mod2 nodel2mod3 \
273 nodlopenmod nodlopenmod2 filtmod1 filtmod2 \
274 reldepmod1 reldepmod2 reldepmod3 reldepmod4 nextmod1 nextmod2 \
275 reldep4mod1 reldep4mod2 reldep4mod3 reldep4mod4 \
276 neededobj1 neededobj2 neededobj3 neededobj4 \
277 neededobj5 neededobj6 firstobj globalmod1 \
278 unload2mod unload2dep ltglobmod1 ltglobmod2 pathoptobj \
279 dblloadmod1 dblloadmod2 dblloadmod3 reldepmod5 reldepmod6 \
280 reldep6mod0 reldep6mod1 reldep6mod2 reldep6mod3 reldep6mod4 \
281 reldep7mod1 reldep7mod2 \
282 tst-tlsmod1 tst-tlsmod2 tst-tlsmod3 tst-tlsmod4 \
283 tst-tlsmod5 tst-tlsmod6 tst-tlsmod7 tst-tlsmod8 \
284 tst-tlsmod9 tst-tlsmod10 tst-tlsmod11 tst-tlsmod12 \
285 tst-tlsmod13 tst-tlsmod13a tst-tlsmod14a tst-tlsmod14b \
286 tst-tlsmod15a tst-tlsmod15b tst-tlsmod16a tst-tlsmod16b \
287 $(tlsmod17a-modules) tst-tlsmod17b $(tlsmod18a-modules) \
288 tst-tls19mod1 tst-tls19mod2 tst-tls19mod3 \
289 circlemod1 circlemod1a circlemod2 circlemod2a \
290 circlemod3 circlemod3a \
291 reldep8mod1 reldep8mod2 reldep8mod3 \
292 reldep9mod1 reldep9mod2 reldep9mod3 \
293 tst-alignmod tst-alignmod2 \
294 $(modules-execstack-$(have-z-execstack)) \
295 tst-dlopenrpathmod tst-deep1mod1 tst-deep1mod2 tst-deep1mod3 \
296 tst-dlmopen1mod tst-auditmod1 \
297 unload3mod1 unload3mod2 unload3mod3 unload3mod4 \
298 unload4mod1 unload4mod2 unload4mod3 unload4mod4 \
299 unload6mod1 unload6mod2 unload6mod3 \
300 unload7mod1 unload7mod2 \
301 unload8mod1 unload8mod1x unload8mod2 unload8mod3 \
302 order2mod1 order2mod2 order2mod3 order2mod4 \
303 tst-unique1mod1 tst-unique1mod2 \
304 tst-unique2mod1 tst-unique2mod2 \
305 tst-auditmod9a tst-auditmod9b \
306 $(if $(CXX),tst-unique3lib tst-unique3lib2 tst-unique4lib \
307 tst-nodelete-uniquemod tst-nodelete-rtldmod \
308 tst-nodelete-zmod \
309 tst-dlopen-nodelete-reloc-mod1 \
310 tst-dlopen-nodelete-reloc-mod2 \
311 tst-dlopen-nodelete-reloc-mod3 \
312 tst-dlopen-nodelete-reloc-mod4 \
313 tst-dlopen-nodelete-reloc-mod5 \
314 tst-dlopen-nodelete-reloc-mod6 \
315 tst-dlopen-nodelete-reloc-mod7 \
316 tst-dlopen-nodelete-reloc-mod8 \
317 tst-dlopen-nodelete-reloc-mod9 \
318 tst-dlopen-nodelete-reloc-mod10 \
319 tst-dlopen-nodelete-reloc-mod11 \
320 tst-dlopen-nodelete-reloc-mod12 \
321 tst-dlopen-nodelete-reloc-mod13 \
322 tst-dlopen-nodelete-reloc-mod14 \
323 tst-dlopen-nodelete-reloc-mod15 \
324 tst-dlopen-nodelete-reloc-mod16 \
325 tst-dlopen-nodelete-reloc-mod17) \
326 tst-initordera1 tst-initorderb1 \
327 tst-initordera2 tst-initorderb2 \
328 tst-initordera3 tst-initordera4 \
329 tst-initorder2a tst-initorder2b tst-initorder2c \
330 tst-initorder2d \
331 tst-relsort1mod1 tst-relsort1mod2 tst-array2dep \
332 tst-array5dep tst-null-argv-lib \
333 tst-tlsalign-lib tst-nodelete-opened-lib tst-nodelete2mod \
334 tst-audit11mod1 tst-audit11mod2 tst-auditmod11 \
335 tst-audit12mod1 tst-audit12mod2 tst-audit12mod3 tst-auditmod12 \
336 tst-latepthreadmod $(tst-tls-many-dynamic-modules) \
337 $(tst-tls-many-dynamic-modules-dep) \
338 $(tst-tls-many-dynamic-modules-dep-bad) \
339 tst-nodelete-dlclose-dso tst-nodelete-dlclose-plugin \
340 tst-main1mod tst-absolute-sym-lib \
341 tst-absolute-zero-lib tst-big-note-lib tst-unwind-ctor-lib \
342 tst-audit13mod1 tst-sonamemove-linkmod1 \
343 tst-sonamemove-runmod1 tst-sonamemove-runmod2 \
344 tst-auditmanymod1 tst-auditmanymod2 tst-auditmanymod3 \
345 tst-auditmanymod4 tst-auditmanymod5 tst-auditmanymod6 \
346 tst-auditmanymod7 tst-auditmanymod8 tst-auditmanymod9 \
347 tst-initlazyfailmod tst-finilazyfailmod \
348 tst-dlopenfailmod1 tst-dlopenfaillinkmod tst-dlopenfailmod2 \
349 tst-dlopenfailmod3 tst-dlopenfailnodelmod tst-ldconfig-ld-mod \
350 tst-filterobj-flt tst-filterobj-aux tst-filterobj-filtee \
351 tst-auditlogmod-1 tst-auditlogmod-2 tst-auditlogmod-3 \
352 tst-single_threaded-mod1 tst-single_threaded-mod2 \
353 tst-single_threaded-mod3 tst-single_threaded-mod4 \
354 tst-tls-ie-mod0 tst-tls-ie-mod1 tst-tls-ie-mod2 \
355 tst-tls-ie-mod3 tst-tls-ie-mod4 tst-tls-ie-mod5 \
356 tst-tls-ie-mod6 libmarkermod1-1 libmarkermod1-2 libmarkermod1-3 \
357 libmarkermod2-1 libmarkermod2-2 \
358 libmarkermod3-1 libmarkermod3-2 libmarkermod3-3 \
359 libmarkermod4-1 libmarkermod4-2 libmarkermod4-3 libmarkermod4-4 \
360 tst-tls20mod-bad tst-tls21mod tst-dlmopen-dlerror-mod \
361 tst-auxvalmod \
362 tst-dlmopen-gethostbyname-mod \
364 # Most modules build with _ISOMAC defined, but those filtered out
365 # depend on internal headers.
366 modules-names-tests = $(filter-out ifuncmod% tst-tlsmod%,\
367 $(modules-names))
369 ifeq (yes,$(have-mtls-dialect-gnu2))
370 tests += tst-gnu2-tls1
371 modules-names += tst-gnu2-tls1mod
372 $(objpfx)tst-gnu2-tls1: $(objpfx)tst-gnu2-tls1mod.so
373 tst-gnu2-tls1mod.so-no-z-defs = yes
374 CFLAGS-tst-gnu2-tls1mod.c += -mtls-dialect=gnu2
375 endif
376 ifeq (yes,$(have-protected-data))
377 modules-names += tst-protected1moda tst-protected1modb
378 tests += tst-protected1a tst-protected1b
379 $(objpfx)tst-protected1a: $(addprefix $(objpfx),tst-protected1moda.so tst-protected1modb.so)
380 $(objpfx)tst-protected1b: $(addprefix $(objpfx),tst-protected1modb.so tst-protected1moda.so)
381 tst-protected1modb.so-no-z-defs = yes
382 # These tests fail with GCC versions prior to 5.1 and with some versions
383 # of binutils. See https://sourceware.org/bugzilla/show_bug.cgi?id=17709
384 # and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248 for details.
385 # Perhaps in future we can make these XFAILs conditional on some detection
386 # of compiler/linker behavior/version.
387 test-xfail-tst-protected1a = yes
388 test-xfail-tst-protected1b = yes
389 endif
390 ifeq (yesyes,$(have-fpie)$(build-shared))
391 modules-names += tst-piemod1
392 tests += tst-pie1 tst-pie2 tst-dlopen-pie tst-dlopen-tlsmodid-pie \
393 tst-dlopen-self-pie
394 tests-pie += tst-pie1 tst-pie2 tst-dlopen-tlsmodid-pie tst-dlopen-self-pie
395 ifeq (yes,$(have-protected-data))
396 tests += vismain
397 tests-pie += vismain
398 CFLAGS-vismain.c += $(PIE-ccflag)
399 endif
400 endif
401 modules-execstack-yes = tst-execstack-mod
402 extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
404 # filtmod1.so, tst-big-note-lib.so have special rules.
405 modules-names-nobuild := filtmod1 tst-big-note-lib
407 tests += $(tests-static)
409 ifeq (yes,$(have-ifunc))
410 tests-ifuncstatic := ifuncmain1static ifuncmain1picstatic \
411 ifuncmain2static ifuncmain2picstatic \
412 ifuncmain4static ifuncmain4picstatic \
413 ifuncmain5static ifuncmain5picstatic \
414 ifuncmain7static ifuncmain7picstatic
415 ifeq (yes,$(have-gcc-ifunc))
416 tests-ifuncstatic += ifuncmain9static ifuncmain9picstatic
417 endif
418 tests-static += $(tests-ifuncstatic)
419 tests-internal += $(tests-ifuncstatic)
420 ifeq (yes,$(build-shared))
421 tests += tst-ifunc-fault-lazy tst-ifunc-fault-bindnow
422 # Note: sysdeps/x86_64/ifuncmain8.c uses ifuncmain8.
423 tests-internal += \
424 ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \
425 ifuncmain1staticpic \
426 ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \
427 ifuncmain5 ifuncmain5pic ifuncmain5staticpic \
428 ifuncmain7 ifuncmain7pic
429 ifeq (yes,$(have-gcc-ifunc))
430 tests-internal += ifuncmain9 ifuncmain9pic
431 endif
432 ifunc-test-modules = ifuncdep1 ifuncdep1pic ifuncdep2 ifuncdep2pic \
433 ifuncdep5 ifuncdep5pic
434 extra-test-objs += $(ifunc-test-modules:=.o)
435 test-internal-extras += $(ifunc-test-modules)
436 ifeq (yes,$(have-fpie))
437 ifunc-pie-tests = ifuncmain1pie ifuncmain1vispie ifuncmain1staticpie \
438 ifuncmain5pie ifuncmain6pie ifuncmain7pie
439 ifeq (yes,$(have-gcc-ifunc))
440 ifunc-pie-tests += ifuncmain9pie
441 endif
442 ifeq (yes,$(have-textrel_ifunc))
443 ifunc-pie-tests += tst-ifunc-textrel
444 endif
445 tests-internal += $(ifunc-pie-tests)
446 tests-pie += $(ifunc-pie-tests)
447 endif
448 modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6
449 endif
450 endif
452 ifeq (yes,$(build-shared))
453 ifeq ($(run-built-tests),yes)
454 tests-special += $(objpfx)tst-pathopt.out $(objpfx)tst-rtld-load-self.out \
455 $(objpfx)tst-rtld-preload.out $(objpfx)argv0test.out \
456 $(objpfx)tst-rtld-help.out
457 endif
458 tests-special += $(objpfx)check-textrel.out $(objpfx)check-execstack.out \
459 $(objpfx)check-wx-segment.out \
460 $(objpfx)check-localplt.out $(objpfx)check-initfini.out
461 endif
463 ifeq ($(run-built-tests),yes)
464 tests-special += $(objpfx)order-cmp.out $(objpfx)tst-array1-cmp.out \
465 $(objpfx)tst-array1-static-cmp.out \
466 $(objpfx)tst-array2-cmp.out $(objpfx)tst-array3-cmp.out \
467 $(objpfx)tst-array4-cmp.out $(objpfx)tst-array5-cmp.out \
468 $(objpfx)tst-array5-static-cmp.out $(objpfx)order2-cmp.out \
469 $(objpfx)tst-initorder-cmp.out \
470 $(objpfx)tst-initorder2-cmp.out $(objpfx)tst-unused-dep.out \
471 $(objpfx)tst-unused-dep-cmp.out
472 endif
474 check-abi: $(objpfx)check-abi-ld.out
475 tests-special += $(objpfx)check-abi-ld.out
476 update-abi: update-abi-ld
477 update-all-abi: update-all-abi-ld
479 ifeq ($(have-glob-dat-reloc),yes)
480 tests += tst-prelink
481 tests-internal += tst-prelink-cmp
482 # Don't compile tst-prelink.c with PIE for GLOB_DAT relocation.
483 CFLAGS-tst-prelink.c += -fno-pie
484 tst-prelink-no-pie = yes
485 endif
487 # The test requires shared _and_ PIE because the executable
488 # unit test driver must be able to link with the shared object
489 # that is going to eventually go into an installed DSO.
490 ifeq (yesyes,$(have-fpie)$(build-shared))
491 tests-internal += tst-_dl_addr_inside_object
492 tests-pie += tst-_dl_addr_inside_object
493 $(objpfx)tst-_dl_addr_inside_object: $(objpfx)dl-addr-obj.os
494 CFLAGS-tst-_dl_addr_inside_object.c += $(PIE-ccflag)
495 endif
497 # We can only test static libcrypt use if libcrypt has been built,
498 # and either NSS crypto is not in use, or static NSS libraries are
499 # available.
500 ifeq ($(build-crypt),no)
501 CFLAGS-tst-linkall-static.c += -DUSE_CRYPT=0
502 else
503 ifeq ($(nss-crypt),no)
504 CFLAGS-tst-linkall-static.c += -DUSE_CRYPT=1
505 else
506 ifeq ($(static-nss-crypt),no)
507 CFLAGS-tst-linkall-static.c += -DUSE_CRYPT=0
508 else
509 CFLAGS-tst-linkall-static.c += -DUSE_CRYPT=1
510 endif
511 endif
512 endif
514 include ../Rules
516 ifeq (yes,$(build-shared))
517 # Make sure these things are built in the `make lib' pass so they can be used
518 # to run programs during the `make others' pass.
519 lib-noranlib: $(objpfx)$(rtld-installed-name) \
520 $(addprefix $(objpfx),$(extra-objs))
521 endif
523 # Command to link into a larger single relocatable object.
524 reloc-link = $(LINK.o) -nostdlib -nostartfiles -r
526 $(objpfx)sotruss-lib.so: $(shlib-lds)
528 $(objpfx)dl-allobjs.os: $(all-rtld-routines:%=$(objpfx)%.os)
529 $(reloc-link) -o $@ $^
531 # Link together the dynamic linker into a single relocatable object.
532 # First we do a link against libc_pic.a just to get a link map,
533 # and discard the object produced by that link. From the link map
534 # we can glean all the libc modules that need to go into the dynamic
535 # linker. Then we do a recursive make that goes into all the subdirs
536 # those modules come from and builds special rtld-foo.os versions that
537 # are compiled with special flags, and puts these modules into rtld-libc.a
538 # for us. Then we do the real link using rtld-libc.a instead of libc_pic.a.
540 # These symbols need to be stubbed out during symbol discovery because
541 # their implementation is provided differently in rtld, and the symbol
542 # discovery mechanism is not compatible with the libc implementation
543 # when compiled for libc.
544 rtld-stubbed-symbols = \
545 __GI___pthread_disable_asynccancel \
546 __GI___pthread_enable_asynccancel \
547 __pthread_disable_asynccancel \
548 __pthread_enable_asynccancel \
549 calloc \
550 free \
551 malloc \
552 realloc \
554 ifeq ($(have-ssp),yes)
555 # rtld is not built with the stack protector, so these references will
556 # go away in the rebuilds.
557 rtld-stubbed-symbols += __stack_chk_fail __stack_chk_fail_local
558 endif
560 $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
561 @-rm -f $@T
562 for symbol in $(rtld-stubbed-symbols); do \
563 echo ".globl $$symbol"; \
564 echo "$$symbol:"; \
565 done | $(CC) -o $@T.o $(ASFLAGS) -c -x assembler -
566 $(reloc-link) -o $@.o $@T.o '-Wl,-(' $^ -lgcc '-Wl,-)' -Wl,-Map,$@T
567 rm -f %@T.o $@.o
568 mv -f $@T $@
570 # For lld, skip preceding addresses and values before matching the archive and the member.
571 $(objpfx)librtld.mk: $(objpfx)librtld.map Makefile
572 LC_ALL=C \
573 sed -n 's@^[0-9a-f ]*$(common-objpfx)\([^(]*\)(\([^)]*\.os\)) *.*$$@\1 \2@p' \
574 $< | \
575 while read lib file; do \
576 case $$lib in \
577 libc_pic.a) \
578 LC_ALL=C fgrep -l /$$file \
579 $(common-objpfx)stamp.os $(common-objpfx)*/stamp.os | \
580 LC_ALL=C \
581 sed 's@^$(common-objpfx)\([^/]*\)/stamp\.os$$@rtld-\1'" +=$$file@"\
582 ;; \
583 */*.a) \
584 echo rtld-$${lib%%/*} += $$file ;; \
585 *) echo "Wasn't expecting $$lib($$file)" >&2; exit 1 ;; \
586 esac; \
587 done > $@T
588 echo rtld-subdirs = `LC_ALL=C sed 's/^rtld-\([^ ]*\).*$$/\1/' $@T \
589 | LC_ALL=C sort -u` >> $@T
590 mv -f $@T $@
592 $(objpfx)rtld-libc.a: $(objpfx)librtld.mk FORCE
593 $(MAKE) -f $< -f rtld-Rules
595 $(objpfx)librtld.os: $(objpfx)dl-allobjs.os $(objpfx)rtld-libc.a
596 $(LINK.o) -nostdlib -nostartfiles -r -o $@ '-Wl,-(' $^ -lgcc '-Wl,-)' \
597 -Wl,-Map,$@.map
599 generated += librtld.map librtld.mk rtld-libc.a librtld.os.map
601 z-now-yes = -Wl,-z,now
603 $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
604 # Link into a temporary file so that we don't touch $@ at all
605 # if the sanity check below fails.
606 $(LINK.o) -nostdlib -nostartfiles -shared -o $@.new \
607 $(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \
608 $(filter-out $(map-file),$^) $(load-map-file) \
609 -Wl,-soname=$(rtld-installed-name) \
610 -Wl,-defsym=_begin=0
611 $(call after-link,$@.new)
612 $(READELF) -s $@.new \
613 | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
614 mv -f $@.new $@
616 ifeq (yes,$(build-shared))
617 # interp.c exists just to get the runtime linker path into libc.so.
618 $(objpfx)interp.os: $(common-objpfx)runtime-linker.h
619 endif
621 ifneq (ld.so,$(rtld-installed-name))
622 # Make sure ld.so.1 exists in the build directory so we can link
623 # against it.
624 $(objpfx)$(rtld-installed-name): $(objpfx)ld.so
625 $(make-link)
626 generated += $(rtld-installed-name)
627 endif
629 # Build a file mentioning all trustworthy directories to look for shared
630 # libraries when using LD_LIBRARY_PATH in a setuid program. The user can
631 # add directories to the list by defining $(user-defined-trusted-dirs)
632 # before starting make.
633 $(objpfx)trusted-dirs.h: $(objpfx)trusted-dirs.st; @:
634 $(objpfx)trusted-dirs.st: Makefile $(..)Makeconfig
635 $(make-target-directory)
636 echo "$(subst :, ,$(default-rpath) $(user-defined-trusted-dirs))" \
637 | $(AWK) -f gen-trusted-dirs.awk > ${@:st=T};
638 echo '#define DL_DST_LIB "$(notdir $(slibdir))"' >> ${@:st=T}
639 $(move-if-change) ${@:st=T} ${@:st=h}
640 touch $@
641 CPPFLAGS-dl-load.c += -I$(objpfx). -I$(csu-objpfx).
643 ifeq (yes,$(build-shared))
644 $(inst_rtlddir)/$(rtld-installed-name): $(objpfx)ld.so $(+force)
645 $(make-target-directory)
646 $(do-install-program)
648 # Special target called by parent to install just the dynamic linker.
649 .PHONY: ldso_install
650 ldso_install: $(inst_rtlddir)/$(rtld-installed-name)
651 endif # $(build-shared)
654 # Workarounds for ${exec_prefix} expansion in configure variables.
655 # config.status cannot be used directly for processing ldd.bash.in or
656 # expanding variables such as sysconfdir because the expansion
657 # contains the literal string ${exec_prefix}, which is not valid in C
658 # headers or installed shell scripts.
660 ldd-rewrite = -e 's%@RTLD@%$(rtlddir)/$(rtld-installed-name)%g' \
661 -e 's%@VERSION@%$(version)%g' \
662 -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
663 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' \
664 -e 's%@TEXTDOMAINDIR@%$(localedir)%g'
666 ifeq ($(ldd-rewrite-script),no)
667 define gen-ldd
668 LC_ALL=C sed $(ldd-rewrite) < $< > $@.new
669 endef
670 else
671 define gen-ldd
672 LC_ALL=C sed $(ldd-rewrite) < $< \
673 | LC_ALL=C sed -f $(patsubst $(..)/%,/%,$(..)$(ldd-rewrite-script)) > $@.new
674 endef
675 endif
677 $(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \
678 $(common-objpfx)config.make
679 $(gen-ldd)
680 chmod 555 $@.new
681 mv -f $@.new $@
683 $(objpfx)sln: $(sln-modules:%=$(objpfx)%.o)
685 $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
687 SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
688 CFLAGS-ldconfig.c += $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
689 -D'SLIBDIR="$(slibdir)"'
690 libof-ldconfig = ldconfig
691 CFLAGS-dl-cache.c += $(SYSCONF-FLAGS)
692 CFLAGS-cache.c += $(SYSCONF-FLAGS)
693 CFLAGS-rtld.c += $(SYSCONF-FLAGS)
694 CFLAGS-dl-usage.c += $(SYSCONF-FLAGS) \
695 -D'RTLD="$(rtlddir)/$(rtld-installed-name)"'
696 CFLAGS-dl-diagnostics.c += $(SYSCONF-FLAGS) \
697 -D'PREFIX="$(prefix)"' \
698 -D'RTLD="$(rtlddir)/$(rtld-installed-name)"'
700 cpp-srcs-left := $(all-rtld-routines:=.os)
701 lib := rtld
702 include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
704 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
705 generated += $(addsuffix .so,$(strip $(modules-names)))
707 $(objpfx)testobj1_1.so: $(objpfx)testobj1.so
708 $(objpfx)testobj2.so: $(objpfx)testobj1.so
709 $(objpfx)testobj6.so: $(objpfx)testobj1.so $(objpfx)testobj2.so
710 $(objpfx)failobj.so: $(objpfx)testobj6.so
711 $(objpfx)dep1.so: $(objpfx)dep2.so $(objpfx)dep4.so
712 $(objpfx)dep2.so: $(objpfx)dep3.so $(objpfx)dep4.so
713 $(objpfx)dep4.so: $(objpfx)dep3.so
714 $(objpfx)nodelmod3.so: $(objpfx)nodelmod4.so
715 $(objpfx)neededobj2.so: $(objpfx)neededobj1.so
716 $(objpfx)neededobj3.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so
717 $(objpfx)neededobj4.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
718 $(objpfx)neededobj3.so
719 $(objpfx)neededobj6.so: $(objpfx)neededobj5.so
720 $(objpfx)unload2mod.so: $(objpfx)unload2dep.so
721 $(objpfx)firstobj.so: $(shared-thread-library)
722 $(objpfx)reldep4mod1.so: $(objpfx)reldep4mod3.so
723 $(objpfx)reldep4mod2.so: $(objpfx)reldep4mod4.so
724 $(objpfx)dblloadmod1.so: $(objpfx)dblloadmod3.so
725 $(objpfx)dblloadmod2.so: $(objpfx)dblloadmod3.so
726 $(objpfx)reldepmod5.so: $(objpfx)reldepmod2.so
727 $(objpfx)reldepmod6.so: $(objpfx)reldepmod2.so
728 $(objpfx)reldep6mod1.so: $(objpfx)reldep6mod0.so
729 $(objpfx)reldep6mod2.so: $(objpfx)reldep6mod1.so
730 $(objpfx)reldep6mod3.so: $(objpfx)reldep6mod2.so
731 $(objpfx)reldep6mod4.so: $(objpfx)reldep6mod1.so
732 $(objpfx)tst-tlsmod3.so: $(objpfx)tst-tlsmod2.so
733 $(objpfx)tst-tlsmod8.so: $(objpfx)tst-tlsmod7.so
734 $(objpfx)tst-tlsmod10.so: $(objpfx)tst-tlsmod9.so
735 $(objpfx)tst-tlsmod12.so: $(objpfx)tst-tlsmod11.so
736 $(objpfx)tst-tlsmod13a.so: $(objpfx)tst-tlsmod13.so
737 # For tst-tls9-static, make sure the modules it dlopens have libc.so in DT_NEEDED
738 $(objpfx)tst-tlsmod5.so: $(common-objpfx)libc.so
739 $(objpfx)tst-tlsmod6.so: $(common-objpfx)libc.so
740 $(objpfx)tst-tls19mod1.so: $(objpfx)tst-tls19mod2.so $(objpfx)tst-tls19mod3.so
741 $(objpfx)tst-tls19mod3.so: $(objpfx)ld.so
742 $(objpfx)reldep8mod3.so: $(objpfx)reldep8mod1.so $(objpfx)reldep8mod2.so
743 $(objpfx)nodel2mod3.so: $(objpfx)nodel2mod1.so $(objpfx)nodel2mod2.so
744 $(objpfx)reldep9mod2.so: $(objpfx)reldep9mod1.so
745 $(objpfx)reldep9mod3.so: $(objpfx)reldep9mod1.so $(objpfx)reldep9mod2.so
746 $(objpfx)unload3mod1.so: $(objpfx)unload3mod3.so
747 $(objpfx)unload3mod2.so: $(objpfx)unload3mod3.so
748 $(objpfx)unload3mod3.so: $(objpfx)unload3mod4.so
749 $(objpfx)unload4mod1.so: $(objpfx)unload4mod2.so $(objpfx)unload4mod3.so
750 $(objpfx)unload4mod2.so: $(objpfx)unload4mod4.so $(objpfx)unload4mod3.so
751 $(objpfx)unload7mod2.so: $(objpfx)unload7mod1.so
752 $(objpfx)unload8mod1.so: $(objpfx)unload8mod2.so
753 $(objpfx)unload8mod2.so: $(objpfx)unload8mod3.so
754 $(objpfx)tst-initordera2.so: $(objpfx)tst-initordera1.so
755 $(objpfx)tst-initorderb2.so: $(objpfx)tst-initorderb1.so $(objpfx)tst-initordera2.so
756 $(objpfx)tst-initordera3.so: $(objpfx)tst-initorderb2.so $(objpfx)tst-initorderb1.so
757 $(objpfx)tst-initordera4.so: $(objpfx)tst-initordera3.so
758 $(objpfx)tst-initorder: $(objpfx)tst-initordera4.so $(objpfx)tst-initordera1.so $(objpfx)tst-initorderb2.so
759 $(objpfx)tst-null-argv: $(objpfx)tst-null-argv-lib.so
760 $(objpfx)tst-tlsalign: $(objpfx)tst-tlsalign-lib.so
761 $(objpfx)tst-nodelete-opened.out: $(objpfx)tst-nodelete-opened-lib.so
763 $(objpfx)tst-tlsalign-extern: $(objpfx)tst-tlsalign-vars.o
764 $(objpfx)tst-tlsalign-extern-static: $(objpfx)tst-tlsalign-vars.o
766 tst-null-argv-ENV = LD_DEBUG=all LD_DEBUG_OUTPUT=$(objpfx)tst-null-argv.debug.out
767 LDFLAGS-nodel2mod3.so = -Wl,--no-as-needed
768 LDFLAGS-reldepmod5.so = -Wl,--no-as-needed
769 LDFLAGS-reldep6mod1.so = -Wl,--no-as-needed
770 LDFLAGS-reldep6mod4.so = -Wl,--no-as-needed
771 LDFLAGS-reldep8mod3.so = -Wl,--no-as-needed
772 LDFLAGS-unload4mod1.so = -Wl,--no-as-needed
773 LDFLAGS-unload4mod2.so = -Wl,--no-as-needed
774 LDFLAGS-tst-initorder = -Wl,--no-as-needed
775 LDFLAGS-tst-initordera2.so = -Wl,--no-as-needed
776 LDFLAGS-tst-initordera3.so = -Wl,--no-as-needed
777 LDFLAGS-tst-initordera4.so = -Wl,--no-as-needed
778 LDFLAGS-tst-initorderb2.so = -Wl,--no-as-needed
779 LDFLAGS-tst-tlsmod5.so = -nostdlib -Wl,--no-as-needed
780 LDFLAGS-tst-tlsmod6.so = -nostdlib -Wl,--no-as-needed
782 testobj1.so-no-z-defs = yes
783 testobj3.so-no-z-defs = yes
784 testobj4.so-no-z-defs = yes
785 testobj5.so-no-z-defs = yes
786 testobj6.so-no-z-defs = yes
787 failobj.so-no-z-defs = yes
788 constload2.so-no-z-defs = yes
789 constload3.so-no-z-defs = yes
790 nodelmod1.so-no-z-defs = yes
791 nodelmod2.so-no-z-defs = yes
792 nodelmod4.so-no-z-defs = yes
793 nodel2mod2.so-no-z-defs = yes
794 reldepmod2.so-no-z-defs = yes
795 reldepmod3.so-no-z-defs = yes
796 reldepmod4.so-no-z-defs = yes
797 reldep4mod4.so-no-z-defs = yes
798 reldep4mod2.so-no-z-defs = yes
799 ltglobmod2.so-no-z-defs = yes
800 dblloadmod3.so-no-z-defs = yes
801 tst-tlsmod1.so-no-z-defs = yes
802 tst-tlsmod2.so-no-z-defs = yes
803 tst-tlsmod3.so-no-z-defs = yes
804 tst-tlsmod4.so-no-z-defs = yes
805 tst-tlsmod7.so-no-z-defs = yes
806 tst-tlsmod8.so-no-z-defs = yes
807 tst-tlsmod9.so-no-z-defs = yes
808 tst-tlsmod10.so-no-z-defs = yes
809 tst-tlsmod12.so-no-z-defs = yes
810 tst-tlsmod14a.so-no-z-defs = yes
811 tst-tlsmod14b.so-no-z-defs = yes
812 tst-tlsmod15a.so-no-z-defs = yes
813 tst-tlsmod16b.so-no-z-defs = yes
814 circlemod2.so-no-z-defs = yes
815 circlemod3.so-no-z-defs = yes
816 circlemod3a.so-no-z-defs = yes
817 reldep8mod2.so-no-z-defs = yes
818 reldep9mod1.so-no-z-defs = yes
819 unload3mod4.so-no-z-defs = yes
820 unload4mod1.so-no-z-defs = yes
821 ifuncmod1.so-no-z-defs = yes
822 ifuncmod5.so-no-z-defs = yes
823 ifuncmod6.so-no-z-defs = yes
824 tst-auditmod9a.so-no-z-defs = yes
825 tst-auditmod9b.so-no-z-defs = yes
826 tst-nodelete-uniquemod.so-no-z-defs = yes
827 tst-nodelete-rtldmod.so-no-z-defs = yes
828 tst-nodelete-zmod.so-no-z-defs = yes
829 tst-nodelete2mod.so-no-z-defs = yes
831 ifeq ($(build-shared),yes)
832 # Build all the modules even when not actually running test programs.
833 tests: $(test-modules)
834 endif
836 LDFLAGS-loadtest = -rdynamic
838 $(objpfx)loadtest.out: $(test-modules)
840 $(objpfx)neededtest.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
841 $(objpfx)neededobj3.so
843 $(objpfx)neededtest2.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
844 $(objpfx)neededobj3.so
846 $(objpfx)neededtest3.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
847 $(objpfx)neededobj3.so $(objpfx)neededobj4.so
849 $(objpfx)neededtest4: $(objpfx)neededobj1.so
850 $(objpfx)neededtest4.out: $(objpfx)neededobj5.so $(objpfx)neededobj6.so
852 $(objpfx)restest1: $(objpfx)testobj1.so $(objpfx)testobj1_1.so
853 LDFLAGS-restest1 = -rdynamic
855 LDFLAGS-restest2 = -rdynamic
857 $(objpfx)restest1.out: $(test-modules)
859 preloadtest-preloads = testobj1 testobj2 testobj3 testobj4 testobj5
860 $(objpfx)preloadtest: $(objpfx)testobj6.so
861 LDFLAGS-preloadtest = -rdynamic
862 $(objpfx)preloadtest.out: $(preloadtest-preloads:%=$(objpfx)%.so)
863 preloadtest-ENV = \
864 LD_PRELOAD=$(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
866 LDFLAGS-loadfail = -rdynamic
868 $(objpfx)loadfail.out: $(objpfx)failobj.so
870 LDFLAGS-multiload = -rdynamic
871 CFLAGS-multiload.c += -DOBJDIR=\"$(elf-objpfx)\"
873 $(objpfx)multiload.out: $(objpfx)testobj1.so
875 LDFLAGS-origtest = -rdynamic
876 $(objpfx)origtest.out: $(objpfx)testobj1.so
878 ifeq ($(have-thread-library),yes)
879 $(objpfx)resolvfail: $(shared-thread-library)
880 endif
882 $(objpfx)constload1.out: $(objpfx)constload2.so $(objpfx)constload3.so
884 $(objpfx)circleload1.out: $(objpfx)circlemod1.so \
885 $(objpfx)circlemod1a.so
887 $(objpfx)circlemod1.so: $(objpfx)circlemod2.so
888 $(objpfx)circlemod2.so: $(objpfx)circlemod3.so
889 $(objpfx)circlemod1a.so: $(objpfx)circlemod2a.so
890 $(objpfx)circlemod2a.so: $(objpfx)circlemod3a.so
892 $(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so)
894 $(objpfx)order-cmp.out: $(objpfx)order.out
895 (echo "0123456789" | cmp $< -) > $@; \
896 $(evaluate-test)
898 $(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so)
899 $(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
900 vismain-ENV = LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
902 $(objpfx)noload: $(objpfx)testobj1.so
903 LDFLAGS-noload = -rdynamic -Wl,--no-as-needed
904 $(objpfx)noload.out: $(objpfx)testobj5.so
906 $(objpfx)noload-mem.out: $(objpfx)noload.out
907 $(common-objpfx)malloc/mtrace $(objpfx)noload.mtrace > $@; \
908 $(evaluate-test)
909 noload-ENV = MALLOC_TRACE=$(objpfx)noload.mtrace \
910 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
912 LDFLAGS-nodelete = -rdynamic
913 LDFLAGS-nodelmod1.so = -Wl,--enable-new-dtags,-z,nodelete
914 LDFLAGS-nodelmod4.so = -Wl,--enable-new-dtags,-z,nodelete
915 $(objpfx)nodelete.out: $(objpfx)nodelmod1.so $(objpfx)nodelmod2.so \
916 $(objpfx)nodelmod3.so
918 LDFLAGS-nodlopenmod.so = -Wl,--enable-new-dtags,-z,nodlopen
919 $(objpfx)nodlopen.out: $(objpfx)nodlopenmod.so
921 $(objpfx)nodlopenmod2.so: $(objpfx)nodlopenmod.so
922 $(objpfx)nodlopen2.out: $(objpfx)nodlopenmod2.so
924 $(objpfx)filtmod1.so: $(objpfx)filtmod1.os $(objpfx)filtmod2.so
925 $(LINK.o) -shared -o $@ -B$(csu-objpfx) $(LDFLAGS.so) \
926 -L$(subst :, -L,$(rpath-link)) \
927 -Wl,-rpath-link=$(rpath-link) \
928 $< -Wl,-F,$(objpfx)filtmod2.so
929 $(objpfx)filter: $(objpfx)filtmod1.so
931 # This does not link against libc.
932 CFLAGS-filtmod1.c += $(no-stack-protector)
934 $(objpfx)unload.out: $(objpfx)unloadmod.so
936 $(objpfx)reldep.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod2.so
938 $(objpfx)reldep2.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod3.so
940 $(objpfx)reldep3.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
942 $(objpfx)reldep4.out: $(objpfx)reldep4mod1.so $(objpfx)reldep4mod2.so
944 $(objpfx)next: $(objpfx)nextmod1.so $(objpfx)nextmod2.so
945 LDFLAGS-next = -Wl,--no-as-needed
947 $(objpfx)unload2.out: $(objpfx)unload2mod.so $(objpfx)unload2dep.so
949 $(objpfx)lateglobal.out: $(objpfx)ltglobmod1.so $(objpfx)ltglobmod2.so
951 $(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \
952 $(objpfx)pathoptobj.so
953 $(SHELL) $< $(common-objpfx) '$(test-wrapper-env)' \
954 '$(run-program-env)'; \
955 $(evaluate-test)
957 $(objpfx)tst-rtld-load-self.out: tst-rtld-load-self.sh $(objpfx)ld.so
958 $(SHELL) $^ '$(test-wrapper)' '$(test-wrapper-env)' > $@; \
959 $(evaluate-test)
961 tst-rtld-preload-OBJS = $(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
962 $(objpfx)tst-rtld-preload.out: tst-rtld-preload.sh $(objpfx)ld.so \
963 $(objpfx)preloadtest \
964 $(preloadtest-preloads:%=$(objpfx)%.so)
965 $(SHELL) $< $(objpfx)ld.so $(objpfx)preloadtest \
966 '$(test-wrapper-env)' '$(run_program_env)' \
967 '$(rpath-link)' '$(tst-rtld-preload-OBJS)' > $@; \
968 $(evaluate-test)
970 $(objpfx)initfirst.out: $(objpfx)firstobj.so
972 $(objpfx)global: $(objpfx)globalmod1.so
973 $(objpfx)global.out: $(objpfx)reldepmod1.so
975 $(objpfx)dblload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
977 $(objpfx)dblunload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
979 $(objpfx)reldep5.out: $(objpfx)reldepmod5.so $(objpfx)reldepmod6.so
981 $(objpfx)reldep6.out: $(objpfx)reldep6mod3.so $(objpfx)reldep6mod4.so
983 $(objpfx)reldep7.out: $(objpfx)reldep7mod1.so $(objpfx)reldep7mod2.so
985 $(objpfx)reldep8.out: $(objpfx)reldep8mod3.so
987 LDFLAGS-nodel2mod2.so = -Wl,--enable-new-dtags,-z,nodelete
988 $(objpfx)nodelete2.out: $(objpfx)nodel2mod3.so
990 $(objpfx)reldep9.out: $(objpfx)reldep9mod3.so
992 $(objpfx)tst-tls3: $(objpfx)tst-tlsmod1.so
994 $(objpfx)tst-tls4.out: $(objpfx)tst-tlsmod2.so
996 $(objpfx)tst-tls5.out: $(objpfx)tst-tlsmod2.so
998 $(objpfx)tst-tls6.out: $(objpfx)tst-tlsmod2.so
1000 $(objpfx)tst-tls7.out: $(objpfx)tst-tlsmod3.so
1002 $(objpfx)tst-tls8.out: $(objpfx)tst-tlsmod3.so $(objpfx)tst-tlsmod4.so
1004 $(objpfx)tst-tls9.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
1006 $(objpfx)tst-tls10: $(objpfx)tst-tlsmod8.so $(objpfx)tst-tlsmod7.so
1008 $(objpfx)tst-tls11: $(objpfx)tst-tlsmod10.so $(objpfx)tst-tlsmod9.so
1010 $(objpfx)tst-tls12: $(objpfx)tst-tlsmod12.so $(objpfx)tst-tlsmod11.so
1012 $(objpfx)tst-tls13.out: $(objpfx)tst-tlsmod13a.so
1014 $(objpfx)tst-tls14: $(objpfx)tst-tlsmod14a.so
1015 $(objpfx)tst-tls14.out: $(objpfx)tst-tlsmod14b.so
1017 $(objpfx)tst-tls15.out: $(objpfx)tst-tlsmod15a.so $(objpfx)tst-tlsmod15b.so
1019 $(objpfx)tst-tls-dlinfo.out: $(objpfx)tst-tlsmod2.so
1023 $(objpfx)tst-tls16.out: $(objpfx)tst-tlsmod16a.so $(objpfx)tst-tlsmod16b.so
1025 $(objpfx)tst-tls17.out: $(objpfx)tst-tlsmod17b.so
1026 $(patsubst %,$(objpfx)%.os,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.os: tst-tlsmod17a.c
1027 $(compile-command.c) -DN=$*
1028 $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.so: $(objpfx)ld.so
1029 $(objpfx)tst-tlsmod17b.so: $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules))
1031 $(objpfx)tst-tls18.out: $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules))
1032 $(patsubst %,$(objpfx)%.os,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.os : tst-tlsmod18a.c
1033 $(compile-command.c) -DN=$*
1034 $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.so: $(objpfx)ld.so
1036 $(objpfx)tst-tls19.out: $(objpfx)tst-tls19mod1.so
1038 CFLAGS-tst-align.c += $(stack-align-test-flags)
1039 CFLAGS-tst-align2.c += $(stack-align-test-flags)
1040 CFLAGS-tst-alignmod.c += $(stack-align-test-flags)
1041 CFLAGS-tst-alignmod2.c += $(stack-align-test-flags)
1042 $(objpfx)tst-align.out: $(objpfx)tst-alignmod.so
1043 $(objpfx)tst-align2: $(objpfx)tst-alignmod2.so
1045 $(objpfx)unload3.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
1046 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
1048 $(objpfx)unload4.out: $(objpfx)unload4mod1.so $(objpfx)unload4mod3.so
1050 $(objpfx)unload5.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
1051 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
1053 $(objpfx)unload6.out: $(objpfx)unload6mod1.so $(objpfx)unload6mod2.so \
1054 $(objpfx)unload6mod3.so
1056 $(objpfx)unload7.out: $(objpfx)unload7mod1.so $(objpfx)unload7mod2.so
1057 unload7-ENV = MALLOC_PERTURB_=85
1059 $(objpfx)unload8.out: $(objpfx)unload8mod1.so $(objpfx)unload8mod1x.so
1061 $(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
1063 ifeq ($(have-z-execstack),yes)
1064 $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
1065 CPPFLAGS-tst-execstack.c += -DUSE_PTHREADS=0
1066 LDFLAGS-tst-execstack = -Wl,-z,noexecstack
1067 LDFLAGS-tst-execstack-mod.so = -Wl,-z,execstack
1069 $(objpfx)tst-execstack-needed: $(objpfx)tst-execstack-mod.so
1070 LDFLAGS-tst-execstack-needed = -Wl,-z,noexecstack
1072 LDFLAGS-tst-execstack-prog = -Wl,-z,execstack
1073 CFLAGS-tst-execstack-prog.c += -Wno-trampolines
1074 CFLAGS-tst-execstack-mod.c += -Wno-trampolines
1075 endif
1077 LDFLAGS-tst-array2 = -Wl,--no-as-needed
1078 LDFLAGS-tst-array5 = -Wl,--no-as-needed
1080 $(objpfx)tst-array1-cmp.out: tst-array1.exp $(objpfx)tst-array1.out
1081 cmp $^ > $@; \
1082 $(evaluate-test)
1084 $(objpfx)tst-array1-static-cmp.out: tst-array1.exp \
1085 $(objpfx)tst-array1-static.out
1086 cmp $^ > $@; \
1087 $(evaluate-test)
1089 $(objpfx)tst-array2: $(objpfx)tst-array2dep.so
1090 $(objpfx)tst-array2-cmp.out: tst-array2.exp $(objpfx)tst-array2.out
1091 cmp $^ > $@; \
1092 $(evaluate-test)
1094 $(objpfx)tst-array3-cmp.out: tst-array1.exp $(objpfx)tst-array3.out
1095 cmp $^ > $@; \
1096 $(evaluate-test)
1098 $(objpfx)tst-array4.out: $(objpfx)tst-array2dep.so
1099 $(objpfx)tst-array4-cmp.out: tst-array4.exp $(objpfx)tst-array4.out
1100 cmp $^ > $@; \
1101 $(evaluate-test)
1103 $(objpfx)tst-array5: $(objpfx)tst-array5dep.so
1104 $(objpfx)tst-array5-cmp.out: tst-array5.exp $(objpfx)tst-array5.out
1105 cmp $^ > $@; \
1106 $(evaluate-test)
1108 $(objpfx)tst-array5-static-cmp.out: tst-array5-static.exp \
1109 $(objpfx)tst-array5-static.out
1110 cmp $^ > $@; \
1111 $(evaluate-test)
1113 CFLAGS-tst-pie1.c += $(pie-ccflag)
1114 CFLAGS-tst-pie2.c += $(pie-ccflag)
1116 $(objpfx)tst-piemod1.so: $(libsupport)
1117 $(objpfx)tst-pie1: $(objpfx)tst-piemod1.so
1118 $(objpfx)tst-dlopen-pie.out: $(objpfx)tst-pie1
1120 ifeq (yes,$(build-shared))
1121 # NB: Please keep cet-built-dso in sysdeps/x86/Makefile in sync with
1122 # all-built-dso here.
1123 all-built-dso := $(common-objpfx)elf/ld.so $(common-objpfx)libc.so \
1124 $(filter-out $(common-objpfx)linkobj/libc.so, \
1125 $(sort $(wildcard $(addprefix $(common-objpfx), \
1126 */lib*.so \
1127 iconvdata/*.so))))
1129 $(all-built-dso:=.dyn): %.dyn: %
1130 @rm -f $@T
1131 LC_ALL=C $(READELF) -W -d $< > $@T
1132 test -s $@T
1133 mv -f $@T $@
1134 common-generated += $(all-built-dso:$(common-objpfx)%=%.dyn)
1136 $(objpfx)check-textrel.out: $(..)scripts/check-textrel.awk \
1137 $(all-built-dso:=.dyn)
1138 LC_ALL=C $(AWK) -f $^ > $@; \
1139 $(evaluate-test)
1140 generated += check-textrel.out
1142 $(objpfx)execstack-default: $(first-word $(wildcard $(sysdirs:%=%/stackinfo.h)))
1143 $(make-target-directory)
1144 { echo '#include <elf.h>'; \
1145 echo '#include <stackinfo.h>'; \
1146 echo '#if (DEFAULT_STACK_PERMS & PF_X) == 0'; \
1147 echo '@@@execstack-no@@@'; \
1148 echo '#else'; \
1149 echo '@@@execstack-yes@@@'; \
1150 echo '#endif'; } | \
1151 $(CC) $(CFLAGS) $(CPPFLAGS) -E -x c-header - | \
1152 sed -n -e 's/^@@@\(.*\)@@@/\1/p' > $@T
1153 mv -f $@T $@
1154 generated += execstack-default
1156 $(all-built-dso:=.phdr): %.phdr: %
1157 @rm -f $@T
1158 LC_ALL=C $(READELF) -W -l $< > $@T
1159 test -s $@T
1160 mv -f $@T $@
1161 common-generated += $(all-built-dso:$(common-objpfx)%=%.phdr)
1163 $(objpfx)check-execstack.out: $(..)scripts/check-execstack.awk \
1164 $(objpfx)execstack-default \
1165 $(all-built-dso:=.phdr)
1166 LC_ALL=C $(AWK) -v "xfail=$(check-execstack-xfail)" -f $^ > $@; \
1167 $(evaluate-test)
1168 generated += check-execstack.out
1170 $(objpfx)check-wx-segment.out: $(..)scripts/check-wx-segment.py \
1171 $(all-built-dso:=.phdr)
1172 $(PYTHON) $^ --xfail="$(check-wx-segment-xfail)" > $@; \
1173 $(evaluate-test)
1174 generated += check-wx-segment.out
1176 $(objpfx)tst-dlmodcount.out: $(test-modules)
1178 $(all-built-dso:=.jmprel): %.jmprel: % Makefile
1179 @rm -f $@T
1180 LC_ALL=C $(READELF) -W -S -d -r $< > $@T
1181 test -s $@T
1182 mv -f $@T $@
1183 common-generated += $(all-built-dso:$(common-objpfx)%=%.jmprel)
1185 localplt-built-dso := $(addprefix $(common-objpfx),\
1186 libc.so \
1187 elf/ld.so \
1188 math/libm.so \
1189 dlfcn/libdl.so \
1190 resolv/libresolv.so \
1192 ifeq ($(build-mathvec),yes)
1193 localplt-built-dso += $(addprefix $(common-objpfx), mathvec/libmvec.so)
1194 endif
1195 ifeq ($(have-thread-library),yes)
1196 localplt-built-dso += $(filter-out %_nonshared.a, $(shared-thread-library))
1197 endif
1198 ifeq ($(build-crypt),yes)
1199 localplt-built-dso += $(addprefix $(common-objpfx), crypt/libcrypt.so)
1200 endif
1201 ifneq ($(pthread-in-libc),yes)
1202 localplt-built-dso += $(addprefix $(common-objpfx), rt/librt.so)
1203 endif
1205 vpath localplt.data $(+sysdep_dirs)
1207 $(objpfx)check-localplt.out: $(..)scripts/check-localplt.awk \
1208 $(..)scripts/localplt.awk \
1209 $(localplt-built-dso:=.jmprel) \
1210 localplt.data
1211 LC_ALL=C $(AWK) -f $(filter-out $< %localplt.data,$^) | \
1212 LC_ALL=C $(AWK) -f $< $(filter %localplt.data,$^) - \
1213 > $@; \
1214 $(evaluate-test)
1215 endif
1217 $(all-built-dso:=.dynsym): %.dynsym: %
1218 @rm -f $@T
1219 LC_ALL=C $(READELF) -W --dyn-syms $< > $@T
1220 test -s $@T
1221 mv -f $@T $@
1222 common-generated += $(all-built-dso:$(common-objpfx)%=%.dynsym)
1224 $(objpfx)check-initfini.out: $(..)scripts/check-initfini.awk \
1225 $(all-built-dso:=.dynsym)
1226 LC_ALL=C $(AWK) -f $^ > $@; \
1227 $(evaluate-test)
1228 generated += check-initfini.out
1230 $(objpfx)tst-dlopenrpath: $(objpfx)tst-dlopenrpathmod.so
1231 CFLAGS-tst-dlopenrpath.c += -DPFX=\"$(objpfx)\"
1232 LDFLAGS-tst-dlopenrpathmod.so += -Wl,-rpath,\$$ORIGIN/test-subdir
1233 $(objpfx)tst-dlopenrpath.out: $(objpfx)firstobj.so
1235 $(objpfx)tst-deep1mod2.so: $(objpfx)tst-deep1mod3.so
1236 $(objpfx)tst-deep1: $(objpfx)tst-deep1mod1.so
1237 $(objpfx)tst-deep1.out: $(objpfx)tst-deep1mod2.so
1238 LDFLAGS-tst-deep1 += -rdynamic
1239 tst-deep1mod3.so-no-z-defs = yes
1241 $(objpfx)tst-dlmopen1.out: $(objpfx)tst-dlmopen1mod.so
1243 $(objpfx)tst-dlmopen2.out: $(objpfx)tst-dlmopen1mod.so
1245 $(objpfx)tst-dlmopen3.out: $(objpfx)tst-dlmopen1mod.so
1247 $(objpfx)tst-audit1.out: $(objpfx)tst-auditmod1.so
1248 tst-audit1-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1250 $(objpfx)tst-audit2.out: $(objpfx)tst-auditmod1.so $(objpfx)tst-auditmod9b.so
1251 # Prevent GCC-5 from translating a malloc/memset pair into calloc
1252 CFLAGS-tst-audit2.c += -fno-builtin
1253 tst-audit2-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1255 $(objpfx)tst-audit9.out: $(objpfx)tst-auditmod9a.so $(objpfx)tst-auditmod9b.so
1256 tst-audit9-ENV = LD_AUDIT=$(objpfx)tst-auditmod9a.so
1258 $(objpfx)tst-audit8: $(libm)
1259 $(objpfx)tst-audit8.out: $(objpfx)tst-auditmod1.so
1260 tst-audit8-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1262 $(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
1264 $(objpfx)order2.out: $(objpfx)order2mod1.so $(objpfx)order2mod2.so
1265 $(objpfx)order2-cmp.out: $(objpfx)order2.out
1266 (echo "12345" | cmp $< -) > $@; \
1267 $(evaluate-test)
1268 $(objpfx)order2mod1.so: $(objpfx)order2mod4.so
1269 $(objpfx)order2mod4.so: $(objpfx)order2mod3.so
1270 $(objpfx)order2mod2.so: $(objpfx)order2mod3.so
1271 order2mod2.so-no-z-defs = yes
1272 LDFLAGS-order2mod1.so = -Wl,--no-as-needed
1273 LDFLAGS-order2mod2.so = -Wl,--no-as-needed
1275 tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child"
1276 tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
1278 tst-ptrguard1-ARGS = --command "$(host-test-program-cmd) --child"
1279 # When built statically, the pointer guard interface uses
1280 # __pointer_chk_guard_local.
1281 CFLAGS-tst-ptrguard1-static.c += -DPTRGUARD_LOCAL
1282 tst-ptrguard1-static-ARGS = --command "$(objpfx)tst-ptrguard1-static --child"
1284 $(objpfx)tst-leaks1-mem.out: $(objpfx)tst-leaks1.out
1285 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1.mtrace > $@; \
1286 $(evaluate-test)
1288 tst-leaks1-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1.mtrace \
1289 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
1291 $(objpfx)tst-thrlock: $(shared-thread-library)
1292 $(objpfx)tst-thrlock.out: $(libm)
1293 $(objpfx)tst-noload.out: $(libm)
1295 tst-tst-dlopen-tlsmodid-no-pie = yes
1296 $(objpfx)tst-dlopen-tlsmodid: $(shared-thread-library)
1297 $(objpfx)tst-dlopen-tlsmodid.out: $(objpfx)tst-dlopen-self
1298 CFLAGS-tst-dlopen-tlsmodid-pie.c += $(pie-ccflag)
1299 $(objpfx)tst-dlopen-tlsmodid-pie: $(shared-thread-library)
1300 $(objpfx)tst-dlopen-tlsmodid-pie.out: $(objpfx)tst-dlopen-self-pie
1301 $(objpfx)tst-dlopen-tlsmodid-container: $(shared-thread-library)
1302 LDFLAGS-tst-dlopen-tlsmodid-container += -Wl,-rpath,\$$ORIGIN
1304 tst-tst-dlopen-self-no-pie = yes
1305 CFLAGS-tst-dlopen-self-pie.c += $(pie-ccflag)
1306 LDFLAGS-tst-dlopen-self-container += -Wl,-rpath,\$$ORIGIN
1308 CFLAGS-ifuncmain1pic.c += $(pic-ccflag)
1309 CFLAGS-ifuncmain1picstatic.c += $(pic-ccflag)
1310 CFLAGS-ifuncmain1staticpic.c += $(pic-ccflag)
1311 CFLAGS-ifuncdep1pic.c += $(pic-ccflag)
1312 CFLAGS-ifuncmain1vispic.c += $(pic-ccflag)
1313 CFLAGS-ifuncmain2pic.c += $(pic-ccflag)
1314 CFLAGS-ifuncmain2picstatic.c += $(pic-ccflag)
1315 CFLAGS-ifuncdep2pic.c += $(pic-ccflag)
1316 CFLAGS-ifuncmain4picstatic.c += $(pic-ccflag)
1317 CFLAGS-ifuncmain5pic.c += $(pic-ccflag)
1318 CFLAGS-ifuncmain5picstatic.c += $(pic-ccflag)
1319 CFLAGS-ifuncmain5staticpic.c += $(pic-ccflag)
1320 CFLAGS-ifuncdep5pic.c += $(pic-ccflag)
1321 CFLAGS-ifuncmain7pic.c += $(pic-ccflag)
1322 CFLAGS-ifuncmain7picstatic.c += $(pic-ccflag)
1323 CFLAGS-ifuncmain9pic.c += $(pic-ccflag)
1324 CFLAGS-ifuncmain9picstatic.c += $(pic-ccflag)
1326 LDFLAGS-ifuncmain3 = -Wl,-export-dynamic
1328 CFLAGS-ifuncmain1pie.c += $(pie-ccflag)
1329 CFLAGS-ifuncmain1vispie.c += $(pie-ccflag)
1330 CFLAGS-ifuncmain1staticpie.c += $(pie-ccflag)
1331 CFLAGS-ifuncmain5pie.c += $(pie-ccflag)
1332 CFLAGS-ifuncmain6pie.c += $(pie-ccflag)
1333 CFLAGS-ifuncmain7pie.c += $(pie-ccflag)
1334 CFLAGS-ifuncmain9pie.c += $(pie-ccflag)
1335 CFLAGS-tst-ifunc-textrel.c += $(pic-ccflag)
1337 LDFLAGS-ifuncmain6pie = -Wl,-z,lazy
1339 $(objpfx)ifuncmain1pie: $(objpfx)ifuncmod1.so
1340 $(objpfx)ifuncmain1staticpie: $(objpfx)ifuncdep1pic.o
1341 $(objpfx)ifuncmain1vispie: $(objpfx)ifuncmod1.so
1342 $(objpfx)ifuncmain5pie: $(objpfx)ifuncmod5.so
1343 $(objpfx)ifuncmain6pie: $(objpfx)ifuncmod6.so
1345 $(objpfx)ifuncmain1: $(addprefix $(objpfx),ifuncmod1.so)
1346 $(objpfx)ifuncmain1pic: $(addprefix $(objpfx),ifuncmod1.so)
1347 $(objpfx)ifuncmain1staticpic: $(addprefix $(objpfx),ifuncdep1pic.o)
1348 $(objpfx)ifuncmain1static: $(addprefix $(objpfx),ifuncdep1.o)
1349 $(objpfx)ifuncmain1picstatic: $(addprefix $(objpfx),ifuncdep1pic.o)
1350 $(objpfx)ifuncmain1vis: $(addprefix $(objpfx),ifuncmod1.so)
1351 $(objpfx)ifuncmain1vispic: $(addprefix $(objpfx),ifuncmod1.so)
1352 $(objpfx)ifuncmain2: $(addprefix $(objpfx),ifuncdep2.o)
1353 $(objpfx)ifuncmain2pic: $(addprefix $(objpfx),ifuncdep2pic.o)
1354 $(objpfx)ifuncmain2static: $(addprefix $(objpfx),ifuncdep2.o)
1355 $(objpfx)ifuncmain2picstatic: $(addprefix $(objpfx),ifuncdep2pic.o)
1357 $(objpfx)ifuncmain3.out: $(objpfx)ifuncmod3.so
1359 $(objpfx)ifuncmain5: $(addprefix $(objpfx),ifuncmod5.so)
1360 $(objpfx)ifuncmain5pic: $(addprefix $(objpfx),ifuncmod5.so)
1361 $(objpfx)ifuncmain5static: $(addprefix $(objpfx),ifuncdep5.o)
1362 $(objpfx)ifuncmain5staticpic: $(addprefix $(objpfx),ifuncdep5pic.o)
1363 $(objpfx)ifuncmain5picstatic: $(addprefix $(objpfx),ifuncdep5pic.o)
1365 LDFLAGS-tst-ifunc-fault-lazy = -Wl,-z,lazy
1366 LDFLAGS-tst-ifunc-fault-bindnow = -Wl,-z,now
1367 define tst-ifunc-fault-script
1368 ( $(test-wrapper) $(rtld-prefix) --verify $^ \
1369 && $(test-wrapper-env) LD_TRACE_LOADED_OBJECTS=1 $(rtld-prefix) $^ \
1370 && $(test-wrapper-env) LD_TRACE_LOADED_OBJECTS=1 LD_DEBUG=unused \
1371 $(rtld-prefix) $^ \
1372 ) > $@; $(evaluate-test)
1373 endef
1374 $(objpfx)tst-ifunc-fault-lazy.out: $(objpfx)tst-ifunc-fault-lazy $(objpfx)ld.so
1375 $(tst-ifunc-fault-script)
1376 $(objpfx)tst-ifunc-fault-bindnow.out: $(objpfx)tst-ifunc-fault-bindnow \
1377 $(objpfx)ld.so
1378 $(tst-ifunc-fault-script)
1380 $(objpfx)tst-unique1.out: $(objpfx)tst-unique1mod1.so \
1381 $(objpfx)tst-unique1mod2.so
1383 $(objpfx)tst-unique2: $(objpfx)tst-unique2mod1.so
1384 $(objpfx)tst-unique2.out: $(objpfx)tst-unique2mod2.so
1386 $(objpfx)tst-unique3: $(objpfx)tst-unique3lib.so
1387 $(objpfx)tst-unique3.out: $(objpfx)tst-unique3lib2.so
1389 $(objpfx)tst-unique4: $(objpfx)tst-unique4lib.so
1391 $(objpfx)tst-nodelete.out: $(objpfx)tst-nodelete-uniquemod.so \
1392 $(objpfx)tst-nodelete-rtldmod.so \
1393 $(objpfx)tst-nodelete-zmod.so
1395 LDFLAGS-tst-nodelete = -rdynamic
1396 LDFLAGS-tst-nodelete-zmod.so = -Wl,--enable-new-dtags,-z,nodelete
1398 $(objpfx)tst-nodelete2.out: $(objpfx)tst-nodelete2mod.so
1400 LDFLAGS-tst-nodelete2 = -rdynamic
1402 $(objpfx)tst-initorder-cmp.out: tst-initorder.exp $(objpfx)tst-initorder.out
1403 cmp $^ > $@; \
1404 $(evaluate-test)
1406 $(objpfx)tst-initorder2: $(objpfx)tst-initorder2a.so $(objpfx)tst-initorder2d.so $(objpfx)tst-initorder2c.so
1407 $(objpfx)tst-initorder2a.so: $(objpfx)tst-initorder2b.so
1408 $(objpfx)tst-initorder2b.so: $(objpfx)tst-initorder2c.so
1409 $(objpfx)tst-initorder2c.so: $(objpfx)tst-initorder2d.so
1410 LDFLAGS-tst-initorder2 = -Wl,--no-as-needed
1411 LDFLAGS-tst-initorder2a.so = -Wl,--no-as-needed
1412 LDFLAGS-tst-initorder2b.so = -Wl,--no-as-needed
1413 LDFLAGS-tst-initorder2c.so = -Wl,--no-as-needed
1414 define o-iterator-doit
1415 $(objpfx)tst-initorder2$o.os: tst-initorder2.c; \
1416 $$(compile-command.c) -DNAME=\"$o\"
1417 endef
1418 object-suffixes-left := a b c d
1419 include $(o-iterator)
1421 $(objpfx)tst-initorder2-cmp.out: tst-initorder2.exp $(objpfx)tst-initorder2.out
1422 cmp $^ > $@; \
1423 $(evaluate-test)
1425 $(objpfx)tst-relsort1mod1.so: $(libm) $(objpfx)tst-relsort1mod2.so
1426 $(objpfx)tst-relsort1mod2.so: $(libm)
1427 $(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
1428 $(objpfx)tst-relsort1mod2.so
1430 $(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so
1431 $(test-wrapper-env) \
1432 LD_TRACE_LOADED_OBJECTS=1 \
1433 LD_DEBUG=unused \
1434 LD_PRELOAD= \
1435 $(rtld-prefix) \
1436 $< > $@; \
1437 $(evaluate-test)
1439 $(objpfx)tst-unused-dep-cmp.out: $(objpfx)tst-unused-dep.out
1440 cmp $< /dev/null > $@; \
1441 $(evaluate-test)
1443 $(objpfx)tst-audit11.out: $(objpfx)tst-auditmod11.so $(objpfx)tst-audit11mod1.so
1444 tst-audit11-ENV = LD_AUDIT=$(objpfx)tst-auditmod11.so
1445 $(objpfx)tst-audit11mod1.so: $(objpfx)tst-audit11mod2.so
1446 LDFLAGS-tst-audit11mod2.so = -Wl,--version-script=tst-audit11mod2.map,-soname,tst-audit11mod2.so
1448 $(objpfx)tst-audit12.out: $(objpfx)tst-auditmod12.so $(objpfx)tst-audit12mod1.so $(objpfx)tst-audit12mod3.so
1449 tst-audit12-ENV = LD_AUDIT=$(objpfx)tst-auditmod12.so
1450 $(objpfx)tst-audit12mod1.so: $(objpfx)tst-audit12mod2.so
1451 LDFLAGS-tst-audit12mod2.so = -Wl,--version-script=tst-audit12mod2.map
1453 $(objpfx)tst-audit13.out: $(objpfx)tst-audit13mod1.so
1454 LDFLAGS-tst-audit13mod1.so = -Wl,-z,lazy
1455 tst-audit13-ENV = LD_AUDIT=$(objpfx)tst-audit13mod1.so
1457 $(objpfx)tst-auditmany.out: $(objpfx)tst-auditmanymod1.so \
1458 $(objpfx)tst-auditmanymod2.so $(objpfx)tst-auditmanymod3.so \
1459 $(objpfx)tst-auditmanymod4.so $(objpfx)tst-auditmanymod5.so \
1460 $(objpfx)tst-auditmanymod6.so $(objpfx)tst-auditmanymod7.so \
1461 $(objpfx)tst-auditmanymod8.so $(objpfx)tst-auditmanymod9.so
1462 tst-auditmany-ENV = \
1463 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
1465 LDFLAGS-tst-audit14 = -Wl,--audit=tst-auditlogmod-1.so
1466 $(objpfx)tst-auditlogmod-1.so: $(libsupport)
1467 $(objpfx)tst-audit14.out: $(objpfx)tst-auditlogmod-1.so
1468 LDFLAGS-tst-audit15 = \
1469 -Wl,--audit=tst-auditlogmod-1.so,--depaudit=tst-auditlogmod-2.so
1470 $(objpfx)tst-auditlogmod-2.so: $(libsupport)
1471 $(objpfx)tst-audit15.out: \
1472 $(objpfx)tst-auditlogmod-1.so $(objpfx)tst-auditlogmod-2.so
1473 LDFLAGS-tst-audit16 = \
1474 -Wl,--audit=tst-auditlogmod-1.so:tst-auditlogmod-2.so \
1475 -Wl,--depaudit=tst-auditlogmod-3.so
1476 $(objpfx)tst-auditlogmod-3.so: $(libsupport)
1477 $(objpfx)tst-audit16.out: \
1478 $(objpfx)tst-auditlogmod-1.so $(objpfx)tst-auditlogmod-2.so \
1479 $(objpfx)tst-auditlogmod-3.so
1480 $(objpfx)tst-audit17.out: $(objpfx)tst-auditmod17.so
1481 # The test check if a audit library without libc.so on DT_NEEDED works as
1482 # intended, so it uses an explicit link rule.
1483 $(objpfx)tst-auditmod17.so: $(objpfx)tst-auditmod17.os
1484 $(CC) -nostdlib -nostartfiles -shared -o $@.new \
1485 $(filter-out $(map-file),$^)
1486 $(call after-link,$@.new)
1487 mv -f $@.new $@
1488 CFLAGS-.os += $(call elide-stack-protector,.os,tst-auditmod17)
1489 tst-audit17-ENV = LD_AUDIT=$(objpfx)tst-auditmod17.so
1491 # tst-sonamemove links against an older implementation of the library.
1492 LDFLAGS-tst-sonamemove-linkmod1.so = \
1493 -Wl,--version-script=tst-sonamemove-linkmod1.map \
1494 -Wl,-soname,tst-sonamemove-runmod1.so
1495 LDFLAGS-tst-sonamemove-runmod1.so = -Wl,--no-as-needed \
1496 -Wl,--version-script=tst-sonamemove-runmod1.map \
1497 -Wl,-soname,tst-sonamemove-runmod1.so
1498 LDFLAGS-tst-sonamemove-runmod2.so = \
1499 -Wl,--version-script=tst-sonamemove-runmod2.map \
1500 -Wl,-soname,tst-sonamemove-runmod2.so
1501 $(objpfx)tst-sonamemove-runmod1.so: $(objpfx)tst-sonamemove-runmod2.so
1502 # Link against the link module, but depend on the run-time modules
1503 # for execution.
1504 $(objpfx)tst-sonamemove-link: $(objpfx)tst-sonamemove-linkmod1.so
1505 $(objpfx)tst-sonamemove-link.out: \
1506 $(objpfx)tst-sonamemove-runmod1.so \
1507 $(objpfx)tst-sonamemove-runmod2.so
1508 $(objpfx)tst-sonamemove-dlopen.out: \
1509 $(objpfx)tst-sonamemove-runmod1.so \
1510 $(objpfx)tst-sonamemove-runmod2.so
1512 $(objpfx)tst-dlmopen-dlerror-mod.so: $(libsupport)
1513 $(objpfx)tst-dlmopen-dlerror.out: $(objpfx)tst-dlmopen-dlerror-mod.so
1515 # Override -z defs, so that we can reference an undefined symbol.
1516 # Force lazy binding for the same reason.
1517 LDFLAGS-tst-latepthreadmod.so = \
1518 -Wl,-z,lazy -Wl,--unresolved-symbols=ignore-all
1519 # Do not optimize sibling calls as the test relies on a JMP_SLOT relocation for
1520 # function this_function_is_not_defined.
1521 CFLAGS-tst-latepthreadmod.c += -fno-optimize-sibling-calls
1522 $(objpfx)tst-latepthreadmod.so: $(shared-thread-library)
1523 $(objpfx)tst-latepthread.out: $(objpfx)tst-latepthreadmod.so
1525 # The test modules are parameterized by preprocessor macros.
1526 $(patsubst %,$(objpfx)%.os,$(tst-tls-many-dynamic-modules)): \
1527 $(objpfx)tst-tls-manydynamic%mod.os : tst-tls-manydynamicmod.c
1528 $(compile-command.c) \
1529 -DNAME=tls_global_$* -DSETTER=set_value_$* -DGETTER=get_value_$*
1530 $(objpfx)tst-tls-manydynamic: $(shared-thread-library)
1531 $(objpfx)tst-tls-manydynamic.out: \
1532 $(patsubst %,$(objpfx)%.so,$(tst-tls-many-dynamic-modules))
1534 tst-prelink-ENV = LD_TRACE_PRELINKING=1
1536 $(objpfx)tst-prelink-conflict.out: $(objpfx)tst-prelink.out
1537 grep stdout $< | grep conflict | $(AWK) '{ print $$10, $$11 }' > $@
1539 $(objpfx)tst-prelink-cmp.out: $(objpfx)tst-prelink-conflict.out
1541 $(objpfx)tst-ldconfig-X.out : tst-ldconfig-X.sh $(objpfx)ldconfig
1542 $(SHELL) $< '$(common-objpfx)' '$(test-wrapper-env)' \
1543 '$(run-program-env)' > $@; \
1544 $(evaluate-test)
1546 # Test static linking of all the libraries we can possibly link
1547 # together. Note that in some configurations this may be less than the
1548 # complete list of libraries we build but we try to maxmimize this list.
1549 $(objpfx)tst-linkall-static: \
1550 $(common-objpfx)math/libm.a \
1551 $(common-objpfx)resolv/libresolv.a \
1552 $(common-objpfx)login/libutil.a \
1553 $(common-objpfx)rt/librt.a \
1554 $(common-objpfx)resolv/libanl.a \
1555 $(static-thread-library)
1557 ifeq ($(build-crypt),yes)
1558 # If we are using NSS crypto and we have the ability to link statically
1559 # then we include libcrypt.a, otherwise we leave out libcrypt.a and
1560 # link as much as we can into the tst-linkall-static test. This assumes
1561 # that linking with libcrypt.a does everything required to include the
1562 # static NSS crypto library.
1563 ifeq (yesyes,$(nss-crypt)$(static-nss-crypt))
1564 $(objpfx)tst-linkall-static: \
1565 $(common-objpfx)crypt/libcrypt.a
1566 endif
1567 # If we are not using NSS crypto then we always have the ability to link
1568 # with libcrypt.a.
1569 ifeq (no,$(nss-crypt))
1570 $(objpfx)tst-linkall-static: \
1571 $(common-objpfx)crypt/libcrypt.a
1572 endif
1573 endif
1575 # The application depends on the DSO, and the DSO loads the plugin.
1576 # The plugin also depends on the DSO. This creates the circular
1577 # dependency via dlopen that we're testing to make sure works.
1578 $(objpfx)tst-nodelete-dlclose-plugin.so: $(objpfx)tst-nodelete-dlclose-dso.so
1579 $(objpfx)tst-nodelete-dlclose: $(objpfx)tst-nodelete-dlclose-dso.so
1580 $(objpfx)tst-nodelete-dlclose.out: $(objpfx)tst-nodelete-dlclose-dso.so \
1581 $(objpfx)tst-nodelete-dlclose-plugin.so
1583 tst-env-setuid-ENV = MALLOC_CHECK_=2 MALLOC_MMAP_THRESHOLD_=4096 \
1584 LD_HWCAP_MASK=0x1
1586 $(objpfx)tst-debug1.out: $(objpfx)tst-debug1mod1.so
1588 $(objpfx)tst-debug1mod1.so: $(objpfx)testobj1.so
1589 $(OBJCOPY) --only-keep-debug $< $@
1591 $(objpfx)tst-main1: $(objpfx)tst-main1mod.so
1592 CRT-tst-main1 := $(csu-objpfx)crt1.o
1593 tst-main1-no-pie = yes
1594 LDLIBS-tst-main1 = $(libsupport)
1595 tst-main1mod.so-no-z-defs = yes
1597 LDLIBS-tst-absolute-sym-lib.so = tst-absolute-sym-lib.lds
1598 $(objpfx)tst-absolute-sym-lib.so: $(LDLIBS-tst-absolute-sym-lib.so)
1599 $(objpfx)tst-absolute-sym: $(objpfx)tst-absolute-sym-lib.so
1601 LDLIBS-tst-absolute-zero-lib.so = tst-absolute-zero-lib.lds
1602 $(objpfx)tst-absolute-zero-lib.so: $(LDLIBS-tst-absolute-zero-lib.so)
1603 $(objpfx)tst-absolute-zero: $(objpfx)tst-absolute-zero-lib.so
1605 $(objpfx)tst-big-note: $(objpfx)tst-big-note-lib.so
1606 # Avoid creating an ABI tag note, which may come before the
1607 # artificial, large note in tst-big-note-lib.o and invalidate the
1608 # test.
1609 $(objpfx)tst-big-note-lib.so: $(objpfx)tst-big-note-lib.o
1610 $(LINK.o) -shared -o $@ $(LDFLAGS.so) $<
1612 $(objpfx)tst-unwind-ctor: $(objpfx)tst-unwind-ctor-lib.so
1614 CFLAGS-tst-unwind-main.c += -funwind-tables -DUSE_PTHREADS=0
1616 $(objpfx)tst-initfinilazyfail.out: \
1617 $(objpfx)tst-initlazyfailmod.so $(objpfx)tst-finilazyfailmod.so
1618 # Override -z defs, so that we can reference an undefined symbol.
1619 # Force lazy binding for the same reason.
1620 LDFLAGS-tst-initlazyfailmod.so = \
1621 -Wl,-z,lazy -Wl,--unresolved-symbols=ignore-all
1622 LDFLAGS-tst-finilazyfailmod.so = \
1623 -Wl,-z,lazy -Wl,--unresolved-symbols=ignore-all
1625 $(objpfx)tst-dlopenfail.out: \
1626 $(objpfx)tst-dlopenfailmod1.so $(objpfx)tst-dlopenfailmod2.so
1627 # Order matters here. tst-dlopenfaillinkmod.so's soname ensures a
1628 # run-time loader failure. --as-needed breaks this test because
1629 # nothing actually references tst-dlopenfailmod2.so (with its soname
1630 # tst-dlopenfail-missingmod.so).
1631 LDFLAGS-tst-dlopenfailmod1.so = -Wl,--no-as-needed
1632 $(objpfx)tst-dlopenfailmod1.so: \
1633 $(shared-thread-library) $(objpfx)tst-dlopenfaillinkmod.so
1634 LDFLAGS-tst-dlopenfaillinkmod.so = -Wl,-soname,tst-dlopenfail-missingmod.so
1635 $(objpfx)tst-dlopenfailmod2.so: $(objpfx)tst-dlopenfailnodelmod.so
1636 $(objpfx)tst-dlopenfail-2.out: \
1637 $(objpfx)tst-dlopenfailmod1.so $(objpfx)tst-dlopenfailmod2.so \
1638 $(objpfx)tst-dlopenfailmod3.so
1639 # tst-dlopenfailnodelmod.so emulates how libpthread was linked.
1640 $(objpfx)tst-dlopenfailnodelmod.so: $(libsupport)
1641 LDFLAGS-tst-dlopenfailnodelmod.so = \
1642 -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
1643 # tst-dlopenfail should export the libsupport symbols, so that
1644 # tst-dlopenfailnodelmod.so uses them for error reporting.
1645 LDFLAGS-tst-dlopenfail = -Wl,-E
1647 $(objpfx)tst-dlopen-nodelete-reloc.out: \
1648 $(objpfx)tst-dlopen-nodelete-reloc-mod1.so \
1649 $(objpfx)tst-dlopen-nodelete-reloc-mod2.so \
1650 $(objpfx)tst-dlopen-nodelete-reloc-mod3.so \
1651 $(objpfx)tst-dlopen-nodelete-reloc-mod4.so \
1652 $(objpfx)tst-dlopen-nodelete-reloc-mod5.so \
1653 $(objpfx)tst-dlopen-nodelete-reloc-mod6.so \
1654 $(objpfx)tst-dlopen-nodelete-reloc-mod7.so \
1655 $(objpfx)tst-dlopen-nodelete-reloc-mod8.so \
1656 $(objpfx)tst-dlopen-nodelete-reloc-mod9.so \
1657 $(objpfx)tst-dlopen-nodelete-reloc-mod10.so \
1658 $(objpfx)tst-dlopen-nodelete-reloc-mod11.so \
1659 $(objpfx)tst-dlopen-nodelete-reloc-mod12.so \
1660 $(objpfx)tst-dlopen-nodelete-reloc-mod13.so \
1661 $(objpfx)tst-dlopen-nodelete-reloc-mod14.so \
1662 $(objpfx)tst-dlopen-nodelete-reloc-mod15.so \
1663 $(objpfx)tst-dlopen-nodelete-reloc-mod16.so \
1664 $(objpfx)tst-dlopen-nodelete-reloc-mod17.so
1665 tst-dlopen-nodelete-reloc-mod2.so-no-z-defs = yes
1666 LDFLAGS-tst-dlopen-nodelete-reloc-mod2.so = -Wl,-z,nodelete
1667 $(objpfx)tst-dlopen-nodelete-reloc-mod4.so: \
1668 $(objpfx)tst-dlopen-nodelete-reloc-mod3.so
1669 LDFLAGS-tst-dlopen-nodelete-reloc-mod4.so = -Wl,--no-as-needed
1670 $(objpfx)tst-dlopen-nodelete-reloc-mod5.so: \
1671 $(objpfx)tst-dlopen-nodelete-reloc-mod4.so
1672 LDFLAGS-tst-dlopen-nodelete-reloc-mod5.so = -Wl,-z,nodelete,--no-as-needed
1673 tst-dlopen-nodelete-reloc-mod5.so-no-z-defs = yes
1674 tst-dlopen-nodelete-reloc-mod7.so-no-z-defs = yes
1675 tst-dlopen-nodelete-reloc-mod11.so-no-z-defs = yes
1676 $(objpfx)tst-dlopen-nodelete-reloc-mod13.so: \
1677 $(objpfx)tst-dlopen-nodelete-reloc-mod12.so
1678 $(objpfx)tst-dlopen-nodelete-reloc-mod15.so: \
1679 $(objpfx)tst-dlopen-nodelete-reloc-mod14.so
1680 tst-dlopen-nodelete-reloc-mod16.so-no-z-defs = yes
1681 $(objpfx)tst-dlopen-nodelete-reloc-mod16.so: \
1682 $(objpfx)tst-dlopen-nodelete-reloc-mod15.so
1683 LDFLAGS-tst-dlopen-nodelete-reloc-mod16.so = -Wl,--no-as-needed
1684 $(objpfx)tst-dlopen-nodelete-reloc-mod17.so: \
1685 $(objpfx)tst-dlopen-nodelete-reloc-mod15.so \
1686 $(objpfx)tst-dlopen-nodelete-reloc-mod16.so
1687 LDFLAGS-tst-dlopen-nodelete-reloc-mod17.so = -Wl,--no-as-needed
1689 $(objpfx)tst-ldconfig-ld_so_conf-update.out: $(objpfx)tst-ldconfig-ld-mod.so
1691 LDFLAGS-tst-filterobj-flt.so = -Wl,--filter=$(objpfx)tst-filterobj-filtee.so
1692 $(objpfx)tst-filterobj: $(objpfx)tst-filterobj-flt.so
1693 $(objpfx)tst-filterobj.out: $(objpfx)tst-filterobj-filtee.so
1694 $(objpfx)tst-filterobj-dlopen.out: $(objpfx)tst-filterobj-filtee.so
1696 LDFLAGS-tst-filterobj-aux.so = -Wl,--auxiliary=$(objpfx)tst-filterobj-filtee.so
1697 $(objpfx)tst-auxobj: $(objpfx)tst-filterobj-aux.so
1698 $(objpfx)tst-auxobj.out: $(objpfx)tst-filterobj-filtee.so
1699 $(objpfx)tst-auxobj-dlopen.out: $(objpfx)tst-filterobj-filtee.so
1701 $(objpfx)tst-single_threaded: $(objpfx)tst-single_threaded-mod1.so
1702 $(objpfx)tst-single_threaded.out: \
1703 $(objpfx)tst-single_threaded-mod2.so $(objpfx)tst-single_threaded-mod3.so
1704 $(objpfx)tst-single_threaded-static-dlopen: \
1705 $(objpfx)tst-single_threaded-mod1.o
1706 $(objpfx)tst-single_threaded-static-dlopen.out: \
1707 $(objpfx)tst-single_threaded-mod2.so
1708 $(objpfx)tst-single_threaded-pthread: \
1709 $(objpfx)tst-single_threaded-mod1.so $(shared-thread-library)
1710 $(objpfx)tst-single_threaded-pthread.out: \
1711 $(objpfx)tst-single_threaded-mod2.so $(objpfx)tst-single_threaded-mod3.so \
1712 $(objpfx)tst-single_threaded-mod4.so
1713 $(objpfx)tst-single_threaded-pthread-static: $(static-thread-library)
1715 $(objpfx)tst-tls-ie: $(shared-thread-library)
1716 $(objpfx)tst-tls-ie.out: \
1717 $(objpfx)tst-tls-ie-mod0.so \
1718 $(objpfx)tst-tls-ie-mod1.so \
1719 $(objpfx)tst-tls-ie-mod2.so \
1720 $(objpfx)tst-tls-ie-mod3.so \
1721 $(objpfx)tst-tls-ie-mod4.so \
1722 $(objpfx)tst-tls-ie-mod5.so \
1723 $(objpfx)tst-tls-ie-mod6.so
1725 $(objpfx)tst-tls-ie-dlmopen: $(shared-thread-library)
1726 $(objpfx)tst-tls-ie-dlmopen.out: \
1727 $(objpfx)tst-tls-ie-mod0.so \
1728 $(objpfx)tst-tls-ie-mod1.so \
1729 $(objpfx)tst-tls-ie-mod2.so \
1730 $(objpfx)tst-tls-ie-mod3.so \
1731 $(objpfx)tst-tls-ie-mod4.so \
1732 $(objpfx)tst-tls-ie-mod5.so \
1733 $(objpfx)tst-tls-ie-mod6.so
1735 $(objpfx)argv0test.out: tst-rtld-argv0.sh $(objpfx)ld.so \
1736 $(objpfx)argv0test
1737 $(SHELL) $< $(objpfx)ld.so $(objpfx)argv0test \
1738 '$(test-wrapper-env)' '$(run_program_env)' \
1739 '$(rpath-link)' 'test-argv0' > $@; \
1740 $(evaluate-test)
1742 # A list containing the name of the most likely searched subdirectory
1743 # of the glibc-hwcaps directory, for each supported architecture (in
1744 # other words, the oldest hardware level recognized by the
1745 # glibc-hwcaps mechanism for this architecture). Used to obtain test
1746 # coverage for some glibc-hwcaps tests for the widest possible range
1747 # of systems.
1748 glibc-hwcaps-first-subdirs-for-tests = power9 x86-64-v2 z13
1750 # The test modules are parameterized by preprocessor macros.
1751 LDFLAGS-libmarkermod1-1.so += -Wl,-soname,libmarkermod1.so
1752 LDFLAGS-libmarkermod2-1.so += -Wl,-soname,libmarkermod2.so
1753 LDFLAGS-libmarkermod3-1.so += -Wl,-soname,libmarkermod3.so
1754 LDFLAGS-libmarkermod4-1.so += -Wl,-soname,libmarkermod4.so
1755 $(objpfx)libmarkermod%.os : markermodMARKER-VALUE.c
1756 $(compile-command.c) \
1757 -DMARKER=marker$(firstword $(subst -, ,$*)) \
1758 -DVALUE=$(lastword $(subst -, ,$*))
1759 $(objpfx)libmarkermod1.so: $(objpfx)libmarkermod1-1.so
1760 cp $< $@
1761 $(objpfx)libmarkermod2.so: $(objpfx)libmarkermod2-1.so
1762 cp $< $@
1763 $(objpfx)libmarkermod3.so: $(objpfx)libmarkermod3-1.so
1764 cp $< $@
1765 $(objpfx)libmarkermod4.so: $(objpfx)libmarkermod4-1.so
1766 cp $< $@
1768 # tst-glibc-hwcaps-prepend checks that --glibc-hwcaps-prepend is
1769 # preferred over auto-detected subdirectories.
1770 $(objpfx)tst-glibc-hwcaps-prepend: $(objpfx)libmarkermod1-1.so
1771 $(objpfx)glibc-hwcaps/prepend-markermod1/libmarkermod1.so: \
1772 $(objpfx)libmarkermod1-2.so
1773 $(make-target-directory)
1774 cp $< $@
1775 $(objpfx)glibc-hwcaps/%/libmarkermod1.so: $(objpfx)libmarkermod1-3.so
1776 $(make-target-directory)
1777 cp $< $@
1778 $(objpfx)tst-glibc-hwcaps-prepend.out: \
1779 $(objpfx)tst-glibc-hwcaps-prepend $(objpfx)libmarkermod1.so \
1780 $(patsubst %,$(objpfx)glibc-hwcaps/%/libmarkermod1.so,prepend-markermod1 \
1781 $(glibc-hwcaps-first-subdirs-for-tests))
1782 $(test-wrapper) $(rtld-prefix) \
1783 --glibc-hwcaps-prepend prepend-markermod1 \
1784 $< > $@; \
1785 $(evaluate-test)
1787 # Like tst-glibc-hwcaps-prepend, but uses a container and loads the
1788 # library via ld.so.cache. Test setup is contained in the test
1789 # itself.
1790 $(objpfx)tst-glibc-hwcaps-prepend-cache.out: \
1791 $(objpfx)tst-glibc-hwcaps-prepend-cache $(objpfx)libmarkermod1-1.so \
1792 $(objpfx)libmarkermod1-2.so $(objpfx)libmarkermod1-3.so
1794 # tst-glibc-hwcaps-mask checks that --glibc-hwcaps-mask can be used to
1795 # suppress all auto-detected subdirectories.
1796 $(objpfx)tst-glibc-hwcaps-mask: $(objpfx)libmarkermod1-1.so
1797 $(objpfx)tst-glibc-hwcaps-mask.out: \
1798 $(objpfx)tst-glibc-hwcaps-mask $(objpfx)libmarkermod1.so \
1799 $(patsubst %,$(objpfx)glibc-hwcaps/%/libmarkermod1.so,\
1800 $(glibc-hwcaps-first-subdirs-for-tests))
1801 $(test-wrapper) $(rtld-prefix) \
1802 --glibc-hwcaps-mask does-not-exist \
1803 $< > $@; \
1804 $(evaluate-test)
1806 # Generic dependency for sysdeps implementation of
1807 # tst-glibc-hwcaps-cache.
1808 $(objpfx)tst-glibc-hwcaps-cache.out: $(objpfx)tst-glibc-hwcaps
1810 $(objpfx)list-tunables.out: tst-rtld-list-tunables.sh $(objpfx)ld.so
1811 $(SHELL) $< $(objpfx)ld.so '$(test-wrapper-env)' \
1812 '$(run_program_env)' > $(objpfx)/tst-rtld-list-tunables.out
1813 cmp tst-rtld-list-tunables.exp \
1814 $(objpfx)/tst-rtld-list-tunables.out > $@; \
1815 $(evaluate-test)
1817 tst-dst-static-ENV = LD_LIBRARY_PATH='$$ORIGIN'
1819 $(objpfx)tst-rtld-help.out: $(objpfx)ld.so
1820 $(test-wrapper) $(rtld-prefix) --help > $@; \
1821 status=$$?; \
1822 echo "info: ld.so exit status: $$status" >> $@; \
1823 if ! grep -q 'Legacy HWCAP subdirectories under library search path directories' $@; then \
1824 echo "error: missing subdirectory pattern" >> $@; \
1825 if test $$status -eq 0; then \
1826 status=1; \
1827 fi; \
1828 fi; \
1829 (exit $$status); \
1830 $(evaluate-test)
1832 # Reuses tst-tls-many-dynamic-modules
1833 $(patsubst %,$(objpfx)%.os,$(tst-tls-many-dynamic-modules-dep)): \
1834 $(objpfx)tst-tls-manydynamic%mod-dep.os : tst-tls-manydynamicmod.c
1835 $(compile-command.c) \
1836 -DNAME=tls_global_$* -DSETTER=set_value_$* -DGETTER=get_value_$*
1837 $(patsubst %,$(objpfx)%.os,$(tst-tls-many-dynamic-modules-dep-bad)): \
1838 $(objpfx)tst-tls-manydynamic%mod-dep-bad.os : tst-tls-manydynamicmod.c
1839 $(compile-command.c) \
1840 -DNAME=tls_global_$* -DSETTER=set_value_$* -DGETTER=get_value_$*
1841 tst-tls20mod-bad.so-no-z-defs = yes
1842 # Single dependency.
1843 $(objpfx)tst-tls-manydynamic0mod-dep.so: $(objpfx)tst-tls-manydynamic1mod-dep.so
1844 # Double dependencies.
1845 $(objpfx)tst-tls-manydynamic2mod-dep.so: $(objpfx)tst-tls-manydynamic3mod-dep.so \
1846 $(objpfx)tst-tls-manydynamic4mod-dep.so
1847 # Double dependencies with each dependency depent of another module.
1848 $(objpfx)tst-tls-manydynamic5mod-dep.so: $(objpfx)tst-tls-manydynamic6mod-dep.so \
1849 $(objpfx)tst-tls-manydynamic7mod-dep.so
1850 $(objpfx)tst-tls-manydynamic6mod-dep.so: $(objpfx)tst-tls-manydynamic8mod-dep.so
1851 $(objpfx)tst-tls-manydynamic7mod-dep.so: $(objpfx)tst-tls-manydynamic8mod-dep.so
1852 # Long chain with one double dependency in the middle
1853 $(objpfx)tst-tls-manydynamic9mod-dep.so: $(objpfx)tst-tls-manydynamic10mod-dep.so \
1854 $(objpfx)tst-tls-manydynamic11mod-dep.so
1855 $(objpfx)tst-tls-manydynamic10mod-dep.so: $(objpfx)tst-tls-manydynamic12mod-dep.so
1856 $(objpfx)tst-tls-manydynamic12mod-dep.so: $(objpfx)tst-tls-manydynamic13mod-dep.so
1857 # Long chain with two double depedencies in the middle
1858 $(objpfx)tst-tls-manydynamic14mod-dep.so: $(objpfx)tst-tls-manydynamic15mod-dep.so
1859 $(objpfx)tst-tls-manydynamic15mod-dep.so: $(objpfx)tst-tls-manydynamic16mod-dep.so \
1860 $(objpfx)tst-tls-manydynamic17mod-dep.so
1861 $(objpfx)tst-tls-manydynamic16mod-dep.so: $(objpfx)tst-tls-manydynamic18mod-dep.so \
1862 $(objpfx)tst-tls-manydynamic19mod-dep.so
1863 # Same but with an invalid module.
1864 # Single dependency.
1865 $(objpfx)tst-tls-manydynamic0mod-dep-bad.so: $(objpfx)tst-tls20mod-bad.so
1866 LDFLAGS-tst-tls-manydynamic0mod-dep-bad.so = -Wl,--no-as-needed
1867 # Double dependencies.
1868 $(objpfx)tst-tls-manydynamic1mod-dep-bad.so: $(objpfx)tst-tls-manydynamic2mod-dep-bad.so \
1869 $(objpfx)tst-tls20mod-bad.so
1870 LDFLAGS-tst-tls-manydynamic1mod-dep-bad.so = -Wl,--no-as-needed
1871 # Double dependencies with each dependency depent of another module.
1872 $(objpfx)tst-tls-manydynamic3mod-dep-bad.so: $(objpfx)tst-tls-manydynamic4mod-dep-bad.so \
1873 $(objpfx)tst-tls-manydynamic5mod-dep-bad.so
1874 LDFLAGS-tst-tls-manydynamic3mod-dep-bad.so = -Wl,--no-as-needed
1875 $(objpfx)tst-tls-manydynamic4mod-dep-bad.so: $(objpfx)tst-tls20mod-bad.so
1876 LDFLAGS-tst-tls-manydynamic4mod-dep-bad.so = -Wl,--no-as-needed
1877 $(objpfx)tst-tls-manydynamic5mod-dep-bad.so: $(objpfx)tst-tls20mod-bad.so
1878 LDFLAGS-tst-tls-manydynamic5mod-dep-bad.so = -Wl,--no-as-needed
1879 # Long chain with one double dependency in the middle
1880 $(objpfx)tst-tls-manydynamic6mod-dep-bad.so: $(objpfx)tst-tls-manydynamic7mod-dep-bad.so \
1881 $(objpfx)tst-tls-manydynamic8mod-dep-bad.so
1882 LDFLAGS-tst-tls-manydynamic6mod-dep-bad.so = -Wl,--no-as-needed
1883 $(objpfx)tst-tls-manydynamic7mod-dep-bad.so: $(objpfx)tst-tls-manydynamic9mod-dep-bad.so
1884 LDFLAGS-tst-tls-manydynamic7mod-dep-bad.so = -Wl,--no-as-needed
1885 $(objpfx)tst-tls-manydynamic9mod-dep-bad.so: $(objpfx)tst-tls20mod-bad.so
1886 LDFLAGS-tst-tls-manydynamic9mod-dep-bad.so = -Wl,--no-as-needed
1887 # Long chain with two double depedencies in the middle
1888 $(objpfx)tst-tls-manydynamic10mod-dep-bad.so: $(objpfx)tst-tls-manydynamic11mod-dep-bad.so
1889 LDFLAGS-tst-tls-manydynamic10mod-dep-bad.so = -Wl,--no-as-needed
1890 $(objpfx)tst-tls-manydynamic11mod-dep-bad.so: $(objpfx)tst-tls-manydynamic12mod-dep-bad.so \
1891 $(objpfx)tst-tls-manydynamic13mod-dep-bad.so
1892 LDFLAGS-tst-tls-manydynamic11mod-dep-bad.so = -Wl,--no-as-needed
1893 $(objpfx)tst-tls-manydynamic12mod-dep-bad.so: $(objpfx)tst-tls-manydynamic14mod-dep-bad.so \
1894 $(objpfx)tst-tls20mod-bad.so
1895 LDFLAGS-tst-tls-manydynamic12mod-dep-bad.so = -Wl,--no-as-needed
1896 $(objpfx)tst-tls20: $(shared-thread-library)
1897 $(objpfx)tst-tls20.out: $(objpfx)tst-tls20mod-bad.so \
1898 $(tst-tls-many-dynamic-modules:%=$(objpfx)%.so) \
1899 $(tst-tls-many-dynamic-modules-dep:%=$(objpfx)%.so) \
1900 $(tst-tls-many-dynamic-modules-dep-bad:%=$(objpfx)%.so) \
1902 # Reuses tst-tls-many-dynamic-modules
1903 $(objpfx)tst-tls21: $(shared-thread-library)
1904 $(objpfx)tst-tls21.out: $(objpfx)tst-tls21mod.so
1905 $(objpfx)tst-tls21mod.so: $(tst-tls-many-dynamic-modules:%=$(objpfx)%.so)
1907 $(objpfx)tst-getauxval-static.out: $(objpfx)tst-auxvalmod.so
1908 tst-getauxval-static-ENV = LD_LIBRARY_PATH=$(objpfx):$(common-objpfx)
1910 $(objpfx)tst-dlmopen-gethostbyname.out: $(objpfx)tst-dlmopen-gethostbyname-mod.so