Add more libm tests (fabs, fdim, fma, fmax, fmin, fmod).
[glibc.git] / elf / Makefile
blob546c8eb376bb61d29459a0268c9644d969632941
1 # Copyright (C) 1995-2015 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 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@%$(msgcatdir)%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 ifeq (yes,$(build-shared))
127 tests-static += tst-tls9-static
128 tst-tls9-static-ENV = \
129 LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn
130 endif
131 tests += $(tests-static)
132 ifeq (yes,$(build-shared))
133 tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
134 constload1 order noload filter unload \
135 reldep reldep2 reldep3 reldep4 nodelete nodelete2 \
136 nodlopen nodlopen2 neededtest neededtest2 \
137 neededtest3 neededtest4 unload2 lateglobal initfirst global \
138 restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
139 circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \
140 tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-tls15 \
141 tst-tls16 tst-tls17 tst-tls18 tst-tls19 tst-tls-dlinfo \
142 tst-align tst-align2 $(tests-execstack-$(have-z-execstack)) \
143 tst-dlmodcount tst-dlopenrpath tst-deep1 \
144 tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
145 unload3 unload4 unload5 unload6 unload7 unload8 tst-global1 order2 \
146 tst-audit1 tst-audit2 tst-audit8 tst-audit9 \
147 tst-stackguard1 tst-addr1 tst-thrlock \
148 tst-unique1 tst-unique2 $(if $(CXX),tst-unique3 tst-unique4 \
149 tst-nodelete) \
150 tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \
151 tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
152 tst-nodelete2
153 # reldep9
154 ifeq ($(build-hardcoded-path-in-tests),yes)
155 tests += tst-dlopen-aout
156 LDFLAGS-tst-dlopen-aout = $(no-pie-ldflag)
157 endif
158 test-srcs = tst-pathopt
159 selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
160 ifneq ($(selinux-enabled),1)
161 tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
162 endif
163 endif
164 ifeq ($(run-built-tests),yes)
165 tests-special += $(objpfx)tst-leaks1-mem.out \
166 $(objpfx)tst-leaks1-static-mem.out $(objpfx)noload-mem.out
167 endif
168 tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
169 tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
170 tlsmod17a-modules = $(addprefix tst-tlsmod17a, $(tlsmod17a-suffixes))
171 tlsmod18a-modules = $(addprefix tst-tlsmod18a, $(tlsmod17a-suffixes))
172 extra-test-objs += $(tlsmod17a-modules:=.os) $(tlsmod18a-modules:=.os)
173 test-extras += tst-tlsmod17a tst-tlsmod18a
174 modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
175 testobj1_1 failobj constload2 constload3 unloadmod \
176 dep1 dep2 dep3 dep4 vismod1 vismod2 vismod3 \
177 nodelmod1 nodelmod2 nodelmod3 nodelmod4 \
178 nodel2mod1 nodel2mod2 nodel2mod3 \
179 nodlopenmod nodlopenmod2 filtmod1 filtmod2 \
180 reldepmod1 reldepmod2 reldepmod3 reldepmod4 nextmod1 nextmod2 \
181 reldep4mod1 reldep4mod2 reldep4mod3 reldep4mod4 \
182 neededobj1 neededobj2 neededobj3 neededobj4 \
183 neededobj5 neededobj6 firstobj globalmod1 \
184 unload2mod unload2dep ltglobmod1 ltglobmod2 pathoptobj \
185 dblloadmod1 dblloadmod2 dblloadmod3 reldepmod5 reldepmod6 \
186 reldep6mod0 reldep6mod1 reldep6mod2 reldep6mod3 reldep6mod4 \
187 reldep7mod1 reldep7mod2 \
188 tst-tlsmod1 tst-tlsmod2 tst-tlsmod3 tst-tlsmod4 \
189 tst-tlsmod5 tst-tlsmod6 tst-tlsmod7 tst-tlsmod8 \
190 tst-tlsmod9 tst-tlsmod10 tst-tlsmod11 tst-tlsmod12 \
191 tst-tlsmod13 tst-tlsmod13a tst-tlsmod14a tst-tlsmod14b \
192 tst-tlsmod15a tst-tlsmod15b tst-tlsmod16a tst-tlsmod16b \
193 $(tlsmod17a-modules) tst-tlsmod17b $(tlsmod18a-modules) \
194 tst-tls19mod1 tst-tls19mod2 tst-tls19mod3 \
195 circlemod1 circlemod1a circlemod2 circlemod2a \
196 circlemod3 circlemod3a \
197 reldep8mod1 reldep8mod2 reldep8mod3 \
198 reldep9mod1 reldep9mod2 reldep9mod3 \
199 tst-alignmod tst-alignmod2 \
200 $(modules-execstack-$(have-z-execstack)) \
201 tst-dlopenrpathmod tst-deep1mod1 tst-deep1mod2 tst-deep1mod3 \
202 tst-dlmopen1mod tst-auditmod1 \
203 unload3mod1 unload3mod2 unload3mod3 unload3mod4 \
204 unload4mod1 unload4mod2 unload4mod3 unload4mod4 \
205 unload6mod1 unload6mod2 unload6mod3 \
206 unload7mod1 unload7mod2 \
207 unload8mod1 unload8mod1x unload8mod2 unload8mod3 \
208 order2mod1 order2mod2 order2mod3 order2mod4 \
209 tst-unique1mod1 tst-unique1mod2 \
210 tst-unique2mod1 tst-unique2mod2 \
211 tst-auditmod9a tst-auditmod9b \
212 $(if $(CXX),tst-unique3lib tst-unique3lib2 tst-unique4lib \
213 tst-nodelete-uniquemod tst-nodelete-rtldmod \
214 tst-nodelete-zmod) \
215 tst-initordera1 tst-initorderb1 \
216 tst-initordera2 tst-initorderb2 \
217 tst-initordera3 tst-initordera4 \
218 tst-initorder2a tst-initorder2b tst-initorder2c \
219 tst-initorder2d \
220 tst-relsort1mod1 tst-relsort1mod2 tst-array2dep \
221 tst-array5dep tst-null-argv-lib \
222 tst-tlsalign-lib tst-nodelete-opened-lib tst-nodelete2mod
223 ifeq (yes,$(have-protected-data))
224 modules-names += tst-protected1moda tst-protected1modb
225 tests += tst-protected1a tst-protected1b
226 $(objpfx)tst-protected1a: $(addprefix $(objpfx),tst-protected1moda.so tst-protected1modb.so)
227 $(objpfx)tst-protected1b: $(addprefix $(objpfx),tst-protected1modb.so tst-protected1moda.so)
228 tst-protected1modb.so-no-z-defs = yes
229 # These tests fail with GCC versions prior to 5.1 and with some versions
230 # of binutils. See https://sourceware.org/bugzilla/show_bug.cgi?id=17709
231 # and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248 for details.
232 # Perhaps in future we can make these XFAILs conditional on some detection
233 # of compiler/linker behavior/version.
234 test-xfail-tst-protected1a = yes
235 test-xfail-tst-protected1b = yes
236 endif
237 ifeq (yesyes,$(have-fpie)$(build-shared))
238 modules-names += tst-piemod1
239 tests += tst-pie1 tst-pie2
240 tests-pie += tst-pie1 tst-pie2
241 tests += vismain
242 tests-pie += vismain
243 CFLAGS-vismain.c = $(PIE-ccflag)
244 endif
245 modules-execstack-yes = tst-execstack-mod
246 extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
247 # We need this variable to be sure the test modules get the right CPPFLAGS.
248 test-extras += $(modules-names)
250 # filtmod1.so has a special rule
251 modules-names-nobuild := filtmod1
253 ifneq (no,$(multi-arch))
254 tests-static += ifuncmain1static ifuncmain1picstatic \
255 ifuncmain2static ifuncmain2picstatic \
256 ifuncmain4static ifuncmain4picstatic \
257 ifuncmain5static ifuncmain5picstatic \
258 ifuncmain7static ifuncmain7picstatic
260 ifeq (yes,$(build-shared))
261 tests += ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \
262 ifuncmain1staticpic \
263 ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \
264 ifuncmain5 ifuncmain5pic ifuncmain5staticpic \
265 ifuncmain7 ifuncmain7pic
266 ifunc-test-modules = ifuncdep1 ifuncdep1pic ifuncdep2 ifuncdep2pic \
267 ifuncdep5 ifuncdep5pic
268 extra-test-objs += $(ifunc-test-modules:=.o)
269 test-extras += $(ifunc-test-modules)
270 ifeq (yes,$(have-fpie))
271 ifunc-pie-tests = ifuncmain1pie ifuncmain1vispie ifuncmain1staticpie \
272 ifuncmain5pie ifuncmain6pie ifuncmain7pie
273 tests += $(ifunc-pie-tests)
274 tests-pie += $(ifunc-pie-tests)
275 endif
276 modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6
277 endif
278 endif
280 ifeq (yes,$(build-shared))
281 ifeq ($(run-built-tests),yes)
282 tests-special += $(objpfx)tst-pathopt.out $(objpfx)tst-rtld-load-self.out
283 endif
284 tests-special += $(objpfx)check-textrel.out $(objpfx)check-execstack.out \
285 $(objpfx)check-localplt.out
286 endif
288 ifeq ($(run-built-tests),yes)
289 tests-special += $(objpfx)order-cmp.out $(objpfx)tst-array1-cmp.out \
290 $(objpfx)tst-array1-static-cmp.out \
291 $(objpfx)tst-array2-cmp.out $(objpfx)tst-array3-cmp.out \
292 $(objpfx)tst-array4-cmp.out $(objpfx)tst-array5-cmp.out \
293 $(objpfx)tst-array5-static-cmp.out $(objpfx)order2-cmp.out \
294 $(objpfx)tst-initorder-cmp.out \
295 $(objpfx)tst-initorder2-cmp.out $(objpfx)tst-unused-dep.out \
296 $(objpfx)tst-unused-dep-cmp.out
297 endif
299 check-abi: $(objpfx)check-abi-ld.out
300 tests-special += $(objpfx)check-abi-ld.out
301 update-abi: update-abi-ld
303 include ../Rules
305 ifeq (yes,$(build-shared))
306 # Make sure these things are built in the `make lib' pass so they can be used
307 # to run programs during the `make others' pass.
308 lib-noranlib: $(objpfx)$(rtld-installed-name) \
309 $(addprefix $(objpfx),$(extra-objs))
310 endif
312 # Command to link into a larger single relocatable object.
313 reloc-link = $(LINK.o) -nostdlib -nostartfiles -r
315 $(objpfx)sotruss-lib.so: $(shlib-lds)
317 $(objpfx)dl-allobjs.os: $(all-rtld-routines:%=$(objpfx)%.os)
318 $(reloc-link) -o $@ $^
320 # Link together the dynamic linker into a single relocatable object.
321 # First we do a link against libc_pic.a just to get a link map,
322 # and discard the object produced by that link. From the link map
323 # we can glean all the libc modules that need to go into the dynamic
324 # linker. Then we do a recursive make that goes into all the subdirs
325 # those modules come from and builds special rtld-foo.os versions that
326 # are compiled with special flags, and puts these modules into rtld-libc.a
327 # for us. Then we do the real link using rtld-libc.a instead of libc_pic.a.
329 $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
330 @-rm -f $@T
331 $(reloc-link) -o $@.o '-Wl,-(' $^ -lgcc '-Wl,-)' -Wl,-Map,$@T
332 rm -f $@.o
333 mv -f $@T $@
335 $(objpfx)librtld.mk: $(objpfx)librtld.map Makefile
336 LC_ALL=C \
337 sed -n 's@^$(common-objpfx)\([^(]*\)(\([^)]*\.os\)) *.*$$@\1 \2@p' \
338 $< | \
339 while read lib file; do \
340 case $$lib in \
341 libc_pic.a) \
342 LC_ALL=C fgrep -l /$$file \
343 $(common-objpfx)stamp.os $(common-objpfx)*/stamp.os | \
344 LC_ALL=C \
345 sed 's@^$(common-objpfx)\([^/]*\)/stamp\.os$$@rtld-\1'" +=$$file@"\
346 ;; \
347 */*.a) \
348 echo rtld-$${lib%%/*} += $$file ;; \
349 *) echo "Wasn't expecting $$lib($$file)" >&2; exit 1 ;; \
350 esac; \
351 done > $@T
352 echo rtld-subdirs = `LC_ALL=C sed 's/^rtld-\([^ ]*\).*$$/\1/' $@T \
353 | LC_ALL=C sort -u` >> $@T
354 mv -f $@T $@
356 $(objpfx)rtld-libc.a: $(objpfx)librtld.mk FORCE
357 $(MAKE) -f $< -f rtld-Rules
359 $(objpfx)librtld.os: $(objpfx)dl-allobjs.os $(objpfx)rtld-libc.a
360 $(LINK.o) -nostdlib -nostartfiles -r -o $@ '-Wl,-(' $^ -lgcc '-Wl,-)' \
361 -Wl,-Map,$@.map
363 generated += librtld.map librtld.mk rtld-libc.a librtld.os.map
365 z-now-yes = -Wl,-z,now
367 $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
368 # Link into a temporary file so that we don't touch $@ at all
369 # if the sanity check below fails.
370 $(LINK.o) -nostdlib -nostartfiles -shared -o $@.new \
371 $(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \
372 $(filter-out $(map-file),$^) $(load-map-file) \
373 -Wl,-soname=$(rtld-installed-name) \
374 -Wl,-defsym=_begin=0
375 $(call after-link,$@.new)
376 $(READELF) -s $@.new \
377 | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
378 mv -f $@.new $@
380 ifeq (yes,$(build-shared))
381 # interp.c exists just to get the runtime linker path into libc.so.
382 $(objpfx)interp.os: $(common-objpfx)runtime-linker.h
383 endif
385 ifneq (ld.so,$(rtld-installed-name))
386 # Make sure ld.so.1 exists in the build directory so we can link
387 # against it.
388 $(objpfx)$(rtld-installed-name): $(objpfx)ld.so
389 $(make-link)
390 generated += $(rtld-installed-name)
391 endif
393 # Build a file mentioning all trustworthy directories to look for shared
394 # libraries when using LD_LIBRARY_PATH in a setuid program. The user can
395 # add directories to the list by defining $(user-defined-trusted-dirs)
396 # before starting make.
397 $(objpfx)trusted-dirs.h: $(objpfx)trusted-dirs.st; @:
398 $(objpfx)trusted-dirs.st: Makefile $(..)Makeconfig
399 $(make-target-directory)
400 echo "$(subst :, ,$(default-rpath) $(user-defined-trusted-dirs))" \
401 | $(AWK) -f gen-trusted-dirs.awk > ${@:st=T};
402 echo '#define DL_DST_LIB "$(notdir $(slibdir))"' >> ${@:st=T}
403 $(move-if-change) ${@:st=T} ${@:st=h}
404 touch $@
405 CPPFLAGS-dl-load.c = -I$(objpfx). -I$(csu-objpfx).
407 ifeq (yes,$(build-shared))
408 $(inst_slibdir)/$(rtld-version-installed-name): $(objpfx)ld.so $(+force)
409 $(make-target-directory)
410 $(do-install-program)
412 $(inst_rtlddir)/$(rtld-installed-name): \
413 $(inst_slibdir)/$(rtld-version-installed-name) \
414 $(inst_slibdir)/libc-$(version).so
415 $(make-target-directory)
416 $(make-shlib-link)
418 # Special target called by parent to install just the dynamic linker.
419 .PHONY: ldso_install
420 ldso_install: $(inst_rtlddir)/$(rtld-installed-name)
421 endif
424 ldd-rewrite = -e 's%@RTLD@%$(rtlddir)/$(rtld-installed-name)%g' \
425 -e 's%@VERSION@%$(version)%g' \
426 -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
427 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' \
428 -e 's%@BASH@%$(BASH)%g' \
429 -e 's%@TEXTDOMAINDIR@%$(msgcatdir)%g'
431 ifeq ($(ldd-rewrite-script),no)
432 define gen-ldd
433 LC_ALL=C sed $(ldd-rewrite) < $< > $@.new
434 endef
435 else
436 define gen-ldd
437 LC_ALL=C sed $(ldd-rewrite) < $< \
438 | LC_ALL=C sed -f $(patsubst $(..)/%,/%,$(..)$(ldd-rewrite-script)) > $@.new
439 endef
440 endif
442 $(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \
443 $(common-objpfx)config.make
444 $(gen-ldd)
445 chmod 555 $@.new
446 mv -f $@.new $@
448 $(objpfx)sprof: $(libdl)
450 $(objpfx)sln: $(sln-modules:%=$(objpfx)%.o)
452 $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
454 SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
455 CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
456 -D'SLIBDIR="$(slibdir)"'
457 libof-ldconfig = ldconfig
458 CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
459 CFLAGS-cache.c = $(SYSCONF-FLAGS)
460 CFLAGS-rtld.c = $(SYSCONF-FLAGS)
462 cpp-srcs-left := $(all-rtld-routines:=.os)
463 lib := rtld
464 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
466 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
467 generated += $(addsuffix .so,$(strip $(modules-names)))
469 $(objpfx)testobj1.so: $(libdl)
470 $(objpfx)testobj1_1.so: $(objpfx)testobj1.so $(libdl)
471 $(objpfx)testobj2.so: $(objpfx)testobj1.so $(libdl)
472 $(objpfx)testobj3.so: $(libdl)
473 $(objpfx)testobj4.so: $(libdl)
474 $(objpfx)testobj5.so: $(libdl)
475 $(objpfx)testobj6.so: $(objpfx)testobj1.so $(objpfx)testobj2.so $(libdl)
476 $(objpfx)failobj.so: $(objpfx)testobj6.so
477 $(objpfx)dep1.so: $(objpfx)dep2.so $(objpfx)dep4.so
478 $(objpfx)dep2.so: $(objpfx)dep3.so $(objpfx)dep4.so
479 $(objpfx)dep4.so: $(objpfx)dep3.so
480 $(objpfx)nodelmod3.so: $(objpfx)nodelmod4.so
481 $(objpfx)nextmod1.so: $(libdl)
482 $(objpfx)neededobj1.so: $(libdl)
483 $(objpfx)neededobj2.so: $(objpfx)neededobj1.so $(libdl)
484 $(objpfx)neededobj3.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so $(libdl)
485 $(objpfx)neededobj4.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
486 $(objpfx)neededobj3.so $(libdl)
487 $(objpfx)neededobj6.so: $(objpfx)neededobj5.so
488 $(objpfx)unload2mod.so: $(objpfx)unload2dep.so
489 $(objpfx)ltglobmod2.so: $(libdl)
490 $(objpfx)firstobj.so: $(shared-thread-library)
491 $(objpfx)globalmod1.so: $(libdl)
492 $(objpfx)reldep4mod1.so: $(objpfx)reldep4mod3.so
493 $(objpfx)reldep4mod2.so: $(objpfx)reldep4mod4.so
494 $(objpfx)dblloadmod1.so: $(objpfx)dblloadmod3.so
495 $(objpfx)dblloadmod2.so: $(objpfx)dblloadmod3.so
496 $(objpfx)reldepmod5.so: $(objpfx)reldepmod2.so
497 $(objpfx)reldepmod6.so: $(objpfx)reldepmod2.so
498 $(objpfx)reldep6mod1.so: $(objpfx)reldep6mod0.so
499 $(objpfx)reldep6mod2.so: $(objpfx)reldep6mod1.so
500 $(objpfx)reldep6mod3.so: $(objpfx)reldep6mod2.so
501 $(objpfx)reldep6mod4.so: $(objpfx)reldep6mod1.so
502 $(objpfx)tst-tlsmod3.so: $(objpfx)tst-tlsmod2.so
503 $(objpfx)tst-tlsmod8.so: $(objpfx)tst-tlsmod7.so
504 $(objpfx)tst-tlsmod10.so: $(objpfx)tst-tlsmod9.so
505 $(objpfx)tst-tlsmod12.so: $(objpfx)tst-tlsmod11.so
506 $(objpfx)tst-tlsmod13a.so: $(objpfx)tst-tlsmod13.so
507 # For tst-tls9-static, make sure the modules it dlopens have libc.so in DT_NEEDED
508 $(objpfx)tst-tlsmod5.so: $(common-objpfx)libc.so
509 $(objpfx)tst-tlsmod6.so: $(common-objpfx)libc.so
510 $(objpfx)tst-tls19mod1.so: $(objpfx)tst-tls19mod2.so $(objpfx)tst-tls19mod3.so
511 $(objpfx)tst-tls19mod3.so: $(objpfx)ld.so
512 $(objpfx)reldep8mod3.so: $(objpfx)reldep8mod1.so $(objpfx)reldep8mod2.so
513 $(objpfx)nodel2mod3.so: $(objpfx)nodel2mod1.so $(objpfx)nodel2mod2.so
514 $(objpfx)reldep9mod2.so: $(objpfx)reldep9mod1.so
515 $(objpfx)reldep9mod3.so: $(objpfx)reldep9mod1.so $(objpfx)reldep9mod2.so
516 $(objpfx)unload3mod1.so: $(objpfx)unload3mod3.so
517 $(objpfx)unload3mod2.so: $(objpfx)unload3mod3.so
518 $(objpfx)unload3mod3.so: $(objpfx)unload3mod4.so
519 $(objpfx)unload4mod1.so: $(objpfx)unload4mod2.so $(objpfx)unload4mod3.so
520 $(objpfx)unload4mod2.so: $(objpfx)unload4mod4.so $(objpfx)unload4mod3.so
521 $(objpfx)unload6mod1.so: $(libdl)
522 $(objpfx)unload6mod2.so: $(libdl)
523 $(objpfx)unload6mod3.so: $(libdl)
524 $(objpfx)unload7mod1.so: $(libdl)
525 $(objpfx)unload7mod2.so: $(objpfx)unload7mod1.so
526 $(objpfx)unload8mod1.so: $(objpfx)unload8mod2.so
527 $(objpfx)unload8mod2.so: $(objpfx)unload8mod3.so
528 $(objpfx)unload8mod3.so: $(libdl)
529 $(objpfx)tst-initordera2.so: $(objpfx)tst-initordera1.so
530 $(objpfx)tst-initorderb2.so: $(objpfx)tst-initorderb1.so $(objpfx)tst-initordera2.so
531 $(objpfx)tst-initordera3.so: $(objpfx)tst-initorderb2.so $(objpfx)tst-initorderb1.so
532 $(objpfx)tst-initordera4.so: $(objpfx)tst-initordera3.so
533 $(objpfx)tst-initorder: $(objpfx)tst-initordera4.so $(objpfx)tst-initordera1.so $(objpfx)tst-initorderb2.so
534 $(objpfx)tst-null-argv: $(objpfx)tst-null-argv-lib.so
535 $(objpfx)tst-tlsalign: $(objpfx)tst-tlsalign-lib.so
536 $(objpfx)tst-nodelete-opened.out: $(objpfx)tst-nodelete-opened-lib.so
537 $(objpfx)tst-nodelete-opened: $(libdl)
539 $(objpfx)tst-tlsalign-extern: $(objpfx)tst-tlsalign-vars.o
540 $(objpfx)tst-tlsalign-extern-static: $(objpfx)tst-tlsalign-vars.o
542 tst-null-argv-ENV = LD_DEBUG=all LD_DEBUG_OUTPUT=$(objpfx)tst-null-argv.debug.out
543 LDFLAGS-nodel2mod3.so = $(no-as-needed)
544 LDFLAGS-reldepmod5.so = $(no-as-needed)
545 LDFLAGS-reldep6mod1.so = $(no-as-needed)
546 LDFLAGS-reldep6mod4.so = $(no-as-needed)
547 LDFLAGS-reldep8mod3.so = $(no-as-needed)
548 LDFLAGS-unload4mod1.so = $(no-as-needed)
549 LDFLAGS-unload4mod2.so = $(no-as-needed)
550 LDFLAGS-tst-initorder = $(no-as-needed)
551 LDFLAGS-tst-initordera2.so = $(no-as-needed)
552 LDFLAGS-tst-initordera3.so = $(no-as-needed)
553 LDFLAGS-tst-initordera4.so = $(no-as-needed)
554 LDFLAGS-tst-initorderb2.so = $(no-as-needed)
555 LDFLAGS-tst-tlsmod5.so = -nostdlib $(no-as-needed)
556 LDFLAGS-tst-tlsmod6.so = -nostdlib $(no-as-needed)
558 testobj1.so-no-z-defs = yes
559 testobj3.so-no-z-defs = yes
560 testobj4.so-no-z-defs = yes
561 testobj5.so-no-z-defs = yes
562 testobj6.so-no-z-defs = yes
563 failobj.so-no-z-defs = yes
564 constload2.so-no-z-defs = yes
565 constload3.so-no-z-defs = yes
566 nodelmod1.so-no-z-defs = yes
567 nodelmod2.so-no-z-defs = yes
568 nodelmod4.so-no-z-defs = yes
569 nodel2mod2.so-no-z-defs = yes
570 reldepmod2.so-no-z-defs = yes
571 reldepmod3.so-no-z-defs = yes
572 reldepmod4.so-no-z-defs = yes
573 reldep4mod4.so-no-z-defs = yes
574 reldep4mod2.so-no-z-defs = yes
575 ltglobmod2.so-no-z-defs = yes
576 dblloadmod3.so-no-z-defs = yes
577 tst-tlsmod1.so-no-z-defs = yes
578 tst-tlsmod2.so-no-z-defs = yes
579 tst-tlsmod3.so-no-z-defs = yes
580 tst-tlsmod4.so-no-z-defs = yes
581 tst-tlsmod7.so-no-z-defs = yes
582 tst-tlsmod8.so-no-z-defs = yes
583 tst-tlsmod9.so-no-z-defs = yes
584 tst-tlsmod10.so-no-z-defs = yes
585 tst-tlsmod12.so-no-z-defs = yes
586 tst-tlsmod14a.so-no-z-defs = yes
587 tst-tlsmod14b.so-no-z-defs = yes
588 tst-tlsmod15a.so-no-z-defs = yes
589 tst-tlsmod16b.so-no-z-defs = yes
590 circlemod2.so-no-z-defs = yes
591 circlemod3.so-no-z-defs = yes
592 circlemod3a.so-no-z-defs = yes
593 reldep8mod2.so-no-z-defs = yes
594 reldep9mod1.so-no-z-defs = yes
595 unload3mod4.so-no-z-defs = yes
596 unload4mod1.so-no-z-defs = yes
597 ifuncmod1.so-no-z-defs = yes
598 ifuncmod5.so-no-z-defs = yes
599 ifuncmod6.so-no-z-defs = yes
600 tst-auditmod9a.so-no-z-defs = yes
601 tst-auditmod9b.so-no-z-defs = yes
602 tst-nodelete-uniquemod.so-no-z-defs = yes
603 tst-nodelete-rtldmod.so-no-z-defs = yes
604 tst-nodelete-zmod.so-no-z-defs = yes
605 tst-nodelete2mod.so-no-z-defs = yes
607 ifeq ($(build-shared),yes)
608 # Build all the modules even when not actually running test programs.
609 tests: $(test-modules)
610 endif
612 $(objpfx)loadtest: $(libdl)
613 LDFLAGS-loadtest = -rdynamic
615 $(objpfx)loadtest.out: $(test-modules)
617 $(objpfx)neededtest: $(libdl)
618 $(objpfx)neededtest.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
619 $(objpfx)neededobj3.so
621 $(objpfx)neededtest2: $(libdl)
622 $(objpfx)neededtest2.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
623 $(objpfx)neededobj3.so
625 $(objpfx)neededtest3: $(libdl)
626 $(objpfx)neededtest3.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
627 $(objpfx)neededobj3.so $(objpfx)neededobj4.so
629 $(objpfx)neededtest4: $(libdl) $(objpfx)neededobj1.so
630 $(objpfx)neededtest4.out: $(objpfx)neededobj5.so $(objpfx)neededobj6.so
632 $(objpfx)restest1: $(objpfx)testobj1.so $(objpfx)testobj1_1.so $(libdl)
633 LDFLAGS-restest1 = -rdynamic
635 $(objpfx)restest2: $(libdl)
636 LDFLAGS-restest2 = -rdynamic
638 $(objpfx)restest1.out: $(test-modules)
640 preloadtest-preloads = testobj1 testobj2 testobj3 testobj4 testobj5
641 $(objpfx)preloadtest: $(objpfx)testobj6.so
642 LDFLAGS-preloadtest = -rdynamic
643 $(objpfx)preloadtest.out: $(preloadtest-preloads:%=$(objpfx)%.so)
644 preloadtest-ENV = \
645 LD_PRELOAD=$(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
647 $(objpfx)loadfail: $(libdl)
648 LDFLAGS-loadfail = -rdynamic
650 $(objpfx)loadfail.out: $(objpfx)failobj.so
652 $(objpfx)multiload: $(libdl)
653 LDFLAGS-multiload = -rdynamic
654 CFLAGS-multiload.c = -DOBJDIR=\"$(elf-objpfx)\"
656 $(objpfx)multiload.out: $(objpfx)testobj1.so
658 $(objpfx)origtest: $(libdl)
659 LDFLAGS-origtest = -rdynamic
660 $(objpfx)origtest.out: $(objpfx)testobj1.so
662 ifeq ($(have-thread-library),yes)
663 $(objpfx)resolvfail: $(libdl) $(shared-thread-library)
664 else
665 $(objpfx)resolvfail: $(libdl)
666 endif
668 $(objpfx)constload1: $(libdl)
669 $(objpfx)constload1.out: $(objpfx)constload2.so $(objpfx)constload3.so
671 $(objpfx)circleload1: $(libdl)
672 $(objpfx)circleload1.out: $(objpfx)circlemod1.so \
673 $(objpfx)circlemod1a.so
675 $(objpfx)circlemod1.so: $(objpfx)circlemod2.so
676 $(objpfx)circlemod2.so: $(objpfx)circlemod3.so
677 $(objpfx)circlemod1a.so: $(objpfx)circlemod2a.so
678 $(objpfx)circlemod2a.so: $(objpfx)circlemod3a.so
680 $(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so)
682 $(objpfx)order-cmp.out: $(objpfx)order.out
683 (echo "0123456789" | cmp $< -) > $@; \
684 $(evaluate-test)
686 $(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so)
687 $(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
688 vismain-ENV = LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
690 $(objpfx)noload: $(objpfx)testobj1.so $(libdl)
691 LDFLAGS-noload = -rdynamic $(no-as-needed)
692 $(objpfx)noload.out: $(objpfx)testobj5.so
694 $(objpfx)noload-mem.out: $(objpfx)noload.out
695 $(common-objpfx)malloc/mtrace $(objpfx)noload.mtrace > $@; \
696 $(evaluate-test)
697 noload-ENV = MALLOC_TRACE=$(objpfx)noload.mtrace
699 LDFLAGS-nodelete = -rdynamic
700 LDFLAGS-nodelmod1.so = -Wl,--enable-new-dtags,-z,nodelete
701 LDFLAGS-nodelmod4.so = -Wl,--enable-new-dtags,-z,nodelete
702 $(objpfx)nodelete: $(libdl)
703 $(objpfx)nodelete.out: $(objpfx)nodelmod1.so $(objpfx)nodelmod2.so \
704 $(objpfx)nodelmod3.so
706 LDFLAGS-nodlopenmod.so = -Wl,--enable-new-dtags,-z,nodlopen
707 $(objpfx)nodlopen: $(libdl)
708 $(objpfx)nodlopen.out: $(objpfx)nodlopenmod.so
710 $(objpfx)nodlopenmod2.so: $(objpfx)nodlopenmod.so
711 $(objpfx)nodlopen2: $(libdl)
712 $(objpfx)nodlopen2.out: $(objpfx)nodlopenmod2.so
714 $(objpfx)filtmod1.so: $(objpfx)filtmod1.os $(objpfx)filtmod2.so
715 $(LINK.o) -shared -o $@ -B$(csu-objpfx) $(LDFLAGS.so) \
716 -L$(subst :, -L,$(rpath-link)) \
717 -Wl,-rpath-link=$(rpath-link) \
718 $< -Wl,-F,$(objpfx)filtmod2.so
719 $(objpfx)filter: $(objpfx)filtmod1.so
721 $(objpfx)unload: $(libdl)
722 $(objpfx)unload.out: $(objpfx)unloadmod.so
724 $(objpfx)reldep: $(libdl)
725 $(objpfx)reldep.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod2.so
727 $(objpfx)reldep2: $(libdl)
728 $(objpfx)reldep2.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod3.so
730 $(objpfx)reldep3: $(libdl)
731 $(objpfx)reldep3.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
733 $(objpfx)reldep4: $(libdl)
734 $(objpfx)reldep4.out: $(objpfx)reldep4mod1.so $(objpfx)reldep4mod2.so
736 $(objpfx)next: $(objpfx)nextmod1.so $(objpfx)nextmod2.so $(libdl)
737 LDFLAGS-next = $(no-as-needed)
739 $(objpfx)unload2: $(libdl)
740 $(objpfx)unload2.out: $(objpfx)unload2mod.so $(objpfx)unload2dep.so
742 $(objpfx)lateglobal: $(libdl)
743 $(objpfx)lateglobal.out: $(objpfx)ltglobmod1.so $(objpfx)ltglobmod2.so
745 $(objpfx)tst-pathopt: $(libdl)
746 $(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \
747 $(objpfx)pathoptobj.so
748 $(SHELL) $< $(common-objpfx) '$(test-wrapper-env)' \
749 '$(run-program-env)'; \
750 $(evaluate-test)
752 $(objpfx)tst-rtld-load-self.out: tst-rtld-load-self.sh $(objpfx)ld.so
753 $(SHELL) $^ '$(test-wrapper)' '$(test-wrapper-env)' > $@; \
754 $(evaluate-test)
756 $(objpfx)initfirst: $(libdl)
757 $(objpfx)initfirst.out: $(objpfx)firstobj.so
759 $(objpfx)global: $(objpfx)globalmod1.so
760 $(objpfx)global.out: $(objpfx)reldepmod1.so
762 $(objpfx)dblload: $(libdl)
763 $(objpfx)dblload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
765 $(objpfx)dblunload: $(libdl)
766 $(objpfx)dblunload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
768 $(objpfx)reldep5: $(libdl)
769 $(objpfx)reldep5.out: $(objpfx)reldepmod5.so $(objpfx)reldepmod6.so
771 $(objpfx)reldep6: $(libdl)
772 $(objpfx)reldep6.out: $(objpfx)reldep6mod3.so $(objpfx)reldep6mod4.so
774 $(objpfx)reldep7: $(libdl)
775 $(objpfx)reldep7.out: $(objpfx)reldep7mod1.so $(objpfx)reldep7mod2.so
777 $(objpfx)reldep8: $(libdl)
778 $(objpfx)reldep8.out: $(objpfx)reldep8mod3.so
780 LDFLAGS-nodel2mod2.so = -Wl,--enable-new-dtags,-z,nodelete
781 $(objpfx)nodelete2: $(libdl)
782 $(objpfx)nodelete2.out: $(objpfx)nodel2mod3.so
784 $(objpfx)reldep9: $(libdl)
785 $(objpfx)reldep9.out: $(objpfx)reldep9mod3.so
787 $(objpfx)tst-tls3: $(objpfx)tst-tlsmod1.so
789 $(objpfx)tst-tls4: $(libdl)
790 $(objpfx)tst-tls4.out: $(objpfx)tst-tlsmod2.so
792 $(objpfx)tst-tls5: $(libdl)
793 $(objpfx)tst-tls5.out: $(objpfx)tst-tlsmod2.so
795 $(objpfx)tst-tls6: $(libdl)
796 $(objpfx)tst-tls6.out: $(objpfx)tst-tlsmod2.so
798 $(objpfx)tst-tls7: $(libdl)
799 $(objpfx)tst-tls7.out: $(objpfx)tst-tlsmod3.so
801 $(objpfx)tst-tls8: $(libdl)
802 $(objpfx)tst-tls8.out: $(objpfx)tst-tlsmod3.so $(objpfx)tst-tlsmod4.so
804 $(objpfx)tst-tls9: $(libdl)
805 $(objpfx)tst-tls9.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
807 $(objpfx)tst-tls10: $(objpfx)tst-tlsmod8.so $(objpfx)tst-tlsmod7.so
809 $(objpfx)tst-tls11: $(objpfx)tst-tlsmod10.so $(objpfx)tst-tlsmod9.so
811 $(objpfx)tst-tls12: $(objpfx)tst-tlsmod12.so $(objpfx)tst-tlsmod11.so
813 $(objpfx)tst-tls13: $(libdl)
814 $(objpfx)tst-tls13.out: $(objpfx)tst-tlsmod13a.so
816 $(objpfx)tst-tls14: $(objpfx)tst-tlsmod14a.so $(libdl)
817 $(objpfx)tst-tls14.out: $(objpfx)tst-tlsmod14b.so
819 $(objpfx)tst-tls15: $(libdl)
820 $(objpfx)tst-tls15.out: $(objpfx)tst-tlsmod15a.so $(objpfx)tst-tlsmod15b.so
822 $(objpfx)tst-tls-dlinfo: $(libdl)
823 $(objpfx)tst-tls-dlinfo.out: $(objpfx)tst-tlsmod2.so
827 $(objpfx)tst-tls16: $(libdl)
828 $(objpfx)tst-tls16.out: $(objpfx)tst-tlsmod16a.so $(objpfx)tst-tlsmod16b.so
830 $(objpfx)tst-tls17: $(libdl)
831 $(objpfx)tst-tls17.out: $(objpfx)tst-tlsmod17b.so
832 $(patsubst %,$(objpfx)%.os,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.os: tst-tlsmod17a.c
833 $(compile-command.c) -DN=$*
834 $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.so: $(objpfx)ld.so
835 $(objpfx)tst-tlsmod17b.so: $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules))
837 $(objpfx)tst-tls18: $(libdl)
838 $(objpfx)tst-tls18.out: $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules))
839 $(patsubst %,$(objpfx)%.os,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.os : tst-tlsmod18a.c
840 $(compile-command.c) -DN=$*
841 $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.so: $(objpfx)ld.so
843 $(objpfx)tst-tls19: $(libdl)
844 $(objpfx)tst-tls19.out: $(objpfx)tst-tls19mod1.so
846 CFLAGS-tst-align.c = $(stack-align-test-flags)
847 CFLAGS-tst-align2.c = $(stack-align-test-flags)
848 CFLAGS-tst-alignmod.c = $(stack-align-test-flags)
849 CFLAGS-tst-alignmod2.c = $(stack-align-test-flags)
850 $(objpfx)tst-align: $(libdl)
851 $(objpfx)tst-align.out: $(objpfx)tst-alignmod.so
852 $(objpfx)tst-align2: $(objpfx)tst-alignmod2.so
854 $(objpfx)unload3: $(libdl)
855 $(objpfx)unload3.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
856 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
858 $(objpfx)unload4: $(libdl)
859 $(objpfx)unload4.out: $(objpfx)unload4mod1.so $(objpfx)unload4mod3.so
861 $(objpfx)unload5: $(libdl)
862 $(objpfx)unload5.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
863 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
865 $(objpfx)unload6: $(libdl)
866 $(objpfx)unload6.out: $(objpfx)unload6mod1.so $(objpfx)unload6mod2.so \
867 $(objpfx)unload6mod3.so
869 $(objpfx)unload7: $(libdl)
870 $(objpfx)unload7.out: $(objpfx)unload7mod1.so $(objpfx)unload7mod2.so
871 unload7-ENV = MALLOC_PERTURB_=85
873 $(objpfx)unload8: $(libdl)
874 $(objpfx)unload8.out: $(objpfx)unload8mod1.so $(objpfx)unload8mod1x.so
876 ifdef libdl
877 $(objpfx)tst-tls9-static: $(common-objpfx)dlfcn/libdl.a
878 $(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
879 endif
881 ifeq ($(have-z-execstack),yes)
882 $(objpfx)tst-execstack: $(libdl)
883 $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
884 CPPFLAGS-tst-execstack.c = -DUSE_PTHREADS=0
885 LDFLAGS-tst-execstack = -Wl,-z,noexecstack
886 LDFLAGS-tst-execstack-mod = -Wl,-z,execstack
888 $(objpfx)tst-execstack-needed: $(objpfx)tst-execstack-mod.so
889 LDFLAGS-tst-execstack-needed = -Wl,-z,noexecstack
891 LDFLAGS-tst-execstack-prog = -Wl,-z,execstack
892 CFLAGS-tst-execstack-prog.c += -Wno-trampolines
893 CFLAGS-tst-execstack-mod.c += -Wno-trampolines
894 endif
896 LDFLAGS-tst-array2 = $(no-as-needed)
897 LDFLAGS-tst-array5 = $(no-as-needed)
899 $(objpfx)tst-array1-cmp.out: tst-array1.exp $(objpfx)tst-array1.out
900 cmp $^ > $@; \
901 $(evaluate-test)
903 $(objpfx)tst-array1-static-cmp.out: tst-array1.exp \
904 $(objpfx)tst-array1-static.out
905 cmp $^ > $@; \
906 $(evaluate-test)
908 $(objpfx)tst-array2: $(objpfx)tst-array2dep.so
909 $(objpfx)tst-array2-cmp.out: tst-array2.exp $(objpfx)tst-array2.out
910 cmp $^ > $@; \
911 $(evaluate-test)
913 $(objpfx)tst-array3-cmp.out: tst-array1.exp $(objpfx)tst-array3.out
914 cmp $^ > $@; \
915 $(evaluate-test)
917 $(objpfx)tst-array4: $(libdl)
918 $(objpfx)tst-array4.out: $(objpfx)tst-array2dep.so
919 $(objpfx)tst-array4-cmp.out: tst-array4.exp $(objpfx)tst-array4.out
920 cmp $^ > $@; \
921 $(evaluate-test)
923 $(objpfx)tst-array5: $(objpfx)tst-array5dep.so
924 $(objpfx)tst-array5-cmp.out: tst-array5.exp $(objpfx)tst-array5.out
925 cmp $^ > $@; \
926 $(evaluate-test)
928 $(objpfx)tst-array5-static-cmp.out: tst-array5-static.exp \
929 $(objpfx)tst-array5-static.out
930 cmp $^ > $@; \
931 $(evaluate-test)
933 CFLAGS-tst-pie1.c += $(pie-ccflag)
934 CFLAGS-tst-pie2.c += $(pie-ccflag)
936 $(objpfx)tst-pie1: $(objpfx)tst-piemod1.so
938 ifeq (yes,$(build-shared))
939 all-built-dso := $(common-objpfx)elf/ld.so $(common-objpfx)libc.so \
940 $(filter-out $(common-objpfx)linkobj/libc.so, \
941 $(sort $(wildcard $(addprefix $(common-objpfx), \
942 */lib*.so \
943 iconvdata/*.so))))
945 $(all-built-dso:=.dyn): %.dyn: %
946 @rm -f $@T
947 LC_ALL=C $(READELF) -W -d $< > $@T
948 test -s $@T
949 mv -f $@T $@
950 common-generated += $(all-built-dso:$(common-objpfx)%=%.dyn)
952 $(objpfx)check-textrel.out: $(..)scripts/check-textrel.awk \
953 $(all-built-dso:=.dyn)
954 LC_ALL=C $(AWK) -f $^ > $@; \
955 $(evaluate-test)
956 generated += check-textrel.out
958 $(objpfx)execstack-default: $(first-word $(wildcard $(sysdirs:%=%/stackinfo.h)))
959 $(make-target-directory)
960 { echo '#include <elf.h>'; \
961 echo '#include <stackinfo.h>'; \
962 echo '#if (DEFAULT_STACK_PERMS & PF_X) == 0'; \
963 echo '@@@execstack-no@@@'; \
964 echo '#else'; \
965 echo '@@@execstack-yes@@@'; \
966 echo '#endif'; } | \
967 $(CC) $(CFLAGS) $(CPPFLAGS) -E -x c-header - | \
968 sed -n -e 's/^@@@\(.*\)@@@/\1/p' > $@T
969 mv -f $@T $@
970 generated += execstack-default
972 $(all-built-dso:=.phdr): %.phdr: %
973 @rm -f $@T
974 LC_ALL=C $(READELF) -W -l $< > $@T
975 test -s $@T
976 mv -f $@T $@
977 common-generated += $(all-built-dso:$(common-objpfx)%=%.phdr)
979 $(objpfx)check-execstack.out: $(..)scripts/check-execstack.awk \
980 $(objpfx)execstack-default \
981 $(all-built-dso:=.phdr)
982 LC_ALL=C $(AWK) -f $^ > $@; \
983 $(evaluate-test)
984 generated += check-execstack.out
986 $(objpfx)tst-dlmodcount: $(libdl)
987 $(objpfx)tst-dlmodcount.out: $(test-modules)
989 $(all-built-dso:=.jmprel): %.jmprel: % Makefile
990 @rm -f $@T
991 LC_ALL=C $(READELF) -W -S -d -r $< > $@T
992 test -s $@T
993 mv -f $@T $@
994 common-generated += $(all-built-dso:$(common-objpfx)%=%.jmprel)
996 localplt-built-dso := $(addprefix $(common-objpfx),\
997 libc.so \
998 elf/ld.so \
999 math/libm.so \
1000 rt/librt.so \
1001 dlfcn/libdl.so \
1002 resolv/libresolv.so \
1003 crypt/libcrypt.so \
1005 ifeq ($(build-mathvec),yes)
1006 localplt-built-dso += $(addprefix $(common-objpfx), mathvec/libmvec.so)
1007 endif
1008 ifeq ($(have-thread-library),yes)
1009 localplt-built-dso += $(filter-out %_nonshared.a, $(shared-thread-library))
1010 endif
1012 vpath localplt.data $(+sysdep_dirs)
1014 $(objpfx)check-localplt.out: $(..)scripts/check-localplt.awk \
1015 $(..)scripts/localplt.awk \
1016 $(localplt-built-dso:=.jmprel) \
1017 localplt.data
1018 LC_ALL=C $(AWK) -f $(filter-out $< %localplt.data,$^) | \
1019 LC_ALL=C $(AWK) -f $< $(filter %localplt.data,$^) - \
1020 > $@; \
1021 $(evaluate-test)
1022 endif
1024 $(objpfx)tst-dlopenrpathmod.so: $(libdl)
1025 $(objpfx)tst-dlopenrpath: $(objpfx)tst-dlopenrpathmod.so $(libdl)
1026 CFLAGS-tst-dlopenrpath.c += -DPFX=\"$(objpfx)\"
1027 LDFLAGS-tst-dlopenrpathmod.so += -Wl,-rpath,\$$ORIGIN/test-subdir
1028 $(objpfx)tst-dlopenrpath.out: $(objpfx)firstobj.so
1030 $(objpfx)tst-deep1mod2.so: $(objpfx)tst-deep1mod3.so
1031 $(objpfx)tst-deep1: $(libdl) $(objpfx)tst-deep1mod1.so
1032 $(objpfx)tst-deep1.out: $(objpfx)tst-deep1mod2.so
1033 LDFLAGS-tst-deep1 += -rdynamic
1034 tst-deep1mod3.so-no-z-defs = yes
1036 $(objpfx)tst-dlmopen1mod.so: $(libdl)
1037 $(objpfx)tst-dlmopen1: $(libdl)
1038 $(objpfx)tst-dlmopen1.out: $(objpfx)tst-dlmopen1mod.so
1040 $(objpfx)tst-dlmopen2: $(libdl)
1041 $(objpfx)tst-dlmopen2.out: $(objpfx)tst-dlmopen1mod.so
1043 $(objpfx)tst-dlmopen3: $(libdl)
1044 $(objpfx)tst-dlmopen3.out: $(objpfx)tst-dlmopen1mod.so
1046 $(objpfx)tst-audit1.out: $(objpfx)tst-auditmod1.so
1047 tst-audit1-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1049 $(objpfx)tst-audit2: $(libdl)
1050 $(objpfx)tst-audit2.out: $(objpfx)tst-auditmod1.so $(objpfx)tst-auditmod9b.so
1051 # Prevent GCC-5 from translating a malloc/memset pair into calloc
1052 CFLAGS-tst-audit2.c += -fno-builtin
1053 tst-audit2-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1055 $(objpfx)tst-audit9: $(libdl)
1056 $(objpfx)tst-audit9.out: $(objpfx)tst-auditmod9a.so $(objpfx)tst-auditmod9b.so
1057 tst-audit9-ENV = LD_AUDIT=$(objpfx)tst-auditmod9a.so
1059 $(objpfx)tst-audit8: $(libm)
1060 $(objpfx)tst-audit8.out: $(objpfx)tst-auditmod1.so
1061 tst-audit8-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1063 $(objpfx)tst-global1: $(libdl)
1064 $(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
1066 $(objpfx)order2: $(libdl)
1067 $(objpfx)order2.out: $(objpfx)order2mod1.so $(objpfx)order2mod2.so
1068 $(objpfx)order2-cmp.out: $(objpfx)order2.out
1069 (echo "12345" | cmp $< -) > $@; \
1070 $(evaluate-test)
1071 $(objpfx)order2mod1.so: $(objpfx)order2mod4.so
1072 $(objpfx)order2mod4.so: $(objpfx)order2mod3.so
1073 $(objpfx)order2mod2.so: $(objpfx)order2mod3.so
1074 order2mod2.so-no-z-defs = yes
1075 LDFLAGS-order2mod1.so = $(no-as-needed)
1076 LDFLAGS-order2mod2.so = $(no-as-needed)
1078 tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child"
1079 tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
1081 tst-ptrguard1-ARGS = --command "$(host-test-program-cmd) --child"
1082 # When built statically, the pointer guard interface uses
1083 # __pointer_chk_guard_local.
1084 CFLAGS-tst-ptrguard1-static.c = -DPTRGUARD_LOCAL
1085 tst-ptrguard1-static-ARGS = --command "$(objpfx)tst-ptrguard1-static --child"
1087 $(objpfx)tst-leaks1: $(libdl)
1088 $(objpfx)tst-leaks1-mem.out: $(objpfx)tst-leaks1.out
1089 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1.mtrace > $@; \
1090 $(evaluate-test)
1092 $(objpfx)tst-leaks1-static: $(common-objpfx)dlfcn/libdl.a
1093 $(objpfx)tst-leaks1-static-mem.out: $(objpfx)tst-leaks1-static.out
1094 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1-static.mtrace > $@; \
1095 $(evaluate-test)
1097 tst-leaks1-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1.mtrace
1098 tst-leaks1-static-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1-static.mtrace
1100 $(objpfx)tst-addr1: $(libdl)
1102 $(objpfx)tst-thrlock: $(libdl) $(shared-thread-library)
1103 $(objpfx)tst-dlopen-aout: $(libdl) $(shared-thread-library)
1105 CFLAGS-ifuncmain1pic.c += $(pic-ccflag)
1106 CFLAGS-ifuncmain1picstatic.c += $(pic-ccflag)
1107 CFLAGS-ifuncmain1staticpic.c += $(pic-ccflag)
1108 CFLAGS-ifuncdep1pic.c += $(pic-ccflag)
1109 CFLAGS-ifuncmain1vispic.c += $(pic-ccflag)
1110 CFLAGS-ifuncmain2pic.c += $(pic-ccflag)
1111 CFLAGS-ifuncmain2picstatic.c += $(pic-ccflag)
1112 CFLAGS-ifuncdep2pic.c += $(pic-ccflag)
1113 CFLAGS-ifuncmain4picstatic.c += $(pic-ccflag)
1114 CFLAGS-ifuncmain5pic.c += $(pic-ccflag)
1115 CFLAGS-ifuncmain5picstatic.c += $(pic-ccflag)
1116 CFLAGS-ifuncmain5staticpic.c += $(pic-ccflag)
1117 CFLAGS-ifuncdep5pic.c += $(pic-ccflag)
1118 CFLAGS-ifuncmain7pic.c += $(pic-ccflag)
1119 CFLAGS-ifuncmain7picstatic.c += $(pic-ccflag)
1121 LDFLAGS-ifuncmain3 = -Wl,-export-dynamic
1123 CFLAGS-ifuncmain1pie.c += $(pie-ccflag)
1124 CFLAGS-ifuncmain1vispie.c += $(pie-ccflag)
1125 CFLAGS-ifuncmain1staticpie.c += $(pie-ccflag)
1126 CFLAGS-ifuncmain5pie.c += $(pie-ccflag)
1127 CFLAGS-ifuncmain6pie.c += $(pie-ccflag)
1128 CFLAGS-ifuncmain7pie.c += $(pie-ccflag)
1130 $(objpfx)ifuncmain1pie: $(objpfx)ifuncmod1.so
1131 $(objpfx)ifuncmain1staticpie: $(objpfx)ifuncdep1pic.o
1132 $(objpfx)ifuncmain1vispie: $(objpfx)ifuncmod1.so
1133 $(objpfx)ifuncmain5pie: $(objpfx)ifuncmod5.so
1134 $(objpfx)ifuncmain6pie: $(objpfx)ifuncmod6.so
1136 $(objpfx)ifuncmain1: $(addprefix $(objpfx),ifuncmod1.so)
1137 $(objpfx)ifuncmain1pic: $(addprefix $(objpfx),ifuncmod1.so)
1138 $(objpfx)ifuncmain1staticpic: $(addprefix $(objpfx),ifuncdep1pic.o)
1139 $(objpfx)ifuncmain1static: $(addprefix $(objpfx),ifuncdep1.o)
1140 $(objpfx)ifuncmain1picstatic: $(addprefix $(objpfx),ifuncdep1pic.o)
1141 $(objpfx)ifuncmain1vis: $(addprefix $(objpfx),ifuncmod1.so)
1142 $(objpfx)ifuncmain1vispic: $(addprefix $(objpfx),ifuncmod1.so)
1143 $(objpfx)ifuncmain2: $(addprefix $(objpfx),ifuncdep2.o)
1144 $(objpfx)ifuncmain2pic: $(addprefix $(objpfx),ifuncdep2pic.o)
1145 $(objpfx)ifuncmain2static: $(addprefix $(objpfx),ifuncdep2.o)
1146 $(objpfx)ifuncmain2picstatic: $(addprefix $(objpfx),ifuncdep2pic.o)
1148 $(objpfx)ifuncmain3: $(libdl)
1149 $(objpfx)ifuncmain3.out: $(objpfx)ifuncmod3.so
1151 $(objpfx)ifuncmain5: $(addprefix $(objpfx),ifuncmod5.so)
1152 $(objpfx)ifuncmain5pic: $(addprefix $(objpfx),ifuncmod5.so)
1153 $(objpfx)ifuncmain5static: $(addprefix $(objpfx),ifuncdep5.o)
1154 $(objpfx)ifuncmain5staticpic: $(addprefix $(objpfx),ifuncdep5pic.o)
1155 $(objpfx)ifuncmain5picstatic: $(addprefix $(objpfx),ifuncdep5pic.o)
1157 $(objpfx)tst-unique1: $(libdl)
1158 $(objpfx)tst-unique1.out: $(objpfx)tst-unique1mod1.so \
1159 $(objpfx)tst-unique1mod2.so
1161 $(objpfx)tst-unique2: $(libdl) $(objpfx)tst-unique2mod1.so
1162 $(objpfx)tst-unique2.out: $(objpfx)tst-unique2mod2.so
1164 $(objpfx)tst-unique3: $(libdl) $(objpfx)tst-unique3lib.so
1165 $(objpfx)tst-unique3.out: $(objpfx)tst-unique3lib2.so
1167 $(objpfx)tst-unique4: $(objpfx)tst-unique4lib.so
1169 $(objpfx)tst-nodelete: $(libdl)
1170 $(objpfx)tst-nodelete.out: $(objpfx)tst-nodelete-uniquemod.so \
1171 $(objpfx)tst-nodelete-rtldmod.so \
1172 $(objpfx)tst-nodelete-zmod.so
1174 LDFLAGS-tst-nodelete = -rdynamic
1175 LDFLAGS-tst-nodelete-zmod.so = -Wl,--enable-new-dtags,-z,nodelete
1177 $(objpfx)tst-nodelete2: $(libdl)
1178 $(objpfx)tst-nodelete2.out: $(objpfx)tst-nodelete2mod.so
1180 LDFLAGS-tst-nodelete2 = -rdynamic
1182 $(objpfx)tst-initorder-cmp.out: tst-initorder.exp $(objpfx)tst-initorder.out
1183 cmp $^ > $@; \
1184 $(evaluate-test)
1186 $(objpfx)tst-initorder2: $(objpfx)tst-initorder2a.so $(objpfx)tst-initorder2d.so $(objpfx)tst-initorder2c.so
1187 $(objpfx)tst-initorder2a.so: $(objpfx)tst-initorder2b.so
1188 $(objpfx)tst-initorder2b.so: $(objpfx)tst-initorder2c.so
1189 $(objpfx)tst-initorder2c.so: $(objpfx)tst-initorder2d.so
1190 LDFLAGS-tst-initorder2 = $(no-as-needed)
1191 LDFLAGS-tst-initorder2a.so = $(no-as-needed)
1192 LDFLAGS-tst-initorder2b.so = $(no-as-needed)
1193 LDFLAGS-tst-initorder2c.so = $(no-as-needed)
1194 define o-iterator-doit
1195 $(objpfx)tst-initorder2$o.os: tst-initorder2.c; \
1196 $$(compile-command.c) -DNAME=\"$o\"
1197 endef
1198 object-suffixes-left := a b c d
1199 include $(o-iterator)
1201 $(objpfx)tst-initorder2-cmp.out: tst-initorder2.exp $(objpfx)tst-initorder2.out
1202 cmp $^ > $@; \
1203 $(evaluate-test)
1205 $(objpfx)tst-relsort1: $(libdl)
1206 $(objpfx)tst-relsort1mod1.so: $(libm) $(objpfx)tst-relsort1mod2.so
1207 $(objpfx)tst-relsort1mod2.so: $(libm)
1208 $(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
1209 $(objpfx)tst-relsort1mod2.so
1211 $(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so
1212 $(test-wrapper-env) \
1213 LD_TRACE_LOADED_OBJECTS=1 \
1214 LD_DEBUG=unused \
1215 LD_PRELOAD= \
1216 $(rtld-prefix) \
1217 $< > $@; \
1218 $(evaluate-test)
1220 $(objpfx)tst-unused-dep-cmp.out: $(objpfx)tst-unused-dep.out
1221 cmp $< /dev/null > $@; \
1222 $(evaluate-test)