]> git.ipfire.org Git - thirdparty/glibc.git/blob - elf/Makefile
Fix elf/tst-ldconfig-X for cross testing.
[thirdparty/glibc.git] / elf / Makefile
1 # Copyright (C) 1995-2017 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
3
4 # The GNU C Library is free software; you can redistribute it and/or
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.
8
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
13
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 # <http://www.gnu.org/licenses/>.
17
18 # Makefile for elf subdirectory of GNU C Library.
19
20 subdir := elf
21
22 include ../Makeconfig
23
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
29 # The core dynamic linking functions are in libc for the static and
30 # profiled libraries.
31 dl-routines = $(addprefix dl-,load lookup object reloc deps hwcaps \
32 runtime init fini debug misc \
33 version profile conflict tls origin scope \
34 execstack caller open close trampoline)
35 ifeq (yes,$(use-ldconfig))
36 dl-routines += dl-cache
37 endif
38
39 ifneq (no,$(have-tunables))
40 dl-routines += dl-tunables
41 tunables-type = $(addprefix TUNABLES_FRONTEND_,$(have-tunables))
42 CPPFLAGS-dl-tunables.c = -DTUNABLES_FRONTEND=$(tunables-type)
43
44 # Make sure that the compiler does not insert any library calls in tunables
45 # code paths.
46 ifeq (yes,$(have-loop-to-function))
47 CFLAGS-dl-tunables.c = -fno-tree-loop-distribute-patterns
48 endif
49 endif
50
51 all-dl-routines = $(dl-routines) $(sysdep-dl-routines)
52 # But they are absent from the shared libc, because that code is in ld.so.
53 elide-routines.os = $(all-dl-routines) dl-support enbl-secure dl-origin \
54 dl-sysdep
55 shared-only-routines += dl-caller
56
57 # ld.so uses those routines, plus some special stuff for being the program
58 # interpreter and operating independent of libc.
59 rtld-routines = rtld $(all-dl-routines) dl-sysdep dl-environ dl-minimal \
60 dl-error-minimal
61 all-rtld-routines = $(rtld-routines) $(sysdep-rtld-routines)
62
63 CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
64 CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
65 CFLAGS-dl-iterate-phdr.c = $(uses-callbacks)
66
67 # Compile rtld itself without stack protection.
68 # Also compile all routines in the static library that are elided from
69 # the shared libc because they are in libc.a in the same way.
70
71 define elide-stack-protector
72 $(if $(filter $(@F),$(patsubst %,%$(1),$(2))), $(no-stack-protector))
73 endef
74
75 CFLAGS-.o += $(call elide-stack-protector,.o,$(elide-routines.os))
76 CFLAGS-.op += $(call elide-stack-protector,.op,$(elide-routines.os))
77 CFLAGS-.os += $(call elide-stack-protector,.os,$(all-rtld-routines))
78
79 ifeq ($(unwind-find-fde),yes)
80 routines += unwind-dw2-fde-glibc
81 shared-only-routines += unwind-dw2-fde-glibc
82 endif
83
84 before-compile += $(objpfx)trusted-dirs.h
85 generated += trusted-dirs.h trusted-dirs.st for-renamed/renamed.so
86 generated-dirs += for-renamed
87
88 ifeq ($(build-shared),yes)
89 ld-map = $(common-objpfx)ld.map
90 endif
91
92 ifeq (yes,$(build-shared))
93 extra-objs = $(all-rtld-routines:%=%.os) soinit.os sofini.os interp.os
94 generated += librtld.os dl-allobjs.os ld.so ldd
95 install-others = $(inst_rtlddir)/$(rtld-installed-name)
96 install-bin-script = ldd
97 endif
98
99 others = sprof sln
100 install-bin = sprof
101 others-static = sln
102 install-rootsbin = sln
103 sln-modules := static-stubs
104 extra-objs += $(sln-modules:=.o)
105
106 ifeq (yes,$(use-ldconfig))
107 ifeq (yes,$(build-shared))
108 others-static += ldconfig
109 others += ldconfig
110 install-rootsbin += ldconfig
111
112 ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon static-stubs
113 extra-objs += $(ldconfig-modules:=.o)
114 endif
115 endif
116
117 # To find xmalloc.c and xstrdup.c
118 vpath %.c ../locale/programs
119
120 ifeq ($(build-shared),yes)
121 extra-objs += sotruss-lib.os sotruss-lib.so
122 install-others += $(inst_auditdir)/sotruss-lib.so
123 install-bin-script += sotruss
124 generated += sotruss
125 libof-sotruss-lib = extramodules
126 $(objpfx)sotruss-lib.so: $(objpfx)sotruss-lib.os
127 $(build-module-asneeded)
128 $(objpfx)sotruss-lib.so: $(common-objpfx)libc.so $(objpfx)ld.so \
129 $(common-objpfx)libc_nonshared.a
130
131 $(objpfx)sotruss: sotruss.sh $(common-objpfx)config.make
132 sed -e 's%@BASH@%$(BASH)%g' \
133 -e 's%@VERSION@%$(version)%g' \
134 -e 's%@TEXTDOMAINDIR@%$(localedir)%g' \
135 -e 's%@PREFIX@%$(prefix)%g' \
136 -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
137 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' \
138 < $< > $@.new
139 chmod 555 $@.new
140 mv -f $@.new $@
141 $(inst_auditdir)/sotruss-lib.so: $(objpfx)sotruss-lib.so $(+force)
142 $(do-install-program)
143 endif
144
145 tests = tst-tls1 tst-tls2 tst-tls9 tst-leaks1 \
146 tst-array1 tst-array2 tst-array3 tst-array4 tst-array5 \
147 tst-auxv
148 tests-static = tst-tls1-static tst-tls2-static tst-stackguard1-static \
149 tst-leaks1-static tst-array1-static tst-array5-static \
150 tst-ptrguard1-static tst-dl-iter-static \
151 tst-tlsalign-static tst-tlsalign-extern-static \
152 tst-linkall-static
153 ifeq (yes,$(build-shared))
154 tests-static += tst-tls9-static
155 tst-tls9-static-ENV = \
156 LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn
157 endif
158 tests += $(tests-static)
159 ifeq (yes,$(build-shared))
160 tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
161 constload1 order noload filter unload \
162 reldep reldep2 reldep3 reldep4 nodelete nodelete2 \
163 nodlopen nodlopen2 neededtest neededtest2 \
164 neededtest3 neededtest4 unload2 lateglobal initfirst global \
165 restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
166 circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \
167 tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-tls15 \
168 tst-tls16 tst-tls17 tst-tls18 tst-tls19 tst-tls-dlinfo \
169 tst-align tst-align2 $(tests-execstack-$(have-z-execstack)) \
170 tst-dlmodcount tst-dlopenrpath tst-deep1 \
171 tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
172 unload3 unload4 unload5 unload6 unload7 unload8 tst-global1 order2 \
173 tst-audit1 tst-audit2 tst-audit8 tst-audit9 \
174 tst-stackguard1 tst-addr1 tst-thrlock \
175 tst-unique1 tst-unique2 $(if $(CXX),tst-unique3 tst-unique4 \
176 tst-nodelete) \
177 tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \
178 tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
179 tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error tst-noload \
180 tst-latepthread tst-tls-manydynamic tst-nodelete-dlclose
181 # reldep9
182 ifeq ($(build-hardcoded-path-in-tests),yes)
183 tests += tst-dlopen-aout
184 LDFLAGS-tst-dlopen-aout = $(no-pie-ldflag)
185 endif
186 test-srcs = tst-pathopt
187 selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
188 ifneq ($(selinux-enabled),1)
189 tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
190 endif
191 endif
192 ifeq ($(run-built-tests),yes)
193 tests-special += $(objpfx)tst-leaks1-mem.out \
194 $(objpfx)tst-leaks1-static-mem.out $(objpfx)noload-mem.out \
195 $(objpfx)tst-ldconfig-X.out
196 endif
197 tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
198 tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
199 tlsmod17a-modules = $(addprefix tst-tlsmod17a, $(tlsmod17a-suffixes))
200 tlsmod18a-modules = $(addprefix tst-tlsmod18a, $(tlsmod17a-suffixes))
201 one-hundred = $(foreach x,0 1 2 3 4 5 6 7 8 9, \
202 0$x 1$x 2$x 3$x 4$x 5$x 6$x 7$x 8$x 9$x)
203 tst-tls-many-dynamic-modules := \
204 $(foreach n,$(one-hundred),tst-tls-manydynamic$(n)mod)
205 extra-test-objs += $(tlsmod17a-modules:=.os) $(tlsmod18a-modules:=.os) \
206 tst-tlsalign-vars.o
207 test-extras += tst-tlsmod17a tst-tlsmod18a tst-tlsalign-vars
208 modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
209 testobj1_1 failobj constload2 constload3 unloadmod \
210 dep1 dep2 dep3 dep4 vismod1 vismod2 vismod3 \
211 nodelmod1 nodelmod2 nodelmod3 nodelmod4 \
212 nodel2mod1 nodel2mod2 nodel2mod3 \
213 nodlopenmod nodlopenmod2 filtmod1 filtmod2 \
214 reldepmod1 reldepmod2 reldepmod3 reldepmod4 nextmod1 nextmod2 \
215 reldep4mod1 reldep4mod2 reldep4mod3 reldep4mod4 \
216 neededobj1 neededobj2 neededobj3 neededobj4 \
217 neededobj5 neededobj6 firstobj globalmod1 \
218 unload2mod unload2dep ltglobmod1 ltglobmod2 pathoptobj \
219 dblloadmod1 dblloadmod2 dblloadmod3 reldepmod5 reldepmod6 \
220 reldep6mod0 reldep6mod1 reldep6mod2 reldep6mod3 reldep6mod4 \
221 reldep7mod1 reldep7mod2 \
222 tst-tlsmod1 tst-tlsmod2 tst-tlsmod3 tst-tlsmod4 \
223 tst-tlsmod5 tst-tlsmod6 tst-tlsmod7 tst-tlsmod8 \
224 tst-tlsmod9 tst-tlsmod10 tst-tlsmod11 tst-tlsmod12 \
225 tst-tlsmod13 tst-tlsmod13a tst-tlsmod14a tst-tlsmod14b \
226 tst-tlsmod15a tst-tlsmod15b tst-tlsmod16a tst-tlsmod16b \
227 $(tlsmod17a-modules) tst-tlsmod17b $(tlsmod18a-modules) \
228 tst-tls19mod1 tst-tls19mod2 tst-tls19mod3 \
229 circlemod1 circlemod1a circlemod2 circlemod2a \
230 circlemod3 circlemod3a \
231 reldep8mod1 reldep8mod2 reldep8mod3 \
232 reldep9mod1 reldep9mod2 reldep9mod3 \
233 tst-alignmod tst-alignmod2 \
234 $(modules-execstack-$(have-z-execstack)) \
235 tst-dlopenrpathmod tst-deep1mod1 tst-deep1mod2 tst-deep1mod3 \
236 tst-dlmopen1mod tst-auditmod1 \
237 unload3mod1 unload3mod2 unload3mod3 unload3mod4 \
238 unload4mod1 unload4mod2 unload4mod3 unload4mod4 \
239 unload6mod1 unload6mod2 unload6mod3 \
240 unload7mod1 unload7mod2 \
241 unload8mod1 unload8mod1x unload8mod2 unload8mod3 \
242 order2mod1 order2mod2 order2mod3 order2mod4 \
243 tst-unique1mod1 tst-unique1mod2 \
244 tst-unique2mod1 tst-unique2mod2 \
245 tst-auditmod9a tst-auditmod9b \
246 $(if $(CXX),tst-unique3lib tst-unique3lib2 tst-unique4lib \
247 tst-nodelete-uniquemod tst-nodelete-rtldmod \
248 tst-nodelete-zmod) \
249 tst-initordera1 tst-initorderb1 \
250 tst-initordera2 tst-initorderb2 \
251 tst-initordera3 tst-initordera4 \
252 tst-initorder2a tst-initorder2b tst-initorder2c \
253 tst-initorder2d \
254 tst-relsort1mod1 tst-relsort1mod2 tst-array2dep \
255 tst-array5dep tst-null-argv-lib \
256 tst-tlsalign-lib tst-nodelete-opened-lib tst-nodelete2mod \
257 tst-audit11mod1 tst-audit11mod2 tst-auditmod11 \
258 tst-audit12mod1 tst-audit12mod2 tst-audit12mod3 tst-auditmod12 \
259 tst-latepthreadmod $(tst-tls-many-dynamic-modules) \
260 tst-nodelete-dlclose-dso tst-nodelete-dlclose-plugin
261 ifeq (yes,$(have-mtls-dialect-gnu2))
262 tests += tst-gnu2-tls1
263 modules-names += tst-gnu2-tls1mod
264 $(objpfx)tst-gnu2-tls1: $(objpfx)tst-gnu2-tls1mod.so
265 tst-gnu2-tls1mod.so-no-z-defs = yes
266 CFLAGS-tst-gnu2-tls1mod.c += -mtls-dialect=gnu2
267 endif
268 ifeq (yes,$(have-protected-data))
269 modules-names += tst-protected1moda tst-protected1modb
270 tests += tst-protected1a tst-protected1b
271 $(objpfx)tst-protected1a: $(addprefix $(objpfx),tst-protected1moda.so tst-protected1modb.so)
272 $(objpfx)tst-protected1b: $(addprefix $(objpfx),tst-protected1modb.so tst-protected1moda.so)
273 tst-protected1modb.so-no-z-defs = yes
274 # These tests fail with GCC versions prior to 5.1 and with some versions
275 # of binutils. See https://sourceware.org/bugzilla/show_bug.cgi?id=17709
276 # and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248 for details.
277 # Perhaps in future we can make these XFAILs conditional on some detection
278 # of compiler/linker behavior/version.
279 test-xfail-tst-protected1a = yes
280 test-xfail-tst-protected1b = yes
281 endif
282 ifeq (yesyes,$(have-fpie)$(build-shared))
283 modules-names += tst-piemod1
284 tests += tst-pie1 tst-pie2
285 tests-pie += tst-pie1 tst-pie2
286 tests += vismain
287 tests-pie += vismain
288 CFLAGS-vismain.c = $(PIE-ccflag)
289 endif
290 modules-execstack-yes = tst-execstack-mod
291 extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
292 # We need this variable to be sure the test modules get the right CPPFLAGS.
293 test-extras += $(modules-names)
294
295 # filtmod1.so has a special rule
296 modules-names-nobuild := filtmod1
297
298 ifneq (no,$(multi-arch))
299 tests-static += ifuncmain1static ifuncmain1picstatic \
300 ifuncmain2static ifuncmain2picstatic \
301 ifuncmain4static ifuncmain4picstatic \
302 ifuncmain5static ifuncmain5picstatic \
303 ifuncmain7static ifuncmain7picstatic
304
305 ifeq (yes,$(build-shared))
306 tests += ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \
307 ifuncmain1staticpic \
308 ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \
309 ifuncmain5 ifuncmain5pic ifuncmain5staticpic \
310 ifuncmain7 ifuncmain7pic
311 ifunc-test-modules = ifuncdep1 ifuncdep1pic ifuncdep2 ifuncdep2pic \
312 ifuncdep5 ifuncdep5pic
313 extra-test-objs += $(ifunc-test-modules:=.o)
314 test-extras += $(ifunc-test-modules)
315 ifeq (yes,$(have-fpie))
316 ifunc-pie-tests = ifuncmain1pie ifuncmain1vispie ifuncmain1staticpie \
317 ifuncmain5pie ifuncmain6pie ifuncmain7pie
318 tests += $(ifunc-pie-tests)
319 tests-pie += $(ifunc-pie-tests)
320 endif
321 modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6
322 endif
323 endif
324
325 ifeq (yes,$(build-shared))
326 ifeq ($(run-built-tests),yes)
327 tests-special += $(objpfx)tst-pathopt.out $(objpfx)tst-rtld-load-self.out
328 endif
329 tests-special += $(objpfx)check-textrel.out $(objpfx)check-execstack.out \
330 $(objpfx)check-localplt.out
331 endif
332
333 ifeq ($(run-built-tests),yes)
334 tests-special += $(objpfx)order-cmp.out $(objpfx)tst-array1-cmp.out \
335 $(objpfx)tst-array1-static-cmp.out \
336 $(objpfx)tst-array2-cmp.out $(objpfx)tst-array3-cmp.out \
337 $(objpfx)tst-array4-cmp.out $(objpfx)tst-array5-cmp.out \
338 $(objpfx)tst-array5-static-cmp.out $(objpfx)order2-cmp.out \
339 $(objpfx)tst-initorder-cmp.out \
340 $(objpfx)tst-initorder2-cmp.out $(objpfx)tst-unused-dep.out \
341 $(objpfx)tst-unused-dep-cmp.out
342 endif
343
344 check-abi: $(objpfx)check-abi-ld.out
345 tests-special += $(objpfx)check-abi-ld.out
346 update-abi: update-abi-ld
347 update-all-abi: update-all-abi-ld
348
349 ifeq ($(have-glob-dat-reloc),yes)
350 tests += tst-prelink
351 ifeq ($(run-built-tests),yes)
352 tests-special += $(objpfx)tst-prelink-cmp.out
353 endif
354 endif
355
356 # The test requires shared _and_ PIE because the executable
357 # unit test driver must be able to link with the shared object
358 # that is going to eventually go into an installed DSO.
359 ifeq (yesyes,$(have-fpie)$(build-shared))
360 tests += tst-_dl_addr_inside_object
361 tests-pie += tst-_dl_addr_inside_object
362 $(objpfx)tst-_dl_addr_inside_object: $(objpfx)dl-addr-obj.os
363 CFLAGS-tst-_dl_addr_inside_object.c += $(PIE-ccflag)
364 endif
365
366 # By default tst-linkall-static should try to use crypt routines to test
367 # static libcrypt use.
368 CFLAGS-tst-linkall-static.c = -DUSE_CRYPT=1
369 # However, if we are using NSS crypto and we don't have a static
370 # library, then we exclude the use of crypt functions in the test.
371 # We similarly exclude libcrypt.a from the static link (see below).
372 ifeq (yesno,$(nss-crypt)$(static-nss-crypt))
373 CFLAGS-tst-linkall-static.c = -DUSE_CRYPT=0
374 endif
375
376 include ../Rules
377
378 ifeq (yes,$(build-shared))
379 # Make sure these things are built in the `make lib' pass so they can be used
380 # to run programs during the `make others' pass.
381 lib-noranlib: $(objpfx)$(rtld-installed-name) \
382 $(addprefix $(objpfx),$(extra-objs))
383 endif
384
385 # Command to link into a larger single relocatable object.
386 reloc-link = $(LINK.o) -nostdlib -nostartfiles -r
387
388 $(objpfx)sotruss-lib.so: $(shlib-lds)
389
390 $(objpfx)dl-allobjs.os: $(all-rtld-routines:%=$(objpfx)%.os)
391 $(reloc-link) -o $@ $^
392
393 # Link together the dynamic linker into a single relocatable object.
394 # First we do a link against libc_pic.a just to get a link map,
395 # and discard the object produced by that link. From the link map
396 # we can glean all the libc modules that need to go into the dynamic
397 # linker. Then we do a recursive make that goes into all the subdirs
398 # those modules come from and builds special rtld-foo.os versions that
399 # are compiled with special flags, and puts these modules into rtld-libc.a
400 # for us. Then we do the real link using rtld-libc.a instead of libc_pic.a.
401
402 # If the compiler can do SSP, build the mapfile with dummy __stack_chk_fail
403 # and __stack_chk_fail_local symbols defined, to prevent the real things
404 # being dragged into rtld even though rtld is never built with stack-
405 # protection.
406
407 ifeq ($(have-ssp),yes)
408 dummy-stack-chk-fail := -Wl,--defsym='__stack_chk_fail=0' \
409 -Wl,--defsym='__stack_chk_fail_local=0'
410 else
411 dummy-stack-chk-fail :=
412 endif
413
414 $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
415 @-rm -f $@T
416 $(reloc-link) -o $@.o $(dummy-stack-chk-fail) \
417 '-Wl,-(' $^ -lgcc '-Wl,-)' -Wl,-Map,$@T
418 rm -f $@.o
419 mv -f $@T $@
420
421 $(objpfx)librtld.mk: $(objpfx)librtld.map Makefile
422 LC_ALL=C \
423 sed -n 's@^$(common-objpfx)\([^(]*\)(\([^)]*\.os\)) *.*$$@\1 \2@p' \
424 $< | \
425 while read lib file; do \
426 case $$lib in \
427 libc_pic.a) \
428 LC_ALL=C fgrep -l /$$file \
429 $(common-objpfx)stamp.os $(common-objpfx)*/stamp.os | \
430 LC_ALL=C \
431 sed 's@^$(common-objpfx)\([^/]*\)/stamp\.os$$@rtld-\1'" +=$$file@"\
432 ;; \
433 */*.a) \
434 echo rtld-$${lib%%/*} += $$file ;; \
435 *) echo "Wasn't expecting $$lib($$file)" >&2; exit 1 ;; \
436 esac; \
437 done > $@T
438 echo rtld-subdirs = `LC_ALL=C sed 's/^rtld-\([^ ]*\).*$$/\1/' $@T \
439 | LC_ALL=C sort -u` >> $@T
440 mv -f $@T $@
441
442 $(objpfx)rtld-libc.a: $(objpfx)librtld.mk FORCE
443 $(MAKE) -f $< -f rtld-Rules
444
445 $(objpfx)librtld.os: $(objpfx)dl-allobjs.os $(objpfx)rtld-libc.a
446 $(LINK.o) -nostdlib -nostartfiles -r -o $@ '-Wl,-(' $^ -lgcc '-Wl,-)' \
447 -Wl,-Map,$@.map
448
449 generated += librtld.map librtld.mk rtld-libc.a librtld.os.map
450
451 z-now-yes = -Wl,-z,now
452
453 $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
454 # Link into a temporary file so that we don't touch $@ at all
455 # if the sanity check below fails.
456 $(LINK.o) -nostdlib -nostartfiles -shared -o $@.new \
457 $(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \
458 $(filter-out $(map-file),$^) $(load-map-file) \
459 -Wl,-soname=$(rtld-installed-name) \
460 -Wl,-defsym=_begin=0
461 $(call after-link,$@.new)
462 $(READELF) -s $@.new \
463 | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
464 mv -f $@.new $@
465
466 ifeq (yes,$(build-shared))
467 # interp.c exists just to get the runtime linker path into libc.so.
468 $(objpfx)interp.os: $(common-objpfx)runtime-linker.h
469 endif
470
471 ifneq (ld.so,$(rtld-installed-name))
472 # Make sure ld.so.1 exists in the build directory so we can link
473 # against it.
474 $(objpfx)$(rtld-installed-name): $(objpfx)ld.so
475 $(make-link)
476 generated += $(rtld-installed-name)
477 endif
478
479 # Build a file mentioning all trustworthy directories to look for shared
480 # libraries when using LD_LIBRARY_PATH in a setuid program. The user can
481 # add directories to the list by defining $(user-defined-trusted-dirs)
482 # before starting make.
483 $(objpfx)trusted-dirs.h: $(objpfx)trusted-dirs.st; @:
484 $(objpfx)trusted-dirs.st: Makefile $(..)Makeconfig
485 $(make-target-directory)
486 echo "$(subst :, ,$(default-rpath) $(user-defined-trusted-dirs))" \
487 | $(AWK) -f gen-trusted-dirs.awk > ${@:st=T};
488 echo '#define DL_DST_LIB "$(notdir $(slibdir))"' >> ${@:st=T}
489 $(move-if-change) ${@:st=T} ${@:st=h}
490 touch $@
491 CPPFLAGS-dl-load.c = -I$(objpfx). -I$(csu-objpfx).
492
493 ifeq (yes,$(build-shared))
494 $(inst_slibdir)/$(rtld-version-installed-name): $(objpfx)ld.so $(+force)
495 $(make-target-directory)
496 $(do-install-program)
497
498 $(inst_rtlddir)/$(rtld-installed-name): \
499 $(inst_slibdir)/$(rtld-version-installed-name) \
500 $(inst_slibdir)/libc-$(version).so
501 $(make-target-directory)
502 $(make-shlib-link)
503
504 # Special target called by parent to install just the dynamic linker.
505 .PHONY: ldso_install
506 ldso_install: $(inst_rtlddir)/$(rtld-installed-name)
507 endif
508
509
510 ldd-rewrite = -e 's%@RTLD@%$(rtlddir)/$(rtld-installed-name)%g' \
511 -e 's%@VERSION@%$(version)%g' \
512 -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
513 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' \
514 -e 's%@BASH@%$(BASH)%g' \
515 -e 's%@TEXTDOMAINDIR@%$(localedir)%g'
516
517 ifeq ($(ldd-rewrite-script),no)
518 define gen-ldd
519 LC_ALL=C sed $(ldd-rewrite) < $< > $@.new
520 endef
521 else
522 define gen-ldd
523 LC_ALL=C sed $(ldd-rewrite) < $< \
524 | LC_ALL=C sed -f $(patsubst $(..)/%,/%,$(..)$(ldd-rewrite-script)) > $@.new
525 endef
526 endif
527
528 $(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \
529 $(common-objpfx)config.make
530 $(gen-ldd)
531 chmod 555 $@.new
532 mv -f $@.new $@
533
534 $(objpfx)sprof: $(libdl)
535
536 $(objpfx)sln: $(sln-modules:%=$(objpfx)%.o)
537
538 $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
539
540 SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
541 CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
542 -D'SLIBDIR="$(slibdir)"'
543 libof-ldconfig = ldconfig
544 CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
545 CFLAGS-cache.c = $(SYSCONF-FLAGS)
546 CFLAGS-rtld.c = $(SYSCONF-FLAGS)
547
548 cpp-srcs-left := $(all-rtld-routines:=.os)
549 lib := rtld
550 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
551
552 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
553 generated += $(addsuffix .so,$(strip $(modules-names)))
554
555 $(objpfx)testobj1.so: $(libdl)
556 $(objpfx)testobj1_1.so: $(objpfx)testobj1.so $(libdl)
557 $(objpfx)testobj2.so: $(objpfx)testobj1.so $(libdl)
558 $(objpfx)testobj3.so: $(libdl)
559 $(objpfx)testobj4.so: $(libdl)
560 $(objpfx)testobj5.so: $(libdl)
561 $(objpfx)testobj6.so: $(objpfx)testobj1.so $(objpfx)testobj2.so $(libdl)
562 $(objpfx)failobj.so: $(objpfx)testobj6.so
563 $(objpfx)dep1.so: $(objpfx)dep2.so $(objpfx)dep4.so
564 $(objpfx)dep2.so: $(objpfx)dep3.so $(objpfx)dep4.so
565 $(objpfx)dep4.so: $(objpfx)dep3.so
566 $(objpfx)nodelmod3.so: $(objpfx)nodelmod4.so
567 $(objpfx)nextmod1.so: $(libdl)
568 $(objpfx)neededobj1.so: $(libdl)
569 $(objpfx)neededobj2.so: $(objpfx)neededobj1.so $(libdl)
570 $(objpfx)neededobj3.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so $(libdl)
571 $(objpfx)neededobj4.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
572 $(objpfx)neededobj3.so $(libdl)
573 $(objpfx)neededobj6.so: $(objpfx)neededobj5.so
574 $(objpfx)unload2mod.so: $(objpfx)unload2dep.so
575 $(objpfx)ltglobmod2.so: $(libdl)
576 $(objpfx)firstobj.so: $(shared-thread-library)
577 $(objpfx)globalmod1.so: $(libdl)
578 $(objpfx)reldep4mod1.so: $(objpfx)reldep4mod3.so
579 $(objpfx)reldep4mod2.so: $(objpfx)reldep4mod4.so
580 $(objpfx)dblloadmod1.so: $(objpfx)dblloadmod3.so
581 $(objpfx)dblloadmod2.so: $(objpfx)dblloadmod3.so
582 $(objpfx)reldepmod5.so: $(objpfx)reldepmod2.so
583 $(objpfx)reldepmod6.so: $(objpfx)reldepmod2.so
584 $(objpfx)reldep6mod1.so: $(objpfx)reldep6mod0.so
585 $(objpfx)reldep6mod2.so: $(objpfx)reldep6mod1.so
586 $(objpfx)reldep6mod3.so: $(objpfx)reldep6mod2.so
587 $(objpfx)reldep6mod4.so: $(objpfx)reldep6mod1.so
588 $(objpfx)tst-tlsmod3.so: $(objpfx)tst-tlsmod2.so
589 $(objpfx)tst-tlsmod8.so: $(objpfx)tst-tlsmod7.so
590 $(objpfx)tst-tlsmod10.so: $(objpfx)tst-tlsmod9.so
591 $(objpfx)tst-tlsmod12.so: $(objpfx)tst-tlsmod11.so
592 $(objpfx)tst-tlsmod13a.so: $(objpfx)tst-tlsmod13.so
593 # For tst-tls9-static, make sure the modules it dlopens have libc.so in DT_NEEDED
594 $(objpfx)tst-tlsmod5.so: $(common-objpfx)libc.so
595 $(objpfx)tst-tlsmod6.so: $(common-objpfx)libc.so
596 $(objpfx)tst-tls19mod1.so: $(objpfx)tst-tls19mod2.so $(objpfx)tst-tls19mod3.so
597 $(objpfx)tst-tls19mod3.so: $(objpfx)ld.so
598 $(objpfx)reldep8mod3.so: $(objpfx)reldep8mod1.so $(objpfx)reldep8mod2.so
599 $(objpfx)nodel2mod3.so: $(objpfx)nodel2mod1.so $(objpfx)nodel2mod2.so
600 $(objpfx)reldep9mod2.so: $(objpfx)reldep9mod1.so
601 $(objpfx)reldep9mod3.so: $(objpfx)reldep9mod1.so $(objpfx)reldep9mod2.so
602 $(objpfx)unload3mod1.so: $(objpfx)unload3mod3.so
603 $(objpfx)unload3mod2.so: $(objpfx)unload3mod3.so
604 $(objpfx)unload3mod3.so: $(objpfx)unload3mod4.so
605 $(objpfx)unload4mod1.so: $(objpfx)unload4mod2.so $(objpfx)unload4mod3.so
606 $(objpfx)unload4mod2.so: $(objpfx)unload4mod4.so $(objpfx)unload4mod3.so
607 $(objpfx)unload6mod1.so: $(libdl)
608 $(objpfx)unload6mod2.so: $(libdl)
609 $(objpfx)unload6mod3.so: $(libdl)
610 $(objpfx)unload7mod1.so: $(libdl)
611 $(objpfx)unload7mod2.so: $(objpfx)unload7mod1.so
612 $(objpfx)unload8mod1.so: $(objpfx)unload8mod2.so
613 $(objpfx)unload8mod2.so: $(objpfx)unload8mod3.so
614 $(objpfx)unload8mod3.so: $(libdl)
615 $(objpfx)tst-initordera2.so: $(objpfx)tst-initordera1.so
616 $(objpfx)tst-initorderb2.so: $(objpfx)tst-initorderb1.so $(objpfx)tst-initordera2.so
617 $(objpfx)tst-initordera3.so: $(objpfx)tst-initorderb2.so $(objpfx)tst-initorderb1.so
618 $(objpfx)tst-initordera4.so: $(objpfx)tst-initordera3.so
619 $(objpfx)tst-initorder: $(objpfx)tst-initordera4.so $(objpfx)tst-initordera1.so $(objpfx)tst-initorderb2.so
620 $(objpfx)tst-null-argv: $(objpfx)tst-null-argv-lib.so
621 $(objpfx)tst-tlsalign: $(objpfx)tst-tlsalign-lib.so
622 $(objpfx)tst-nodelete-opened.out: $(objpfx)tst-nodelete-opened-lib.so
623 $(objpfx)tst-nodelete-opened: $(libdl)
624 $(objpfx)tst-noload: $(libdl)
625
626 $(objpfx)tst-tlsalign-extern: $(objpfx)tst-tlsalign-vars.o
627 $(objpfx)tst-tlsalign-extern-static: $(objpfx)tst-tlsalign-vars.o
628
629 tst-null-argv-ENV = LD_DEBUG=all LD_DEBUG_OUTPUT=$(objpfx)tst-null-argv.debug.out
630 LDFLAGS-nodel2mod3.so = $(no-as-needed)
631 LDFLAGS-reldepmod5.so = $(no-as-needed)
632 LDFLAGS-reldep6mod1.so = $(no-as-needed)
633 LDFLAGS-reldep6mod4.so = $(no-as-needed)
634 LDFLAGS-reldep8mod3.so = $(no-as-needed)
635 LDFLAGS-unload4mod1.so = $(no-as-needed)
636 LDFLAGS-unload4mod2.so = $(no-as-needed)
637 LDFLAGS-tst-initorder = $(no-as-needed)
638 LDFLAGS-tst-initordera2.so = $(no-as-needed)
639 LDFLAGS-tst-initordera3.so = $(no-as-needed)
640 LDFLAGS-tst-initordera4.so = $(no-as-needed)
641 LDFLAGS-tst-initorderb2.so = $(no-as-needed)
642 LDFLAGS-tst-tlsmod5.so = -nostdlib $(no-as-needed)
643 LDFLAGS-tst-tlsmod6.so = -nostdlib $(no-as-needed)
644
645 testobj1.so-no-z-defs = yes
646 testobj3.so-no-z-defs = yes
647 testobj4.so-no-z-defs = yes
648 testobj5.so-no-z-defs = yes
649 testobj6.so-no-z-defs = yes
650 failobj.so-no-z-defs = yes
651 constload2.so-no-z-defs = yes
652 constload3.so-no-z-defs = yes
653 nodelmod1.so-no-z-defs = yes
654 nodelmod2.so-no-z-defs = yes
655 nodelmod4.so-no-z-defs = yes
656 nodel2mod2.so-no-z-defs = yes
657 reldepmod2.so-no-z-defs = yes
658 reldepmod3.so-no-z-defs = yes
659 reldepmod4.so-no-z-defs = yes
660 reldep4mod4.so-no-z-defs = yes
661 reldep4mod2.so-no-z-defs = yes
662 ltglobmod2.so-no-z-defs = yes
663 dblloadmod3.so-no-z-defs = yes
664 tst-tlsmod1.so-no-z-defs = yes
665 tst-tlsmod2.so-no-z-defs = yes
666 tst-tlsmod3.so-no-z-defs = yes
667 tst-tlsmod4.so-no-z-defs = yes
668 tst-tlsmod7.so-no-z-defs = yes
669 tst-tlsmod8.so-no-z-defs = yes
670 tst-tlsmod9.so-no-z-defs = yes
671 tst-tlsmod10.so-no-z-defs = yes
672 tst-tlsmod12.so-no-z-defs = yes
673 tst-tlsmod14a.so-no-z-defs = yes
674 tst-tlsmod14b.so-no-z-defs = yes
675 tst-tlsmod15a.so-no-z-defs = yes
676 tst-tlsmod16b.so-no-z-defs = yes
677 circlemod2.so-no-z-defs = yes
678 circlemod3.so-no-z-defs = yes
679 circlemod3a.so-no-z-defs = yes
680 reldep8mod2.so-no-z-defs = yes
681 reldep9mod1.so-no-z-defs = yes
682 unload3mod4.so-no-z-defs = yes
683 unload4mod1.so-no-z-defs = yes
684 ifuncmod1.so-no-z-defs = yes
685 ifuncmod5.so-no-z-defs = yes
686 ifuncmod6.so-no-z-defs = yes
687 tst-auditmod9a.so-no-z-defs = yes
688 tst-auditmod9b.so-no-z-defs = yes
689 tst-nodelete-uniquemod.so-no-z-defs = yes
690 tst-nodelete-rtldmod.so-no-z-defs = yes
691 tst-nodelete-zmod.so-no-z-defs = yes
692 tst-nodelete2mod.so-no-z-defs = yes
693
694 ifeq ($(build-shared),yes)
695 # Build all the modules even when not actually running test programs.
696 tests: $(test-modules)
697 endif
698
699 $(objpfx)loadtest: $(libdl)
700 LDFLAGS-loadtest = -rdynamic
701
702 $(objpfx)loadtest.out: $(test-modules)
703
704 $(objpfx)neededtest: $(libdl)
705 $(objpfx)neededtest.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
706 $(objpfx)neededobj3.so
707
708 $(objpfx)neededtest2: $(libdl)
709 $(objpfx)neededtest2.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
710 $(objpfx)neededobj3.so
711
712 $(objpfx)neededtest3: $(libdl)
713 $(objpfx)neededtest3.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
714 $(objpfx)neededobj3.so $(objpfx)neededobj4.so
715
716 $(objpfx)neededtest4: $(libdl) $(objpfx)neededobj1.so
717 $(objpfx)neededtest4.out: $(objpfx)neededobj5.so $(objpfx)neededobj6.so
718
719 $(objpfx)restest1: $(objpfx)testobj1.so $(objpfx)testobj1_1.so $(libdl)
720 LDFLAGS-restest1 = -rdynamic
721
722 $(objpfx)restest2: $(libdl)
723 LDFLAGS-restest2 = -rdynamic
724
725 $(objpfx)restest1.out: $(test-modules)
726
727 preloadtest-preloads = testobj1 testobj2 testobj3 testobj4 testobj5
728 $(objpfx)preloadtest: $(objpfx)testobj6.so
729 LDFLAGS-preloadtest = -rdynamic
730 $(objpfx)preloadtest.out: $(preloadtest-preloads:%=$(objpfx)%.so)
731 preloadtest-ENV = \
732 LD_PRELOAD=$(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
733
734 $(objpfx)loadfail: $(libdl)
735 LDFLAGS-loadfail = -rdynamic
736
737 $(objpfx)loadfail.out: $(objpfx)failobj.so
738
739 $(objpfx)multiload: $(libdl)
740 LDFLAGS-multiload = -rdynamic
741 CFLAGS-multiload.c = -DOBJDIR=\"$(elf-objpfx)\"
742
743 $(objpfx)multiload.out: $(objpfx)testobj1.so
744
745 $(objpfx)origtest: $(libdl)
746 LDFLAGS-origtest = -rdynamic
747 $(objpfx)origtest.out: $(objpfx)testobj1.so
748
749 ifeq ($(have-thread-library),yes)
750 $(objpfx)resolvfail: $(libdl) $(shared-thread-library)
751 else
752 $(objpfx)resolvfail: $(libdl)
753 endif
754
755 $(objpfx)constload1: $(libdl)
756 $(objpfx)constload1.out: $(objpfx)constload2.so $(objpfx)constload3.so
757
758 $(objpfx)circleload1: $(libdl)
759 $(objpfx)circleload1.out: $(objpfx)circlemod1.so \
760 $(objpfx)circlemod1a.so
761
762 $(objpfx)circlemod1.so: $(objpfx)circlemod2.so
763 $(objpfx)circlemod2.so: $(objpfx)circlemod3.so
764 $(objpfx)circlemod1a.so: $(objpfx)circlemod2a.so
765 $(objpfx)circlemod2a.so: $(objpfx)circlemod3a.so
766
767 $(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so)
768
769 $(objpfx)order-cmp.out: $(objpfx)order.out
770 (echo "0123456789" | cmp $< -) > $@; \
771 $(evaluate-test)
772
773 $(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so)
774 $(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
775 vismain-ENV = LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
776
777 $(objpfx)noload: $(objpfx)testobj1.so $(libdl)
778 LDFLAGS-noload = -rdynamic $(no-as-needed)
779 $(objpfx)noload.out: $(objpfx)testobj5.so
780
781 $(objpfx)noload-mem.out: $(objpfx)noload.out
782 $(common-objpfx)malloc/mtrace $(objpfx)noload.mtrace > $@; \
783 $(evaluate-test)
784 noload-ENV = MALLOC_TRACE=$(objpfx)noload.mtrace
785
786 LDFLAGS-nodelete = -rdynamic
787 LDFLAGS-nodelmod1.so = -Wl,--enable-new-dtags,-z,nodelete
788 LDFLAGS-nodelmod4.so = -Wl,--enable-new-dtags,-z,nodelete
789 $(objpfx)nodelete: $(libdl)
790 $(objpfx)nodelete.out: $(objpfx)nodelmod1.so $(objpfx)nodelmod2.so \
791 $(objpfx)nodelmod3.so
792
793 LDFLAGS-nodlopenmod.so = -Wl,--enable-new-dtags,-z,nodlopen
794 $(objpfx)nodlopen: $(libdl)
795 $(objpfx)nodlopen.out: $(objpfx)nodlopenmod.so
796
797 $(objpfx)nodlopenmod2.so: $(objpfx)nodlopenmod.so
798 $(objpfx)nodlopen2: $(libdl)
799 $(objpfx)nodlopen2.out: $(objpfx)nodlopenmod2.so
800
801 $(objpfx)filtmod1.so: $(objpfx)filtmod1.os $(objpfx)filtmod2.so
802 $(LINK.o) -shared -o $@ -B$(csu-objpfx) $(LDFLAGS.so) \
803 -L$(subst :, -L,$(rpath-link)) \
804 -Wl,-rpath-link=$(rpath-link) \
805 $< -Wl,-F,$(objpfx)filtmod2.so
806 $(objpfx)filter: $(objpfx)filtmod1.so
807
808 # This does not link against libc.
809 CFLAGS-filtmod1.c = $(no-stack-protector)
810
811 $(objpfx)unload: $(libdl)
812 $(objpfx)unload.out: $(objpfx)unloadmod.so
813
814 $(objpfx)reldep: $(libdl)
815 $(objpfx)reldep.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod2.so
816
817 $(objpfx)reldep2: $(libdl)
818 $(objpfx)reldep2.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod3.so
819
820 $(objpfx)reldep3: $(libdl)
821 $(objpfx)reldep3.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
822
823 $(objpfx)reldep4: $(libdl)
824 $(objpfx)reldep4.out: $(objpfx)reldep4mod1.so $(objpfx)reldep4mod2.so
825
826 $(objpfx)next: $(objpfx)nextmod1.so $(objpfx)nextmod2.so $(libdl)
827 LDFLAGS-next = $(no-as-needed)
828
829 $(objpfx)unload2: $(libdl)
830 $(objpfx)unload2.out: $(objpfx)unload2mod.so $(objpfx)unload2dep.so
831
832 $(objpfx)lateglobal: $(libdl)
833 $(objpfx)lateglobal.out: $(objpfx)ltglobmod1.so $(objpfx)ltglobmod2.so
834
835 $(objpfx)tst-pathopt: $(libdl)
836 $(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \
837 $(objpfx)pathoptobj.so
838 $(SHELL) $< $(common-objpfx) '$(test-wrapper-env)' \
839 '$(run-program-env)'; \
840 $(evaluate-test)
841
842 $(objpfx)tst-rtld-load-self.out: tst-rtld-load-self.sh $(objpfx)ld.so
843 $(SHELL) $^ '$(test-wrapper)' '$(test-wrapper-env)' > $@; \
844 $(evaluate-test)
845
846 $(objpfx)initfirst: $(libdl)
847 $(objpfx)initfirst.out: $(objpfx)firstobj.so
848
849 $(objpfx)global: $(objpfx)globalmod1.so
850 $(objpfx)global.out: $(objpfx)reldepmod1.so
851
852 $(objpfx)dblload: $(libdl)
853 $(objpfx)dblload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
854
855 $(objpfx)dblunload: $(libdl)
856 $(objpfx)dblunload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
857
858 $(objpfx)reldep5: $(libdl)
859 $(objpfx)reldep5.out: $(objpfx)reldepmod5.so $(objpfx)reldepmod6.so
860
861 $(objpfx)reldep6: $(libdl)
862 $(objpfx)reldep6.out: $(objpfx)reldep6mod3.so $(objpfx)reldep6mod4.so
863
864 $(objpfx)reldep7: $(libdl)
865 $(objpfx)reldep7.out: $(objpfx)reldep7mod1.so $(objpfx)reldep7mod2.so
866
867 $(objpfx)reldep8: $(libdl)
868 $(objpfx)reldep8.out: $(objpfx)reldep8mod3.so
869
870 LDFLAGS-nodel2mod2.so = -Wl,--enable-new-dtags,-z,nodelete
871 $(objpfx)nodelete2: $(libdl)
872 $(objpfx)nodelete2.out: $(objpfx)nodel2mod3.so
873
874 $(objpfx)reldep9: $(libdl)
875 $(objpfx)reldep9.out: $(objpfx)reldep9mod3.so
876
877 $(objpfx)tst-tls3: $(objpfx)tst-tlsmod1.so
878
879 $(objpfx)tst-tls4: $(libdl)
880 $(objpfx)tst-tls4.out: $(objpfx)tst-tlsmod2.so
881
882 $(objpfx)tst-tls5: $(libdl)
883 $(objpfx)tst-tls5.out: $(objpfx)tst-tlsmod2.so
884
885 $(objpfx)tst-tls6: $(libdl)
886 $(objpfx)tst-tls6.out: $(objpfx)tst-tlsmod2.so
887
888 $(objpfx)tst-tls7: $(libdl)
889 $(objpfx)tst-tls7.out: $(objpfx)tst-tlsmod3.so
890
891 $(objpfx)tst-tls8: $(libdl)
892 $(objpfx)tst-tls8.out: $(objpfx)tst-tlsmod3.so $(objpfx)tst-tlsmod4.so
893
894 $(objpfx)tst-tls9: $(libdl)
895 $(objpfx)tst-tls9.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
896
897 $(objpfx)tst-tls10: $(objpfx)tst-tlsmod8.so $(objpfx)tst-tlsmod7.so
898
899 $(objpfx)tst-tls11: $(objpfx)tst-tlsmod10.so $(objpfx)tst-tlsmod9.so
900
901 $(objpfx)tst-tls12: $(objpfx)tst-tlsmod12.so $(objpfx)tst-tlsmod11.so
902
903 $(objpfx)tst-tls13: $(libdl)
904 $(objpfx)tst-tls13.out: $(objpfx)tst-tlsmod13a.so
905
906 $(objpfx)tst-tls14: $(objpfx)tst-tlsmod14a.so $(libdl)
907 $(objpfx)tst-tls14.out: $(objpfx)tst-tlsmod14b.so
908
909 $(objpfx)tst-tls15: $(libdl)
910 $(objpfx)tst-tls15.out: $(objpfx)tst-tlsmod15a.so $(objpfx)tst-tlsmod15b.so
911
912 $(objpfx)tst-tls-dlinfo: $(libdl)
913 $(objpfx)tst-tls-dlinfo.out: $(objpfx)tst-tlsmod2.so
914
915
916
917 $(objpfx)tst-tls16: $(libdl)
918 $(objpfx)tst-tls16.out: $(objpfx)tst-tlsmod16a.so $(objpfx)tst-tlsmod16b.so
919
920 $(objpfx)tst-tls17: $(libdl)
921 $(objpfx)tst-tls17.out: $(objpfx)tst-tlsmod17b.so
922 $(patsubst %,$(objpfx)%.os,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.os: tst-tlsmod17a.c
923 $(compile-command.c) -DN=$*
924 $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.so: $(objpfx)ld.so
925 $(objpfx)tst-tlsmod17b.so: $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules))
926
927 $(objpfx)tst-tls18: $(libdl)
928 $(objpfx)tst-tls18.out: $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules))
929 $(patsubst %,$(objpfx)%.os,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.os : tst-tlsmod18a.c
930 $(compile-command.c) -DN=$*
931 $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.so: $(objpfx)ld.so
932
933 $(objpfx)tst-tls19: $(libdl)
934 $(objpfx)tst-tls19.out: $(objpfx)tst-tls19mod1.so
935
936 CFLAGS-tst-align.c = $(stack-align-test-flags)
937 CFLAGS-tst-align2.c = $(stack-align-test-flags)
938 CFLAGS-tst-alignmod.c = $(stack-align-test-flags)
939 CFLAGS-tst-alignmod2.c = $(stack-align-test-flags)
940 $(objpfx)tst-align: $(libdl)
941 $(objpfx)tst-align.out: $(objpfx)tst-alignmod.so
942 $(objpfx)tst-align2: $(objpfx)tst-alignmod2.so
943
944 $(objpfx)unload3: $(libdl)
945 $(objpfx)unload3.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
946 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
947
948 $(objpfx)unload4: $(libdl)
949 $(objpfx)unload4.out: $(objpfx)unload4mod1.so $(objpfx)unload4mod3.so
950
951 $(objpfx)unload5: $(libdl)
952 $(objpfx)unload5.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
953 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
954
955 $(objpfx)unload6: $(libdl)
956 $(objpfx)unload6.out: $(objpfx)unload6mod1.so $(objpfx)unload6mod2.so \
957 $(objpfx)unload6mod3.so
958
959 $(objpfx)unload7: $(libdl)
960 $(objpfx)unload7.out: $(objpfx)unload7mod1.so $(objpfx)unload7mod2.so
961 unload7-ENV = MALLOC_PERTURB_=85
962
963 $(objpfx)unload8: $(libdl)
964 $(objpfx)unload8.out: $(objpfx)unload8mod1.so $(objpfx)unload8mod1x.so
965
966 ifdef libdl
967 $(objpfx)tst-tls9-static: $(common-objpfx)dlfcn/libdl.a
968 $(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
969 endif
970
971 ifeq ($(have-z-execstack),yes)
972 $(objpfx)tst-execstack: $(libdl)
973 $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
974 CPPFLAGS-tst-execstack.c = -DUSE_PTHREADS=0
975 LDFLAGS-tst-execstack = -Wl,-z,noexecstack
976 LDFLAGS-tst-execstack-mod = -Wl,-z,execstack
977
978 $(objpfx)tst-execstack-needed: $(objpfx)tst-execstack-mod.so
979 LDFLAGS-tst-execstack-needed = -Wl,-z,noexecstack
980
981 LDFLAGS-tst-execstack-prog = -Wl,-z,execstack
982 CFLAGS-tst-execstack-prog.c += -Wno-trampolines
983 CFLAGS-tst-execstack-mod.c += -Wno-trampolines
984 endif
985
986 LDFLAGS-tst-array2 = $(no-as-needed)
987 LDFLAGS-tst-array5 = $(no-as-needed)
988
989 $(objpfx)tst-array1-cmp.out: tst-array1.exp $(objpfx)tst-array1.out
990 cmp $^ > $@; \
991 $(evaluate-test)
992
993 $(objpfx)tst-array1-static-cmp.out: tst-array1.exp \
994 $(objpfx)tst-array1-static.out
995 cmp $^ > $@; \
996 $(evaluate-test)
997
998 $(objpfx)tst-array2: $(objpfx)tst-array2dep.so
999 $(objpfx)tst-array2-cmp.out: tst-array2.exp $(objpfx)tst-array2.out
1000 cmp $^ > $@; \
1001 $(evaluate-test)
1002
1003 $(objpfx)tst-array3-cmp.out: tst-array1.exp $(objpfx)tst-array3.out
1004 cmp $^ > $@; \
1005 $(evaluate-test)
1006
1007 $(objpfx)tst-array4: $(libdl)
1008 $(objpfx)tst-array4.out: $(objpfx)tst-array2dep.so
1009 $(objpfx)tst-array4-cmp.out: tst-array4.exp $(objpfx)tst-array4.out
1010 cmp $^ > $@; \
1011 $(evaluate-test)
1012
1013 $(objpfx)tst-array5: $(objpfx)tst-array5dep.so
1014 $(objpfx)tst-array5-cmp.out: tst-array5.exp $(objpfx)tst-array5.out
1015 cmp $^ > $@; \
1016 $(evaluate-test)
1017
1018 $(objpfx)tst-array5-static-cmp.out: tst-array5-static.exp \
1019 $(objpfx)tst-array5-static.out
1020 cmp $^ > $@; \
1021 $(evaluate-test)
1022
1023 CFLAGS-tst-pie1.c += $(pie-ccflag)
1024 CFLAGS-tst-pie2.c += $(pie-ccflag)
1025
1026 $(objpfx)tst-piemod1.so: $(libsupport)
1027 $(objpfx)tst-pie1: $(objpfx)tst-piemod1.so
1028
1029 ifeq (yes,$(build-shared))
1030 all-built-dso := $(common-objpfx)elf/ld.so $(common-objpfx)libc.so \
1031 $(filter-out $(common-objpfx)linkobj/libc.so, \
1032 $(sort $(wildcard $(addprefix $(common-objpfx), \
1033 */lib*.so \
1034 iconvdata/*.so))))
1035
1036 $(all-built-dso:=.dyn): %.dyn: %
1037 @rm -f $@T
1038 LC_ALL=C $(READELF) -W -d $< > $@T
1039 test -s $@T
1040 mv -f $@T $@
1041 common-generated += $(all-built-dso:$(common-objpfx)%=%.dyn)
1042
1043 $(objpfx)check-textrel.out: $(..)scripts/check-textrel.awk \
1044 $(all-built-dso:=.dyn)
1045 LC_ALL=C $(AWK) -f $^ > $@; \
1046 $(evaluate-test)
1047 generated += check-textrel.out
1048
1049 $(objpfx)execstack-default: $(first-word $(wildcard $(sysdirs:%=%/stackinfo.h)))
1050 $(make-target-directory)
1051 { echo '#include <elf.h>'; \
1052 echo '#include <stackinfo.h>'; \
1053 echo '#if (DEFAULT_STACK_PERMS & PF_X) == 0'; \
1054 echo '@@@execstack-no@@@'; \
1055 echo '#else'; \
1056 echo '@@@execstack-yes@@@'; \
1057 echo '#endif'; } | \
1058 $(CC) $(CFLAGS) $(CPPFLAGS) -E -x c-header - | \
1059 sed -n -e 's/^@@@\(.*\)@@@/\1/p' > $@T
1060 mv -f $@T $@
1061 generated += execstack-default
1062
1063 $(all-built-dso:=.phdr): %.phdr: %
1064 @rm -f $@T
1065 LC_ALL=C $(READELF) -W -l $< > $@T
1066 test -s $@T
1067 mv -f $@T $@
1068 common-generated += $(all-built-dso:$(common-objpfx)%=%.phdr)
1069
1070 $(objpfx)check-execstack.out: $(..)scripts/check-execstack.awk \
1071 $(objpfx)execstack-default \
1072 $(all-built-dso:=.phdr)
1073 LC_ALL=C $(AWK) -f $^ > $@; \
1074 $(evaluate-test)
1075 generated += check-execstack.out
1076
1077 $(objpfx)tst-dlmodcount: $(libdl)
1078 $(objpfx)tst-dlmodcount.out: $(test-modules)
1079
1080 $(all-built-dso:=.jmprel): %.jmprel: % Makefile
1081 @rm -f $@T
1082 LC_ALL=C $(READELF) -W -S -d -r $< > $@T
1083 test -s $@T
1084 mv -f $@T $@
1085 common-generated += $(all-built-dso:$(common-objpfx)%=%.jmprel)
1086
1087 localplt-built-dso := $(addprefix $(common-objpfx),\
1088 libc.so \
1089 elf/ld.so \
1090 math/libm.so \
1091 rt/librt.so \
1092 dlfcn/libdl.so \
1093 resolv/libresolv.so \
1094 crypt/libcrypt.so \
1095 )
1096 ifeq ($(build-mathvec),yes)
1097 localplt-built-dso += $(addprefix $(common-objpfx), mathvec/libmvec.so)
1098 endif
1099 ifeq ($(have-thread-library),yes)
1100 localplt-built-dso += $(filter-out %_nonshared.a, $(shared-thread-library))
1101 endif
1102
1103 vpath localplt.data $(+sysdep_dirs)
1104
1105 $(objpfx)check-localplt.out: $(..)scripts/check-localplt.awk \
1106 $(..)scripts/localplt.awk \
1107 $(localplt-built-dso:=.jmprel) \
1108 localplt.data
1109 LC_ALL=C $(AWK) -f $(filter-out $< %localplt.data,$^) | \
1110 LC_ALL=C $(AWK) -f $< $(filter %localplt.data,$^) - \
1111 > $@; \
1112 $(evaluate-test)
1113 endif
1114
1115 $(objpfx)tst-dlopenrpathmod.so: $(libdl)
1116 $(objpfx)tst-dlopenrpath: $(objpfx)tst-dlopenrpathmod.so $(libdl)
1117 CFLAGS-tst-dlopenrpath.c += -DPFX=\"$(objpfx)\"
1118 LDFLAGS-tst-dlopenrpathmod.so += -Wl,-rpath,\$$ORIGIN/test-subdir
1119 $(objpfx)tst-dlopenrpath.out: $(objpfx)firstobj.so
1120
1121 $(objpfx)tst-deep1mod2.so: $(objpfx)tst-deep1mod3.so
1122 $(objpfx)tst-deep1: $(libdl) $(objpfx)tst-deep1mod1.so
1123 $(objpfx)tst-deep1.out: $(objpfx)tst-deep1mod2.so
1124 LDFLAGS-tst-deep1 += -rdynamic
1125 tst-deep1mod3.so-no-z-defs = yes
1126
1127 $(objpfx)tst-dlmopen1mod.so: $(libdl)
1128 $(objpfx)tst-dlmopen1: $(libdl)
1129 $(objpfx)tst-dlmopen1.out: $(objpfx)tst-dlmopen1mod.so
1130
1131 $(objpfx)tst-dlmopen2: $(libdl)
1132 $(objpfx)tst-dlmopen2.out: $(objpfx)tst-dlmopen1mod.so
1133
1134 $(objpfx)tst-dlmopen3: $(libdl)
1135 $(objpfx)tst-dlmopen3.out: $(objpfx)tst-dlmopen1mod.so
1136
1137 $(objpfx)tst-audit1.out: $(objpfx)tst-auditmod1.so
1138 tst-audit1-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1139
1140 $(objpfx)tst-audit2: $(libdl)
1141 $(objpfx)tst-audit2.out: $(objpfx)tst-auditmod1.so $(objpfx)tst-auditmod9b.so
1142 # Prevent GCC-5 from translating a malloc/memset pair into calloc
1143 CFLAGS-tst-audit2.c += -fno-builtin
1144 tst-audit2-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1145
1146 $(objpfx)tst-audit9: $(libdl)
1147 $(objpfx)tst-audit9.out: $(objpfx)tst-auditmod9a.so $(objpfx)tst-auditmod9b.so
1148 tst-audit9-ENV = LD_AUDIT=$(objpfx)tst-auditmod9a.so
1149
1150 $(objpfx)tst-audit8: $(libm)
1151 $(objpfx)tst-audit8.out: $(objpfx)tst-auditmod1.so
1152 tst-audit8-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1153
1154 $(objpfx)tst-global1: $(libdl)
1155 $(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
1156
1157 $(objpfx)order2: $(libdl)
1158 $(objpfx)order2.out: $(objpfx)order2mod1.so $(objpfx)order2mod2.so
1159 $(objpfx)order2-cmp.out: $(objpfx)order2.out
1160 (echo "12345" | cmp $< -) > $@; \
1161 $(evaluate-test)
1162 $(objpfx)order2mod1.so: $(objpfx)order2mod4.so
1163 $(objpfx)order2mod4.so: $(objpfx)order2mod3.so
1164 $(objpfx)order2mod2.so: $(objpfx)order2mod3.so
1165 order2mod2.so-no-z-defs = yes
1166 LDFLAGS-order2mod1.so = $(no-as-needed)
1167 LDFLAGS-order2mod2.so = $(no-as-needed)
1168
1169 tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child"
1170 tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
1171
1172 tst-ptrguard1-ARGS = --command "$(host-test-program-cmd) --child"
1173 # When built statically, the pointer guard interface uses
1174 # __pointer_chk_guard_local.
1175 CFLAGS-tst-ptrguard1-static.c = -DPTRGUARD_LOCAL
1176 tst-ptrguard1-static-ARGS = --command "$(objpfx)tst-ptrguard1-static --child"
1177
1178 $(objpfx)tst-leaks1: $(libdl)
1179 $(objpfx)tst-leaks1-mem.out: $(objpfx)tst-leaks1.out
1180 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1.mtrace > $@; \
1181 $(evaluate-test)
1182
1183 $(objpfx)tst-leaks1-static: $(common-objpfx)dlfcn/libdl.a
1184 $(objpfx)tst-leaks1-static-mem.out: $(objpfx)tst-leaks1-static.out
1185 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1-static.mtrace > $@; \
1186 $(evaluate-test)
1187
1188 tst-leaks1-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1.mtrace
1189 tst-leaks1-static-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1-static.mtrace
1190
1191 $(objpfx)tst-addr1: $(libdl)
1192
1193 $(objpfx)tst-thrlock: $(libdl) $(shared-thread-library)
1194 $(objpfx)tst-dlopen-aout: $(libdl) $(shared-thread-library)
1195
1196 CFLAGS-ifuncmain1pic.c += $(pic-ccflag)
1197 CFLAGS-ifuncmain1picstatic.c += $(pic-ccflag)
1198 CFLAGS-ifuncmain1staticpic.c += $(pic-ccflag)
1199 CFLAGS-ifuncdep1pic.c += $(pic-ccflag)
1200 CFLAGS-ifuncmain1vispic.c += $(pic-ccflag)
1201 CFLAGS-ifuncmain2pic.c += $(pic-ccflag)
1202 CFLAGS-ifuncmain2picstatic.c += $(pic-ccflag)
1203 CFLAGS-ifuncdep2pic.c += $(pic-ccflag)
1204 CFLAGS-ifuncmain4picstatic.c += $(pic-ccflag)
1205 CFLAGS-ifuncmain5pic.c += $(pic-ccflag)
1206 CFLAGS-ifuncmain5picstatic.c += $(pic-ccflag)
1207 CFLAGS-ifuncmain5staticpic.c += $(pic-ccflag)
1208 CFLAGS-ifuncdep5pic.c += $(pic-ccflag)
1209 CFLAGS-ifuncmain7pic.c += $(pic-ccflag)
1210 CFLAGS-ifuncmain7picstatic.c += $(pic-ccflag)
1211
1212 LDFLAGS-ifuncmain3 = -Wl,-export-dynamic
1213
1214 CFLAGS-ifuncmain1pie.c += $(pie-ccflag)
1215 CFLAGS-ifuncmain1vispie.c += $(pie-ccflag)
1216 CFLAGS-ifuncmain1staticpie.c += $(pie-ccflag)
1217 CFLAGS-ifuncmain5pie.c += $(pie-ccflag)
1218 CFLAGS-ifuncmain6pie.c += $(pie-ccflag)
1219 CFLAGS-ifuncmain7pie.c += $(pie-ccflag)
1220
1221 $(objpfx)ifuncmain1pie: $(objpfx)ifuncmod1.so
1222 $(objpfx)ifuncmain1staticpie: $(objpfx)ifuncdep1pic.o
1223 $(objpfx)ifuncmain1vispie: $(objpfx)ifuncmod1.so
1224 $(objpfx)ifuncmain5pie: $(objpfx)ifuncmod5.so
1225 $(objpfx)ifuncmain6pie: $(objpfx)ifuncmod6.so
1226
1227 $(objpfx)ifuncmain1: $(addprefix $(objpfx),ifuncmod1.so)
1228 $(objpfx)ifuncmain1pic: $(addprefix $(objpfx),ifuncmod1.so)
1229 $(objpfx)ifuncmain1staticpic: $(addprefix $(objpfx),ifuncdep1pic.o)
1230 $(objpfx)ifuncmain1static: $(addprefix $(objpfx),ifuncdep1.o)
1231 $(objpfx)ifuncmain1picstatic: $(addprefix $(objpfx),ifuncdep1pic.o)
1232 $(objpfx)ifuncmain1vis: $(addprefix $(objpfx),ifuncmod1.so)
1233 $(objpfx)ifuncmain1vispic: $(addprefix $(objpfx),ifuncmod1.so)
1234 $(objpfx)ifuncmain2: $(addprefix $(objpfx),ifuncdep2.o)
1235 $(objpfx)ifuncmain2pic: $(addprefix $(objpfx),ifuncdep2pic.o)
1236 $(objpfx)ifuncmain2static: $(addprefix $(objpfx),ifuncdep2.o)
1237 $(objpfx)ifuncmain2picstatic: $(addprefix $(objpfx),ifuncdep2pic.o)
1238
1239 $(objpfx)ifuncmain3: $(libdl)
1240 $(objpfx)ifuncmain3.out: $(objpfx)ifuncmod3.so
1241
1242 $(objpfx)ifuncmain5: $(addprefix $(objpfx),ifuncmod5.so)
1243 $(objpfx)ifuncmain5pic: $(addprefix $(objpfx),ifuncmod5.so)
1244 $(objpfx)ifuncmain5static: $(addprefix $(objpfx),ifuncdep5.o)
1245 $(objpfx)ifuncmain5staticpic: $(addprefix $(objpfx),ifuncdep5pic.o)
1246 $(objpfx)ifuncmain5picstatic: $(addprefix $(objpfx),ifuncdep5pic.o)
1247
1248 $(objpfx)tst-unique1: $(libdl)
1249 $(objpfx)tst-unique1.out: $(objpfx)tst-unique1mod1.so \
1250 $(objpfx)tst-unique1mod2.so
1251
1252 $(objpfx)tst-unique2: $(libdl) $(objpfx)tst-unique2mod1.so
1253 $(objpfx)tst-unique2.out: $(objpfx)tst-unique2mod2.so
1254
1255 $(objpfx)tst-unique3: $(libdl) $(objpfx)tst-unique3lib.so
1256 $(objpfx)tst-unique3.out: $(objpfx)tst-unique3lib2.so
1257
1258 $(objpfx)tst-unique4: $(objpfx)tst-unique4lib.so
1259
1260 $(objpfx)tst-nodelete: $(libdl)
1261 $(objpfx)tst-nodelete.out: $(objpfx)tst-nodelete-uniquemod.so \
1262 $(objpfx)tst-nodelete-rtldmod.so \
1263 $(objpfx)tst-nodelete-zmod.so
1264
1265 LDFLAGS-tst-nodelete = -rdynamic
1266 LDFLAGS-tst-nodelete-zmod.so = -Wl,--enable-new-dtags,-z,nodelete
1267
1268 $(objpfx)tst-nodelete2: $(libdl)
1269 $(objpfx)tst-nodelete2.out: $(objpfx)tst-nodelete2mod.so
1270
1271 LDFLAGS-tst-nodelete2 = -rdynamic
1272
1273 $(objpfx)tst-initorder-cmp.out: tst-initorder.exp $(objpfx)tst-initorder.out
1274 cmp $^ > $@; \
1275 $(evaluate-test)
1276
1277 $(objpfx)tst-initorder2: $(objpfx)tst-initorder2a.so $(objpfx)tst-initorder2d.so $(objpfx)tst-initorder2c.so
1278 $(objpfx)tst-initorder2a.so: $(objpfx)tst-initorder2b.so
1279 $(objpfx)tst-initorder2b.so: $(objpfx)tst-initorder2c.so
1280 $(objpfx)tst-initorder2c.so: $(objpfx)tst-initorder2d.so
1281 LDFLAGS-tst-initorder2 = $(no-as-needed)
1282 LDFLAGS-tst-initorder2a.so = $(no-as-needed)
1283 LDFLAGS-tst-initorder2b.so = $(no-as-needed)
1284 LDFLAGS-tst-initorder2c.so = $(no-as-needed)
1285 define o-iterator-doit
1286 $(objpfx)tst-initorder2$o.os: tst-initorder2.c; \
1287 $$(compile-command.c) -DNAME=\"$o\"
1288 endef
1289 object-suffixes-left := a b c d
1290 include $(o-iterator)
1291
1292 $(objpfx)tst-initorder2-cmp.out: tst-initorder2.exp $(objpfx)tst-initorder2.out
1293 cmp $^ > $@; \
1294 $(evaluate-test)
1295
1296 $(objpfx)tst-relsort1: $(libdl)
1297 $(objpfx)tst-relsort1mod1.so: $(libm) $(objpfx)tst-relsort1mod2.so
1298 $(objpfx)tst-relsort1mod2.so: $(libm)
1299 $(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
1300 $(objpfx)tst-relsort1mod2.so
1301
1302 $(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so
1303 $(test-wrapper-env) \
1304 LD_TRACE_LOADED_OBJECTS=1 \
1305 LD_DEBUG=unused \
1306 LD_PRELOAD= \
1307 $(rtld-prefix) \
1308 $< > $@; \
1309 $(evaluate-test)
1310
1311 $(objpfx)tst-unused-dep-cmp.out: $(objpfx)tst-unused-dep.out
1312 cmp $< /dev/null > $@; \
1313 $(evaluate-test)
1314
1315 $(objpfx)tst-audit11.out: $(objpfx)tst-auditmod11.so $(objpfx)tst-audit11mod1.so
1316 $(objpfx)tst-audit11: $(libdl)
1317 tst-audit11-ENV = LD_AUDIT=$(objpfx)tst-auditmod11.so
1318 $(objpfx)tst-audit11mod1.so: $(objpfx)tst-audit11mod2.so
1319 LDFLAGS-tst-audit11mod2.so = -Wl,--version-script=tst-audit11mod2.map,-soname,tst-audit11mod2.so
1320
1321 $(objpfx)tst-audit12.out: $(objpfx)tst-auditmod12.so $(objpfx)tst-audit12mod1.so $(objpfx)tst-audit12mod3.so
1322 $(objpfx)tst-audit12: $(libdl)
1323 tst-audit12-ENV = LD_AUDIT=$(objpfx)tst-auditmod12.so
1324 $(objpfx)tst-audit12mod1.so: $(objpfx)tst-audit12mod2.so
1325 LDFLAGS-tst-audit12mod2.so = -Wl,--version-script=tst-audit12mod2.map
1326
1327 # Override -z defs, so that we can reference an undefined symbol.
1328 # Force lazy binding for the same reason.
1329 LDFLAGS-tst-latepthreadmod.so = \
1330 -Wl,-z,lazy -Wl,--unresolved-symbols=ignore-all
1331 # Do not optimize sibling calls as the test relies on a JMP_SLOT relocation for
1332 # function this_function_is_not_defined.
1333 CFLAGS-tst-latepthreadmod.c = -fno-optimize-sibling-calls
1334 $(objpfx)tst-latepthreadmod.so: $(shared-thread-library)
1335 $(objpfx)tst-latepthread: $(libdl)
1336 $(objpfx)tst-latepthread.out: $(objpfx)tst-latepthreadmod.so
1337
1338 # The test modules are parameterized by preprocessor macros.
1339 $(patsubst %,$(objpfx)%.os,$(tst-tls-many-dynamic-modules)): \
1340 $(objpfx)tst-tls-manydynamic%mod.os : tst-tls-manydynamicmod.c
1341 $(compile-command.c) \
1342 -DNAME=tls_global_$* -DSETTER=set_value_$* -DGETTER=get_value_$*
1343 $(objpfx)tst-tls-manydynamic: $(libdl) $(shared-thread-library)
1344 $(objpfx)tst-tls-manydynamic.out: \
1345 $(patsubst %,$(objpfx)%.so,$(tst-tls-many-dynamic-modules))
1346
1347 tst-prelink-ENV = LD_TRACE_PRELINKING=1
1348
1349 $(objpfx)tst-prelink-conflict.out: $(objpfx)tst-prelink.out
1350 grep stdout $< | grep conflict | $(AWK) '{ print $$10, $$11 }' > $@
1351
1352 $(objpfx)tst-prelink-cmp.out: tst-prelink.exp \
1353 $(objpfx)tst-prelink-conflict.out
1354 cmp $^ > $@; \
1355 $(evaluate-test)
1356
1357 $(objpfx)tst-ldconfig-X.out : tst-ldconfig-X.sh $(objpfx)ldconfig
1358 $(SHELL) $< '$(common-objpfx)' '$(test-wrapper-env)' \
1359 '$(run-program-env)' > $@; \
1360 $(evaluate-test)
1361
1362 $(objpfx)tst-dlsym-error: $(libdl)
1363
1364 # Test static linking of all the libraries we can possibly link
1365 # together. Note that in some configurations this may be less than the
1366 # complete list of libraries we build but we try to maxmimize this list.
1367 $(objpfx)tst-linkall-static: \
1368 $(common-objpfx)math/libm.a \
1369 $(common-objpfx)resolv/libresolv.a \
1370 $(common-objpfx)dlfcn/libdl.a \
1371 $(common-objpfx)login/libutil.a \
1372 $(common-objpfx)rt/librt.a \
1373 $(common-objpfx)resolv/libanl.a \
1374 $(static-thread-library)
1375
1376 # If we are using NSS crypto and we have the ability to link statically
1377 # then we include libcrypt.a, otherwise we leave out libcrypt.a and
1378 # link as much as we can into the tst-linkall-static test. This assumes
1379 # that linking with libcrypt.a does everything required to include the
1380 # static NSS crypto library.
1381 ifeq (yesyes,$(nss-crypt)$(static-nss-crypt))
1382 $(objpfx)tst-linkall-static: \
1383 $(common-objpfx)crypt/libcrypt.a
1384 endif
1385 # If we are not using NSS crypto then we always have the ability to link
1386 # with libcrypt.a.
1387 ifeq (no,$(nss-crypt))
1388 $(objpfx)tst-linkall-static: \
1389 $(common-objpfx)crypt/libcrypt.a
1390 endif
1391
1392 # The application depends on the DSO, and the DSO loads the plugin.
1393 # The plugin also depends on the DSO. This creates the circular
1394 # dependency via dlopen that we're testing to make sure works.
1395 $(objpfx)tst-nodelete-dlclose-dso.so: $(libdl)
1396 $(objpfx)tst-nodelete-dlclose-plugin.so: $(objpfx)tst-nodelete-dlclose-dso.so
1397 $(objpfx)tst-nodelete-dlclose: $(objpfx)tst-nodelete-dlclose-dso.so
1398 $(objpfx)tst-nodelete-dlclose.out: $(objpfx)tst-nodelete-dlclose-dso.so \
1399 $(objpfx)tst-nodelete-dlclose-plugin.so