Fix spurious jnf underflows (bug 14155).
[glibc.git] / elf / Makefile
blob3b58649de5bb511b50c473da797e41955e25c555
1 # Copyright (C) 1995-2013 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 = $(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 $(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 ($(versioning),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 pldd
74 install-bin = sprof pldd
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 pldd-modules := xmalloc
93 # To find xmalloc.c and xstrdup.c
94 vpath %.c ../locale/programs
96 ifeq ($(have-ksh)$(build-shared),yesyes)
97 extra-objs += sotruss-lib.os sotruss-lib.so
98 install-others += $(inst_auditdir)/sotruss-lib.so
99 install-bin-script += sotruss
100 generated += sotruss
101 CPPFLAGS-sotruss-lib = -DNOT_IN_libc
102 $(objpfx)sotruss-lib.so: $(objpfx)sotruss-lib.os
103 $(build-module-asneeded)
104 $(objpfx)sotruss-lib.so: $(common-objpfx)libc.so $(objpfx)ld.so \
105 $(common-objpfx)libc_nonshared.a
107 $(objpfx)sotruss: sotruss.ksh $(common-objpfx)config.make
108 sed -e 's%@KSH@%$(KSH)%g' \
109 -e 's%@VERSION@%$(version)%g' \
110 -e 's%@TEXTDOMAINDIR@%$(msgcatdir)%g' \
111 -e 's%@PREFIX@%$(prefix)%g' \
112 -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
113 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' \
114 < $< > $@.new
115 chmod 555 $@.new
116 mv -f $@.new $@
117 $(inst_auditdir)/sotruss-lib.so: $(objpfx)sotruss-lib.so $(+force)
118 $(do-install-program)
119 endif
121 tests = tst-tls1 tst-tls2 tst-tls9 tst-leaks1 \
122 tst-array1 tst-array2 tst-array3 tst-array4 tst-array5
123 tests-static = tst-tls1-static tst-tls2-static tst-stackguard1-static \
124 tst-leaks1-static tst-array1-static tst-array5-static
125 ifeq (yes,$(build-shared))
126 tests-static += tst-tls9-static
127 tst-tls9-static-ENV = \
128 LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn
129 endif
130 tests += $(tests-static)
131 ifeq (yes,$(build-shared))
132 tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
133 constload1 order vismain noload filter unload \
134 reldep reldep2 reldep3 reldep4 nodelete nodelete2 \
135 nodlopen nodlopen2 neededtest neededtest2 \
136 neededtest3 neededtest4 unload2 lateglobal initfirst global \
137 restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
138 circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \
139 tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-tls15 \
140 tst-tls16 tst-tls17 tst-tls18 tst-tls19 tst-tls-dlinfo \
141 tst-align tst-align2 $(tests-execstack-$(have-z-execstack)) \
142 tst-dlmodcount tst-dlopenrpath tst-deep1 \
143 tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
144 unload3 unload4 unload5 unload6 unload7 unload8 tst-global1 order2 \
145 tst-audit1 tst-audit2 tst-audit8 \
146 tst-stackguard1 tst-addr1 tst-thrlock \
147 tst-unique1 tst-unique2 tst-unique3 tst-unique4 \
148 tst-initorder tst-initorder2 tst-relsort1 tst-null-argv
149 # reldep9
150 test-srcs = tst-pathopt
151 selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
152 ifneq ($(selinux-enabled),1)
153 tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
154 endif
155 endif
156 ifeq ($(run-built-tests),yes)
157 tests: $(objpfx)tst-leaks1-mem $(objpfx)tst-leaks1-static-mem \
158 $(objpfx)noload-mem
159 endif
160 tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
161 tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
162 tlsmod17a-modules = $(addprefix tst-tlsmod17a, $(tlsmod17a-suffixes))
163 tlsmod18a-modules = $(addprefix tst-tlsmod18a, $(tlsmod17a-suffixes))
164 extra-test-objs += $(tlsmod17a-modules:=.os) $(tlsmod18a-modules:=.os)
165 test-extras += tst-tlsmod17a tst-tlsmod18a
166 modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
167 testobj1_1 failobj constload2 constload3 unloadmod \
168 dep1 dep2 dep3 dep4 vismod1 vismod2 vismod3 \
169 nodelmod1 nodelmod2 nodelmod3 nodelmod4 \
170 nodel2mod1 nodel2mod2 nodel2mod3 \
171 nodlopenmod nodlopenmod2 filtmod1 filtmod2 \
172 reldepmod1 reldepmod2 reldepmod3 reldepmod4 nextmod1 nextmod2 \
173 reldep4mod1 reldep4mod2 reldep4mod3 reldep4mod4 \
174 neededobj1 neededobj2 neededobj3 neededobj4 \
175 neededobj5 neededobj6 firstobj globalmod1 \
176 unload2mod unload2dep ltglobmod1 ltglobmod2 pathoptobj \
177 dblloadmod1 dblloadmod2 dblloadmod3 reldepmod5 reldepmod6 \
178 reldep6mod0 reldep6mod1 reldep6mod2 reldep6mod3 reldep6mod4 \
179 reldep7mod1 reldep7mod2 \
180 tst-tlsmod1 tst-tlsmod2 tst-tlsmod3 tst-tlsmod4 \
181 tst-tlsmod5 tst-tlsmod6 tst-tlsmod7 tst-tlsmod8 \
182 tst-tlsmod9 tst-tlsmod10 tst-tlsmod11 tst-tlsmod12 \
183 tst-tlsmod13 tst-tlsmod13a tst-tlsmod14a tst-tlsmod14b \
184 tst-tlsmod15a tst-tlsmod15b tst-tlsmod16a tst-tlsmod16b \
185 $(tlsmod17a-modules) tst-tlsmod17b $(tlsmod18a-modules) \
186 tst-tls19mod1 tst-tls19mod2 tst-tls19mod3 \
187 circlemod1 circlemod1a circlemod2 circlemod2a \
188 circlemod3 circlemod3a \
189 reldep8mod1 reldep8mod2 reldep8mod3 \
190 reldep9mod1 reldep9mod2 reldep9mod3 \
191 tst-alignmod tst-alignmod2 \
192 $(modules-execstack-$(have-z-execstack)) \
193 tst-dlopenrpathmod tst-deep1mod1 tst-deep1mod2 tst-deep1mod3 \
194 tst-dlmopen1mod tst-auditmod1 \
195 unload3mod1 unload3mod2 unload3mod3 unload3mod4 \
196 unload4mod1 unload4mod2 unload4mod3 unload4mod4 \
197 unload6mod1 unload6mod2 unload6mod3 \
198 unload7mod1 unload7mod2 \
199 unload8mod1 unload8mod1x unload8mod2 unload8mod3 \
200 order2mod1 order2mod2 order2mod3 order2mod4 \
201 tst-unique1mod1 tst-unique1mod2 \
202 tst-unique2mod1 tst-unique2mod2 \
203 tst-unique3lib tst-unique3lib2 \
204 tst-unique4lib \
205 tst-initordera1 tst-initorderb1 \
206 tst-initordera2 tst-initorderb2 \
207 tst-initordera3 tst-initordera4 \
208 tst-initorder2a tst-initorder2b tst-initorder2c \
209 tst-initorder2d \
210 tst-relsort1mod1 tst-relsort1mod2 tst-array2dep \
211 tst-array5dep tst-null-argv-lib
212 ifeq (yesyes,$(have-fpie)$(build-shared))
213 modules-names += tst-piemod1
214 tests += tst-pie1
215 tests-pie += tst-pie1
216 endif
217 modules-execstack-yes = tst-execstack-mod
218 extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
219 # We need this variable to be sure the test modules get the right CPPFLAGS.
220 test-extras += $(modules-names)
222 # filtmod1.so has a special rule
223 modules-names-nobuild := filtmod1
225 ifneq (no,$(multi-arch))
226 tests-static += ifuncmain1static ifuncmain1picstatic \
227 ifuncmain2static ifuncmain2picstatic \
228 ifuncmain4static ifuncmain4picstatic \
229 ifuncmain5static ifuncmain5picstatic \
230 ifuncmain7static ifuncmain7picstatic
232 ifeq (yes,$(build-shared))
233 tests += ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \
234 ifuncmain1staticpic \
235 ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \
236 ifuncmain5 ifuncmain5pic ifuncmain5staticpic \
237 ifuncmain7 ifuncmain7pic
238 ifunc-test-modules = ifuncdep1 ifuncdep1pic ifuncdep2 ifuncdep2pic \
239 ifuncdep5 ifuncdep5pic
240 extra-test-objs += $(ifunc-test-modules:=.o)
241 test-extras += $(ifunc-test-modules)
242 ifeq (yes,$(have-fpie))
243 ifunc-pie-tests = ifuncmain1pie ifuncmain1vispie ifuncmain1staticpie \
244 ifuncmain5pie ifuncmain6pie ifuncmain7pie
245 tests += $(ifunc-pie-tests)
246 tests-pie += $(ifunc-pie-tests)
247 endif
248 modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6
249 endif
250 endif
253 include ../Rules
255 check-abi: check-abi-ld
256 update-abi: update-abi-ld
258 ifeq (yes,$(build-shared))
259 # Make sure these things are built in the `make lib' pass so they can be used
260 # to run programs during the `make others' pass.
261 lib-noranlib: $(objpfx)$(rtld-installed-name) \
262 $(addprefix $(objpfx),$(extra-objs))
263 endif
265 # Command to link into a larger single relocatable object.
266 reloc-link = $(LINK.o) -nostdlib -nostartfiles -r
268 $(objpfx)sotruss-lib.so: $(shlib-lds)
270 $(objpfx)dl-allobjs.os: $(all-rtld-routines:%=$(objpfx)%.os)
271 $(reloc-link) -o $@ $^
273 # Link together the dynamic linker into a single relocatable object.
274 # First we do a link against libc_pic.a just to get a link map,
275 # and discard the object produced by that link. From the link map
276 # we can glean all the libc modules that need to go into the dynamic
277 # linker. Then we do a recursive make that goes into all the subdirs
278 # those modules come from and builds special rtld-foo.os versions that
279 # are compiled with special flags, and puts these modules into rtld-libc.a
280 # for us. Then we do the real link using rtld-libc.a instead of libc_pic.a.
282 $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
283 @-rm -f $@T
284 $(reloc-link) -o $@.o '-Wl,-(' $^ -lgcc '-Wl,-)' -Wl,-Map,$@T
285 rm -f $@.o
286 mv -f $@T $@
288 $(objpfx)librtld.mk: $(objpfx)librtld.map Makefile
289 LC_ALL=C \
290 sed -n 's@^$(common-objpfx)\([^(]*\)(\([^)]*\.os\)) *.*$$@\1 \2@p' \
291 $< | \
292 while read lib file; do \
293 case $$lib in \
294 libc_pic.a) \
295 LC_ALL=C fgrep -l /$$file \
296 $(common-objpfx)stamp.os $(common-objpfx)*/stamp.os | \
297 LC_ALL=C \
298 sed 's@^$(common-objpfx)\([^/]*\)/stamp\.os$$@rtld-\1'" +=$$file@"\
299 ;; \
300 */*.a) \
301 echo rtld-$${lib%%/*} += $$file ;; \
302 *) echo "Wasn't expecting $$lib($$file)" >&2; exit 1 ;; \
303 esac; \
304 done > $@T
305 echo rtld-subdirs = `LC_ALL=C sed 's/^rtld-\([^ ]*\).*$$/\1/' $@T \
306 | LC_ALL=C sort -u` >> $@T
307 mv -f $@T $@
309 $(objpfx)rtld-libc.a: $(objpfx)librtld.mk FORCE
310 $(MAKE) -f $< -f rtld-Rules
312 $(objpfx)librtld.os: $(objpfx)dl-allobjs.os $(objpfx)rtld-libc.a
313 $(LINK.o) -nostdlib -nostartfiles -r -o $@ '-Wl,-(' $^ -lgcc '-Wl,-)' \
314 -Wl,-Map,$@.map
316 generated += librtld.map librtld.mk rtld-libc.a librtld.os.map
318 z-now-yes = -Wl,-z,now
320 $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
321 # Link into a temporary file so that we don't touch $@ at all
322 # if the sanity check below fails.
323 $(LINK.o) -nostdlib -nostartfiles -shared -o $@.new \
324 $(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \
325 $(filter-out $(map-file),$^) $(load-map-file) \
326 -Wl,-soname=$(rtld-installed-name) \
327 -Wl,-defsym=_begin=0
328 $(READELF) -s $@.new \
329 | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
330 mv -f $@.new $@
332 # interp.c exists just to get this string into the libraries.
333 CFLAGS-interp.c = -D'RUNTIME_LINKER="$(rtlddir)/$(rtld-installed-name)"' \
334 -DNOT_IN_libc=1
335 $(objpfx)interp.os: $(common-objpfx)config.make
337 ifneq (ld.so,$(rtld-installed-name))
338 # Make sure ld.so.1 exists in the build directory so we can link
339 # against it.
340 $(objpfx)$(rtld-installed-name): $(objpfx)ld.so
341 rm -f $@
342 ln -s $(<F) $@
343 generated += $(rtld-installed-name)
344 endif
346 # Build a file mentioning all trustworthy directories to look for shared
347 # libraries when using LD_LIBRARY_PATH in a setuid program. The user can
348 # add directories to the list by defining $(user-defined-trusted-dirs)
349 # before starting make.
350 $(objpfx)trusted-dirs.h: $(objpfx)trusted-dirs.st; @:
351 $(objpfx)trusted-dirs.st: Makefile $(..)Makeconfig
352 $(make-target-directory)
353 echo "$(subst :, ,$(default-rpath) $(user-defined-trusted-dirs))" \
354 | $(AWK) -f gen-trusted-dirs.awk > ${@:st=T};
355 echo '#define DL_DST_LIB "$(notdir $(slibdir))"' >> ${@:st=T}
356 $(move-if-change) ${@:st=T} ${@:st=h}
357 touch $@
358 CPPFLAGS-dl-load.c = -I$(objpfx). -I$(csu-objpfx).
360 ifeq (yes,$(build-shared))
361 $(inst_slibdir)/$(rtld-version-installed-name): $(objpfx)ld.so $(+force)
362 $(make-target-directory)
363 $(do-install-program)
365 $(inst_rtlddir)/$(rtld-installed-name): \
366 $(inst_slibdir)/$(rtld-version-installed-name) \
367 $(inst_slibdir)/libc-$(version).so
368 $(make-target-directory)
369 $(make-shlib-link)
371 # Special target called by parent to install just the dynamic linker.
372 .PHONY: ldso_install
373 ldso_install: $(inst_rtlddir)/$(rtld-installed-name)
374 endif
377 common-ldd-rewrite = -e 's%@RTLD@%$(rtlddir)/$(rtld-installed-name)%g' \
378 -e 's%@VERSION@%$(version)%g' \
379 -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
380 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g'
381 sh-ldd-rewrite = $(common-ldd-rewrite) -e 's%@BASH@%/bin/sh%g;s/\$$"/"/g'
382 bash-ldd-rewrite = $(common-ldd-rewrite) -e 's%@BASH@%$(BASH)%g' \
383 -e 's%@TEXTDOMAINDIR@%$(msgcatdir)%g'
385 ifneq ($(have-bash2),yes)
386 ldd-shell = sh
387 else
388 ldd-shell = bash
389 endif
391 ifeq ($(ldd-rewrite-script),no)
392 define gen-ldd
393 LC_ALL=C sed $($(ldd-shell)-ldd-rewrite) < $< > $@.new
394 endef
395 else
396 define gen-ldd
397 LC_ALL=C sed $($(ldd-shell)-ldd-rewrite) < $< \
398 | LC_ALL=C sed -f $(patsubst $(..)/%,/%,$(..)$(ldd-rewrite-script)) > $@.new
399 endef
400 endif
402 $(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \
403 $(common-objpfx)config.make
404 $(gen-ldd)
405 chmod 555 $@.new
406 mv -f $@.new $@
408 $(objpfx)sprof: $(libdl)
410 $(objpfx)sln: $(sln-modules:%=$(objpfx)%.o)
412 $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
414 $(objpfx)pldd: $(pldd-modules:%=$(objpfx)%.o)
416 SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
417 CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
418 -D'SLIBDIR="$(slibdir)"' -DIS_IN_ldconfig=1
419 CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
420 CFLAGS-cache.c = $(SYSCONF-FLAGS)
421 CFLAGS-rtld.c = $(SYSCONF-FLAGS)
423 CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\
424 -DNOT_IN_libc=1 -DIS_IN_rtld=1 -DIN_LIB=rtld)
426 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
427 generated += $(addsuffix .so,$(strip $(modules-names)))
429 ifeq (yes,$(build-shared))
430 ifeq ($(run-built-tests),yes)
431 tests: $(objpfx)tst-pathopt.out $(objpfx)tst-rtld-load-self.out
432 endif
433 endif
435 $(objpfx)testobj1.so: $(libdl)
436 $(objpfx)testobj1_1.so: $(objpfx)testobj1.so $(libdl)
437 $(objpfx)testobj2.so: $(objpfx)testobj1.so $(libdl)
438 $(objpfx)testobj3.so: $(libdl)
439 $(objpfx)testobj4.so: $(libdl)
440 $(objpfx)testobj5.so: $(libdl)
441 $(objpfx)testobj6.so: $(objpfx)testobj1.so $(objpfx)testobj2.so $(libdl)
442 $(objpfx)failobj.so: $(objpfx)testobj6.so
443 $(objpfx)dep1.so: $(objpfx)dep2.so $(objpfx)dep4.so
444 $(objpfx)dep2.so: $(objpfx)dep3.so $(objpfx)dep4.so
445 $(objpfx)dep4.so: $(objpfx)dep3.so
446 $(objpfx)nodelmod3.so: $(objpfx)nodelmod4.so
447 $(objpfx)nextmod1.so: $(libdl)
448 $(objpfx)neededobj1.so: $(libdl)
449 $(objpfx)neededobj2.so: $(objpfx)neededobj1.so $(libdl)
450 $(objpfx)neededobj3.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so $(libdl)
451 $(objpfx)neededobj4.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
452 $(objpfx)neededobj3.so $(libdl)
453 $(objpfx)neededobj6.so: $(objpfx)neededobj5.so
454 $(objpfx)unload2mod.so: $(objpfx)unload2dep.so
455 $(objpfx)ltglobmod2.so: $(libdl)
456 $(objpfx)firstobj.so: $(shared-thread-library)
457 $(objpfx)globalmod1.so: $(libdl)
458 $(objpfx)reldep4mod1.so: $(objpfx)reldep4mod3.so
459 $(objpfx)reldep4mod2.so: $(objpfx)reldep4mod4.so
460 $(objpfx)dblloadmod1.so: $(objpfx)dblloadmod3.so
461 $(objpfx)dblloadmod2.so: $(objpfx)dblloadmod3.so
462 $(objpfx)reldepmod5.so: $(objpfx)reldepmod2.so
463 $(objpfx)reldepmod6.so: $(objpfx)reldepmod2.so
464 $(objpfx)reldep6mod1.so: $(objpfx)reldep6mod0.so
465 $(objpfx)reldep6mod2.so: $(objpfx)reldep6mod1.so
466 $(objpfx)reldep6mod3.so: $(objpfx)reldep6mod2.so
467 $(objpfx)reldep6mod4.so: $(objpfx)reldep6mod1.so
468 $(objpfx)tst-tlsmod3.so: $(objpfx)tst-tlsmod2.so
469 $(objpfx)tst-tlsmod8.so: $(objpfx)tst-tlsmod7.so
470 $(objpfx)tst-tlsmod10.so: $(objpfx)tst-tlsmod9.so
471 $(objpfx)tst-tlsmod12.so: $(objpfx)tst-tlsmod11.so
472 $(objpfx)tst-tlsmod13a.so: $(objpfx)tst-tlsmod13.so
473 # For tst-tls9-static, make sure the modules it dlopens have libc.so in DT_NEEDED
474 $(objpfx)tst-tlsmod5.so: $(common-objpfx)libc.so
475 $(objpfx)tst-tlsmod6.so: $(common-objpfx)libc.so
476 $(objpfx)tst-tls19mod1.so: $(objpfx)tst-tls19mod2.so $(objpfx)tst-tls19mod3.so
477 $(objpfx)tst-tls19mod3.so: $(objpfx)ld.so
478 $(objpfx)reldep8mod3.so: $(objpfx)reldep8mod1.so $(objpfx)reldep8mod2.so
479 $(objpfx)nodel2mod3.so: $(objpfx)nodel2mod1.so $(objpfx)nodel2mod2.so
480 $(objpfx)reldep9mod2.so: $(objpfx)reldep9mod1.so
481 $(objpfx)reldep9mod3.so: $(objpfx)reldep9mod1.so $(objpfx)reldep9mod2.so
482 $(objpfx)unload3mod1.so: $(objpfx)unload3mod3.so
483 $(objpfx)unload3mod2.so: $(objpfx)unload3mod3.so
484 $(objpfx)unload3mod3.so: $(objpfx)unload3mod4.so
485 $(objpfx)unload4mod1.so: $(objpfx)unload4mod2.so $(objpfx)unload4mod3.so
486 $(objpfx)unload4mod2.so: $(objpfx)unload4mod4.so $(objpfx)unload4mod3.so
487 $(objpfx)unload6mod1.so: $(libdl)
488 $(objpfx)unload6mod2.so: $(libdl)
489 $(objpfx)unload6mod3.so: $(libdl)
490 $(objpfx)unload7mod1.so: $(libdl)
491 $(objpfx)unload7mod2.so: $(objpfx)unload7mod1.so
492 $(objpfx)unload8mod1.so: $(objpfx)unload8mod2.so
493 $(objpfx)unload8mod2.so: $(objpfx)unload8mod3.so
494 $(objpfx)unload8mod3.so: $(libdl)
495 $(objpfx)tst-initordera2.so: $(objpfx)tst-initordera1.so
496 $(objpfx)tst-initorderb2.so: $(objpfx)tst-initorderb1.so $(objpfx)tst-initordera2.so
497 $(objpfx)tst-initordera3.so: $(objpfx)tst-initorderb2.so $(objpfx)tst-initorderb1.so
498 $(objpfx)tst-initordera4.so: $(objpfx)tst-initordera3.so
499 $(objpfx)tst-initorder: $(objpfx)tst-initordera4.so $(objpfx)tst-initordera1.so $(objpfx)tst-initorderb2.so
500 $(objpfx)tst-null-argv: $(objpfx)tst-null-argv-lib.so
502 tst-null-argv-ENV = LD_DEBUG=all LD_DEBUG_OUTPUT=$(objpfx)tst-null-argv.debug.out
503 LDFLAGS-nodel2mod3.so = $(no-as-needed)
504 LDFLAGS-reldepmod5.so = $(no-as-needed)
505 LDFLAGS-reldep6mod1.so = $(no-as-needed)
506 LDFLAGS-reldep6mod4.so = $(no-as-needed)
507 LDFLAGS-reldep8mod3.so = $(no-as-needed)
508 LDFLAGS-unload4mod1.so = $(no-as-needed)
509 LDFLAGS-unload4mod2.so = $(no-as-needed)
510 LDFLAGS-tst-initorder = $(no-as-needed)
511 LDFLAGS-tst-initordera2.so = $(no-as-needed)
512 LDFLAGS-tst-initordera3.so = $(no-as-needed)
513 LDFLAGS-tst-initordera4.so = $(no-as-needed)
514 LDFLAGS-tst-initorderb2.so = $(no-as-needed)
515 LDFLAGS-tst-tlsmod5.so = -nostdlib
516 LDFLAGS-tst-tlsmod6.so = -nostdlib
518 testobj1.so-no-z-defs = yes
519 testobj3.so-no-z-defs = yes
520 testobj4.so-no-z-defs = yes
521 testobj5.so-no-z-defs = yes
522 testobj6.so-no-z-defs = yes
523 failobj.so-no-z-defs = yes
524 constload2.so-no-z-defs = yes
525 constload3.so-no-z-defs = yes
526 nodelmod1.so-no-z-defs = yes
527 nodelmod2.so-no-z-defs = yes
528 nodelmod4.so-no-z-defs = yes
529 nodel2mod2.so-no-z-defs = yes
530 reldepmod2.so-no-z-defs = yes
531 reldepmod3.so-no-z-defs = yes
532 reldepmod4.so-no-z-defs = yes
533 reldep4mod4.so-no-z-defs = yes
534 reldep4mod2.so-no-z-defs = yes
535 ltglobmod2.so-no-z-defs = yes
536 dblloadmod3.so-no-z-defs = yes
537 tst-tlsmod1.so-no-z-defs = yes
538 tst-tlsmod2.so-no-z-defs = yes
539 tst-tlsmod3.so-no-z-defs = yes
540 tst-tlsmod4.so-no-z-defs = yes
541 tst-tlsmod7.so-no-z-defs = yes
542 tst-tlsmod8.so-no-z-defs = yes
543 tst-tlsmod9.so-no-z-defs = yes
544 tst-tlsmod10.so-no-z-defs = yes
545 tst-tlsmod12.so-no-z-defs = yes
546 tst-tlsmod14a.so-no-z-defs = yes
547 tst-tlsmod14b.so-no-z-defs = yes
548 tst-tlsmod15a.so-no-z-defs = yes
549 tst-tlsmod16b.so-no-z-defs = yes
550 circlemod2.so-no-z-defs = yes
551 circlemod3.so-no-z-defs = yes
552 circlemod3a.so-no-z-defs = yes
553 reldep8mod2.so-no-z-defs = yes
554 reldep9mod1.so-no-z-defs = yes
555 unload3mod4.so-no-z-defs = yes
556 unload4mod1.so-no-z-defs = yes
557 ifuncmod1.so-no-z-defs = yes
558 ifuncmod5.so-no-z-defs = yes
559 ifuncmod6.so-no-z-defs = yes
561 ifeq ($(build-shared),yes)
562 # Build all the modules even when not actually running test programs.
563 tests: $(test-modules)
564 endif
566 $(objpfx)loadtest: $(libdl)
567 LDFLAGS-loadtest = -rdynamic
569 $(objpfx)loadtest.out: $(test-modules)
571 $(objpfx)neededtest: $(libdl)
572 $(objpfx)neededtest.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
573 $(objpfx)neededobj3.so
575 $(objpfx)neededtest2: $(libdl)
576 $(objpfx)neededtest2.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
577 $(objpfx)neededobj3.so
579 $(objpfx)neededtest3: $(libdl)
580 $(objpfx)neededtest3.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
581 $(objpfx)neededobj3.so $(objpfx)neededobj4.so
583 neededtest4-ENV = LC_ALL=C LANGUAGE=C
584 $(objpfx)neededtest4: $(libdl) $(objpfx)neededobj1.so
585 $(objpfx)neededtest4.out: $(objpfx)neededobj5.so $(objpfx)neededobj6.so
587 $(objpfx)restest1: $(objpfx)testobj1.so $(objpfx)testobj1_1.so $(libdl)
588 LDFLAGS-restest1 = -rdynamic
590 $(objpfx)restest2: $(libdl)
591 LDFLAGS-restest2 = -rdynamic
593 $(objpfx)restest1.out: $(test-modules)
595 preloadtest-preloads = testobj1 testobj2 testobj3 testobj4 testobj5
596 $(objpfx)preloadtest: $(objpfx)testobj6.so
597 LDFLAGS-preloadtest = -rdynamic
598 $(objpfx)preloadtest.out: $(preloadtest-preloads:%=$(objpfx)%.so)
599 preloadtest-ENV = \
600 LD_PRELOAD=$(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
602 $(objpfx)loadfail: $(libdl)
603 LDFLAGS-loadfail = -rdynamic
605 $(objpfx)loadfail.out: $(objpfx)failobj.so
607 $(objpfx)multiload: $(libdl)
608 LDFLAGS-multiload = -rdynamic
609 CFLAGS-multiload.c = -DOBJDIR=\"$(elf-objpfx)\"
611 $(objpfx)multiload.out: $(objpfx)testobj1.so
613 $(objpfx)origtest: $(libdl)
614 LDFLAGS-origtest = -rdynamic
615 $(objpfx)origtest.out: $(objpfx)testobj1.so
617 ifeq ($(have-thread-library),yes)
618 $(objpfx)resolvfail: $(libdl) $(shared-thread-library)
619 else
620 $(objpfx)resolvfail: $(libdl)
621 endif
623 $(objpfx)constload1: $(libdl)
624 $(objpfx)constload1.out: $(objpfx)constload2.so $(objpfx)constload3.so
626 $(objpfx)circleload1: $(libdl)
627 $(objpfx)circleload1.out: $(objpfx)circlemod1.so \
628 $(objpfx)circlemod1a.so
630 $(objpfx)circlemod1.so: $(objpfx)circlemod2.so
631 $(objpfx)circlemod2.so: $(objpfx)circlemod3.so
632 $(objpfx)circlemod1a.so: $(objpfx)circlemod2a.so
633 $(objpfx)circlemod2a.so: $(objpfx)circlemod3a.so
635 $(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so)
637 $(objpfx)order.out: $(objpfx)order
638 $(test-program-prefix) \
639 $(objpfx)order > $@
640 (echo "0123456789" | cmp $@ -) > /dev/null
642 $(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so)
643 $(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
644 vismain-ENV = LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
646 $(objpfx)noload: $(objpfx)testobj1.so $(common-objpfx)dlfcn/libdl.so
647 LDFLAGS-noload = -rdynamic $(no-as-needed)
648 $(objpfx)noload.out: $(objpfx)testobj5.so
650 $(objpfx)noload-mem: $(objpfx)noload.out
651 $(common-objpfx)malloc/mtrace $(objpfx)noload.mtrace > $@
652 noload-ENV = MALLOC_TRACE=$(objpfx)noload.mtrace
654 LDFLAGS-nodelete = -rdynamic
655 LDFLAGS-nodelmod1.so = -Wl,--enable-new-dtags,-z,nodelete
656 LDFLAGS-nodelmod4.so = -Wl,--enable-new-dtags,-z,nodelete
657 $(objpfx)nodelete: $(libdl)
658 $(objpfx)nodelete.out: $(objpfx)nodelmod1.so $(objpfx)nodelmod2.so \
659 $(objpfx)nodelmod3.so
661 LDFLAGS-nodlopenmod.so = -Wl,--enable-new-dtags,-z,nodlopen
662 $(objpfx)nodlopen: $(libdl)
663 $(objpfx)nodlopen.out: $(objpfx)nodlopenmod.so
665 $(objpfx)nodlopenmod2.so: $(objpfx)nodlopenmod.so
666 $(objpfx)nodlopen2: $(libdl)
667 $(objpfx)nodlopen2.out: $(objpfx)nodlopenmod2.so
669 $(objpfx)filtmod1.so: $(objpfx)filtmod1.os $(objpfx)filtmod2.so
670 $(LINK.o) -shared -o $@ -B$(csu-objpfx) $(LDFLAGS.so) \
671 -L$(subst :, -L,$(rpath-link)) \
672 -Wl,-rpath-link=$(rpath-link) \
673 $< -Wl,-F,$(objpfx)filtmod2.so
674 $(objpfx)filter: $(objpfx)filtmod1.so
676 $(objpfx)unload: $(libdl)
677 $(objpfx)unload.out: $(objpfx)unloadmod.so
679 $(objpfx)reldep: $(libdl)
680 $(objpfx)reldep.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod2.so
682 $(objpfx)reldep2: $(libdl)
683 $(objpfx)reldep2.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod3.so
685 $(objpfx)reldep3: $(libdl)
686 $(objpfx)reldep3.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
688 $(objpfx)reldep4: $(libdl)
689 $(objpfx)reldep4.out: $(objpfx)reldep4mod1.so $(objpfx)reldep4mod2.so
691 $(objpfx)next: $(objpfx)nextmod1.so $(objpfx)nextmod2.so $(libdl)
692 LDFLAGS-next = $(no-as-needed)
694 $(objpfx)unload2: $(libdl)
695 $(objpfx)unload2.out: $(objpfx)unload2mod.so $(objpfx)unload2dep.so
697 $(objpfx)lateglobal: $(libdl)
698 $(objpfx)lateglobal.out: $(objpfx)ltglobmod1.so $(objpfx)ltglobmod2.so
700 $(objpfx)tst-pathopt: $(libdl)
701 $(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \
702 $(objpfx)pathoptobj.so
703 $(SHELL) $< $(common-objpfx) '$(test-wrapper-env)'
705 $(objpfx)tst-rtld-load-self.out: tst-rtld-load-self.sh $(objpfx)ld.so
706 $(SHELL) $^ '$(test-wrapper)' '$(test-wrapper-env)' > $@
708 $(objpfx)initfirst: $(libdl)
709 $(objpfx)initfirst.out: $(objpfx)firstobj.so
711 $(objpfx)global: $(objpfx)globalmod1.so
712 $(objpfx)global.out: $(objpfx)reldepmod1.so
714 $(objpfx)dblload: $(libdl)
715 $(objpfx)dblload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
717 $(objpfx)dblunload: $(libdl)
718 $(objpfx)dblunload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
720 $(objpfx)reldep5: $(libdl)
721 $(objpfx)reldep5.out: $(objpfx)reldepmod5.so $(objpfx)reldepmod6.so
723 $(objpfx)reldep6: $(libdl)
724 $(objpfx)reldep6.out: $(objpfx)reldep6mod3.so $(objpfx)reldep6mod4.so
726 $(objpfx)reldep7: $(libdl)
727 $(objpfx)reldep7.out: $(objpfx)reldep7mod1.so $(objpfx)reldep7mod2.so
729 $(objpfx)reldep8: $(libdl)
730 $(objpfx)reldep8.out: $(objpfx)reldep8mod3.so
732 LDFLAGS-nodel2mod2.so = -Wl,--enable-new-dtags,-z,nodelete
733 $(objpfx)nodelete2: $(libdl)
734 $(objpfx)nodelete2.out: $(objpfx)nodel2mod3.so
736 $(objpfx)reldep9: $(libdl)
737 $(objpfx)reldep9.out: $(objpfx)reldep9mod3.so
739 $(objpfx)tst-tls3: $(objpfx)tst-tlsmod1.so
741 $(objpfx)tst-tls4: $(libdl)
742 $(objpfx)tst-tls4.out: $(objpfx)tst-tlsmod2.so
744 $(objpfx)tst-tls5: $(libdl)
745 $(objpfx)tst-tls5.out: $(objpfx)tst-tlsmod2.so
747 $(objpfx)tst-tls6: $(libdl)
748 $(objpfx)tst-tls6.out: $(objpfx)tst-tlsmod2.so
750 $(objpfx)tst-tls7: $(libdl)
751 $(objpfx)tst-tls7.out: $(objpfx)tst-tlsmod3.so
753 $(objpfx)tst-tls8: $(libdl)
754 $(objpfx)tst-tls8.out: $(objpfx)tst-tlsmod3.so $(objpfx)tst-tlsmod4.so
756 $(objpfx)tst-tls9: $(libdl)
757 $(objpfx)tst-tls9.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
759 $(objpfx)tst-tls10: $(objpfx)tst-tlsmod8.so $(objpfx)tst-tlsmod7.so
761 $(objpfx)tst-tls11: $(objpfx)tst-tlsmod10.so $(objpfx)tst-tlsmod9.so
763 $(objpfx)tst-tls12: $(objpfx)tst-tlsmod12.so $(objpfx)tst-tlsmod11.so
765 $(objpfx)tst-tls13: $(libdl)
766 $(objpfx)tst-tls13.out: $(objpfx)tst-tlsmod13a.so
768 $(objpfx)tst-tls14: $(objpfx)tst-tlsmod14a.so $(libdl)
769 $(objpfx)tst-tls14.out: $(objpfx)tst-tlsmod14b.so
771 $(objpfx)tst-tls15: $(libdl)
772 $(objpfx)tst-tls15.out: $(objpfx)tst-tlsmod15a.so $(objpfx)tst-tlsmod15b.so
774 $(objpfx)tst-tls-dlinfo: $(libdl)
775 $(objpfx)tst-tls-dlinfo.out: $(objpfx)tst-tlsmod2.so
779 $(objpfx)tst-tls16: $(libdl)
780 $(objpfx)tst-tls16.out: $(objpfx)tst-tlsmod16a.so $(objpfx)tst-tlsmod16b.so
782 $(objpfx)tst-tls17: $(libdl)
783 $(objpfx)tst-tls17.out: $(objpfx)tst-tlsmod17b.so
784 $(patsubst %,$(objpfx)%.os,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.os: tst-tlsmod17a.c
785 $(compile-command.c) -DN=$*
786 $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.so: $(objpfx)ld.so
787 $(objpfx)tst-tlsmod17b.so: $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules))
789 $(objpfx)tst-tls18: $(libdl)
790 $(objpfx)tst-tls18.out: $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules))
791 $(patsubst %,$(objpfx)%.os,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.os : tst-tlsmod18a.c
792 $(compile-command.c) -DN=$*
793 $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.so: $(objpfx)ld.so
795 $(objpfx)tst-tls19: $(libdl)
796 $(objpfx)tst-tls19.out: $(objpfx)tst-tls19mod1.so
798 CFLAGS-tst-align.c = $(stack-align-test-flags)
799 CFLAGS-tst-align2.c = $(stack-align-test-flags)
800 CFLAGS-tst-alignmod.c = $(stack-align-test-flags)
801 CFLAGS-tst-alignmod2.c = $(stack-align-test-flags)
802 $(objpfx)tst-align: $(libdl)
803 $(objpfx)tst-align.out: $(objpfx)tst-alignmod.so
804 $(objpfx)tst-align2: $(objpfx)tst-alignmod2.so
806 $(objpfx)unload3: $(libdl)
807 $(objpfx)unload3.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
808 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
810 $(objpfx)unload4: $(libdl)
811 $(objpfx)unload4.out: $(objpfx)unload4mod1.so $(objpfx)unload4mod3.so
813 $(objpfx)unload5: $(libdl)
814 $(objpfx)unload5.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
815 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
817 $(objpfx)unload6: $(libdl)
818 $(objpfx)unload6.out: $(objpfx)unload6mod1.so $(objpfx)unload6mod2.so \
819 $(objpfx)unload6mod3.so
821 $(objpfx)unload7: $(libdl)
822 $(objpfx)unload7.out: $(objpfx)unload7mod1.so $(objpfx)unload7mod2.so
823 unload7-ENV = MALLOC_PERTURB_=85
825 $(objpfx)unload8: $(libdl)
826 $(objpfx)unload8.out: $(objpfx)unload8mod1.so $(objpfx)unload8mod1x.so
828 ifdef libdl
829 $(objpfx)tst-tls9-static: $(common-objpfx)dlfcn/libdl.a
830 $(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
831 endif
833 ifeq ($(have-z-execstack),yes)
834 $(objpfx)tst-execstack: $(libdl)
835 $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
836 LDFLAGS-tst-execstack = -Wl,-z,noexecstack
837 LDFLAGS-tst-execstack-mod = -Wl,-z,execstack
839 $(objpfx)tst-execstack-needed: $(objpfx)tst-execstack-mod.so
840 LDFLAGS-tst-execstack-needed = -Wl,-z,noexecstack
842 LDFLAGS-tst-execstack-prog = -Wl,-z,execstack
843 endif
845 LDFLAGS-tst-array2 = $(no-as-needed)
846 LDFLAGS-tst-array5 = $(no-as-needed)
848 $(objpfx)tst-array1.out: tst-array1.exp $(objpfx)tst-array1
849 $(test-program-cmd) > $@
850 cmp $@ tst-array1.exp > /dev/null
852 $(objpfx)tst-array1-static.out: tst-array1.exp $(objpfx)tst-array1-static
853 $(test-program-cmd) > $@
854 cmp $@ tst-array1.exp > /dev/null
856 $(objpfx)tst-array2: $(objpfx)tst-array2dep.so
857 $(objpfx)tst-array2.out: tst-array2.exp $(objpfx)tst-array2
858 $(test-program-cmd) > $@
859 cmp $@ tst-array2.exp > /dev/null
861 $(objpfx)tst-array3.out: tst-array1.exp $(objpfx)tst-array3
862 $(test-program-cmd) > $@
863 cmp $@ tst-array1.exp > /dev/null
865 $(objpfx)tst-array4: $(libdl)
866 $(objpfx)tst-array4.out: tst-array4.exp $(objpfx)tst-array4 \
867 $(objpfx)tst-array2dep.so
868 $(test-program-cmd) > $@
869 cmp $@ tst-array4.exp > /dev/null
871 $(objpfx)tst-array5: $(objpfx)tst-array5dep.so
872 $(objpfx)tst-array5.out: tst-array5.exp $(objpfx)tst-array5
873 $(test-program-cmd) > $@
874 cmp $@ tst-array5.exp > /dev/null
876 $(objpfx)tst-array5-static.out: tst-array5-static.exp \
877 $(objpfx)tst-array5-static
878 $(test-program-cmd) > $@
879 cmp $@ tst-array5-static.exp > /dev/null
881 CFLAGS-tst-pie1.c += $(pie-ccflag)
883 $(objpfx)tst-pie1: $(objpfx)tst-piemod1.so
885 ifeq (yes,$(build-shared))
886 tests: $(objpfx)check-textrel.out $(objpfx)check-execstack.out
888 all-built-dso := $(common-objpfx)libc.so \
889 $(filter-out $(common-objpfx)linkobj/libc.so, \
890 $(sort $(wildcard $(addprefix $(common-objpfx), \
891 */lib*.so \
892 iconvdata/*.so))))
894 $(all-built-dso:=.dyn): %.dyn: %
895 @rm -f $@T
896 LC_ALL=C $(READELF) -W -d $< > $@T
897 test -s $@T
898 mv -f $@T $@
899 common-generated += $(all-built-dso:$(common-objpfx)%=%.dyn)
901 $(objpfx)check-textrel.out: $(..)scripts/check-textrel.awk \
902 $(all-built-dso:=.dyn)
903 LC_ALL=C $(AWK) -f $^ > $@
904 generated += check-textrel.out
906 $(objpfx)execstack-default: $(first-word $(wildcard $(sysdirs:%=%/stackinfo.h)))
907 $(make-target-directory)
908 { echo '#include <elf.h>'; \
909 echo '#include <stackinfo.h>'; \
910 echo '#if (DEFAULT_STACK_PERMS & PF_X) == 0'; \
911 echo '@@@execstack-no@@@'; \
912 echo '#else'; \
913 echo '@@@execstack-yes@@@'; \
914 echo '#endif'; } | \
915 $(CC) $(CFLAGS) $(CPPFLAGS) -E -x c-header - | \
916 sed -n -e 's/^@@@\(.*\)@@@/\1/p' > $@T
917 mv -f $@T $@
918 generated += execstack-default
920 $(all-built-dso:=.phdr): %.phdr: %
921 @rm -f $@T
922 LC_ALL=C $(READELF) -W -l $< > $@T
923 test -s $@T
924 mv -f $@T $@
925 common-generated += $(all-built-dso:$(common-objpfx)%=%.phdr)
927 $(objpfx)check-execstack.out: $(..)scripts/check-execstack.awk \
928 $(objpfx)execstack-default \
929 $(all-built-dso:=.phdr)
930 LC_ALL=C $(AWK) -f $^ > $@
931 generated += check-execstack.out
933 $(objpfx)tst-dlmodcount: $(libdl)
934 $(objpfx)tst-dlmodcount.out: $(test-modules)
936 $(all-built-dso:=.jmprel): %.jmprel: % Makefile
937 @rm -f $@T
938 LC_ALL=C $(READELF) -W -S -d -r $< > $@T
939 test -s $@T
940 mv -f $@T $@
941 common-generated += $(all-built-dso:$(common-objpfx)%=%.jmprel)
943 tests: $(objpfx)check-localplt.out
945 localplt-built-dso := $(addprefix $(common-objpfx),\
946 libc.so \
947 math/libm.so \
948 rt/librt.so \
949 dlfcn/libdl.so \
950 resolv/libresolv.so \
951 crypt/libcrypt.so \
953 ifeq ($(have-thread-library),yes)
954 localplt-built-dso += $(filter-out %_nonshared.a, $(shared-thread-library))
955 endif
957 vpath localplt.data $(+sysdep_dirs)
959 $(objpfx)check-localplt.out: $(..)scripts/check-localplt.awk \
960 $(..)scripts/localplt.awk \
961 $(localplt-built-dso:=.jmprel) \
962 localplt.data
963 LC_ALL=C $(AWK) -f $(filter-out $< %localplt.data,$^) | \
964 LC_ALL=C $(AWK) -f $< $(filter %localplt.data,$^) - \
965 > $@
966 endif
968 $(objpfx)tst-dlopenrpathmod.so: $(libdl)
969 $(objpfx)tst-dlopenrpath: $(objpfx)tst-dlopenrpathmod.so $(libdl)
970 CFLAGS-tst-dlopenrpath.c += -DPFX=\"$(objpfx)\"
971 LDFLAGS-tst-dlopenrpathmod.so += -Wl,-rpath,\$$ORIGIN/test-subdir
972 $(objpfx)tst-dlopenrpath.out: $(objpfx)firstobj.so
974 $(objpfx)tst-deep1mod2.so: $(objpfx)tst-deep1mod3.so
975 $(objpfx)tst-deep1: $(libdl) $(objpfx)tst-deep1mod1.so
976 $(objpfx)tst-deep1.out: $(objpfx)tst-deep1mod2.so
977 LDFLAGS-tst-deep1 += -rdynamic
978 tst-deep1mod3.so-no-z-defs = yes
980 $(objpfx)tst-dlmopen1mod.so: $(libdl)
981 $(objpfx)tst-dlmopen1: $(libdl)
982 $(objpfx)tst-dlmopen1.out: $(objpfx)tst-dlmopen1mod.so
984 $(objpfx)tst-dlmopen2: $(libdl)
985 $(objpfx)tst-dlmopen2.out: $(objpfx)tst-dlmopen1mod.so
987 $(objpfx)tst-dlmopen3: $(libdl)
988 $(objpfx)tst-dlmopen3.out: $(objpfx)tst-dlmopen1mod.so
990 $(objpfx)tst-audit1.out: $(objpfx)tst-auditmod1.so
991 tst-audit1-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
993 $(objpfx)tst-audit2.out: $(objpfx)tst-auditmod1.so
994 tst-audit2-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
996 $(objpfx)tst-audit8: $(common-objpfx)math/libm.so
997 $(objpfx)tst-audit8.out: $(objpfx)tst-auditmod1.so
998 tst-audit8-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1000 $(objpfx)tst-global1: $(libdl)
1001 $(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
1003 $(objpfx)order2: $(libdl)
1004 $(objpfx)order2.out: $(objpfx)order2 $(objpfx)order2mod1.so \
1005 $(objpfx)order2mod2.so
1006 $(test-program-prefix) \
1007 $(objpfx)order2 > $@
1008 (echo "12345" | cmp $@ -) > /dev/null
1009 $(objpfx)order2mod1.so: $(objpfx)order2mod4.so
1010 $(objpfx)order2mod4.so: $(objpfx)order2mod3.so
1011 $(objpfx)order2mod2.so: $(objpfx)order2mod3.so
1012 order2mod2.so-no-z-defs = yes
1013 LDFLAGS-order2mod1.so = $(no-as-needed)
1014 LDFLAGS-order2mod2.so = $(no-as-needed)
1016 tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child"
1017 tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
1019 $(objpfx)tst-leaks1: $(libdl)
1020 $(objpfx)tst-leaks1-mem: $(objpfx)tst-leaks1.out
1021 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1.mtrace > $@
1023 $(objpfx)tst-leaks1-static: $(common-objpfx)dlfcn/libdl.a
1024 $(objpfx)tst-leaks1-static-mem: $(objpfx)tst-leaks1-static.out
1025 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1-static.mtrace > $@
1027 tst-leaks1-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1.mtrace
1028 tst-leaks1-static-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1-static.mtrace
1030 $(objpfx)tst-addr1: $(libdl)
1032 $(objpfx)tst-thrlock: $(libdl) $(shared-thread-library)
1034 CFLAGS-ifuncmain1pic.c += $(pic-ccflag)
1035 CFLAGS-ifuncmain1picstatic.c += $(pic-ccflag)
1036 CFLAGS-ifuncmain1staticpic.c += $(pic-ccflag)
1037 CFLAGS-ifuncdep1pic.c += $(pic-ccflag)
1038 CFLAGS-ifuncmain1vispic.c += $(pic-ccflag)
1039 CFLAGS-ifuncmain2pic.c += $(pic-ccflag)
1040 CFLAGS-ifuncmain2picstatic.c += $(pic-ccflag)
1041 CFLAGS-ifuncdep2pic.c += $(pic-ccflag)
1042 CFLAGS-ifuncmain4picstatic.c += $(pic-ccflag)
1043 CFLAGS-ifuncmain5pic.c += $(pic-ccflag)
1044 CFLAGS-ifuncmain5picstatic.c += $(pic-ccflag)
1045 CFLAGS-ifuncmain5staticpic.c += $(pic-ccflag)
1046 CFLAGS-ifuncdep5pic.c += $(pic-ccflag)
1047 CFLAGS-ifuncmain7pic.c += $(pic-ccflag)
1048 CFLAGS-ifuncmain7picstatic.c += $(pic-ccflag)
1050 LDFLAGS-ifuncmain3 = -Wl,-export-dynamic
1052 CFLAGS-ifuncmain1pie.c += $(pie-ccflag)
1053 CFLAGS-ifuncmain1vispie.c += $(pie-ccflag)
1054 CFLAGS-ifuncmain1staticpie.c += $(pie-ccflag)
1055 CFLAGS-ifuncmain5pie.c += $(pie-ccflag)
1056 CFLAGS-ifuncmain6pie.c += $(pie-ccflag)
1057 CFLAGS-ifuncmain7pie.c += $(pie-ccflag)
1059 $(objpfx)ifuncmain1pie: $(objpfx)ifuncmod1.so
1060 $(objpfx)ifuncmain1staticpie: $(objpfx)ifuncdep1pic.o
1061 $(objpfx)ifuncmain1vispie: $(objpfx)ifuncmod1.so
1062 $(objpfx)ifuncmain5pie: $(objpfx)ifuncmod5.so
1063 $(objpfx)ifuncmain6pie: $(objpfx)ifuncmod6.so
1065 $(objpfx)ifuncmain1: $(addprefix $(objpfx),ifuncmod1.so)
1066 $(objpfx)ifuncmain1pic: $(addprefix $(objpfx),ifuncmod1.so)
1067 $(objpfx)ifuncmain1staticpic: $(addprefix $(objpfx),ifuncdep1pic.o)
1068 $(objpfx)ifuncmain1static: $(addprefix $(objpfx),ifuncdep1.o)
1069 $(objpfx)ifuncmain1picstatic: $(addprefix $(objpfx),ifuncdep1pic.o)
1070 $(objpfx)ifuncmain1vis: $(addprefix $(objpfx),ifuncmod1.so)
1071 $(objpfx)ifuncmain1vispic: $(addprefix $(objpfx),ifuncmod1.so)
1072 $(objpfx)ifuncmain2: $(addprefix $(objpfx),ifuncdep2.o)
1073 $(objpfx)ifuncmain2pic: $(addprefix $(objpfx),ifuncdep2pic.o)
1074 $(objpfx)ifuncmain2static: $(addprefix $(objpfx),ifuncdep2.o)
1075 $(objpfx)ifuncmain2picstatic: $(addprefix $(objpfx),ifuncdep2pic.o)
1077 $(objpfx)ifuncmain3: $(libdl)
1078 $(objpfx)ifuncmain3.out: $(objpfx)ifuncmod3.so
1080 $(objpfx)ifuncmain5: $(addprefix $(objpfx),ifuncmod5.so)
1081 $(objpfx)ifuncmain5pic: $(addprefix $(objpfx),ifuncmod5.so)
1082 $(objpfx)ifuncmain5static: $(addprefix $(objpfx),ifuncdep5.o)
1083 $(objpfx)ifuncmain5staticpic: $(addprefix $(objpfx),ifuncdep5pic.o)
1084 $(objpfx)ifuncmain5picstatic: $(addprefix $(objpfx),ifuncdep5pic.o)
1086 $(objpfx)tst-unique1: $(libdl)
1087 $(objpfx)tst-unique1.out: $(objpfx)tst-unique1mod1.so \
1088 $(objpfx)tst-unique1mod2.so
1090 $(objpfx)tst-unique2: $(libdl) $(objpfx)tst-unique2mod1.so
1091 $(objpfx)tst-unique2.out: $(objpfx)tst-unique2mod2.so
1093 $(objpfx)tst-unique3: $(libdl) $(objpfx)tst-unique3lib.so
1094 $(objpfx)tst-unique3.out: $(objpfx)tst-unique3lib2.so
1096 $(objpfx)tst-unique4: $(objpfx)tst-unique4lib.so
1098 $(objpfx)tst-initorder.out: $(objpfx)tst-initorder
1099 $(test-program-prefix) \
1100 $< > $@
1101 cmp $@ tst-initorder.exp > /dev/null
1103 $(objpfx)tst-initorder2: $(objpfx)tst-initorder2a.so $(objpfx)tst-initorder2d.so $(objpfx)tst-initorder2c.so
1104 $(objpfx)tst-initorder2a.so: $(objpfx)tst-initorder2b.so
1105 $(objpfx)tst-initorder2b.so: $(objpfx)tst-initorder2c.so
1106 $(objpfx)tst-initorder2c.so: $(objpfx)tst-initorder2d.so
1107 LDFLAGS-tst-initorder2 = $(no-as-needed)
1108 LDFLAGS-tst-initorder2a.so = $(no-as-needed)
1109 LDFLAGS-tst-initorder2b.so = $(no-as-needed)
1110 LDFLAGS-tst-initorder2c.so = $(no-as-needed)
1111 define o-iterator-doit
1112 $(objpfx)tst-initorder2$o.os: tst-initorder2.c; \
1113 $$(compile-command.c) -DNAME=\"$o\"
1114 endef
1115 object-suffixes-left := a b c d
1116 include $(o-iterator)
1118 $(objpfx)tst-initorder2.out: $(objpfx)tst-initorder2
1119 $(test-program-prefix) \
1120 $< > $@
1121 cmp $@ tst-initorder2.exp > /dev/null
1123 $(objpfx)tst-relsort1: $(libdl)
1124 $(objpfx)tst-relsort1mod1.so: $(libm) $(objpfx)tst-relsort1mod2.so
1125 $(objpfx)tst-relsort1mod2.so: $(libm)
1126 $(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
1127 $(objpfx)tst-relsort1mod2.so
1129 ifeq ($(run-built-tests),yes)
1130 tests: $(objpfx)tst-unused-dep.out
1131 endif
1133 $(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so
1134 $(test-wrapper-env) \
1135 LD_TRACE_LOADED_OBJECTS=1 \
1136 LD_DEBUG=unused \
1137 LD_PRELOAD= \
1138 $(elf-objpfx)${rtld-installed-name} \
1139 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
1140 $< > $@
1141 cmp $@ /dev/null > /dev/null