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