Add more NEWS items for 2.17.
[glibc.git] / elf / Makefile
blob6c7bc97d4aaa2f1cb79007d26d9688f1a90a9b12
1 # Copyright (C) 1995-2012 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_slibdir)/$(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
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 ifeq (x86_64,$(config-machine))
156 tests += tst-audit3 tst-audit4 tst-audit5
157 ifeq (yes,$(config-cflags-avx))
158 tests += tst-audit6 tst-audit7
159 endif
160 endif
161 endif
162 ifeq ($(run-built-tests),yes)
163 tests: $(objpfx)tst-leaks1-mem $(objpfx)tst-leaks1-static-mem \
164 $(objpfx)noload-mem
165 endif
166 tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
167 tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
168 tlsmod17a-modules = $(addprefix tst-tlsmod17a, $(tlsmod17a-suffixes))
169 tlsmod18a-modules = $(addprefix tst-tlsmod18a, $(tlsmod17a-suffixes))
170 extra-test-objs += $(tlsmod17a-modules:=.os) $(tlsmod18a-modules:=.os)
171 test-extras += tst-tlsmod17a tst-tlsmod18a
172 modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
173 testobj1_1 failobj constload2 constload3 unloadmod \
174 dep1 dep2 dep3 dep4 vismod1 vismod2 vismod3 \
175 nodelmod1 nodelmod2 nodelmod3 nodelmod4 \
176 nodel2mod1 nodel2mod2 nodel2mod3 \
177 nodlopenmod nodlopenmod2 filtmod1 filtmod2 \
178 reldepmod1 reldepmod2 reldepmod3 reldepmod4 nextmod1 nextmod2 \
179 reldep4mod1 reldep4mod2 reldep4mod3 reldep4mod4 \
180 neededobj1 neededobj2 neededobj3 neededobj4 \
181 neededobj5 neededobj6 firstobj globalmod1 \
182 unload2mod unload2dep ltglobmod1 ltglobmod2 pathoptobj \
183 dblloadmod1 dblloadmod2 dblloadmod3 reldepmod5 reldepmod6 \
184 reldep6mod0 reldep6mod1 reldep6mod2 reldep6mod3 reldep6mod4 \
185 reldep7mod1 reldep7mod2 \
186 tst-tlsmod1 tst-tlsmod2 tst-tlsmod3 tst-tlsmod4 \
187 tst-tlsmod5 tst-tlsmod6 tst-tlsmod7 tst-tlsmod8 \
188 tst-tlsmod9 tst-tlsmod10 tst-tlsmod11 tst-tlsmod12 \
189 tst-tlsmod13 tst-tlsmod13a tst-tlsmod14a tst-tlsmod14b \
190 tst-tlsmod15a tst-tlsmod15b tst-tlsmod16a tst-tlsmod16b \
191 $(tlsmod17a-modules) tst-tlsmod17b $(tlsmod18a-modules) \
192 tst-tls19mod1 tst-tls19mod2 tst-tls19mod3 \
193 circlemod1 circlemod1a circlemod2 circlemod2a \
194 circlemod3 circlemod3a \
195 reldep8mod1 reldep8mod2 reldep8mod3 \
196 reldep9mod1 reldep9mod2 reldep9mod3 \
197 tst-alignmod tst-alignmod2 \
198 $(modules-execstack-$(have-z-execstack)) \
199 tst-dlopenrpathmod tst-deep1mod1 tst-deep1mod2 tst-deep1mod3 \
200 tst-dlmopen1mod tst-auditmod1 \
201 unload3mod1 unload3mod2 unload3mod3 unload3mod4 \
202 unload4mod1 unload4mod2 unload4mod3 unload4mod4 \
203 unload6mod1 unload6mod2 unload6mod3 \
204 unload7mod1 unload7mod2 \
205 unload8mod1 unload8mod1x unload8mod2 unload8mod3 \
206 order2mod1 order2mod2 order2mod3 order2mod4 \
207 tst-unique1mod1 tst-unique1mod2 \
208 tst-unique2mod1 tst-unique2mod2 \
209 tst-unique3lib tst-unique3lib2 \
210 tst-unique4lib \
211 tst-initordera1 tst-initorderb1 \
212 tst-initordera2 tst-initorderb2 \
213 tst-initordera3 tst-initordera4 \
214 tst-initorder2a tst-initorder2b tst-initorder2c \
215 tst-initorder2d \
216 tst-relsort1mod1 tst-relsort1mod2 tst-array2dep \
217 tst-array5dep
218 ifeq (yesyes,$(have-fpie)$(build-shared))
219 modules-names += tst-piemod1
220 tests += tst-pie1
221 tests-pie += tst-pie1
222 endif
223 ifeq (x86_64,$(config-machine))
224 modules-names += tst-auditmod3a tst-auditmod3b \
225 tst-auditmod4a tst-auditmod4b \
226 tst-auditmod5a tst-auditmod5b \
227 tst-auditmod6a tst-auditmod6b tst-auditmod6c \
228 tst-auditmod7a tst-auditmod7b
229 endif
230 modules-execstack-yes = tst-execstack-mod
231 extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
232 # We need this variable to be sure the test modules get the right CPPFLAGS.
233 test-extras += $(modules-names)
235 # filtmod1.so has a special rule
236 modules-names-nobuild := filtmod1
238 ifneq (no,$(multi-arch))
239 tests-static += ifuncmain1static ifuncmain1picstatic \
240 ifuncmain2static ifuncmain2picstatic \
241 ifuncmain4static ifuncmain4picstatic \
242 ifuncmain5static ifuncmain5picstatic \
243 ifuncmain7static ifuncmain7picstatic
245 ifeq (yes,$(build-shared))
246 tests += ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \
247 ifuncmain1staticpic \
248 ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \
249 ifuncmain5 ifuncmain5pic ifuncmain5staticpic \
250 ifuncmain7 ifuncmain7pic
251 ifunc-test-modules = ifuncdep1 ifuncdep1pic ifuncdep2 ifuncdep2pic \
252 ifuncdep5 ifuncdep5pic
253 extra-test-objs += $(ifunc-test-modules:=.o)
254 test-extras += $(ifunc-test-modules)
255 ifeq (yes,$(have-fpie))
256 ifunc-pie-tests = ifuncmain1pie ifuncmain1vispie ifuncmain1staticpie \
257 ifuncmain5pie ifuncmain6pie ifuncmain7pie
258 tests += $(ifunc-pie-tests)
259 tests-pie += $(ifunc-pie-tests)
260 endif
261 modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6
262 endif
263 endif
266 include ../Rules
268 check-abi: check-abi-ld
269 update-abi: update-abi-ld
271 ifeq (yes,$(build-shared))
272 # Make sure these things are built in the `make lib' pass so they can be used
273 # to run programs during the `make others' pass.
274 lib-noranlib: $(objpfx)$(rtld-installed-name) \
275 $(addprefix $(objpfx),$(extra-objs))
276 endif
278 # Command to link into a larger single relocatable object.
279 reloc-link = $(LINK.o) -nostdlib -nostartfiles -r
281 $(objpfx)sotruss-lib.so: $(shlib-lds)
283 $(objpfx)dl-allobjs.os: $(all-rtld-routines:%=$(objpfx)%.os)
284 $(reloc-link) -o $@ $^
286 # Link together the dynamic linker into a single relocatable object.
287 # First we do a link against libc_pic.a just to get a link map,
288 # and discard the object produced by that link. From the link map
289 # we can glean all the libc modules that need to go into the dynamic
290 # linker. Then we do a recursive make that goes into all the subdirs
291 # those modules come from and builds special rtld-foo.os versions that
292 # are compiled with special flags, and puts these modules into rtld-libc.a
293 # for us. Then we do the real link using rtld-libc.a instead of libc_pic.a.
295 $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
296 @-rm -f $@T
297 $(reloc-link) -o $@.o '-Wl,-(' $^ -lgcc '-Wl,-)' -Wl,-Map,$@T
298 rm -f $@.o
299 mv -f $@T $@
301 $(objpfx)librtld.mk: $(objpfx)librtld.map Makefile
302 LC_ALL=C \
303 sed -n 's@^$(common-objpfx)\([^(]*\)(\([^)]*\.os\)) *.*$$@\1 \2@p' \
304 $< | \
305 while read lib file; do \
306 case $$lib in \
307 libc_pic.a) \
308 LC_ALL=C fgrep -l /$$file \
309 $(common-objpfx)stamp.os $(common-objpfx)*/stamp.os | \
310 LC_ALL=C \
311 sed 's@^$(common-objpfx)\([^/]*\)/stamp\.os$$@rtld-\1'" +=$$file@"\
312 ;; \
313 */*.a) \
314 echo rtld-$${lib%%/*} += $$file ;; \
315 *) echo "Wasn't expecting $$lib($$file)" >&2; exit 1 ;; \
316 esac; \
317 done > $@T
318 echo rtld-subdirs = `LC_ALL=C sed 's/^rtld-\([^ ]*\).*$$/\1/' $@T \
319 | LC_ALL=C sort -u` >> $@T
320 mv -f $@T $@
322 $(objpfx)rtld-libc.a: $(objpfx)librtld.mk FORCE
323 $(MAKE) -f $< -f rtld-Rules
325 $(objpfx)librtld.os: $(objpfx)dl-allobjs.os $(objpfx)rtld-libc.a
326 $(LINK.o) -nostdlib -nostartfiles -r -o $@ '-Wl,-(' $^ -lgcc '-Wl,-)' \
327 -Wl,-Map,$@.map
329 generated += librtld.map librtld.mk rtld-libc.a librtld.os.map
331 z-now-yes = -Wl,-z,now
333 $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
334 $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
335 $(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \
336 $(filter-out $(map-file),$^) $(load-map-file) \
337 -Wl,-soname=$(rtld-installed-name) \
338 -Wl,-defsym=_begin=0
339 $(READELF) -s $@ \
340 | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
342 # interp.c exists just to get this string into the libraries.
343 CFLAGS-interp.c = -D'RUNTIME_LINKER="$(slibdir)/$(rtld-installed-name)"' \
344 -DNOT_IN_libc=1
345 $(objpfx)interp.os: $(common-objpfx)config.make
347 ifneq (ld.so,$(rtld-installed-name))
348 # Make sure ld.so.1 exists in the build directory so we can link
349 # against it.
350 $(objpfx)$(rtld-installed-name): $(objpfx)ld.so
351 rm -f $@
352 ln -s $(<F) $@
353 generated += $(rtld-installed-name)
354 endif
356 # Build a file mentioning all trustworthy directories to look for shared
357 # libraries when using LD_LIBRARY_PATH in a setuid program. The user can
358 # add directories to the list by defining $(user-defined-trusted-dirs)
359 # before starting make.
360 $(objpfx)trusted-dirs.h: $(objpfx)trusted-dirs.st; @:
361 $(objpfx)trusted-dirs.st: Makefile $(..)Makeconfig
362 $(make-target-directory)
363 echo "$(subst :, ,$(default-rpath) $(user-defined-trusted-dirs))" \
364 | $(AWK) -f gen-trusted-dirs.awk > ${@:st=T};
365 echo '#define DL_DST_LIB "$(notdir $(slibdir))"' >> ${@:st=T}
366 $(move-if-change) ${@:st=T} ${@:st=h}
367 touch $@
368 CPPFLAGS-dl-load.c = -I$(objpfx). -I$(csu-objpfx).
370 ifeq (yes,$(build-shared))
371 $(inst_slibdir)/$(rtld-version-installed-name): $(objpfx)ld.so $(+force)
372 $(make-target-directory)
373 $(do-install-program)
375 $(inst_slibdir)/$(rtld-installed-name): \
376 $(inst_slibdir)/$(rtld-version-installed-name) \
377 $(inst_slibdir)/libc-$(version).so
378 $(make-shlib-link)
380 # Special target called by parent to install just the dynamic linker.
381 .PHONY: ldso_install
382 ldso_install: $(inst_slibdir)/$(rtld-installed-name)
383 endif
386 common-ldd-rewrite = -e 's%@RTLD@%$(slibdir)/$(rtld-installed-name)%g' \
387 -e 's%@VERSION@%$(version)%g' \
388 -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
389 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g'
390 sh-ldd-rewrite = $(common-ldd-rewrite) -e 's%@BASH@%/bin/sh%g;s/\$$"/"/g'
391 bash-ldd-rewrite = $(common-ldd-rewrite) -e 's%@BASH@%$(BASH)%g' \
392 -e 's%@TEXTDOMAINDIR@%$(msgcatdir)%g'
394 ifneq ($(have-bash2),yes)
395 ldd-shell = sh
396 else
397 ldd-shell = bash
398 endif
400 ifeq ($(ldd-rewrite-script),no)
401 define gen-ldd
402 LC_ALL=C sed $($(ldd-shell)-ldd-rewrite) < $< > $@.new
403 endef
404 else
405 define gen-ldd
406 LC_ALL=C sed $($(ldd-shell)-ldd-rewrite) < $< \
407 | LC_ALL=C sed -f $(patsubst $(..)/%,/%,$(..)$(ldd-rewrite-script)) > $@.new
408 endef
409 endif
411 $(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \
412 $(common-objpfx)config.make
413 $(gen-ldd)
414 chmod 555 $@.new
415 mv -f $@.new $@
417 $(objpfx)sprof: $(libdl)
419 $(objpfx)sln: $(sln-modules:%=$(objpfx)%.o)
421 $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
423 $(objpfx)pldd: $(pldd-modules:%=$(objpfx)%.o)
425 SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
426 CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
427 -D'SLIBDIR="$(slibdir)"' -DIS_IN_ldconfig=1
428 CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
429 CFLAGS-cache.c = $(SYSCONF-FLAGS)
430 CFLAGS-rtld.c = $(SYSCONF-FLAGS)
432 CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\
433 -DNOT_IN_libc=1 -DIS_IN_rtld=1 -DIN_LIB=rtld)
435 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
436 generated += $(addsuffix .so,$(strip $(modules-names)))
438 ifeq (yes,$(build-shared))
439 ifeq ($(run-built-tests),yes)
440 tests: $(objpfx)tst-pathopt.out $(objpfx)tst-rtld-load-self.out
441 endif
442 endif
444 $(objpfx)testobj1.so: $(libdl)
445 $(objpfx)testobj1_1.so: $(objpfx)testobj1.so $(libdl)
446 $(objpfx)testobj2.so: $(objpfx)testobj1.so $(libdl)
447 $(objpfx)testobj3.so: $(libdl)
448 $(objpfx)testobj4.so: $(libdl)
449 $(objpfx)testobj5.so: $(libdl)
450 $(objpfx)testobj6.so: $(objpfx)testobj1.so $(objpfx)testobj2.so $(libdl)
451 $(objpfx)failobj.so: $(objpfx)testobj6.so
452 $(objpfx)dep1.so: $(objpfx)dep2.so $(objpfx)dep4.so
453 $(objpfx)dep2.so: $(objpfx)dep3.so $(objpfx)dep4.so
454 $(objpfx)dep4.so: $(objpfx)dep3.so
455 $(objpfx)nodelmod3.so: $(objpfx)nodelmod4.so
456 $(objpfx)nextmod1.so: $(libdl)
457 $(objpfx)neededobj1.so: $(libdl)
458 $(objpfx)neededobj2.so: $(objpfx)neededobj1.so $(libdl)
459 $(objpfx)neededobj3.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so $(libdl)
460 $(objpfx)neededobj4.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
461 $(objpfx)neededobj3.so $(libdl)
462 $(objpfx)neededobj6.so: $(objpfx)neededobj5.so
463 $(objpfx)unload2mod.so: $(objpfx)unload2dep.so
464 $(objpfx)ltglobmod2.so: $(libdl)
465 $(objpfx)firstobj.so: $(shared-thread-library)
466 $(objpfx)globalmod1.so: $(libdl)
467 $(objpfx)reldep4mod1.so: $(objpfx)reldep4mod3.so
468 $(objpfx)reldep4mod2.so: $(objpfx)reldep4mod4.so
469 $(objpfx)dblloadmod1.so: $(objpfx)dblloadmod3.so
470 $(objpfx)dblloadmod2.so: $(objpfx)dblloadmod3.so
471 $(objpfx)reldepmod5.so: $(objpfx)reldepmod2.so
472 $(objpfx)reldepmod6.so: $(objpfx)reldepmod2.so
473 $(objpfx)reldep6mod1.so: $(objpfx)reldep6mod0.so
474 $(objpfx)reldep6mod2.so: $(objpfx)reldep6mod1.so
475 $(objpfx)reldep6mod3.so: $(objpfx)reldep6mod2.so
476 $(objpfx)reldep6mod4.so: $(objpfx)reldep6mod1.so
477 $(objpfx)tst-tlsmod3.so: $(objpfx)tst-tlsmod2.so
478 $(objpfx)tst-tlsmod8.so: $(objpfx)tst-tlsmod7.so
479 $(objpfx)tst-tlsmod10.so: $(objpfx)tst-tlsmod9.so
480 $(objpfx)tst-tlsmod12.so: $(objpfx)tst-tlsmod11.so
481 $(objpfx)tst-tlsmod13a.so: $(objpfx)tst-tlsmod13.so
482 # For tst-tls9-static, make sure the modules it dlopens have libc.so in DT_NEEDED
483 $(objpfx)tst-tlsmod5.so: $(common-objpfx)libc.so
484 $(objpfx)tst-tlsmod6.so: $(common-objpfx)libc.so
485 $(objpfx)tst-tls19mod1.so: $(objpfx)tst-tls19mod2.so $(objpfx)tst-tls19mod3.so
486 $(objpfx)tst-tls19mod3.so: $(objpfx)ld.so
487 $(objpfx)reldep8mod3.so: $(objpfx)reldep8mod1.so $(objpfx)reldep8mod2.so
488 $(objpfx)nodel2mod3.so: $(objpfx)nodel2mod1.so $(objpfx)nodel2mod2.so
489 $(objpfx)reldep9mod2.so: $(objpfx)reldep9mod1.so
490 $(objpfx)reldep9mod3.so: $(objpfx)reldep9mod1.so $(objpfx)reldep9mod2.so
491 $(objpfx)unload3mod1.so: $(objpfx)unload3mod3.so
492 $(objpfx)unload3mod2.so: $(objpfx)unload3mod3.so
493 $(objpfx)unload3mod3.so: $(objpfx)unload3mod4.so
494 $(objpfx)unload4mod1.so: $(objpfx)unload4mod2.so $(objpfx)unload4mod3.so
495 $(objpfx)unload4mod2.so: $(objpfx)unload4mod4.so $(objpfx)unload4mod3.so
496 $(objpfx)unload6mod1.so: $(libdl)
497 $(objpfx)unload6mod2.so: $(libdl)
498 $(objpfx)unload6mod3.so: $(libdl)
499 $(objpfx)unload7mod1.so: $(libdl)
500 $(objpfx)unload7mod2.so: $(objpfx)unload7mod1.so
501 $(objpfx)unload8mod1.so: $(objpfx)unload8mod2.so
502 $(objpfx)unload8mod2.so: $(objpfx)unload8mod3.so
503 $(objpfx)unload8mod3.so: $(libdl)
504 $(objpfx)tst-initordera2.so: $(objpfx)tst-initordera1.so
505 $(objpfx)tst-initorderb2.so: $(objpfx)tst-initorderb1.so $(objpfx)tst-initordera2.so
506 $(objpfx)tst-initordera3.so: $(objpfx)tst-initorderb2.so $(objpfx)tst-initorderb1.so
507 $(objpfx)tst-initordera4.so: $(objpfx)tst-initordera3.so
508 $(objpfx)tst-initorder: $(objpfx)tst-initordera4.so $(objpfx)tst-initordera1.so $(objpfx)tst-initorderb2.so
510 LDFLAGS-nodel2mod3.so = $(no-as-needed)
511 LDFLAGS-reldepmod5.so = $(no-as-needed)
512 LDFLAGS-reldep6mod1.so = $(no-as-needed)
513 LDFLAGS-reldep6mod4.so = $(no-as-needed)
514 LDFLAGS-reldep8mod3.so = $(no-as-needed)
515 LDFLAGS-unload4mod1.so = $(no-as-needed)
516 LDFLAGS-unload4mod2.so = $(no-as-needed)
517 LDFLAGS-tst-initorder = $(no-as-needed)
518 LDFLAGS-tst-initordera2.so = $(no-as-needed)
519 LDFLAGS-tst-initordera3.so = $(no-as-needed)
520 LDFLAGS-tst-initordera4.so = $(no-as-needed)
521 LDFLAGS-tst-initorderb2.so = $(no-as-needed)
522 LDFLAGS-tst-tlsmod5.so = -nostdlib
523 LDFLAGS-tst-tlsmod6.so = -nostdlib
525 testobj1.so-no-z-defs = yes
526 testobj3.so-no-z-defs = yes
527 testobj4.so-no-z-defs = yes
528 testobj5.so-no-z-defs = yes
529 testobj6.so-no-z-defs = yes
530 failobj.so-no-z-defs = yes
531 constload2.so-no-z-defs = yes
532 constload3.so-no-z-defs = yes
533 nodelmod1.so-no-z-defs = yes
534 nodelmod2.so-no-z-defs = yes
535 nodelmod4.so-no-z-defs = yes
536 nodel2mod2.so-no-z-defs = yes
537 reldepmod2.so-no-z-defs = yes
538 reldepmod3.so-no-z-defs = yes
539 reldepmod4.so-no-z-defs = yes
540 reldep4mod4.so-no-z-defs = yes
541 reldep4mod2.so-no-z-defs = yes
542 ltglobmod2.so-no-z-defs = yes
543 dblloadmod3.so-no-z-defs = yes
544 tst-tlsmod1.so-no-z-defs = yes
545 tst-tlsmod2.so-no-z-defs = yes
546 tst-tlsmod3.so-no-z-defs = yes
547 tst-tlsmod4.so-no-z-defs = yes
548 tst-tlsmod7.so-no-z-defs = yes
549 tst-tlsmod8.so-no-z-defs = yes
550 tst-tlsmod9.so-no-z-defs = yes
551 tst-tlsmod10.so-no-z-defs = yes
552 tst-tlsmod12.so-no-z-defs = yes
553 tst-tlsmod14a.so-no-z-defs = yes
554 tst-tlsmod14b.so-no-z-defs = yes
555 tst-tlsmod15a.so-no-z-defs = yes
556 tst-tlsmod16b.so-no-z-defs = yes
557 circlemod2.so-no-z-defs = yes
558 circlemod3.so-no-z-defs = yes
559 circlemod3a.so-no-z-defs = yes
560 reldep8mod2.so-no-z-defs = yes
561 reldep9mod1.so-no-z-defs = yes
562 unload3mod4.so-no-z-defs = yes
563 unload4mod1.so-no-z-defs = yes
564 ifuncmod1.so-no-z-defs = yes
565 ifuncmod5.so-no-z-defs = yes
566 ifuncmod6.so-no-z-defs = yes
568 ifeq ($(build-shared),yes)
569 # Build all the modules even when not actually running test programs.
570 tests: $(test-modules)
571 endif
573 $(objpfx)loadtest: $(libdl)
574 LDFLAGS-loadtest = -rdynamic
576 $(objpfx)loadtest.out: $(test-modules)
578 $(objpfx)neededtest: $(libdl)
579 $(objpfx)neededtest.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
580 $(objpfx)neededobj3.so
582 $(objpfx)neededtest2: $(libdl)
583 $(objpfx)neededtest2.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
584 $(objpfx)neededobj3.so
586 $(objpfx)neededtest3: $(libdl)
587 $(objpfx)neededtest3.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
588 $(objpfx)neededobj3.so $(objpfx)neededobj4.so
590 neededtest4-ENV = LC_ALL=C LANGUAGE=C
591 $(objpfx)neededtest4: $(libdl) $(objpfx)neededobj1.so
592 $(objpfx)neededtest4.out: $(objpfx)neededobj5.so $(objpfx)neededobj6.so
594 $(objpfx)restest1: $(objpfx)testobj1.so $(objpfx)testobj1_1.so $(libdl)
595 LDFLAGS-restest1 = -rdynamic
597 $(objpfx)restest2: $(libdl)
598 LDFLAGS-restest2 = -rdynamic
600 $(objpfx)restest1.out: $(test-modules)
602 preloadtest-preloads = testobj1 testobj2 testobj3 testobj4 testobj5
603 $(objpfx)preloadtest: $(objpfx)testobj6.so
604 LDFLAGS-preloadtest = -rdynamic
605 $(objpfx)preloadtest.out: $(preloadtest-preloads:%=$(objpfx)%.so)
606 preloadtest-ENV = \
607 LD_PRELOAD=$(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
609 $(objpfx)loadfail: $(libdl)
610 LDFLAGS-loadfail = -rdynamic
612 $(objpfx)loadfail.out: $(objpfx)failobj.so
614 $(objpfx)multiload: $(libdl)
615 LDFLAGS-multiload = -rdynamic
616 CFLAGS-multiload.c = -DOBJDIR=\"$(elf-objpfx)\"
618 $(objpfx)multiload.out: $(objpfx)testobj1.so
620 $(objpfx)origtest: $(libdl)
621 LDFLAGS-origtest = -rdynamic
622 $(objpfx)origtest.out: $(objpfx)testobj1.so
624 ifeq ($(have-thread-library),yes)
625 $(objpfx)resolvfail: $(libdl) $(shared-thread-library)
626 else
627 $(objpfx)resolvfail: $(libdl)
628 endif
630 $(objpfx)constload1: $(libdl)
631 $(objpfx)constload1.out: $(objpfx)constload2.so $(objpfx)constload3.so
633 $(objpfx)circleload1: $(libdl)
634 $(objpfx)circleload1.out: $(objpfx)circlemod1.so \
635 $(objpfx)circlemod1a.so
637 $(objpfx)circlemod1.so: $(objpfx)circlemod2.so
638 $(objpfx)circlemod2.so: $(objpfx)circlemod3.so
639 $(objpfx)circlemod1a.so: $(objpfx)circlemod2a.so
640 $(objpfx)circlemod2a.so: $(objpfx)circlemod3a.so
642 $(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so)
644 $(objpfx)order.out: $(objpfx)order
645 $(test-wrapper) \
646 $(elf-objpfx)$(rtld-installed-name) \
647 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
648 $(objpfx)order > $@
649 (echo "0123456789" | cmp $@ -) > /dev/null
651 $(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so)
652 $(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
653 vismain-ENV = LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
655 $(objpfx)noload: $(objpfx)testobj1.so $(common-objpfx)dlfcn/libdl.so
656 LDFLAGS-noload = -rdynamic $(no-as-needed)
657 $(objpfx)noload.out: $(objpfx)testobj5.so
659 $(objpfx)noload-mem: $(objpfx)noload.out
660 $(common-objpfx)malloc/mtrace $(objpfx)noload.mtrace > $@
661 noload-ENV = MALLOC_TRACE=$(objpfx)noload.mtrace
663 LDFLAGS-nodelete = -rdynamic
664 LDFLAGS-nodelmod1.so = -Wl,--enable-new-dtags,-z,nodelete
665 LDFLAGS-nodelmod4.so = -Wl,--enable-new-dtags,-z,nodelete
666 $(objpfx)nodelete: $(libdl)
667 $(objpfx)nodelete.out: $(objpfx)nodelmod1.so $(objpfx)nodelmod2.so \
668 $(objpfx)nodelmod3.so
670 LDFLAGS-nodlopenmod.so = -Wl,--enable-new-dtags,-z,nodlopen
671 $(objpfx)nodlopen: $(libdl)
672 $(objpfx)nodlopen.out: $(objpfx)nodlopenmod.so
674 $(objpfx)nodlopenmod2.so: $(objpfx)nodlopenmod.so
675 $(objpfx)nodlopen2: $(libdl)
676 $(objpfx)nodlopen2.out: $(objpfx)nodlopenmod2.so
678 $(objpfx)filtmod1.so: $(objpfx)filtmod1.os $(objpfx)filtmod2.so
679 $(LINK.o) -shared -o $@ -B$(csu-objpfx) $(LDFLAGS.so) \
680 -L$(subst :, -L,$(rpath-link)) \
681 -Wl,-rpath-link=$(rpath-link) \
682 $< -Wl,-F,$(objpfx)filtmod2.so
683 $(objpfx)filter: $(objpfx)filtmod1.so
685 $(objpfx)unload: $(libdl)
686 $(objpfx)unload.out: $(objpfx)unloadmod.so
688 $(objpfx)reldep: $(libdl)
689 $(objpfx)reldep.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod2.so
691 $(objpfx)reldep2: $(libdl)
692 $(objpfx)reldep2.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod3.so
694 $(objpfx)reldep3: $(libdl)
695 $(objpfx)reldep3.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
697 $(objpfx)reldep4: $(libdl)
698 $(objpfx)reldep4.out: $(objpfx)reldep4mod1.so $(objpfx)reldep4mod2.so
700 $(objpfx)next: $(objpfx)nextmod1.so $(objpfx)nextmod2.so $(libdl)
701 LDFLAGS-next = $(no-as-needed)
703 $(objpfx)unload2: $(libdl)
704 $(objpfx)unload2.out: $(objpfx)unload2mod.so $(objpfx)unload2dep.so
706 $(objpfx)lateglobal: $(libdl)
707 $(objpfx)lateglobal.out: $(objpfx)ltglobmod1.so $(objpfx)ltglobmod2.so
709 $(objpfx)tst-pathopt: $(libdl)
710 $(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \
711 $(objpfx)pathoptobj.so
712 $(SHELL) $< $(common-objpfx) '$(test-wrapper-env)'
714 $(objpfx)tst-rtld-load-self.out: tst-rtld-load-self.sh $(objpfx)ld.so
715 $(SHELL) $^ '$(test-wrapper)' '$(test-wrapper-env)' > $@
717 $(objpfx)initfirst: $(libdl)
718 $(objpfx)initfirst.out: $(objpfx)firstobj.so
720 $(objpfx)global: $(objpfx)globalmod1.so
721 $(objpfx)global.out: $(objpfx)reldepmod1.so
723 $(objpfx)dblload: $(libdl)
724 $(objpfx)dblload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
726 $(objpfx)dblunload: $(libdl)
727 $(objpfx)dblunload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
729 $(objpfx)reldep5: $(libdl)
730 $(objpfx)reldep5.out: $(objpfx)reldepmod5.so $(objpfx)reldepmod6.so
732 $(objpfx)reldep6: $(libdl)
733 $(objpfx)reldep6.out: $(objpfx)reldep6mod3.so $(objpfx)reldep6mod4.so
735 $(objpfx)reldep7: $(libdl)
736 $(objpfx)reldep7.out: $(objpfx)reldep7mod1.so $(objpfx)reldep7mod2.so
738 $(objpfx)reldep8: $(libdl)
739 $(objpfx)reldep8.out: $(objpfx)reldep8mod3.so
741 LDFLAGS-nodel2mod2.so = -Wl,--enable-new-dtags,-z,nodelete
742 $(objpfx)nodelete2: $(libdl)
743 $(objpfx)nodelete2.out: $(objpfx)nodel2mod3.so
745 $(objpfx)reldep9: $(libdl)
746 $(objpfx)reldep9.out: $(objpfx)reldep9mod3.so
748 $(objpfx)tst-tls3: $(objpfx)tst-tlsmod1.so
750 $(objpfx)tst-tls4: $(libdl)
751 $(objpfx)tst-tls4.out: $(objpfx)tst-tlsmod2.so
753 $(objpfx)tst-tls5: $(libdl)
754 $(objpfx)tst-tls5.out: $(objpfx)tst-tlsmod2.so
756 $(objpfx)tst-tls6: $(libdl)
757 $(objpfx)tst-tls6.out: $(objpfx)tst-tlsmod2.so
759 $(objpfx)tst-tls7: $(libdl)
760 $(objpfx)tst-tls7.out: $(objpfx)tst-tlsmod3.so
762 $(objpfx)tst-tls8: $(libdl)
763 $(objpfx)tst-tls8.out: $(objpfx)tst-tlsmod3.so $(objpfx)tst-tlsmod4.so
765 $(objpfx)tst-tls9: $(libdl)
766 $(objpfx)tst-tls9.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
768 $(objpfx)tst-tls10: $(objpfx)tst-tlsmod8.so $(objpfx)tst-tlsmod7.so
770 $(objpfx)tst-tls11: $(objpfx)tst-tlsmod10.so $(objpfx)tst-tlsmod9.so
772 $(objpfx)tst-tls12: $(objpfx)tst-tlsmod12.so $(objpfx)tst-tlsmod11.so
774 $(objpfx)tst-tls13: $(libdl)
775 $(objpfx)tst-tls13.out: $(objpfx)tst-tlsmod13a.so
777 $(objpfx)tst-tls14: $(objpfx)tst-tlsmod14a.so $(libdl)
778 $(objpfx)tst-tls14.out: $(objpfx)tst-tlsmod14b.so
780 $(objpfx)tst-tls15: $(libdl)
781 $(objpfx)tst-tls15.out: $(objpfx)tst-tlsmod15a.so $(objpfx)tst-tlsmod15b.so
783 $(objpfx)tst-tls-dlinfo: $(libdl)
784 $(objpfx)tst-tls-dlinfo.out: $(objpfx)tst-tlsmod2.so
788 $(objpfx)tst-tls16: $(libdl)
789 $(objpfx)tst-tls16.out: $(objpfx)tst-tlsmod16a.so $(objpfx)tst-tlsmod16b.so
791 $(objpfx)tst-tls17: $(libdl)
792 $(objpfx)tst-tls17.out: $(objpfx)tst-tlsmod17b.so
793 $(patsubst %,$(objpfx)%.os,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.os: tst-tlsmod17a.c
794 $(compile-command.c) -DN=$*
795 $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.so: $(objpfx)ld.so
796 $(objpfx)tst-tlsmod17b.so: $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules))
798 $(objpfx)tst-tls18: $(libdl)
799 $(objpfx)tst-tls18.out: $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules))
800 $(patsubst %,$(objpfx)%.os,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.os : tst-tlsmod18a.c
801 $(compile-command.c) -DN=$*
802 $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.so: $(objpfx)ld.so
804 $(objpfx)tst-tls19: $(libdl)
805 $(objpfx)tst-tls19.out: $(objpfx)tst-tls19mod1.so
807 CFLAGS-tst-align.c = $(stack-align-test-flags)
808 CFLAGS-tst-align2.c = $(stack-align-test-flags)
809 CFLAGS-tst-alignmod.c = $(stack-align-test-flags)
810 CFLAGS-tst-alignmod2.c = $(stack-align-test-flags)
811 $(objpfx)tst-align: $(libdl)
812 $(objpfx)tst-align.out: $(objpfx)tst-alignmod.so
813 $(objpfx)tst-align2: $(objpfx)tst-alignmod2.so
815 $(objpfx)unload3: $(libdl)
816 $(objpfx)unload3.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
817 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
819 $(objpfx)unload4: $(libdl)
820 $(objpfx)unload4.out: $(objpfx)unload4mod1.so $(objpfx)unload4mod3.so
822 $(objpfx)unload5: $(libdl)
823 $(objpfx)unload5.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
824 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
826 $(objpfx)unload6: $(libdl)
827 $(objpfx)unload6.out: $(objpfx)unload6mod1.so $(objpfx)unload6mod2.so \
828 $(objpfx)unload6mod3.so
830 $(objpfx)unload7: $(libdl)
831 $(objpfx)unload7.out: $(objpfx)unload7mod1.so $(objpfx)unload7mod2.so
832 unload7-ENV = MALLOC_PERTURB_=85
834 $(objpfx)unload8: $(libdl)
835 $(objpfx)unload8.out: $(objpfx)unload8mod1.so $(objpfx)unload8mod1x.so
837 ifdef libdl
838 $(objpfx)tst-tls9-static: $(common-objpfx)dlfcn/libdl.a
839 $(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
840 endif
842 ifeq ($(have-z-execstack),yes)
843 $(objpfx)tst-execstack: $(libdl)
844 $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
845 LDFLAGS-tst-execstack = -Wl,-z,noexecstack
846 LDFLAGS-tst-execstack-mod = -Wl,-z,execstack
848 $(objpfx)tst-execstack-needed: $(objpfx)tst-execstack-mod.so
849 LDFLAGS-tst-execstack-needed = -Wl,-z,noexecstack
851 LDFLAGS-tst-execstack-prog = -Wl,-z,execstack
852 endif
854 $(objpfx)tst-array1.out: tst-array1.exp $(objpfx)tst-array1
855 $(built-program-cmd) > $@
856 cmp $@ tst-array1.exp > /dev/null
858 $(objpfx)tst-array1-static.out: tst-array1.exp $(objpfx)tst-array1-static
859 $(built-program-cmd) > $@
860 cmp $@ tst-array1.exp > /dev/null
862 $(objpfx)tst-array2: $(objpfx)tst-array2dep.so
863 $(objpfx)tst-array2.out: tst-array2.exp $(objpfx)tst-array2
864 $(built-program-cmd) > $@
865 cmp $@ tst-array2.exp > /dev/null
867 $(objpfx)tst-array3.out: tst-array1.exp $(objpfx)tst-array3
868 $(built-program-cmd) > $@
869 cmp $@ tst-array1.exp > /dev/null
871 $(objpfx)tst-array4: $(libdl)
872 $(objpfx)tst-array4.out: tst-array4.exp $(objpfx)tst-array4 \
873 $(objpfx)tst-array2dep.so
874 $(built-program-cmd) > $@
875 cmp $@ tst-array4.exp > /dev/null
877 $(objpfx)tst-array5: $(objpfx)tst-array5dep.so
878 $(objpfx)tst-array5.out: tst-array5.exp $(objpfx)tst-array5
879 $(built-program-cmd) > $@
880 cmp $@ tst-array5.exp > /dev/null
882 $(objpfx)tst-array5-static.out: tst-array5-static.exp \
883 $(objpfx)tst-array5-static
884 $(built-program-cmd) > $@
885 cmp $@ tst-array5-static.exp > /dev/null
887 CFLAGS-tst-pie1.c += $(pie-ccflag)
889 $(objpfx)tst-pie1: $(objpfx)tst-piemod1.so
891 ifeq (yes,$(build-shared))
892 tests: $(objpfx)check-textrel.out $(objpfx)check-execstack.out
894 all-built-dso := $(common-objpfx)libc.so \
895 $(filter-out $(common-objpfx)linkobj/libc.so, \
896 $(sort $(wildcard $(addprefix $(common-objpfx), \
897 */lib*.so \
898 iconvdata/*.so))))
900 $(all-built-dso:=.dyn): %.dyn: %
901 @rm -f $@T
902 LC_ALL=C $(READELF) -W -d $< > $@T
903 test -s $@T
904 mv -f $@T $@
905 common-generated += $(all-built-dso:$(common-objpfx)%=%.dyn)
907 $(objpfx)check-textrel.out: $(..)scripts/check-textrel.awk \
908 $(all-built-dso:=.dyn)
909 LC_ALL=C $(AWK) -f $^ > $@
910 generated += check-textrel.out
912 $(objpfx)execstack-default: $(first-word $(wildcard $(sysdirs:%=%/stackinfo.h)))
913 $(make-target-directory)
914 { echo '#include <elf.h>'; \
915 echo '#include <stackinfo.h>'; \
916 echo '#if (DEFAULT_STACK_PERMS & PF_X) == 0'; \
917 echo '@@@execstack-no@@@'; \
918 echo '#else'; \
919 echo '@@@execstack-yes@@@'; \
920 echo '#endif'; } | \
921 $(CC) $(CFLAGS) $(CPPFLAGS) -E -x c-header - | \
922 sed -n -e 's/^@@@\(.*\)@@@/\1/p' > $@T
923 mv -f $@T $@
924 generated += execstack-default
926 $(all-built-dso:=.phdr): %.phdr: %
927 @rm -f $@T
928 LC_ALL=C $(READELF) -W -l $< > $@T
929 test -s $@T
930 mv -f $@T $@
931 common-generated += $(all-built-dso:$(common-objpfx)%=%.phdr)
933 $(objpfx)check-execstack.out: $(..)scripts/check-execstack.awk \
934 $(objpfx)execstack-default \
935 $(all-built-dso:=.phdr)
936 LC_ALL=C $(AWK) -f $^ > $@
937 generated += check-execstack.out
939 $(objpfx)tst-dlmodcount: $(libdl)
940 $(objpfx)tst-dlmodcount.out: $(test-modules)
942 $(all-built-dso:=.jmprel): %.jmprel: % Makefile
943 @rm -f $@T
944 LC_ALL=C $(READELF) -W -S -d -r $< > $@T
945 test -s $@T
946 mv -f $@T $@
947 common-generated += $(all-built-dso:$(common-objpfx)%=%.jmprel)
949 tests: $(objpfx)check-localplt.out
951 localplt-built-dso := $(addprefix $(common-objpfx),\
952 libc.so \
953 math/libm.so \
954 rt/librt.so \
955 dlfcn/libdl.so \
956 resolv/libresolv.so \
957 crypt/libcrypt.so \
959 ifeq ($(have-thread-library),yes)
960 localplt-built-dso += $(filter-out %_nonshared.a, $(shared-thread-library))
961 endif
963 vpath localplt.data $(+sysdep_dirs)
965 $(objpfx)check-localplt.out: $(..)scripts/check-localplt.awk \
966 $(..)scripts/localplt.awk \
967 $(localplt-built-dso:=.jmprel) \
968 localplt.data
969 LC_ALL=C $(AWK) -f $(filter-out $< %localplt.data,$^) | \
970 LC_ALL=C $(AWK) -f $< $(filter %localplt.data,$^) - \
971 > $@
972 endif
974 $(objpfx)tst-dlopenrpathmod.so: $(libdl)
975 $(objpfx)tst-dlopenrpath: $(objpfx)tst-dlopenrpathmod.so $(libdl)
976 CFLAGS-tst-dlopenrpath.c += -DPFX=\"$(objpfx)\"
977 LDFLAGS-tst-dlopenrpathmod.so += -Wl,-rpath,\$$ORIGIN/test-subdir
978 $(objpfx)tst-dlopenrpath.out: $(objpfx)firstobj.so
980 $(objpfx)tst-deep1mod2.so: $(objpfx)tst-deep1mod3.so
981 $(objpfx)tst-deep1: $(libdl) $(objpfx)tst-deep1mod1.so
982 $(objpfx)tst-deep1.out: $(objpfx)tst-deep1mod2.so
983 LDFLAGS-tst-deep1 += -rdynamic
984 tst-deep1mod3.so-no-z-defs = yes
986 $(objpfx)tst-dlmopen1mod.so: $(libdl)
987 $(objpfx)tst-dlmopen1: $(libdl)
988 $(objpfx)tst-dlmopen1.out: $(objpfx)tst-dlmopen1mod.so
990 $(objpfx)tst-dlmopen2: $(libdl)
991 $(objpfx)tst-dlmopen2.out: $(objpfx)tst-dlmopen1mod.so
993 $(objpfx)tst-dlmopen3: $(libdl)
994 $(objpfx)tst-dlmopen3.out: $(objpfx)tst-dlmopen1mod.so
996 $(objpfx)tst-audit1.out: $(objpfx)tst-auditmod1.so
997 tst-audit1-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
999 $(objpfx)tst-audit2.out: $(objpfx)tst-auditmod1.so
1000 tst-audit2-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1002 $(objpfx)tst-audit3: $(objpfx)tst-auditmod3a.so
1003 $(objpfx)tst-audit3.out: $(objpfx)tst-auditmod3b.so
1004 tst-audit3-ENV = LD_AUDIT=$(objpfx)tst-auditmod3b.so
1006 $(objpfx)tst-audit4: $(objpfx)tst-auditmod4a.so
1007 $(objpfx)tst-audit4.out: $(objpfx)tst-auditmod4b.so
1008 tst-audit4-ENV = LD_AUDIT=$(objpfx)tst-auditmod4b.so
1010 $(objpfx)tst-audit5: $(objpfx)tst-auditmod5a.so
1011 $(objpfx)tst-audit5.out: $(objpfx)tst-auditmod5b.so
1012 tst-audit5-ENV = LD_AUDIT=$(objpfx)tst-auditmod5b.so
1014 $(objpfx)tst-audit6: $(objpfx)tst-auditmod6a.so
1015 $(objpfx)tst-audit6.out: $(objpfx)tst-auditmod6b.so \
1016 $(objpfx)tst-auditmod6c.so
1017 tst-audit6-ENV = LD_AUDIT=$(objpfx)tst-auditmod6b.so:$(objpfx)tst-auditmod6c.so
1019 $(objpfx)tst-audit7: $(objpfx)tst-auditmod7a.so
1020 $(objpfx)tst-audit7.out: $(objpfx)tst-auditmod7b.so
1021 tst-audit7-ENV = LD_AUDIT=$(objpfx)tst-auditmod7b.so
1023 $(objpfx)tst-audit8: $(common-objpfx)math/libm.so
1024 $(objpfx)tst-audit8.out: $(objpfx)tst-auditmod1.so
1025 tst-audit8-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1027 $(objpfx)tst-global1: $(libdl)
1028 $(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
1030 $(objpfx)order2: $(libdl)
1031 $(objpfx)order2.out: $(objpfx)order2 $(objpfx)order2mod1.so \
1032 $(objpfx)order2mod2.so
1033 $(test-wrapper) \
1034 $(elf-objpfx)$(rtld-installed-name) \
1035 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
1036 $(objpfx)order2 > $@
1037 (echo "12345" | cmp $@ -) > /dev/null
1038 $(objpfx)order2mod1.so: $(objpfx)order2mod4.so
1039 $(objpfx)order2mod4.so: $(objpfx)order2mod3.so
1040 $(objpfx)order2mod2.so: $(objpfx)order2mod3.so
1041 order2mod2.so-no-z-defs = yes
1042 LDFLAGS-order2mod1.so = $(no-as-needed)
1043 LDFLAGS-order2mod2.so = $(no-as-needed)
1045 tst-stackguard1-ARGS = --command "$(host-built-program-cmd) --child"
1046 tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
1048 $(objpfx)tst-leaks1: $(libdl)
1049 $(objpfx)tst-leaks1-mem: $(objpfx)tst-leaks1.out
1050 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1.mtrace > $@
1052 $(objpfx)tst-leaks1-static: $(common-objpfx)dlfcn/libdl.a
1053 $(objpfx)tst-leaks1-static-mem: $(objpfx)tst-leaks1-static.out
1054 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1-static.mtrace > $@
1056 tst-leaks1-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1.mtrace
1057 tst-leaks1-static-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1-static.mtrace
1059 $(objpfx)tst-addr1: $(libdl)
1061 $(objpfx)tst-thrlock: $(libdl) $(shared-thread-library)
1063 CFLAGS-ifuncmain1pic.c += $(pic-ccflag)
1064 CFLAGS-ifuncmain1picstatic.c += $(pic-ccflag)
1065 CFLAGS-ifuncmain1staticpic.c += $(pic-ccflag)
1066 CFLAGS-ifuncdep1pic.c += $(pic-ccflag)
1067 CFLAGS-ifuncmain1vispic.c += $(pic-ccflag)
1068 CFLAGS-ifuncmain2pic.c += $(pic-ccflag)
1069 CFLAGS-ifuncmain2picstatic.c += $(pic-ccflag)
1070 CFLAGS-ifuncdep2pic.c += $(pic-ccflag)
1071 CFLAGS-ifuncmain4picstatic.c += $(pic-ccflag)
1072 CFLAGS-ifuncmain5pic.c += $(pic-ccflag)
1073 CFLAGS-ifuncmain5picstatic.c += $(pic-ccflag)
1074 CFLAGS-ifuncmain5staticpic.c += $(pic-ccflag)
1075 CFLAGS-ifuncdep5pic.c += $(pic-ccflag)
1076 CFLAGS-ifuncmain7pic.c += $(pic-ccflag)
1077 CFLAGS-ifuncmain7picstatic.c += $(pic-ccflag)
1079 LDFLAGS-ifuncmain3 = -Wl,-export-dynamic
1081 CFLAGS-ifuncmain1pie.c += $(pie-ccflag)
1082 CFLAGS-ifuncmain1vispie.c += $(pie-ccflag)
1083 CFLAGS-ifuncmain1staticpie.c += $(pie-ccflag)
1084 CFLAGS-ifuncmain5pie.c += $(pie-ccflag)
1085 CFLAGS-ifuncmain6pie.c += $(pie-ccflag)
1086 CFLAGS-ifuncmain7pie.c += $(pie-ccflag)
1088 $(objpfx)ifuncmain1pie: $(objpfx)ifuncmod1.so
1089 $(objpfx)ifuncmain1staticpie: $(objpfx)ifuncdep1pic.o
1090 $(objpfx)ifuncmain1vispie: $(objpfx)ifuncmod1.so
1091 $(objpfx)ifuncmain5pie: $(objpfx)ifuncmod5.so
1092 $(objpfx)ifuncmain6pie: $(objpfx)ifuncmod6.so
1094 $(objpfx)ifuncmain1: $(addprefix $(objpfx),ifuncmod1.so)
1095 $(objpfx)ifuncmain1pic: $(addprefix $(objpfx),ifuncmod1.so)
1096 $(objpfx)ifuncmain1staticpic: $(addprefix $(objpfx),ifuncdep1pic.o)
1097 $(objpfx)ifuncmain1static: $(addprefix $(objpfx),ifuncdep1.o)
1098 $(objpfx)ifuncmain1picstatic: $(addprefix $(objpfx),ifuncdep1pic.o)
1099 $(objpfx)ifuncmain1vis: $(addprefix $(objpfx),ifuncmod1.so)
1100 $(objpfx)ifuncmain1vispic: $(addprefix $(objpfx),ifuncmod1.so)
1101 $(objpfx)ifuncmain2: $(addprefix $(objpfx),ifuncdep2.o)
1102 $(objpfx)ifuncmain2pic: $(addprefix $(objpfx),ifuncdep2pic.o)
1103 $(objpfx)ifuncmain2static: $(addprefix $(objpfx),ifuncdep2.o)
1104 $(objpfx)ifuncmain2picstatic: $(addprefix $(objpfx),ifuncdep2pic.o)
1106 $(objpfx)ifuncmain3: $(libdl)
1107 $(objpfx)ifuncmain3.out: $(objpfx)ifuncmod3.so
1109 $(objpfx)ifuncmain5: $(addprefix $(objpfx),ifuncmod5.so)
1110 $(objpfx)ifuncmain5pic: $(addprefix $(objpfx),ifuncmod5.so)
1111 $(objpfx)ifuncmain5static: $(addprefix $(objpfx),ifuncdep5.o)
1112 $(objpfx)ifuncmain5staticpic: $(addprefix $(objpfx),ifuncdep5pic.o)
1113 $(objpfx)ifuncmain5picstatic: $(addprefix $(objpfx),ifuncdep5pic.o)
1115 $(objpfx)tst-unique1: $(libdl)
1116 $(objpfx)tst-unique1.out: $(objpfx)tst-unique1mod1.so \
1117 $(objpfx)tst-unique1mod2.so
1119 $(objpfx)tst-unique2: $(libdl) $(objpfx)tst-unique2mod1.so
1120 $(objpfx)tst-unique2.out: $(objpfx)tst-unique2mod2.so
1122 $(objpfx)tst-unique3: $(libdl) $(objpfx)tst-unique3lib.so
1123 $(objpfx)tst-unique3.out: $(objpfx)tst-unique3lib2.so
1125 $(objpfx)tst-unique4: $(objpfx)tst-unique4lib.so
1127 $(objpfx)tst-initorder.out: $(objpfx)tst-initorder
1128 $(test-wrapper) \
1129 $(elf-objpfx)${rtld-installed-name} \
1130 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
1131 $< > $@
1132 cmp $@ tst-initorder.exp > /dev/null
1134 $(objpfx)tst-initorder2: $(objpfx)tst-initorder2a.so $(objpfx)tst-initorder2d.so $(objpfx)tst-initorder2c.so
1135 $(objpfx)tst-initorder2a.so: $(objpfx)tst-initorder2b.so
1136 $(objpfx)tst-initorder2b.so: $(objpfx)tst-initorder2c.so
1137 $(objpfx)tst-initorder2c.so: $(objpfx)tst-initorder2d.so
1138 LDFLAGS-tst-initorder2 = $(no-as-needed)
1139 LDFLAGS-tst-initorder2a.so = $(no-as-needed)
1140 LDFLAGS-tst-initorder2b.so = $(no-as-needed)
1141 LDFLAGS-tst-initorder2c.so = $(no-as-needed)
1142 define o-iterator-doit
1143 $(objpfx)tst-initorder2$o.os: tst-initorder2.c; \
1144 $$(compile-command.c) -DNAME=\"$o\"
1145 endef
1146 object-suffixes-left := a b c d
1147 include $(o-iterator)
1149 $(objpfx)tst-initorder2.out: $(objpfx)tst-initorder2
1150 $(test-wrapper) \
1151 $(elf-objpfx)${rtld-installed-name} \
1152 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
1153 $< > $@
1154 cmp $@ tst-initorder2.exp > /dev/null
1156 ifeq (yes,$(config-cflags-avx))
1157 AVX-CFLAGS=-mavx
1158 ifeq (yes,$(config-cflags-novzeroupper))
1159 AVX-CFLAGS+=-mno-vzeroupper
1160 endif
1161 CFLAGS-tst-audit4.c += $(AVX-CFLAGS)
1162 CFLAGS-tst-auditmod4a.c += $(AVX-CFLAGS)
1163 CFLAGS-tst-auditmod4b.c += $(AVX-CFLAGS)
1164 CFLAGS-tst-auditmod6b.c += $(AVX-CFLAGS)
1165 CFLAGS-tst-auditmod6c.c += $(AVX-CFLAGS)
1166 CFLAGS-tst-auditmod7b.c += $(AVX-CFLAGS)
1167 endif
1169 $(objpfx)tst-relsort1: $(libdl)
1170 $(objpfx)tst-relsort1mod1.so: $(libm) $(objpfx)tst-relsort1mod2.so
1171 $(objpfx)tst-relsort1mod2.so: $(libm)
1172 $(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
1173 $(objpfx)tst-relsort1mod2.so
1175 ifeq ($(run-built-tests),yes)
1176 tests: $(objpfx)tst-unused-dep.out
1177 endif
1179 $(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so
1180 $(test-wrapper-env) \
1181 LD_TRACE_LOADED_OBJECTS=1 \
1182 LD_DEBUG=unused \
1183 LD_PRELOAD= \
1184 $(elf-objpfx)${rtld-installed-name} \
1185 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
1186 $< > $@
1187 cmp $@ /dev/null > /dev/null