Add AVX support to ld.so auditing for x86-64.
[glibc.git] / elf / Makefile
blobe4b977e9e3dc2ed10d091101b6e18eae553cdc6f
1 # Copyright (C) 1995-2007, 2008, 2009 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, write to the Free
16 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 # 02111-1307 USA.
19 # Makefile for elf subdirectory of GNU C Library.
21 subdir := elf
23 headers = elf.h bits/elfclass.h link.h bits/link.h
24 routines = $(dl-routines) dl-support dl-iteratephdr \
25 dl-addr enbl-secure dl-profstub \
26 dl-origin dl-libc dl-sym dl-tsd dl-sysdep
28 # The core dynamic linking functions are in libc for the static and
29 # profiled libraries.
30 dl-routines = $(addprefix dl-,load cache lookup object reloc deps \
31 runtime error init fini debug misc \
32 version profile conflict tls origin \
33 execstack caller open close trampoline)
34 all-dl-routines = $(dl-routines) $(sysdep-dl-routines)
35 # But they are absent from the shared libc, because that code is in ld.so.
36 elide-routines.os = $(all-dl-routines) dl-support enbl-secure dl-origin \
37 dl-sysdep
38 shared-only-routines += dl-caller
40 # ld.so uses those routines, plus some special stuff for being the program
41 # interpreter and operating independent of libc.
42 rtld-routines := rtld $(dl-routines) dl-sysdep dl-environ dl-minimal
43 all-rtld-routines = $(rtld-routines) $(sysdep-rtld-routines)
45 distribute := rtld-Rules \
46 $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \
47 dl-cache.h dl-hash.h soinit.c sofini.c ldd.bash.in \
48 genrtldtbl.awk atomicity.h dl-procinfo.h ldsodefs.h \
49 dl-librecon.h interp.c sln.c dl-dst.h hp-timing.h \
50 dl-lookupcfg.h sprof.c gen-trusted-dirs.awk \
51 testobj1.c testobj2.c testobj3.c testobj4.c testobj5.c \
52 testobj6.c testobj1_1.c failobj.c unloadmod.c \
53 ldconfig.h ldconfig.c cache.c readlib.c readelflib.c \
54 chroot_canon.c gccframe.h \
55 dep1.c dep2.c dep3.c dep4.c dl-dtprocnum.h unsecvars.h \
56 vismain.c vismod1.c vismod2.c vismod3.c \
57 constload2.c constload3.c filtmod1.c filtmod2.c \
58 nodlopenmod.c nodelete.c nodelmod1.c nodelmod2.c \
59 nodelmod3.c nodelmod4.c nodlopen.c dl-osinfo.h \
60 reldepmod1.c reldepmod2.c reldepmod3.c reldepmod4.c \
61 reldepmod5.c reldepmod6.c \
62 reldep4mod1.c reldep4mod2.c reldep4mod3.c reldep4mod4.c \
63 nextmod1.c nextmod2.c pathoptobj.c tst-pathopt.sh \
64 neededobj1.c neededobj2.c neededobj3.c neededobj4.c \
65 neededobj5.c neededobj6.c firstobj.c \
66 unload2mod.c unload2dep.c ltglobmod1.c ltglobmod2.c \
67 testobj.h vismod.h globalmod1.c \
68 dblloadmod1.c dblloadmod2.c dblloadmod3.c \
69 reldep6mod4.c reldep6mod3.c reldep6mod2.c reldep6mod1.c \
70 reldep6mod0.c reldep7mod1.c reldep7mod2.c \
71 unwind-dw2.c unwind-dw2-fde.c unwind.h unwind-pe.h \
72 unwind-dw2-fde.h dwarf2.h dl-procinfo.c tls.h dl-tls.h \
73 tst-tlsmod1.c tst-tlsmod2.c tst-tlsmod3.c tst-tlsmod4.c \
74 tst-tlsmod5.c tst-tlsmod6.c tst-tlsmod7.c tst-tlsmod8.c \
75 tst-tlsmod9.c tst-tlsmod10.c tst-tlsmod11.c \
76 tst-tlsmod12.c tst-tls10.h tst-alignmod.c tst-alignmod2.c \
77 circlemod1.c circlemod1a.c circlemod2.c circlemod2a.c \
78 circlemod3.c circlemod3a.c nodlopenmod2.c \
79 tls-macros.h \
80 reldep8mod1.c reldep8mod2.c reldep8mod3.c \
81 nodel2mod1.c nodel2mod2.c nodel2mod3.c \
82 reldep9.c reldep9mod1.c reldep9mod2.c reldep9mod3.c \
83 tst-array1.exp tst-array2.exp tst-array4.exp \
84 tst-array2dep.c tst-piemod1.c \
85 tst-execstack-mod.c tst-dlmodcount.c \
86 check-textrel.c dl-sysdep.h test-dlopenrpathmod.c \
87 tst-deep1mod1.c tst-deep1mod2.c tst-deep1mod3.c \
88 unload3mod1.c unload3mod2.c unload3mod3.c unload3mod4.c \
89 unload4mod1.c unload4mod2.c unload4mod3.c unload4mod4.c \
90 unload6mod1.c unload6mod2.c unload6mod3.c \
91 unload7mod1.c unload7mod2.c \
92 tst-audit1.c tst-audit2.c tst-audit3.c tst-audit4.c \
93 tst-auditmod1.c tst-auditmod3a.c tst-auditmod3b.c \
94 tst-auditmod4a.c tst-auditmod4b.c \
95 tst-audit5.c tst-auditmod5a.c tst-auditmod5b.c \
96 order2mod1.c order2mod2.c order2mod3.c order2mod4.c \
97 tst-stackguard1.c tst-stackguard1-static.c \
98 tst-array5.c tst-array5-static.c tst-array5dep.c \
99 tst-array5.exp tst-leaks1.c check-execstack.c \
100 ifuncmain1.c ifuncmain1pic.c ifuncmain1vis.c \
101 ifuncmain1vispic.c ifuncmain1static.c \
102 ifuncmain1staticpic.c ifuncmain1picstatic.c \
103 ifuncdep1.c ifuncdep1pic.c ifuncmod1.c \
104 ifuncmain1pie.c ifuncmain1vispie.c \
105 ifuncmain1staticpie.c \
106 ifuncmain2.c ifuncmain2static.c ifuncdep2.c \
107 ifuncmain2pic.c ifuncmain2picstatic.c ifuncdep2pic.c \
108 ifuncmain3.c ifuncmod3.c \
109 ifuncmain4.c ifuncmain4static.c ifuncmain4picstatic.c \
110 ifuncmain5.c ifuncmain5pic.c ifuncmain5picstatic.c \
111 ifuncmain5pie.c ifuncmain5static.c \
112 ifuncmain5staticpic.c \
113 ifuncdep5.c ifuncdep5pic.c ifuncmod5.c \
114 ifuncmain6pie.c ifuncmod6.c \
115 ifuncmain7.c ifuncmain7pic.c ifuncmain7picstatic.c \
116 ifuncmain7pie.c ifuncmain7static.c \
117 tst-unique1.c tst-unique1mod1.c tst-unique1mod2.c \
118 tst-unique2.c tst-unique2mod1.c tst-unique2mod2.c
120 CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
121 CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
122 CFLAGS-dl-iterate-phdr.c = $(uses-callbacks)
124 include ../Makeconfig
126 ifeq ($(unwind-find-fde),yes)
127 routines += unwind-dw2-fde-glibc
128 shared-only-routines += unwind-dw2-fde-glibc
129 endif
131 before-compile = $(objpfx)trusted-dirs.h
132 generated := trusted-dirs.h trusted-dirs.st for-renamed/renamed.so
133 generated-dirs := for-renamed
135 ifeq ($(versioning),yes)
136 ld-map = $(common-objpfx)ld.map
137 endif
139 ifeq (yes,$(build-shared))
140 extra-objs = $(all-rtld-routines:%=%.os) soinit.os sofini.os interp.os
141 generated += librtld.os dl-allobjs.os ld.so ldd
142 install-others = $(inst_slibdir)/$(rtld-installed-name)
143 install-bin-script = ldd
144 endif
146 others = sprof sln
147 install-bin = sprof
148 others-static = sln
149 install-rootsbin = sln
151 ifeq (yes,$(use-ldconfig))
152 ifeq (yes,$(build-shared))
153 others-static += ldconfig
154 others += ldconfig
155 install-rootsbin += ldconfig
157 ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon
158 extra-objs += $(ldconfig-modules:=.o)
160 # To find xmalloc.c and xstrdup.c
161 vpath %.c ../locale/programs
163 endif
164 endif
166 tests = tst-tls1 tst-tls2 tst-tls9 tst-leaks1
167 ifeq (yes,$(have-initfini-array))
168 tests += tst-array1 tst-array2 tst-array3 tst-array4 tst-array5
169 endif
170 ifeq (yes,$(build-static))
171 tests-static = tst-tls1-static tst-tls2-static tst-stackguard1-static
172 ifeq (yesyesyes,$(build-static)$(build-shared)$(elf))
173 tests-static += tst-tls9-static
174 tst-tls9-static-ENV = \
175 LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn
176 endif
177 ifeq (yes,$(have-initfini-array))
178 tests-static += tst-array1-static tst-array5-static
179 endif
180 tests += $(tests-static)
181 endif
182 ifeq (yes,$(build-shared))
183 tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
184 constload1 order vismain noload filter unload \
185 reldep reldep2 reldep3 reldep4 nodelete nodelete2 \
186 nodlopen nodlopen2 neededtest neededtest2 \
187 neededtest3 neededtest4 unload2 lateglobal initfirst global \
188 restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
189 circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \
190 tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-tls15 \
191 tst-tls16 tst-tls17 tst-tls18 tst-tls-dlinfo \
192 tst-align tst-align2 $(tests-execstack-$(have-z-execstack)) \
193 tst-dlmodcount tst-dlopenrpath tst-deep1 \
194 tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
195 unload3 unload4 unload5 unload6 unload7 tst-global1 order2 \
196 tst-audit1 tst-audit2 \
197 tst-stackguard1 tst-addr1 tst-thrlock \
198 tst-unique1 tst-unique2
199 # reldep9
200 test-srcs = tst-pathopt
201 tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
202 ifeq (x86_64,$(config-machine))
203 tests += tst-audit3 tst-audit4 tst-audit5
204 endif
205 endif
206 ifeq (yesyes,$(have-fpie)$(build-shared))
207 tests: $(objpfx)tst-pie1.out
208 endif
209 tests: $(objpfx)tst-leaks1-mem
210 tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
211 tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
212 modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
213 testobj1_1 failobj constload2 constload3 unloadmod \
214 dep1 dep2 dep3 dep4 vismod1 vismod2 vismod3 \
215 nodelmod1 nodelmod2 nodelmod3 nodelmod4 \
216 nodel2mod1 nodel2mod2 nodel2mod3 \
217 nodlopenmod nodlopenmod2 filtmod1 filtmod2 \
218 reldepmod1 reldepmod2 reldepmod3 reldepmod4 nextmod1 nextmod2 \
219 reldep4mod1 reldep4mod2 reldep4mod3 reldep4mod4 \
220 neededobj1 neededobj2 neededobj3 neededobj4 \
221 neededobj5 neededobj6 firstobj globalmod1 \
222 unload2mod unload2dep ltglobmod1 ltglobmod2 pathoptobj \
223 dblloadmod1 dblloadmod2 dblloadmod3 reldepmod5 reldepmod6 \
224 reldep6mod0 reldep6mod1 reldep6mod2 reldep6mod3 reldep6mod4 \
225 reldep7mod1 reldep7mod2 \
226 tst-tlsmod1 tst-tlsmod2 tst-tlsmod3 tst-tlsmod4 \
227 tst-tlsmod5 tst-tlsmod6 tst-tlsmod7 tst-tlsmod8 \
228 tst-tlsmod9 tst-tlsmod10 tst-tlsmod11 tst-tlsmod12 \
229 tst-tlsmod13 tst-tlsmod13a tst-tlsmod14a tst-tlsmod14b \
230 tst-tlsmod15a tst-tlsmod15b tst-tlsmod16a tst-tlsmod16b \
231 $(patsubst %,tst-tlsmod17a%,$(tlsmod17a-suffixes)) \
232 tst-tlsmod17b \
233 $(patsubst %,tst-tlsmod18a%,$(tlsmod18a-suffixes)) \
234 circlemod1 circlemod1a circlemod2 circlemod2a \
235 circlemod3 circlemod3a \
236 reldep8mod1 reldep8mod2 reldep8mod3 \
237 reldep9mod1 reldep9mod2 reldep9mod3 \
238 tst-alignmod tst-alignmod2 \
239 $(modules-execstack-$(have-z-execstack)) \
240 tst-dlopenrpathmod tst-deep1mod1 tst-deep1mod2 tst-deep1mod3 \
241 tst-dlmopen1mod tst-auditmod1 \
242 tst-auditmod3a tst-auditmod3b \
243 tst-auditmod4a tst-auditmod4b \
244 tst-auditmod5a tst-auditmod5b \
245 unload3mod1 unload3mod2 unload3mod3 unload3mod4 \
246 unload4mod1 unload4mod2 unload4mod3 unload4mod4 \
247 unload6mod1 unload6mod2 unload6mod3 \
248 unload7mod1 unload7mod2 \
249 order2mod1 order2mod2 order2mod3 order2mod4 \
250 tst-unique1mod1 tst-unique1mod2 \
251 tst-unique2mod1 tst-unique2mod2
252 ifeq (yes,$(have-initfini-array))
253 modules-names += tst-array2dep tst-array5dep
254 endif
255 ifeq (yesyes,$(have-fpie)$(build-shared))
256 modules-names += tst-piemod1
257 endif
258 modules-execstack-yes = tst-execstack-mod
259 extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
260 # We need this variable to be sure the test modules get the right CPPFLAGS.
261 test-extras += $(modules-names)
263 # filtmod1.so has a special rule
264 modules-names-nobuild := filtmod1
266 ifeq (yes,$(multi-arch))
267 tests-static += ifuncmain1static ifuncmain1picstatic \
268 ifuncmain2static ifuncmain2picstatic \
269 ifuncmain4static ifuncmain4picstatic \
270 ifuncmain5static ifuncmain5picstatic \
271 ifuncmain7static ifuncmain7picstatic
273 ifeq (yes,$(build-shared))
274 tests += ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \
275 ifuncmain1staticpic \
276 ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \
277 ifuncmain5 ifuncmain5pic ifuncmain5staticpic \
278 ifuncmain7 ifuncmain7pic
279 ifeq (yes,$(have-fpie))
280 tests: $(objpfx)ifuncmain1pie.out $(objpfx)ifuncmain1vispie.out \
281 $(objpfx)ifuncmain1staticpie.out $(objpfx)ifuncmain5pie.out \
282 $(objpfx)ifuncmain6pie.out $(objpfx)ifuncmain7pie.out
283 endif
284 modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6
285 endif
286 endif
289 include ../Rules
291 check-abi: check-abi-ld
292 update-abi: update-abi-ld
294 ifeq (yes,$(build-shared))
295 # Make sure these things are built in the `make lib' pass so they can be used
296 # to run programs during the `make others' pass.
297 lib-noranlib: $(objpfx)$(rtld-installed-name) \
298 $(addprefix $(objpfx),$(extra-objs))
299 endif
301 # Command to link into a larger single relocatable object.
302 reloc-link = $(LINK.o) -nostdlib -nostartfiles -r
304 $(objpfx)dl-allobjs.os: $(all-rtld-routines:%=$(objpfx)%.os)
305 $(reloc-link) -o $@ $^
307 # Link together the dynamic linker into a single relocatable object.
308 # First we do a link against libc_pic.a just to get a link map,
309 # and discard the object produced by that link. From the link map
310 # we can glean all the libc modules that need to go into the dynamic
311 # linker. Then we do a recursive make that goes into all the subdirs
312 # those modules come from and builds special rtld-foo.os versions that
313 # are compiled with special flags, and puts these modules into rtld-libc.a
314 # for us. Then we do the real link using rtld-libc.a instead of libc_pic.a.
316 $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
317 @-rm -f $@T
318 $(reloc-link) -o $@.o '-Wl,-(' $^ -lgcc '-Wl,-)' -Wl,-Map,$@T
319 rm -f $@.o
320 mv -f $@T $@
322 $(objpfx)librtld.mk: $(objpfx)librtld.map Makefile
323 LC_ALL=C \
324 sed -n 's@^$(common-objpfx)\([^(]*\)(\([^)]*\.os\)) *.*$$@\1 \2@p' \
325 $< | \
326 while read lib file; do \
327 case $$lib in \
328 libc_pic.a) \
329 LC_ALL=C fgrep -l /$$file \
330 $(common-objpfx)stamp.os $(common-objpfx)*/stamp.os | \
331 LC_ALL=C \
332 sed 's@^$(common-objpfx)\([^/]*\)/stamp\.os$$@rtld-\1'" +=$$file@"\
333 ;; \
334 */*.a) \
335 echo rtld-$${lib%%/*} += $$file ;; \
336 *) echo "Wasn't expecting $$lib($$file)" >&2; exit 1 ;; \
337 esac; \
338 done > $@T
339 echo rtld-subdirs = `LC_ALL=C sed 's/^rtld-\([^ ]*\).*$$/\1/' $@T \
340 | LC_ALL=C sort -u` >> $@T
341 mv -f $@T $@
343 $(objpfx)rtld-libc.a: $(objpfx)librtld.mk FORCE
344 $(MAKE) -f $< -f rtld-Rules
346 $(objpfx)librtld.os: $(objpfx)dl-allobjs.os $(objpfx)rtld-libc.a
347 $(LINK.o) -nostdlib -nostartfiles -r -o $@ '-Wl,-(' $^ -lgcc '-Wl,-)' \
348 -Wl,-Map,$@.map
350 generated += librtld.map librtld.mk rtld-libc.a librtld.os.map
352 z-now-yes = -Wl,-z,now
354 $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
355 @rm -f $@.lds
356 $(LINK.o) -nostdlib -nostartfiles -shared $(z-now-$(bind-now)) \
357 $(LDFLAGS-rtld) -Wl,-z,defs -Wl,--verbose 2>&1 | \
358 LC_ALL=C \
359 sed -e '/^=========/,/^=========/!d;/^=========/d' \
360 -e 's/\. = .* + SIZEOF_HEADERS;/& _begin = . - SIZEOF_HEADERS;/' \
361 > $@.lds
362 $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
363 $(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \
364 $(filter-out $(map-file),$^) $(load-map-file) \
365 -Wl,-soname=$(rtld-installed-name) -T $@.lds
366 rm -f $@.lds
367 readelf -s $@ \
368 | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
370 # interp.c exists just to get this string into the libraries.
371 CFLAGS-interp.c = -D'RUNTIME_LINKER="$(slibdir)/$(rtld-installed-name)"' \
372 -DNOT_IN_libc=1
373 $(objpfx)interp.os: $(common-objpfx)config.make
375 ifneq (ld.so,$(rtld-installed-name))
376 # Make sure ld.so.1 exists in the build directory so we can link
377 # against it.
378 $(objpfx)$(rtld-installed-name): $(objpfx)ld.so
379 rm -f $@
380 ln -s $(<F) $@
381 generated += $(rtld-installed-name)
382 endif
384 # Build a file mentioning all trustworthy directories to look for shared
385 # libraries when using LD_LIBRARY_PATH in a setuid program. The user can
386 # add directories to the list by defining $(user-defined-trusted-dirs)
387 # before starting make.
388 $(objpfx)trusted-dirs.h: $(objpfx)trusted-dirs.st; @:
389 $(objpfx)trusted-dirs.st: Makefile $(..)Makeconfig
390 $(make-target-directory)
391 echo "$(subst :, ,$(default-rpath) $(user-defined-trusted-dirs))" \
392 | $(AWK) -f gen-trusted-dirs.awk > ${@:st=T};
393 echo '#define DL_DST_LIB "$(notdir $(slibdir))"' >> ${@:st=T}
394 $(move-if-change) ${@:st=T} ${@:st=h}
395 touch $@
396 CPPFLAGS-dl-load.c = -I$(objpfx). -I$(csu-objpfx).
398 ifeq (yes,$(build-shared))
399 $(inst_slibdir)/$(rtld-version-installed-name): $(objpfx)ld.so $(+force)
400 $(make-target-directory)
401 $(do-install-program)
403 $(inst_slibdir)/$(rtld-installed-name): \
404 $(inst_slibdir)/$(rtld-version-installed-name) \
405 $(inst_slibdir)/libc-$(version).so
406 $(make-shlib-link)
408 # Special target called by parent to install just the dynamic linker.
409 .PHONY: ldso_install
410 ldso_install: $(inst_slibdir)/$(rtld-installed-name)
411 endif
414 common-ldd-rewrite = -e 's%@RTLD@%$(slibdir)/$(rtld-installed-name)%g' \
415 -e 's%@VERSION@%$(version)%g'
416 sh-ldd-rewrite = $(common-ldd-rewrite) -e 's%@BASH@%/bin/sh%g;s/\$$"/"/g'
417 bash-ldd-rewrite = $(common-ldd-rewrite) -e 's%@BASH@%$(BASH)%g' \
418 -e 's%@TEXTDOMAINDIR@%$(msgcatdir)%g'
420 ifneq ($(have-bash2),yes)
421 ldd-shell = sh
422 else
423 ldd-shell = bash
424 endif
426 ifeq ($(ldd-rewrite-script),no)
427 define gen-ldd
428 LC_ALL=C sed $($(ldd-shell)-ldd-rewrite) < $< > $@.new
429 endef
430 else
431 define gen-ldd
432 LC_ALL=C sed $($(ldd-shell)-ldd-rewrite) < $< | LC_ALL=C sed -f $(ldd-rewrite-script) > $@.new
433 endef
434 endif
436 $(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \
437 $(common-objpfx)config.make
438 $(gen-ldd)
439 chmod 555 $@.new
440 mv -f $@.new $@
442 $(objpfx)sprof: $(libdl)
444 $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
445 SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
446 CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
447 -D'SLIBDIR="$(slibdir)"' -DIS_IN_ldconfig=1
448 CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
449 CFLAGS-cache.c = $(SYSCONF-FLAGS)
451 CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),-DNOT_IN_libc=1 -DIS_IN_rtld=1)
453 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
454 generated += $(addsuffix .so,$(strip $(modules-names)))
456 ifeq (yes,$(build-shared))
457 ifeq ($(cross-compiling),no)
458 tests: $(objpfx)tst-pathopt.out
459 endif
460 endif
462 $(objpfx)testobj1.so: $(libdl)
463 $(objpfx)testobj1_1.so: $(objpfx)testobj1.so $(libdl)
464 $(objpfx)testobj2.so: $(objpfx)testobj1.so $(libdl)
465 $(objpfx)testobj3.so: $(libdl)
466 $(objpfx)testobj4.so: $(libdl)
467 $(objpfx)testobj5.so: $(libdl)
468 $(objpfx)testobj6.so: $(objpfx)testobj1.so $(objpfx)testobj2.so $(libdl)
469 $(objpfx)failobj.so: $(objpfx)testobj6.so
470 $(objpfx)dep1.so: $(objpfx)dep2.so $(objpfx)dep4.so
471 $(objpfx)dep2.so: $(objpfx)dep3.so $(objpfx)dep4.so
472 $(objpfx)dep4.so: $(objpfx)dep3.so
473 $(objpfx)nodelmod3.so: $(objpfx)nodelmod4.so
474 $(objpfx)nextmod1.so: $(libdl)
475 $(objpfx)neededobj1.so: $(libdl)
476 $(objpfx)neededobj2.so: $(objpfx)neededobj1.so $(libdl)
477 $(objpfx)neededobj3.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so $(libdl)
478 $(objpfx)neededobj4.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
479 $(objpfx)neededobj3.so $(libdl)
480 $(objpfx)neededobj6.so: $(objpfx)neededobj5.so
481 $(objpfx)unload2mod.so: $(objpfx)unload2dep.so
482 $(objpfx)ltglobmod2.so: $(libdl)
483 $(objpfx)firstobj.so: $(shared-thread-library)
484 $(objpfx)globalmod1.so: $(libdl)
485 $(objpfx)reldep4mod1.so: $(objpfx)reldep4mod3.so
486 $(objpfx)reldep4mod2.so: $(objpfx)reldep4mod4.so
487 $(objpfx)dblloadmod1.so: $(objpfx)dblloadmod3.so
488 $(objpfx)dblloadmod2.so: $(objpfx)dblloadmod3.so
489 $(objpfx)reldepmod5.so: $(objpfx)reldepmod2.so
490 $(objpfx)reldepmod6.so: $(objpfx)reldepmod2.so
491 $(objpfx)reldep6mod1.so: $(objpfx)reldep6mod0.so
492 $(objpfx)reldep6mod2.so: $(objpfx)reldep6mod1.so
493 $(objpfx)reldep6mod3.so: $(objpfx)reldep6mod2.so
494 $(objpfx)reldep6mod4.so: $(objpfx)reldep6mod1.so
495 $(objpfx)tst-tlsmod3.so: $(objpfx)tst-tlsmod2.so
496 $(objpfx)tst-tlsmod8.so: $(objpfx)tst-tlsmod7.so
497 $(objpfx)tst-tlsmod10.so: $(objpfx)tst-tlsmod9.so
498 $(objpfx)tst-tlsmod12.so: $(objpfx)tst-tlsmod11.so
499 $(objpfx)tst-tlsmod13a.so: $(objpfx)tst-tlsmod13.so
500 # For tst-tls9-static, make sure the modules it dlopens have libc.so in DT_NEEDED
501 $(objpfx)tst-tlsmod5.so: $(common-objpfx)libc.so
502 $(objpfx)tst-tlsmod6.so: $(common-objpfx)libc.so
503 $(objpfx)reldep8mod3.so: $(objpfx)reldep8mod1.so $(objpfx)reldep8mod2.so
504 $(objpfx)nodel2mod3.so: $(objpfx)nodel2mod1.so $(objpfx)nodel2mod2.so
505 $(objpfx)reldep9mod2.so: $(objpfx)reldep9mod1.so
506 $(objpfx)reldep9mod3.so: $(objpfx)reldep9mod1.so $(objpfx)reldep9mod2.so
507 $(objpfx)unload3mod1.so: $(objpfx)unload3mod3.so
508 $(objpfx)unload3mod2.so: $(objpfx)unload3mod3.so
509 $(objpfx)unload3mod3.so: $(objpfx)unload3mod4.so
510 $(objpfx)unload4mod1.so: $(objpfx)unload4mod2.so $(objpfx)unload4mod3.so
511 $(objpfx)unload4mod2.so: $(objpfx)unload4mod4.so $(objpfx)unload4mod3.so
512 $(objpfx)unload6mod1.so: $(libdl)
513 $(objpfx)unload6mod2.so: $(libdl)
514 $(objpfx)unload6mod3.so: $(libdl)
515 $(objpfx)unload7mod1.so: $(libdl)
516 $(objpfx)unload7mod2.so: $(objpfx)unload7mod1.so
518 LDFLAGS-tst-tlsmod5.so = -nostdlib
519 LDFLAGS-tst-tlsmod6.so = -nostdlib
521 testobj1.so-no-z-defs = yes
522 testobj3.so-no-z-defs = yes
523 testobj4.so-no-z-defs = yes
524 testobj5.so-no-z-defs = yes
525 testobj6.so-no-z-defs = yes
526 failobj.so-no-z-defs = yes
527 constload2.so-no-z-defs = yes
528 constload3.so-no-z-defs = yes
529 nodelmod1.so-no-z-defs = yes
530 nodelmod2.so-no-z-defs = yes
531 nodelmod4.so-no-z-defs = yes
532 nodel2mod2.so-no-z-defs = yes
533 reldepmod2.so-no-z-defs = yes
534 reldepmod3.so-no-z-defs = yes
535 reldepmod4.so-no-z-defs = yes
536 reldep4mod4.so-no-z-defs = yes
537 reldep4mod2.so-no-z-defs = yes
538 ltglobmod2.so-no-z-defs = yes
539 dblloadmod3.so-no-z-defs = yes
540 tst-tlsmod1.so-no-z-defs = yes
541 tst-tlsmod2.so-no-z-defs = yes
542 tst-tlsmod3.so-no-z-defs = yes
543 tst-tlsmod4.so-no-z-defs = yes
544 tst-tlsmod7.so-no-z-defs = yes
545 tst-tlsmod8.so-no-z-defs = yes
546 tst-tlsmod9.so-no-z-defs = yes
547 tst-tlsmod10.so-no-z-defs = yes
548 tst-tlsmod12.so-no-z-defs = yes
549 tst-tlsmod14a.so-no-z-defs = yes
550 tst-tlsmod14b.so-no-z-defs = yes
551 tst-tlsmod15a.so-no-z-defs = yes
552 tst-tlsmod16b.so-no-z-defs = yes
553 circlemod2.so-no-z-defs = yes
554 circlemod3.so-no-z-defs = yes
555 circlemod3a.so-no-z-defs = yes
556 reldep8mod2.so-no-z-defs = yes
557 reldep9mod1.so-no-z-defs = yes
558 unload3mod4.so-no-z-defs = yes
559 unload4mod1.so-no-z-defs = yes
560 ifuncmod1.so-no-z-defs = yes
561 ifuncmod5.so-no-z-defs = yes
562 ifuncmod6.so-no-z-defs = yes
564 ifeq ($(build-shared),yes)
565 # Build all the modules even when not actually running test programs.
566 tests: $(test-modules)
567 endif
569 $(objpfx)loadtest: $(libdl)
570 LDFLAGS-loadtest = -rdynamic
572 $(objpfx)loadtest.out: $(test-modules)
574 $(objpfx)neededtest: $(libdl)
575 $(objpfx)neededtest.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
576 $(objpfx)neededobj3.so
578 $(objpfx)neededtest2: $(libdl)
579 $(objpfx)neededtest2.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
580 $(objpfx)neededobj3.so
582 $(objpfx)neededtest3: $(libdl)
583 $(objpfx)neededtest3.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
584 $(objpfx)neededobj3.so $(objpfx)neededobj4.so
586 neededtest4-ENV = LC_ALL=C LANGUAGE=C
587 $(objpfx)neededtest4: $(libdl) $(objpfx)neededobj1.so
588 $(objpfx)neededtest4.out: $(objpfx)neededobj5.so $(objpfx)neededobj6.so
590 $(objpfx)restest1: $(objpfx)testobj1.so $(objpfx)testobj1_1.so $(libdl)
591 LDFLAGS-restest1 = -rdynamic
593 $(objpfx)restest2: $(libdl)
594 LDFLAGS-restest2 = -rdynamic
596 $(objpfx)restest1.out: $(test-modules)
598 preloadtest-preloads = testobj1 testobj2 testobj3 testobj4 testobj5
599 $(objpfx)preloadtest: $(objpfx)testobj6.so
600 LDFLAGS-preloadtest = -rdynamic
601 $(objpfx)preloadtest.out: $(preloadtest-preloads:%=$(objpfx)%.so)
602 preloadtest-ENV = \
603 LD_PRELOAD=$(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
605 $(objpfx)loadfail: $(libdl)
606 LDFLAGS-loadfail = -rdynamic
608 $(objpfx)loadfail.out: $(objpfx)failobj.so
610 $(objpfx)multiload: $(libdl)
611 LDFLAGS-multiload = -rdynamic
612 CFLAGS-multiload.c = -DOBJDIR=\"$(elf-objpfx)\"
614 $(objpfx)multiload.out: $(objpfx)testobj1.so
616 $(objpfx)origtest: $(libdl)
617 LDFLAGS-origtest = -rdynamic
618 $(objpfx)origtest.out: $(objpfx)testobj1.so
620 ifeq ($(have-thread-library),yes)
621 $(objpfx)resolvfail: $(libdl) $(shared-thread-library)
622 else
623 $(objpfx)resolvfail: $(libdl)
624 endif
626 $(objpfx)constload1: $(libdl)
627 $(objpfx)constload1.out: $(objpfx)constload2.so $(objpfx)constload3.so
629 $(objpfx)circleload1: $(libdl)
630 $(objpfx)circleload1.out: $(objpfx)circlemod1.so \
631 $(objpfx)circlemod1a.so
633 $(objpfx)circlemod1.so: $(objpfx)circlemod2.so
634 $(objpfx)circlemod2.so: $(objpfx)circlemod3.so
635 $(objpfx)circlemod1a.so: $(objpfx)circlemod2a.so
636 $(objpfx)circlemod2a.so: $(objpfx)circlemod3a.so
638 $(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so)
640 $(objpfx)order.out: $(objpfx)order
641 $(elf-objpfx)$(rtld-installed-name) \
642 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
643 $(objpfx)order > $@
644 (echo "0123456789" | cmp $@ -) > /dev/null
646 $(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so)
647 $(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
648 vismain-ENV = LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
650 $(objpfx)noload: $(objpfx)testobj1.so
651 LDFLAGS-noload = -rdynamic
652 $(objpfx)noload.out: $(objpfx)testobj5.so
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)
693 $(objpfx)unload2: $(libdl)
694 $(objpfx)unload2.out: $(objpfx)unload2mod.so $(objpfx)unload2dep.so
696 $(objpfx)lateglobal: $(libdl)
697 $(objpfx)lateglobal.out: $(objpfx)ltglobmod1.so $(objpfx)ltglobmod2.so
699 $(objpfx)tst-pathopt: $(libdl)
700 $(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \
701 $(objpfx)pathoptobj.so
702 $(SHELL) -e $< $(common-objpfx)
704 $(objpfx)initfirst: $(libdl)
705 $(objpfx)initfirst.out: $(objpfx)firstobj.so
707 $(objpfx)global: $(objpfx)globalmod1.so
708 $(objpfx)global.out: $(objpfx)reldepmod1.so
710 $(objpfx)dblload: $(libdl)
711 $(objpfx)dblload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
713 $(objpfx)dblunload: $(libdl)
714 $(objpfx)dblunload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
716 $(objpfx)reldep5: $(libdl)
717 $(objpfx)reldep5.out: $(objpfx)reldepmod5.so $(objpfx)reldepmod6.so
719 $(objpfx)reldep6: $(libdl)
720 $(objpfx)reldep6.out: $(objpfx)reldep6mod3.so $(objpfx)reldep6mod4.so
722 $(objpfx)reldep7: $(libdl)
723 $(objpfx)reldep7.out: $(objpfx)reldep7mod1.so $(objpfx)reldep7mod2.so
725 $(objpfx)reldep8: $(libdl)
726 $(objpfx)reldep8.out: $(objpfx)reldep8mod3.so
728 LDFLAGS-nodel2mod2.so = -Wl,--enable-new-dtags,-z,nodelete
729 $(objpfx)nodelete2: $(libdl)
730 $(objpfx)nodelete2.out: $(objpfx)nodel2mod3.so
732 $(objpfx)reldep9: $(libdl)
733 $(objpfx)reldep9.out: $(objpfx)reldep9mod3.so
735 $(objpfx)tst-tls3: $(objpfx)tst-tlsmod1.so
737 $(objpfx)tst-tls4: $(libdl)
738 $(objpfx)tst-tls4.out: $(objpfx)tst-tlsmod2.so
740 $(objpfx)tst-tls5: $(libdl)
741 $(objpfx)tst-tls5.out: $(objpfx)tst-tlsmod2.so
743 $(objpfx)tst-tls6: $(libdl)
744 $(objpfx)tst-tls6.out: $(objpfx)tst-tlsmod2.so
746 $(objpfx)tst-tls7: $(libdl)
747 $(objpfx)tst-tls7.out: $(objpfx)tst-tlsmod3.so
749 $(objpfx)tst-tls8: $(libdl)
750 $(objpfx)tst-tls8.out: $(objpfx)tst-tlsmod3.so $(objpfx)tst-tlsmod4.so
752 $(objpfx)tst-tls9: $(libdl)
753 $(objpfx)tst-tls9.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
755 $(objpfx)tst-tls10: $(objpfx)tst-tlsmod8.so
757 $(objpfx)tst-tls11: $(objpfx)tst-tlsmod10.so
759 $(objpfx)tst-tls12: $(objpfx)tst-tlsmod12.so
761 $(objpfx)tst-tls13: $(libdl)
762 $(objpfx)tst-tls13.out: $(objpfx)tst-tlsmod13a.so
764 $(objpfx)tst-tls14: $(objpfx)tst-tlsmod14a.so $(libdl)
765 $(objpfx)tst-tls14.out: $(objpfx)tst-tlsmod14b.so
767 $(objpfx)tst-tls15: $(libdl)
768 $(objpfx)tst-tls15.out: $(objpfx)tst-tlsmod15a.so $(objpfx)tst-tlsmod15b.so
770 $(objpfx)tst-tls-dlinfo: $(libdl)
771 $(objpfx)tst-tls-dlinfo.out: $(objpfx)tst-tlsmod2.so
775 $(objpfx)tst-tls16: $(libdl)
776 $(objpfx)tst-tls16.out: $(objpfx)tst-tlsmod16a.so $(objpfx)tst-tlsmod16b.so
778 $(objpfx)tst-tls17: $(libdl)
779 $(objpfx)tst-tls17.out: $(objpfx)tst-tlsmod17b.so
780 $(patsubst %,$(objpfx)tst-tlsmod17a%.os,$(tlsmod17a-suffixes)): $(objpfx)tst-tlsmod17a%.os : tst-tlsmod17a.c
781 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ -DN=$* -DNOT_IN_libc=1 $<
782 $(patsubst %,$(objpfx)tst-tlsmod17a%.so,$(tlsmod17a-suffixes)): $(objpfx)tst-tlsmod17a%.so: $(objpfx)ld.so
783 $(objpfx)tst-tlsmod17b.so: $(patsubst %,$(objpfx)tst-tlsmod17a%.so,$(tlsmod17a-suffixes))
785 $(objpfx)tst-tls18: $(libdl)
786 $(objpfx)tst-tls18.out: $(patsubst %,$(objpfx)tst-tlsmod18a%.so,$(tlsmod18a-suffixes))
787 $(patsubst %,$(objpfx)tst-tlsmod18a%.os,$(tlsmod18a-suffixes)): $(objpfx)tst-tlsmod18a%.os : tst-tlsmod18a.c
788 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ -DN=$* -DNOT_IN_libc=1 $<
789 $(patsubst %,$(objpfx)tst-tlsmod18a%.so,$(tlsmod18a-suffixes)): $(objpfx)tst-tlsmod18a%.so: $(objpfx)ld.so
791 CFLAGS-tst-align.c = $(stack-align-test-flags)
792 CFLAGS-tst-align2.c = $(stack-align-test-flags)
793 CFLAGS-tst-alignmod.c = $(stack-align-test-flags)
794 CFLAGS-tst-alignmod2.c = $(stack-align-test-flags)
795 $(objpfx)tst-align: $(libdl)
796 $(objpfx)tst-align.out: $(objpfx)tst-alignmod.so
797 $(objpfx)tst-align2: $(objpfx)tst-alignmod2.so
799 $(objpfx)unload3: $(libdl)
800 $(objpfx)unload3.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
801 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
803 $(objpfx)unload4: $(libdl)
804 $(objpfx)unload4.out: $(objpfx)unload4mod1.so $(objpfx)unload4mod3.so
806 $(objpfx)unload5: $(libdl)
807 $(objpfx)unload5.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
808 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
810 $(objpfx)unload6: $(libdl)
811 $(objpfx)unload6.out: $(objpfx)unload6mod1.so $(objpfx)unload6mod2.so \
812 $(objpfx)unload6mod3.so
814 $(objpfx)unload7: $(libdl)
815 $(objpfx)unload7.out: $(objpfx)unload7mod1.so $(objpfx)unload7mod2.so
816 unload7-ENV = MALLOC_PERTURB_=85
818 ifdef libdl
819 $(objpfx)tst-tls9-static: $(common-objpfx)dlfcn/libdl.a
820 $(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
821 endif
823 ifeq ($(have-z-execstack),yes)
824 $(objpfx)tst-execstack: $(libdl)
825 $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
826 LDFLAGS-tst-execstack = -Wl,-z,noexecstack
827 LDFLAGS-tst-execstack-mod = -Wl,-z,execstack
829 $(objpfx)tst-execstack-needed: $(objpfx)tst-execstack-mod.so
830 LDFLAGS-tst-execstack-needed = -Wl,-z,noexecstack
832 LDFLAGS-tst-execstack-prog = -Wl,-z,execstack
833 endif
835 $(objpfx)tst-array1.out: $(objpfx)tst-array1
836 $(elf-objpfx)$(rtld-installed-name) \
837 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
838 $(objpfx)tst-array1 > $@
839 cmp $@ tst-array1.exp > /dev/null
841 $(objpfx)tst-array1-static.out: $(objpfx)tst-array1-static
842 $(objpfx)tst-array1-static > $@
843 cmp $@ tst-array1.exp > /dev/null
845 $(objpfx)tst-array2: $(objpfx)tst-array2dep.so
846 $(objpfx)tst-array2.out: $(objpfx)tst-array2
847 $(elf-objpfx)$(rtld-installed-name) \
848 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
849 $(objpfx)tst-array2 > $@
850 cmp $@ tst-array2.exp > /dev/null
852 $(objpfx)tst-array3.out: $(objpfx)tst-array3
853 $(elf-objpfx)$(rtld-installed-name) \
854 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
855 $(objpfx)tst-array3 > $@
856 cmp $@ tst-array1.exp > /dev/null
858 $(objpfx)tst-array4: $(libdl)
859 $(objpfx)tst-array4.out: $(objpfx)tst-array4 $(objpfx)tst-array2dep.so
860 $(elf-objpfx)$(rtld-installed-name) \
861 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
862 $< > $@
863 cmp $@ tst-array4.exp > /dev/null
865 $(objpfx)tst-array5: $(objpfx)tst-array5dep.so
866 $(objpfx)tst-array5.out: $(objpfx)tst-array5
867 $(elf-objpfx)$(rtld-installed-name) \
868 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
869 $(objpfx)tst-array5 > $@
870 cmp $@ tst-array5.exp > /dev/null
872 $(objpfx)tst-array5-static.out: $(objpfx)tst-array5-static
873 $(objpfx)tst-array5-static > $@
874 cmp $@ tst-array5-static.exp > /dev/null
876 ifeq (yesyes,$(have-fpie)$(build-shared))
877 CFLAGS-tst-pie1.c += $(pie-ccflag)
879 $(objpfx)tst-pie1.out: $(objpfx)tst-pie1
880 $(elf-objpfx)$(rtld-installed-name) \
881 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
882 $< > $@
884 $(objpfx)tst-pie1: $(objpfx)tst-pie1.o $(objpfx)tst-piemod1.so
885 $(+link-pie)
887 generated += tst-pie1 tst-pie1.out tst-pie1.o
888 endif
890 check-textrel-CFLAGS = -O -Wall -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
891 $(objpfx)check-textrel: check-textrel.c
892 $(native-compile)
894 check-execstack-CFLAGS = -O -Wall -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -std=gnu99
895 $(objpfx)check-execstack: check-execstack.c
896 $(native-compile)
898 check-localplt-CFLAGS = -O -Wall -D_GNU_SOURCE -std=gnu99
899 $(objpfx)check-localplt: check-localplt.c
900 $(native-compile)
902 ifeq (yes,$(build-shared))
903 tests: $(objpfx)check-textrel.out $(objpfx)check-execstack.out
905 $(objpfx)check-textrel.out: $(objpfx)check-textrel
906 $(dir $<)$(notdir $<) $(common-objpfx)libc.so \
907 $(sort $(wildcard $(common-objpfx)*/lib*.so \
908 $(common-objpfx)iconvdata/*.so)) > $@
909 generated += check-textrel check-textrel.out
911 $(objpfx)check-execstack.out: $(objpfx)check-execstack
912 $(dir $<)$(notdir $<) $(common-objpfx)libc.so \
913 $(sort $(wildcard $(common-objpfx)*/lib*.so \
914 $(common-objpfx)iconvdata/*.so)) > $@
915 generated += check-execstack check-execstack.out
917 $(objpfx)tst-dlmodcount: $(libdl)
918 $(objpfx)tst-dlmodcount.out: $(test-modules)
920 check-data := $(firstword $(wildcard \
921 $(foreach D,$(add-ons) scripts,\
922 $(patsubst %,$(..)$D/data/localplt-%.data,\
923 $(abi-name) \
924 $(addsuffix -$(config-os),\
925 $(config-machine) \
926 $(base-machine)) \
927 generic))))
929 tests: $(objpfx)check-localplt.out
931 ifeq ($(have-thread-library),yes)
932 thread-dso := $(filter-out %_nonshared.a, $(shared-thread-library))
933 endif
935 $(objpfx)check-localplt.out: $(objpfx)check-localplt \
936 $(common-objpfx)libc.so \
937 $(common-objpfx)math/libm.so $(thread-dso) \
938 $(common-objpfx)rt/librt.so \
939 $(common-objpfx)dlfcn/libdl.so \
940 $(common-objpfx)resolv/libresolv.so \
941 $(common-objpfx)crypt/libcrypt.so \
942 $(check-data)
943 $(dir $<)$(notdir $<) $(filter-out $< $(check-data),$^) | \
944 LC_ALL=C sort | \
945 diff -u $(check-data) - > $@
946 endif
948 $(objpfx)tst-dlopenrpathmod.so: $(libdl)
949 $(objpfx)tst-dlopenrpath: $(objpfx)tst-dlopenrpathmod.so $(libdl)
950 CFLAGS-tst-dlopenrpath.c += -DPFX=\"$(objpfx)\"
951 LDFLAGS-tst-dlopenrpathmod.so += -Wl,-rpath,\$$ORIGIN/test-subdir
952 $(objpfx)tst-dlopenrpath.out: $(objpfx)firstobj.so
954 $(objpfx)tst-deep1mod2.so: $(objpfx)tst-deep1mod3.so
955 $(objpfx)tst-deep1: $(libdl) $(objpfx)tst-deep1mod1.so
956 $(objpfx)tst-deep1.out: $(objpfx)tst-deep1mod2.so
957 LDFLAGS-tst-deep1 += -rdynamic
958 tst-deep1mod3.so-no-z-defs = yes
960 $(objpfx)tst-dlmopen1mod.so: $(libdl)
961 $(objpfx)tst-dlmopen1: $(libdl)
962 $(objpfx)tst-dlmopen1.out: $(objpfx)tst-dlmopen1mod.so
964 $(objpfx)tst-dlmopen2: $(libdl)
965 $(objpfx)tst-dlmopen2.out: $(objpfx)tst-dlmopen1mod.so
967 $(objpfx)tst-dlmopen3: $(libdl)
968 $(objpfx)tst-dlmopen3.out: $(objpfx)tst-dlmopen1mod.so
970 $(objpfx)tst-audit1.out: $(objpfx)tst-auditmod1.so
971 tst-audit1-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
973 $(objpfx)tst-audit2.out: $(objpfx)tst-auditmod1.so
974 tst-audit2-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
976 $(objpfx)tst-audit3: $(objpfx)tst-auditmod3a.so
977 $(objpfx)tst-audit3.out: $(objpfx)tst-auditmod3b.so
978 tst-audit3-ENV = LD_AUDIT=$(objpfx)tst-auditmod3b.so
980 $(objpfx)tst-audit4: $(objpfx)tst-auditmod4a.so
981 $(objpfx)tst-audit4.out: $(objpfx)tst-auditmod4b.so
982 tst-audit4-ENV = LD_AUDIT=$(objpfx)tst-auditmod4b.so
984 $(objpfx)tst-audit5: $(objpfx)tst-auditmod5a.so
985 $(objpfx)tst-audit5.out: $(objpfx)tst-auditmod5b.so
986 tst-audit5-ENV = LD_AUDIT=$(objpfx)tst-auditmod5b.so
988 $(objpfx)tst-global1: $(libdl)
989 $(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
991 $(objpfx)order2: $(libdl)
992 $(objpfx)order2.out: $(objpfx)order2 $(objpfx)order2mod1.so \
993 $(objpfx)order2mod2.so
994 $(elf-objpfx)$(rtld-installed-name) \
995 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
996 $(objpfx)order2 > $@
997 (echo "12345" | cmp $@ -) > /dev/null
998 $(objpfx)order2mod1.so: $(objpfx)order2mod4.so
999 $(objpfx)order2mod4.so: $(objpfx)order2mod3.so
1000 $(objpfx)order2mod2.so: $(objpfx)order2mod3.so
1001 order2mod2.so-no-z-defs = yes
1003 tst-stackguard1-ARGS = --command "$(built-program-cmd) --child"
1004 tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
1006 $(objpfx)tst-leaks1: $(libdl)
1007 $(objpfx)tst-leaks1-mem: $(objpfx)tst-leaks1.out
1008 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1.mtrace > $@
1010 tst-leaks1-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1.mtrace
1012 $(objpfx)tst-addr1: $(libdl)
1014 $(objpfx)tst-thrlock: $(libdl) $(shared-thread-library)
1016 CFLAGS-ifuncmain1pic.c += $(pic-ccflag)
1017 CFLAGS-ifuncmain1picstatic.c += $(pic-ccflag)
1018 CFLAGS-ifuncmain1staticpic.c += $(pic-ccflag)
1019 CFLAGS-ifuncdep1pic.c += $(pic-ccflag)
1020 CFLAGS-ifuncmain1vispic.c += $(pic-ccflag)
1021 CFLAGS-ifuncmain2pic.c += $(pic-ccflag)
1022 CFLAGS-ifuncmain2picstatic.c += $(pic-ccflag)
1023 CFLAGS-ifuncdep2pic.c += $(pic-ccflag)
1024 CFLAGS-ifuncmain4picstatic.c += $(pic-ccflag)
1025 CFLAGS-ifuncmain5pic.c += $(pic-ccflag)
1026 CFLAGS-ifuncmain5picstatic.c += $(pic-ccflag)
1027 CFLAGS-ifuncmain5staticpic.c += $(pic-ccflag)
1028 CFLAGS-ifuncdep5pic.c += $(pic-ccflag)
1029 CFLAGS-ifuncmain7pic.c += $(pic-ccflag)
1030 CFLAGS-ifuncmain7picstatic.c += $(pic-ccflag)
1032 LDFLAGS-ifuncmain3 = -Wl,-export-dynamic
1034 ifeq (yesyes,$(have-fpie)$(build-shared))
1035 CFLAGS-ifuncmain1pie.c += $(pie-ccflag)
1036 CFLAGS-ifuncmain1vispie.c += $(pie-ccflag)
1037 CFLAGS-ifuncmain1staticpie.c += $(pie-ccflag)
1038 CFLAGS-ifuncmain5pie.c += $(pie-ccflag)
1039 CFLAGS-ifuncmain6pie.c += $(pie-ccflag)
1040 CFLAGS-ifuncmain7pie.c += $(pie-ccflag)
1042 $(objpfx)ifuncmain1pie.out: $(objpfx)ifuncmain1pie
1043 $(elf-objpfx)$(rtld-installed-name) \
1044 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
1045 $< > $@
1047 $(objpfx)ifuncmain1pie: $(objpfx)ifuncmain1pie.o $(objpfx)ifuncmod1.so
1048 $(+link-pie)
1050 generated += ifuncmain1pie ifuncmain1pie.out
1052 $(objpfx)ifuncmain1staticpie.out: $(objpfx)ifuncmain1staticpie
1053 $(elf-objpfx)$(rtld-installed-name) \
1054 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
1055 $< > $@
1057 $(objpfx)ifuncmain1staticpie: $(objpfx)ifuncmain1staticpie.o $(objpfx)ifuncdep1pic.o
1058 $(+link-pie)
1060 generated += ifuncmain1staticpie ifuncmain1staticpie.out
1062 $(objpfx)ifuncmain1vispie.out: $(objpfx)ifuncmain1vispie
1063 $(elf-objpfx)$(rtld-installed-name) \
1064 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
1065 $< > $@
1067 $(objpfx)ifuncmain1vispie: $(objpfx)ifuncmain1vispie.o $(objpfx)ifuncmod1.so
1068 $(+link-pie)
1070 generated += ifuncmain1vispie ifuncmain1vispie.out
1072 $(objpfx)ifuncmain5pie.out: $(objpfx)ifuncmain5pie
1073 $(elf-objpfx)$(rtld-installed-name) \
1074 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
1075 $< > $@
1077 $(objpfx)ifuncmain5pie: $(objpfx)ifuncmain5pie.o $(objpfx)ifuncmod5.so
1078 $(+link-pie)
1080 generated += ifuncmain5pie ifuncmain5pie.out
1082 $(objpfx)ifuncmain6pie.out: $(objpfx)ifuncmain6pie
1083 $(elf-objpfx)$(rtld-installed-name) \
1084 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
1085 $< > $@
1087 $(objpfx)ifuncmain6pie: $(objpfx)ifuncmain6pie.o $(objpfx)ifuncmod6.so
1088 $(+link-pie)
1090 generated += ifuncmain6pie ifuncmain6pie.out
1092 $(objpfx)ifuncmain7pie.out: $(objpfx)ifuncmain7pie
1093 $(elf-objpfx)$(rtld-installed-name) \
1094 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
1095 $< > $@
1097 $(objpfx)ifuncmain7pie: $(objpfx)ifuncmain7pie.o
1098 $(+link-pie)
1100 generated += ifuncmain7pie ifuncmain7pie.out
1101 endif
1103 $(objpfx)ifuncmain1: $(addprefix $(objpfx),ifuncmod1.so)
1104 $(objpfx)ifuncmain1pic: $(addprefix $(objpfx),ifuncmod1.so)
1105 $(objpfx)ifuncmain1staticpic: $(addprefix $(objpfx),ifuncdep1pic.o)
1106 $(objpfx)ifuncmain1static: $(addprefix $(objpfx),ifuncdep1.o)
1107 $(objpfx)ifuncmain1picstatic: $(addprefix $(objpfx),ifuncdep1pic.o)
1108 $(objpfx)ifuncmain1vis: $(addprefix $(objpfx),ifuncmod1.so)
1109 $(objpfx)ifuncmain1vispic: $(addprefix $(objpfx),ifuncmod1.so)
1110 $(objpfx)ifuncmain2: $(addprefix $(objpfx),ifuncdep2.o)
1111 $(objpfx)ifuncmain2pic: $(addprefix $(objpfx),ifuncdep2pic.o)
1112 $(objpfx)ifuncmain2static: $(addprefix $(objpfx),ifuncdep2.o)
1113 $(objpfx)ifuncmain2picstatic: $(addprefix $(objpfx),ifuncdep2pic.o)
1115 $(objpfx)ifuncmain3: $(libdl)
1116 $(objpfx)ifuncmain3.out: $(objpfx)ifuncmod3.so
1118 $(objpfx)ifuncmain5: $(addprefix $(objpfx),ifuncmod5.so)
1119 $(objpfx)ifuncmain5pic: $(addprefix $(objpfx),ifuncmod5.so)
1120 $(objpfx)ifuncmain5static: $(addprefix $(objpfx),ifuncdep5.o)
1121 $(objpfx)ifuncmain5staticpic: $(addprefix $(objpfx),ifuncdep5pic.o)
1122 $(objpfx)ifuncmain5picstatic: $(addprefix $(objpfx),ifuncdep5pic.o)
1124 $(objpfx)tst-unique1: $(libdl)
1125 $(objpfx)tst-unique1.out: $(objpfx)tst-unique1mod1.so \
1126 $(objpfx)tst-unique1mod2.so
1128 $(objpfx)tst-unique2: $(libdl) $(objpfx)tst-unique2mod1.so
1129 $(objpfx)tst-unique2.out: $(objpfx)tst-unique2mod2.so
1131 ifeq (yes,$(config-cflags-avx))
1132 CFLAGS-tst-audit4.c += -mavx
1133 CFLAGS-tst-auditmod4a.c += -mavx
1134 CFLAGS-tst-auditmod4b.c += -mavx
1135 endif