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