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