Fix handling of xmm6 in ld.so audit hooks on x86-64.
[glibc.git] / elf / Makefile
blob57febea4830edb78d37ed639f72271a829184186
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 do-lookup.h 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 \
93 tst-auditmod1.c tst-auditmod3a.c tst-auditmod3b.c \
94 order2mod1.c order2mod2.c order2mod3.c order2mod4.c \
95 tst-stackguard1.c tst-stackguard1-static.c \
96 tst-array5.c tst-array5-static.c tst-array5dep.c \
97 tst-array5.exp tst-leaks1.c check-execstack.c \
98 ifuncmain1.c ifuncmain1pic.c ifuncmain1vis.c \
99 ifuncmain1vispic.c ifuncmain1static.c \
100 ifuncmain1staticpic.c ifuncmain1picstatic.c \
101 ifuncdep1.c ifuncdep1pic.c ifuncmod1.c \
102 ifuncmain1pie.c ifuncmain1vispie.c \
103 ifuncmain1staticpie.c \
104 ifuncmain2.c ifuncmain2static.c ifuncdep2.c \
105 ifuncmain2pic.c ifuncmain2picstatic.c ifuncdep2pic.c \
106 ifuncmain3.c ifuncmod3.c \
107 ifuncmain4.c ifuncmain4static.c ifuncmain4picstatic.c \
108 ifuncmain5.c ifuncmain5pic.c ifuncmain5picstatic.c \
109 ifuncmain5pie.c ifuncmain5static.c \
110 ifuncmain5staticpic.c \
111 ifuncdep5.c ifuncdep5pic.c ifuncmod5.c \
112 ifuncmain6pie.c ifuncmod6.c \
113 ifuncmain7.c ifuncmain7pic.c ifuncmain7picstatic.c \
114 ifuncmain7pie.c ifuncmain7static.c
116 CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
117 CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
118 CFLAGS-dl-iterate-phdr.c = $(uses-callbacks)
120 include ../Makeconfig
122 ifeq ($(unwind-find-fde),yes)
123 routines += unwind-dw2-fde-glibc
124 shared-only-routines += unwind-dw2-fde-glibc
125 endif
127 before-compile = $(objpfx)trusted-dirs.h
128 generated := trusted-dirs.h trusted-dirs.st for-renamed/renamed.so
129 generated-dirs := for-renamed
131 ifeq ($(versioning),yes)
132 ld-map = $(common-objpfx)ld.map
133 endif
135 ifeq (yes,$(build-shared))
136 extra-objs = $(all-rtld-routines:%=%.os) soinit.os sofini.os interp.os
137 generated += librtld.os dl-allobjs.os ld.so ldd
138 install-others = $(inst_slibdir)/$(rtld-installed-name)
139 install-bin-script = ldd
140 endif
142 others = sprof sln
143 install-bin = sprof
144 others-static = sln
145 install-rootsbin = sln
147 ifeq (yes,$(use-ldconfig))
148 ifeq (yes,$(build-shared))
149 others-static += ldconfig
150 others += ldconfig
151 install-rootsbin += ldconfig
153 ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon
154 extra-objs += $(ldconfig-modules:=.o)
156 # To find xmalloc.c and xstrdup.c
157 vpath %.c ../locale/programs
159 endif
160 endif
162 tests = tst-tls1 tst-tls2 tst-tls9 tst-leaks1
163 ifeq (yes,$(have-initfini-array))
164 tests += tst-array1 tst-array2 tst-array3 tst-array4 tst-array5
165 endif
166 ifeq (yes,$(build-static))
167 tests-static = tst-tls1-static tst-tls2-static tst-stackguard1-static
168 ifeq (yesyesyes,$(build-static)$(build-shared)$(elf))
169 tests-static += tst-tls9-static
170 tst-tls9-static-ENV = \
171 LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn
172 endif
173 ifeq (yes,$(have-initfini-array))
174 tests-static += tst-array1-static tst-array5-static
175 endif
176 tests += $(tests-static)
177 endif
178 ifeq (yes,$(build-shared))
179 tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
180 constload1 order vismain noload filter unload \
181 reldep reldep2 reldep3 reldep4 nodelete nodelete2 \
182 nodlopen nodlopen2 neededtest neededtest2 \
183 neededtest3 neededtest4 unload2 lateglobal initfirst global \
184 restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
185 circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \
186 tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-tls15 \
187 tst-tls16 tst-tls17 tst-tls18 tst-tls-dlinfo \
188 tst-align tst-align2 $(tests-execstack-$(have-z-execstack)) \
189 tst-dlmodcount tst-dlopenrpath tst-deep1 \
190 tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
191 unload3 unload4 unload5 unload6 unload7 tst-global1 order2 \
192 tst-audit1 tst-audit2 \
193 tst-stackguard1 tst-addr1 tst-thrlock
194 # reldep9
195 test-srcs = tst-pathopt
196 tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
197 ifeq (x86_64,$(config-machine))
198 tests += tst-audit3
199 endif
200 endif
201 ifeq (yesyes,$(have-fpie)$(build-shared))
202 tests: $(objpfx)tst-pie1.out
203 endif
204 tests: $(objpfx)tst-leaks1-mem
205 tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
206 tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
207 modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
208 testobj1_1 failobj constload2 constload3 unloadmod \
209 dep1 dep2 dep3 dep4 vismod1 vismod2 vismod3 \
210 nodelmod1 nodelmod2 nodelmod3 nodelmod4 \
211 nodel2mod1 nodel2mod2 nodel2mod3 \
212 nodlopenmod nodlopenmod2 filtmod1 filtmod2 \
213 reldepmod1 reldepmod2 reldepmod3 reldepmod4 nextmod1 nextmod2 \
214 reldep4mod1 reldep4mod2 reldep4mod3 reldep4mod4 \
215 neededobj1 neededobj2 neededobj3 neededobj4 \
216 neededobj5 neededobj6 firstobj globalmod1 \
217 unload2mod unload2dep ltglobmod1 ltglobmod2 pathoptobj \
218 dblloadmod1 dblloadmod2 dblloadmod3 reldepmod5 reldepmod6 \
219 reldep6mod0 reldep6mod1 reldep6mod2 reldep6mod3 reldep6mod4 \
220 reldep7mod1 reldep7mod2 \
221 tst-tlsmod1 tst-tlsmod2 tst-tlsmod3 tst-tlsmod4 \
222 tst-tlsmod5 tst-tlsmod6 tst-tlsmod7 tst-tlsmod8 \
223 tst-tlsmod9 tst-tlsmod10 tst-tlsmod11 tst-tlsmod12 \
224 tst-tlsmod13 tst-tlsmod13a tst-tlsmod14a tst-tlsmod14b \
225 tst-tlsmod15a tst-tlsmod15b tst-tlsmod16a tst-tlsmod16b \
226 $(patsubst %,tst-tlsmod17a%,$(tlsmod17a-suffixes)) \
227 tst-tlsmod17b \
228 $(patsubst %,tst-tlsmod18a%,$(tlsmod18a-suffixes)) \
229 circlemod1 circlemod1a circlemod2 circlemod2a \
230 circlemod3 circlemod3a \
231 reldep8mod1 reldep8mod2 reldep8mod3 \
232 reldep9mod1 reldep9mod2 reldep9mod3 \
233 tst-alignmod tst-alignmod2 \
234 $(modules-execstack-$(have-z-execstack)) \
235 tst-dlopenrpathmod tst-deep1mod1 tst-deep1mod2 tst-deep1mod3 \
236 tst-dlmopen1mod tst-auditmod1 \
237 tst-auditmod3a tst-auditmod3b \
238 unload3mod1 unload3mod2 unload3mod3 unload3mod4 \
239 unload4mod1 unload4mod2 unload4mod3 unload4mod4 \
240 unload6mod1 unload6mod2 unload6mod3 \
241 unload7mod1 unload7mod2 \
242 order2mod1 order2mod2 order2mod3 order2mod4
243 ifeq (yes,$(have-initfini-array))
244 modules-names += tst-array2dep tst-array5dep
245 endif
246 ifeq (yesyes,$(have-fpie)$(build-shared))
247 modules-names += tst-piemod1
248 endif
249 modules-execstack-yes = tst-execstack-mod
250 extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
251 # We need this variable to be sure the test modules get the right CPPFLAGS.
252 test-extras += $(modules-names)
254 # filtmod1.so has a special rule
255 modules-names-nobuild := filtmod1
257 ifeq (yes,$(multi-arch))
258 tests-static += ifuncmain1static ifuncmain1picstatic \
259 ifuncmain2static ifuncmain2picstatic \
260 ifuncmain4static ifuncmain4picstatic \
261 ifuncmain5static ifuncmain5picstatic \
262 ifuncmain7static ifuncmain7picstatic
264 ifeq (yes,$(build-shared))
265 tests += ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \
266 ifuncmain1staticpic \
267 ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \
268 ifuncmain5 ifuncmain5pic ifuncmain5staticpic \
269 ifuncmain7 ifuncmain7pic
270 ifeq (yes,$(have-fpie))
271 tests: $(objpfx)ifuncmain1pie.out $(objpfx)ifuncmain1vispie.out \
272 $(objpfx)ifuncmain1staticpie.out $(objpfx)ifuncmain5pie.out \
273 $(objpfx)ifuncmain6pie.out $(objpfx)ifuncmain7pie.out
274 endif
275 modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6
276 endif
277 endif
280 include ../Rules
282 check-abi: check-abi-ld
283 update-abi: update-abi-ld
285 ifeq (yes,$(build-shared))
286 # Make sure these things are built in the `make lib' pass so they can be used
287 # to run programs during the `make others' pass.
288 lib-noranlib: $(objpfx)$(rtld-installed-name) \
289 $(addprefix $(objpfx),$(extra-objs))
290 endif
292 # Command to link into a larger single relocatable object.
293 reloc-link = $(LINK.o) -nostdlib -nostartfiles -r
295 $(objpfx)dl-allobjs.os: $(all-rtld-routines:%=$(objpfx)%.os)
296 $(reloc-link) -o $@ $^
298 # Link together the dynamic linker into a single relocatable object.
299 # First we do a link against libc_pic.a just to get a link map,
300 # and discard the object produced by that link. From the link map
301 # we can glean all the libc modules that need to go into the dynamic
302 # linker. Then we do a recursive make that goes into all the subdirs
303 # those modules come from and builds special rtld-foo.os versions that
304 # are compiled with special flags, and puts these modules into rtld-libc.a
305 # for us. Then we do the real link using rtld-libc.a instead of libc_pic.a.
307 $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
308 @-rm -f $@T
309 $(reloc-link) -o $@.o '-Wl,-(' $^ -lgcc '-Wl,-)' -Wl,-Map,$@T
310 rm -f $@.o
311 mv -f $@T $@
313 $(objpfx)librtld.mk: $(objpfx)librtld.map Makefile
314 LC_ALL=C \
315 sed -n 's@^$(common-objpfx)\([^(]*\)(\([^)]*\.os\)) *.*$$@\1 \2@p' \
316 $< | \
317 while read lib file; do \
318 case $$lib in \
319 libc_pic.a) \
320 LC_ALL=C fgrep -l /$$file \
321 $(common-objpfx)stamp.os $(common-objpfx)*/stamp.os | \
322 LC_ALL=C \
323 sed 's@^$(common-objpfx)\([^/]*\)/stamp\.os$$@rtld-\1'" +=$$file@"\
324 ;; \
325 */*.a) \
326 echo rtld-$${lib%%/*} += $$file ;; \
327 *) echo "Wasn't expecting $$lib($$file)" >&2; exit 1 ;; \
328 esac; \
329 done > $@T
330 echo rtld-subdirs = `LC_ALL=C sed 's/^rtld-\([^ ]*\).*$$/\1/' $@T \
331 | LC_ALL=C sort -u` >> $@T
332 mv -f $@T $@
334 $(objpfx)rtld-libc.a: $(objpfx)librtld.mk FORCE
335 $(MAKE) -f $< -f rtld-Rules
337 $(objpfx)librtld.os: $(objpfx)dl-allobjs.os $(objpfx)rtld-libc.a
338 $(LINK.o) -nostdlib -nostartfiles -r -o $@ '-Wl,-(' $^ -lgcc '-Wl,-)' \
339 -Wl,-Map,$@.map
341 generated += librtld.map librtld.mk rtld-libc.a librtld.os.map
343 z-now-yes = -Wl,-z,now
345 $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
346 @rm -f $@.lds
347 $(LINK.o) -nostdlib -nostartfiles -shared $(z-now-$(bind-now)) \
348 $(LDFLAGS-rtld) -Wl,-z,defs -Wl,--verbose 2>&1 | \
349 LC_ALL=C \
350 sed -e '/^=========/,/^=========/!d;/^=========/d' \
351 -e 's/\. = .* + SIZEOF_HEADERS;/& _begin = . - SIZEOF_HEADERS;/' \
352 > $@.lds
353 $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
354 $(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \
355 $(filter-out $(map-file),$^) $(load-map-file) \
356 -Wl,-soname=$(rtld-installed-name) -T $@.lds
357 rm -f $@.lds
358 readelf -s $@ \
359 | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
361 # interp.c exists just to get this string into the libraries.
362 CFLAGS-interp.c = -D'RUNTIME_LINKER="$(slibdir)/$(rtld-installed-name)"' \
363 -DNOT_IN_libc=1
364 $(objpfx)interp.os: $(common-objpfx)config.make
366 ifneq (ld.so,$(rtld-installed-name))
367 # Make sure ld.so.1 exists in the build directory so we can link
368 # against it.
369 $(objpfx)$(rtld-installed-name): $(objpfx)ld.so
370 rm -f $@
371 ln -s $(<F) $@
372 generated += $(rtld-installed-name)
373 endif
375 # Build a file mentioning all trustworthy directories to look for shared
376 # libraries when using LD_LIBRARY_PATH in a setuid program. The user can
377 # add directories to the list by defining $(user-defined-trusted-dirs)
378 # before starting make.
379 $(objpfx)trusted-dirs.h: $(objpfx)trusted-dirs.st; @:
380 $(objpfx)trusted-dirs.st: Makefile $(..)Makeconfig
381 $(make-target-directory)
382 echo "$(subst :, ,$(default-rpath) $(user-defined-trusted-dirs))" \
383 | $(AWK) -f gen-trusted-dirs.awk > ${@:st=T};
384 echo '#define DL_DST_LIB "$(notdir $(slibdir))"' >> ${@:st=T}
385 $(move-if-change) ${@:st=T} ${@:st=h}
386 touch $@
387 CPPFLAGS-dl-load.c = -I$(objpfx). -I$(csu-objpfx).
389 ifeq (yes,$(build-shared))
390 $(inst_slibdir)/$(rtld-version-installed-name): $(objpfx)ld.so $(+force)
391 $(make-target-directory)
392 $(do-install-program)
394 $(inst_slibdir)/$(rtld-installed-name): \
395 $(inst_slibdir)/$(rtld-version-installed-name) \
396 $(inst_slibdir)/libc-$(version).so
397 $(make-shlib-link)
399 # Special target called by parent to install just the dynamic linker.
400 .PHONY: ldso_install
401 ldso_install: $(inst_slibdir)/$(rtld-installed-name)
402 endif
405 common-ldd-rewrite = -e 's%@RTLD@%$(slibdir)/$(rtld-installed-name)%g' \
406 -e 's%@VERSION@%$(version)%g'
407 sh-ldd-rewrite = $(common-ldd-rewrite) -e 's%@BASH@%/bin/sh%g;s/\$$"/"/g'
408 bash-ldd-rewrite = $(common-ldd-rewrite) -e 's%@BASH@%$(BASH)%g' \
409 -e 's%@TEXTDOMAINDIR@%$(msgcatdir)%g'
411 ifneq ($(have-bash2),yes)
412 ldd-shell = sh
413 else
414 ldd-shell = bash
415 endif
417 ifeq ($(ldd-rewrite-script),no)
418 define gen-ldd
419 LC_ALL=C sed $($(ldd-shell)-ldd-rewrite) < $< > $@.new
420 endef
421 else
422 define gen-ldd
423 LC_ALL=C sed $($(ldd-shell)-ldd-rewrite) < $< | LC_ALL=C sed -f $(ldd-rewrite-script) > $@.new
424 endef
425 endif
427 $(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \
428 $(common-objpfx)config.make
429 $(gen-ldd)
430 chmod 555 $@.new
431 mv -f $@.new $@
433 $(objpfx)sprof: $(libdl)
435 $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
436 SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
437 CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
438 -D'SLIBDIR="$(slibdir)"' -DIS_IN_ldconfig=1
439 CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
440 CFLAGS-cache.c = $(SYSCONF-FLAGS)
442 CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),-DNOT_IN_libc=1 -DIS_IN_rtld=1)
444 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
445 generated += $(addsuffix .so,$(strip $(modules-names)))
447 ifeq (yes,$(build-shared))
448 ifeq ($(cross-compiling),no)
449 tests: $(objpfx)tst-pathopt.out
450 endif
451 endif
453 $(objpfx)testobj1.so: $(libdl)
454 $(objpfx)testobj1_1.so: $(objpfx)testobj1.so $(libdl)
455 $(objpfx)testobj2.so: $(objpfx)testobj1.so $(libdl)
456 $(objpfx)testobj3.so: $(libdl)
457 $(objpfx)testobj4.so: $(libdl)
458 $(objpfx)testobj5.so: $(libdl)
459 $(objpfx)testobj6.so: $(objpfx)testobj1.so $(objpfx)testobj2.so $(libdl)
460 $(objpfx)failobj.so: $(objpfx)testobj6.so
461 $(objpfx)dep1.so: $(objpfx)dep2.so $(objpfx)dep4.so
462 $(objpfx)dep2.so: $(objpfx)dep3.so $(objpfx)dep4.so
463 $(objpfx)dep4.so: $(objpfx)dep3.so
464 $(objpfx)nodelmod3.so: $(objpfx)nodelmod4.so
465 $(objpfx)nextmod1.so: $(libdl)
466 $(objpfx)neededobj1.so: $(libdl)
467 $(objpfx)neededobj2.so: $(objpfx)neededobj1.so $(libdl)
468 $(objpfx)neededobj3.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so $(libdl)
469 $(objpfx)neededobj4.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
470 $(objpfx)neededobj3.so $(libdl)
471 $(objpfx)neededobj6.so: $(objpfx)neededobj5.so
472 $(objpfx)unload2mod.so: $(objpfx)unload2dep.so
473 $(objpfx)ltglobmod2.so: $(libdl)
474 $(objpfx)firstobj.so: $(shared-thread-library)
475 $(objpfx)globalmod1.so: $(libdl)
476 $(objpfx)reldep4mod1.so: $(objpfx)reldep4mod3.so
477 $(objpfx)reldep4mod2.so: $(objpfx)reldep4mod4.so
478 $(objpfx)dblloadmod1.so: $(objpfx)dblloadmod3.so
479 $(objpfx)dblloadmod2.so: $(objpfx)dblloadmod3.so
480 $(objpfx)reldepmod5.so: $(objpfx)reldepmod2.so
481 $(objpfx)reldepmod6.so: $(objpfx)reldepmod2.so
482 $(objpfx)reldep6mod1.so: $(objpfx)reldep6mod0.so
483 $(objpfx)reldep6mod2.so: $(objpfx)reldep6mod1.so
484 $(objpfx)reldep6mod3.so: $(objpfx)reldep6mod2.so
485 $(objpfx)reldep6mod4.so: $(objpfx)reldep6mod1.so
486 $(objpfx)tst-tlsmod3.so: $(objpfx)tst-tlsmod2.so
487 $(objpfx)tst-tlsmod8.so: $(objpfx)tst-tlsmod7.so
488 $(objpfx)tst-tlsmod10.so: $(objpfx)tst-tlsmod9.so
489 $(objpfx)tst-tlsmod12.so: $(objpfx)tst-tlsmod11.so
490 $(objpfx)tst-tlsmod13a.so: $(objpfx)tst-tlsmod13.so
491 # For tst-tls9-static, make sure the modules it dlopens have libc.so in DT_NEEDED
492 $(objpfx)tst-tlsmod5.so: $(common-objpfx)libc.so
493 $(objpfx)tst-tlsmod6.so: $(common-objpfx)libc.so
494 $(objpfx)reldep8mod3.so: $(objpfx)reldep8mod1.so $(objpfx)reldep8mod2.so
495 $(objpfx)nodel2mod3.so: $(objpfx)nodel2mod1.so $(objpfx)nodel2mod2.so
496 $(objpfx)reldep9mod2.so: $(objpfx)reldep9mod1.so
497 $(objpfx)reldep9mod3.so: $(objpfx)reldep9mod1.so $(objpfx)reldep9mod2.so
498 $(objpfx)unload3mod1.so: $(objpfx)unload3mod3.so
499 $(objpfx)unload3mod2.so: $(objpfx)unload3mod3.so
500 $(objpfx)unload3mod3.so: $(objpfx)unload3mod4.so
501 $(objpfx)unload4mod1.so: $(objpfx)unload4mod2.so $(objpfx)unload4mod3.so
502 $(objpfx)unload4mod2.so: $(objpfx)unload4mod4.so $(objpfx)unload4mod3.so
503 $(objpfx)unload6mod1.so: $(libdl)
504 $(objpfx)unload6mod2.so: $(libdl)
505 $(objpfx)unload6mod3.so: $(libdl)
506 $(objpfx)unload7mod1.so: $(libdl)
507 $(objpfx)unload7mod2.so: $(objpfx)unload7mod1.so
509 LDFLAGS-tst-tlsmod5.so = -nostdlib
510 LDFLAGS-tst-tlsmod6.so = -nostdlib
512 testobj1.so-no-z-defs = yes
513 testobj3.so-no-z-defs = yes
514 testobj4.so-no-z-defs = yes
515 testobj5.so-no-z-defs = yes
516 testobj6.so-no-z-defs = yes
517 failobj.so-no-z-defs = yes
518 constload2.so-no-z-defs = yes
519 constload3.so-no-z-defs = yes
520 nodelmod1.so-no-z-defs = yes
521 nodelmod2.so-no-z-defs = yes
522 nodelmod4.so-no-z-defs = yes
523 nodel2mod2.so-no-z-defs = yes
524 reldepmod2.so-no-z-defs = yes
525 reldepmod3.so-no-z-defs = yes
526 reldepmod4.so-no-z-defs = yes
527 reldep4mod4.so-no-z-defs = yes
528 reldep4mod2.so-no-z-defs = yes
529 ltglobmod2.so-no-z-defs = yes
530 dblloadmod3.so-no-z-defs = yes
531 tst-tlsmod1.so-no-z-defs = yes
532 tst-tlsmod2.so-no-z-defs = yes
533 tst-tlsmod3.so-no-z-defs = yes
534 tst-tlsmod4.so-no-z-defs = yes
535 tst-tlsmod7.so-no-z-defs = yes
536 tst-tlsmod8.so-no-z-defs = yes
537 tst-tlsmod9.so-no-z-defs = yes
538 tst-tlsmod10.so-no-z-defs = yes
539 tst-tlsmod12.so-no-z-defs = yes
540 tst-tlsmod14a.so-no-z-defs = yes
541 tst-tlsmod14b.so-no-z-defs = yes
542 tst-tlsmod15a.so-no-z-defs = yes
543 tst-tlsmod16b.so-no-z-defs = yes
544 circlemod2.so-no-z-defs = yes
545 circlemod3.so-no-z-defs = yes
546 circlemod3a.so-no-z-defs = yes
547 reldep8mod2.so-no-z-defs = yes
548 reldep9mod1.so-no-z-defs = yes
549 unload3mod4.so-no-z-defs = yes
550 unload4mod1.so-no-z-defs = yes
551 ifuncmod1.so-no-z-defs = yes
552 ifuncmod5.so-no-z-defs = yes
553 ifuncmod6.so-no-z-defs = yes
555 ifeq ($(build-shared),yes)
556 # Build all the modules even when not actually running test programs.
557 tests: $(test-modules)
558 endif
560 $(objpfx)loadtest: $(libdl)
561 LDFLAGS-loadtest = -rdynamic
563 $(objpfx)loadtest.out: $(test-modules)
565 $(objpfx)neededtest: $(libdl)
566 $(objpfx)neededtest.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
567 $(objpfx)neededobj3.so
569 $(objpfx)neededtest2: $(libdl)
570 $(objpfx)neededtest2.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
571 $(objpfx)neededobj3.so
573 $(objpfx)neededtest3: $(libdl)
574 $(objpfx)neededtest3.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
575 $(objpfx)neededobj3.so $(objpfx)neededobj4.so
577 neededtest4-ENV = LC_ALL=C LANGUAGE=C
578 $(objpfx)neededtest4: $(libdl) $(objpfx)neededobj1.so
579 $(objpfx)neededtest4.out: $(objpfx)neededobj5.so $(objpfx)neededobj6.so
581 $(objpfx)restest1: $(objpfx)testobj1.so $(objpfx)testobj1_1.so $(libdl)
582 LDFLAGS-restest1 = -rdynamic
584 $(objpfx)restest2: $(libdl)
585 LDFLAGS-restest2 = -rdynamic
587 $(objpfx)restest1.out: $(test-modules)
589 preloadtest-preloads = testobj1 testobj2 testobj3 testobj4 testobj5
590 $(objpfx)preloadtest: $(objpfx)testobj6.so
591 LDFLAGS-preloadtest = -rdynamic
592 $(objpfx)preloadtest.out: $(preloadtest-preloads:%=$(objpfx)%.so)
593 preloadtest-ENV = \
594 LD_PRELOAD=$(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
596 $(objpfx)loadfail: $(libdl)
597 LDFLAGS-loadfail = -rdynamic
599 $(objpfx)loadfail.out: $(objpfx)failobj.so
601 $(objpfx)multiload: $(libdl)
602 LDFLAGS-multiload = -rdynamic
603 CFLAGS-multiload.c = -DOBJDIR=\"$(elf-objpfx)\"
605 $(objpfx)multiload.out: $(objpfx)testobj1.so
607 $(objpfx)origtest: $(libdl)
608 LDFLAGS-origtest = -rdynamic
609 $(objpfx)origtest.out: $(objpfx)testobj1.so
611 ifeq ($(have-thread-library),yes)
612 $(objpfx)resolvfail: $(libdl) $(shared-thread-library)
613 else
614 $(objpfx)resolvfail: $(libdl)
615 endif
617 $(objpfx)constload1: $(libdl)
618 $(objpfx)constload1.out: $(objpfx)constload2.so $(objpfx)constload3.so
620 $(objpfx)circleload1: $(libdl)
621 $(objpfx)circleload1.out: $(objpfx)circlemod1.so \
622 $(objpfx)circlemod1a.so
624 $(objpfx)circlemod1.so: $(objpfx)circlemod2.so
625 $(objpfx)circlemod2.so: $(objpfx)circlemod3.so
626 $(objpfx)circlemod1a.so: $(objpfx)circlemod2a.so
627 $(objpfx)circlemod2a.so: $(objpfx)circlemod3a.so
629 $(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so)
631 $(objpfx)order.out: $(objpfx)order
632 $(elf-objpfx)$(rtld-installed-name) \
633 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
634 $(objpfx)order > $@
635 (echo "0123456789" | cmp $@ -) > /dev/null
637 $(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so)
638 $(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
639 vismain-ENV = LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
641 $(objpfx)noload: $(objpfx)testobj1.so
642 LDFLAGS-noload = -rdynamic
643 $(objpfx)noload.out: $(objpfx)testobj5.so
645 LDFLAGS-nodelete = -rdynamic
646 LDFLAGS-nodelmod1.so = -Wl,--enable-new-dtags,-z,nodelete
647 LDFLAGS-nodelmod4.so = -Wl,--enable-new-dtags,-z,nodelete
648 $(objpfx)nodelete: $(libdl)
649 $(objpfx)nodelete.out: $(objpfx)nodelmod1.so $(objpfx)nodelmod2.so \
650 $(objpfx)nodelmod3.so
652 LDFLAGS-nodlopenmod.so = -Wl,--enable-new-dtags,-z,nodlopen
653 $(objpfx)nodlopen: $(libdl)
654 $(objpfx)nodlopen.out: $(objpfx)nodlopenmod.so
656 $(objpfx)nodlopenmod2.so: $(objpfx)nodlopenmod.so
657 $(objpfx)nodlopen2: $(libdl)
658 $(objpfx)nodlopen2.out: $(objpfx)nodlopenmod2.so
660 $(objpfx)filtmod1.so: $(objpfx)filtmod1.os $(objpfx)filtmod2.so
661 $(LINK.o) -shared -o $@ -B$(csu-objpfx) $(LDFLAGS.so) \
662 -L$(subst :, -L,$(rpath-link)) \
663 -Wl,-rpath-link=$(rpath-link) \
664 $< -Wl,-F,$(objpfx)filtmod2.so
665 $(objpfx)filter: $(objpfx)filtmod1.so
667 $(objpfx)unload: $(libdl)
668 $(objpfx)unload.out: $(objpfx)unloadmod.so
670 $(objpfx)reldep: $(libdl)
671 $(objpfx)reldep.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod2.so
673 $(objpfx)reldep2: $(libdl)
674 $(objpfx)reldep2.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod3.so
676 $(objpfx)reldep3: $(libdl)
677 $(objpfx)reldep3.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
679 $(objpfx)reldep4: $(libdl)
680 $(objpfx)reldep4.out: $(objpfx)reldep4mod1.so $(objpfx)reldep4mod2.so
682 $(objpfx)next: $(objpfx)nextmod1.so $(objpfx)nextmod2.so $(libdl)
684 $(objpfx)unload2: $(libdl)
685 $(objpfx)unload2.out: $(objpfx)unload2mod.so $(objpfx)unload2dep.so
687 $(objpfx)lateglobal: $(libdl)
688 $(objpfx)lateglobal.out: $(objpfx)ltglobmod1.so $(objpfx)ltglobmod2.so
690 $(objpfx)tst-pathopt: $(libdl)
691 $(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \
692 $(objpfx)pathoptobj.so
693 $(SHELL) -e $< $(common-objpfx)
695 $(objpfx)initfirst: $(libdl)
696 $(objpfx)initfirst.out: $(objpfx)firstobj.so
698 $(objpfx)global: $(objpfx)globalmod1.so
699 $(objpfx)global.out: $(objpfx)reldepmod1.so
701 $(objpfx)dblload: $(libdl)
702 $(objpfx)dblload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
704 $(objpfx)dblunload: $(libdl)
705 $(objpfx)dblunload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
707 $(objpfx)reldep5: $(libdl)
708 $(objpfx)reldep5.out: $(objpfx)reldepmod5.so $(objpfx)reldepmod6.so
710 $(objpfx)reldep6: $(libdl)
711 $(objpfx)reldep6.out: $(objpfx)reldep6mod3.so $(objpfx)reldep6mod4.so
713 $(objpfx)reldep7: $(libdl)
714 $(objpfx)reldep7.out: $(objpfx)reldep7mod1.so $(objpfx)reldep7mod2.so
716 $(objpfx)reldep8: $(libdl)
717 $(objpfx)reldep8.out: $(objpfx)reldep8mod3.so
719 LDFLAGS-nodel2mod2.so = -Wl,--enable-new-dtags,-z,nodelete
720 $(objpfx)nodelete2: $(libdl)
721 $(objpfx)nodelete2.out: $(objpfx)nodel2mod3.so
723 $(objpfx)reldep9: $(libdl)
724 $(objpfx)reldep9.out: $(objpfx)reldep9mod3.so
726 $(objpfx)tst-tls3: $(objpfx)tst-tlsmod1.so
728 $(objpfx)tst-tls4: $(libdl)
729 $(objpfx)tst-tls4.out: $(objpfx)tst-tlsmod2.so
731 $(objpfx)tst-tls5: $(libdl)
732 $(objpfx)tst-tls5.out: $(objpfx)tst-tlsmod2.so
734 $(objpfx)tst-tls6: $(libdl)
735 $(objpfx)tst-tls6.out: $(objpfx)tst-tlsmod2.so
737 $(objpfx)tst-tls7: $(libdl)
738 $(objpfx)tst-tls7.out: $(objpfx)tst-tlsmod3.so
740 $(objpfx)tst-tls8: $(libdl)
741 $(objpfx)tst-tls8.out: $(objpfx)tst-tlsmod3.so $(objpfx)tst-tlsmod4.so
743 $(objpfx)tst-tls9: $(libdl)
744 $(objpfx)tst-tls9.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
746 $(objpfx)tst-tls10: $(objpfx)tst-tlsmod8.so
748 $(objpfx)tst-tls11: $(objpfx)tst-tlsmod10.so
750 $(objpfx)tst-tls12: $(objpfx)tst-tlsmod12.so
752 $(objpfx)tst-tls13: $(libdl)
753 $(objpfx)tst-tls13.out: $(objpfx)tst-tlsmod13a.so
755 $(objpfx)tst-tls14: $(objpfx)tst-tlsmod14a.so $(libdl)
756 $(objpfx)tst-tls14.out: $(objpfx)tst-tlsmod14b.so
758 $(objpfx)tst-tls15: $(libdl)
759 $(objpfx)tst-tls15.out: $(objpfx)tst-tlsmod15a.so $(objpfx)tst-tlsmod15b.so
761 $(objpfx)tst-tls-dlinfo: $(libdl)
762 $(objpfx)tst-tls-dlinfo.out: $(objpfx)tst-tlsmod2.so
766 $(objpfx)tst-tls16: $(libdl)
767 $(objpfx)tst-tls16.out: $(objpfx)tst-tlsmod16a.so $(objpfx)tst-tlsmod16b.so
769 $(objpfx)tst-tls17: $(libdl)
770 $(objpfx)tst-tls17.out: $(objpfx)tst-tlsmod17b.so
771 $(patsubst %,$(objpfx)tst-tlsmod17a%.os,$(tlsmod17a-suffixes)): $(objpfx)tst-tlsmod17a%.os : tst-tlsmod17a.c
772 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ -DN=$* -DNOT_IN_libc=1 $<
773 $(patsubst %,$(objpfx)tst-tlsmod17a%.so,$(tlsmod17a-suffixes)): $(objpfx)tst-tlsmod17a%.so: $(objpfx)ld.so
774 $(objpfx)tst-tlsmod17b.so: $(patsubst %,$(objpfx)tst-tlsmod17a%.so,$(tlsmod17a-suffixes))
776 $(objpfx)tst-tls18: $(libdl)
777 $(objpfx)tst-tls18.out: $(patsubst %,$(objpfx)tst-tlsmod18a%.so,$(tlsmod18a-suffixes))
778 $(patsubst %,$(objpfx)tst-tlsmod18a%.os,$(tlsmod18a-suffixes)): $(objpfx)tst-tlsmod18a%.os : tst-tlsmod18a.c
779 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ -DN=$* -DNOT_IN_libc=1 $<
780 $(patsubst %,$(objpfx)tst-tlsmod18a%.so,$(tlsmod18a-suffixes)): $(objpfx)tst-tlsmod18a%.so: $(objpfx)ld.so
782 CFLAGS-tst-align.c = $(stack-align-test-flags)
783 CFLAGS-tst-align2.c = $(stack-align-test-flags)
784 CFLAGS-tst-alignmod.c = $(stack-align-test-flags)
785 CFLAGS-tst-alignmod2.c = $(stack-align-test-flags)
786 $(objpfx)tst-align: $(libdl)
787 $(objpfx)tst-align.out: $(objpfx)tst-alignmod.so
788 $(objpfx)tst-align2: $(objpfx)tst-alignmod2.so
790 $(objpfx)unload3: $(libdl)
791 $(objpfx)unload3.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
792 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
794 $(objpfx)unload4: $(libdl)
795 $(objpfx)unload4.out: $(objpfx)unload4mod1.so $(objpfx)unload4mod3.so
797 $(objpfx)unload5: $(libdl)
798 $(objpfx)unload5.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
799 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
801 $(objpfx)unload6: $(libdl)
802 $(objpfx)unload6.out: $(objpfx)unload6mod1.so $(objpfx)unload6mod2.so \
803 $(objpfx)unload6mod3.so
805 $(objpfx)unload7: $(libdl)
806 $(objpfx)unload7.out: $(objpfx)unload7mod1.so $(objpfx)unload7mod2.so
807 unload7-ENV = MALLOC_PERTURB_=85
809 ifdef libdl
810 $(objpfx)tst-tls9-static: $(common-objpfx)dlfcn/libdl.a
811 $(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
812 endif
814 ifeq ($(have-z-execstack),yes)
815 $(objpfx)tst-execstack: $(libdl)
816 $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
817 LDFLAGS-tst-execstack = -Wl,-z,noexecstack
818 LDFLAGS-tst-execstack-mod = -Wl,-z,execstack
820 $(objpfx)tst-execstack-needed: $(objpfx)tst-execstack-mod.so
821 LDFLAGS-tst-execstack-needed = -Wl,-z,noexecstack
823 LDFLAGS-tst-execstack-prog = -Wl,-z,execstack
824 endif
826 $(objpfx)tst-array1.out: $(objpfx)tst-array1
827 $(elf-objpfx)$(rtld-installed-name) \
828 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
829 $(objpfx)tst-array1 > $@
830 cmp $@ tst-array1.exp > /dev/null
832 $(objpfx)tst-array1-static.out: $(objpfx)tst-array1-static
833 $(objpfx)tst-array1-static > $@
834 cmp $@ tst-array1.exp > /dev/null
836 $(objpfx)tst-array2: $(objpfx)tst-array2dep.so
837 $(objpfx)tst-array2.out: $(objpfx)tst-array2
838 $(elf-objpfx)$(rtld-installed-name) \
839 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
840 $(objpfx)tst-array2 > $@
841 cmp $@ tst-array2.exp > /dev/null
843 $(objpfx)tst-array3.out: $(objpfx)tst-array3
844 $(elf-objpfx)$(rtld-installed-name) \
845 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
846 $(objpfx)tst-array3 > $@
847 cmp $@ tst-array1.exp > /dev/null
849 $(objpfx)tst-array4: $(libdl)
850 $(objpfx)tst-array4.out: $(objpfx)tst-array4 $(objpfx)tst-array2dep.so
851 $(elf-objpfx)$(rtld-installed-name) \
852 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
853 $< > $@
854 cmp $@ tst-array4.exp > /dev/null
856 $(objpfx)tst-array5: $(objpfx)tst-array5dep.so
857 $(objpfx)tst-array5.out: $(objpfx)tst-array5
858 $(elf-objpfx)$(rtld-installed-name) \
859 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
860 $(objpfx)tst-array5 > $@
861 cmp $@ tst-array5.exp > /dev/null
863 $(objpfx)tst-array5-static.out: $(objpfx)tst-array5-static
864 $(objpfx)tst-array5-static > $@
865 cmp $@ tst-array5-static.exp > /dev/null
867 ifeq (yesyes,$(have-fpie)$(build-shared))
868 CFLAGS-tst-pie1.c += $(pie-ccflag)
870 $(objpfx)tst-pie1.out: $(objpfx)tst-pie1
871 $(elf-objpfx)$(rtld-installed-name) \
872 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
873 $< > $@
875 $(objpfx)tst-pie1: $(objpfx)tst-pie1.o $(objpfx)tst-piemod1.so
876 $(+link-pie)
878 generated += tst-pie1 tst-pie1.out tst-pie1.o
879 endif
881 check-textrel-CFLAGS = -O -Wall -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
882 $(objpfx)check-textrel: check-textrel.c
883 $(native-compile)
885 check-execstack-CFLAGS = -O -Wall -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -std=gnu99
886 $(objpfx)check-execstack: check-execstack.c
887 $(native-compile)
889 check-localplt-CFLAGS = -O -Wall -D_GNU_SOURCE -std=gnu99
890 $(objpfx)check-localplt: check-localplt.c
891 $(native-compile)
893 ifeq (yes,$(build-shared))
894 tests: $(objpfx)check-textrel.out $(objpfx)check-execstack.out
896 $(objpfx)check-textrel.out: $(objpfx)check-textrel
897 $(dir $<)$(notdir $<) $(common-objpfx)libc.so \
898 $(sort $(wildcard $(common-objpfx)*/lib*.so \
899 $(common-objpfx)iconvdata/*.so)) > $@
900 generated += check-textrel check-textrel.out
902 $(objpfx)check-execstack.out: $(objpfx)check-execstack
903 $(dir $<)$(notdir $<) $(common-objpfx)libc.so \
904 $(sort $(wildcard $(common-objpfx)*/lib*.so \
905 $(common-objpfx)iconvdata/*.so)) > $@
906 generated += check-execstack check-execstack.out
908 $(objpfx)tst-dlmodcount: $(libdl)
909 $(objpfx)tst-dlmodcount.out: $(test-modules)
911 check-data := $(firstword $(wildcard \
912 $(foreach D,$(add-ons) scripts,\
913 $(patsubst %,$(..)$D/data/localplt-%.data,\
914 $(abi-name) \
915 $(addsuffix -$(config-os),\
916 $(config-machine) \
917 $(base-machine)) \
918 generic))))
920 tests: $(objpfx)check-localplt.out
922 ifeq ($(have-thread-library),yes)
923 thread-dso := $(filter-out %_nonshared.a, $(shared-thread-library))
924 endif
926 $(objpfx)check-localplt.out: $(objpfx)check-localplt \
927 $(common-objpfx)libc.so \
928 $(common-objpfx)math/libm.so $(thread-dso) \
929 $(common-objpfx)rt/librt.so \
930 $(common-objpfx)dlfcn/libdl.so \
931 $(common-objpfx)resolv/libresolv.so \
932 $(common-objpfx)crypt/libcrypt.so \
933 $(check-data)
934 $(dir $<)$(notdir $<) $(filter-out $< $(check-data),$^) | \
935 LC_ALL=C sort | \
936 diff -u $(check-data) - > $@
937 endif
939 $(objpfx)tst-dlopenrpathmod.so: $(libdl)
940 $(objpfx)tst-dlopenrpath: $(objpfx)tst-dlopenrpathmod.so $(libdl)
941 CFLAGS-tst-dlopenrpath.c += -DPFX=\"$(objpfx)\"
942 LDFLAGS-tst-dlopenrpathmod.so += -Wl,-rpath,\$$ORIGIN/test-subdir
943 $(objpfx)tst-dlopenrpath.out: $(objpfx)firstobj.so
945 $(objpfx)tst-deep1mod2.so: $(objpfx)tst-deep1mod3.so
946 $(objpfx)tst-deep1: $(libdl) $(objpfx)tst-deep1mod1.so
947 $(objpfx)tst-deep1.out: $(objpfx)tst-deep1mod2.so
948 LDFLAGS-tst-deep1 += -rdynamic
949 tst-deep1mod3.so-no-z-defs = yes
951 $(objpfx)tst-dlmopen1mod.so: $(libdl)
952 $(objpfx)tst-dlmopen1: $(libdl)
953 $(objpfx)tst-dlmopen1.out: $(objpfx)tst-dlmopen1mod.so
955 $(objpfx)tst-dlmopen2: $(libdl)
956 $(objpfx)tst-dlmopen2.out: $(objpfx)tst-dlmopen1mod.so
958 $(objpfx)tst-dlmopen3: $(libdl)
959 $(objpfx)tst-dlmopen3.out: $(objpfx)tst-dlmopen1mod.so
961 $(objpfx)tst-audit1.out: $(objpfx)tst-auditmod1.so
962 tst-audit1-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
964 $(objpfx)tst-audit2.out: $(objpfx)tst-auditmod1.so
965 tst-audit2-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
967 $(objpfx)tst-audit3: $(objpfx)tst-auditmod3a.so
968 $(objpfx)tst-audit3.out: $(objpfx)tst-auditmod3b.so
969 tst-audit3-ENV = LD_AUDIT=$(objpfx)tst-auditmod3b.so
971 $(objpfx)tst-global1: $(libdl)
972 $(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
974 $(objpfx)order2: $(libdl)
975 $(objpfx)order2.out: $(objpfx)order2 $(objpfx)order2mod1.so \
976 $(objpfx)order2mod2.so
977 $(elf-objpfx)$(rtld-installed-name) \
978 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
979 $(objpfx)order2 > $@
980 (echo "12345" | cmp $@ -) > /dev/null
981 $(objpfx)order2mod1.so: $(objpfx)order2mod4.so
982 $(objpfx)order2mod4.so: $(objpfx)order2mod3.so
983 $(objpfx)order2mod2.so: $(objpfx)order2mod3.so
984 order2mod2.so-no-z-defs = yes
986 tst-stackguard1-ARGS = --command "$(built-program-cmd) --child"
987 tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
989 $(objpfx)tst-leaks1: $(libdl)
990 $(objpfx)tst-leaks1-mem: $(objpfx)tst-leaks1.out
991 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1.mtrace > $@
993 tst-leaks1-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1.mtrace
995 $(objpfx)tst-addr1: $(libdl)
997 $(objpfx)tst-thrlock: $(libdl) $(shared-thread-library)
999 CFLAGS-ifuncmain1pic.c += $(pic-ccflag)
1000 CFLAGS-ifuncmain1picstatic.c += $(pic-ccflag)
1001 CFLAGS-ifuncmain1staticpic.c += $(pic-ccflag)
1002 CFLAGS-ifuncdep1pic.c += $(pic-ccflag)
1003 CFLAGS-ifuncmain1vispic.c += $(pic-ccflag)
1004 CFLAGS-ifuncmain2pic.c += $(pic-ccflag)
1005 CFLAGS-ifuncmain2picstatic.c += $(pic-ccflag)
1006 CFLAGS-ifuncdep2pic.c += $(pic-ccflag)
1007 CFLAGS-ifuncmain4picstatic.c += $(pic-ccflag)
1008 CFLAGS-ifuncmain5pic.c += $(pic-ccflag)
1009 CFLAGS-ifuncmain5picstatic.c += $(pic-ccflag)
1010 CFLAGS-ifuncmain5staticpic.c += $(pic-ccflag)
1011 CFLAGS-ifuncdep5pic.c += $(pic-ccflag)
1012 CFLAGS-ifuncmain7pic.c += $(pic-ccflag)
1013 CFLAGS-ifuncmain7picstatic.c += $(pic-ccflag)
1015 LDFLAGS-ifuncmain3 = -Wl,-export-dynamic
1017 ifeq (yesyes,$(have-fpie)$(build-shared))
1018 CFLAGS-ifuncmain1pie.c += $(pie-ccflag)
1019 CFLAGS-ifuncmain1vispie.c += $(pie-ccflag)
1020 CFLAGS-ifuncmain1staticpie.c += $(pie-ccflag)
1021 CFLAGS-ifuncmain5pie.c += $(pie-ccflag)
1022 CFLAGS-ifuncmain6pie.c += $(pie-ccflag)
1023 CFLAGS-ifuncmain7pie.c += $(pie-ccflag)
1025 $(objpfx)ifuncmain1pie.out: $(objpfx)ifuncmain1pie
1026 $(elf-objpfx)$(rtld-installed-name) \
1027 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
1028 $< > $@
1030 $(objpfx)ifuncmain1pie: $(objpfx)ifuncmain1pie.o $(objpfx)ifuncmod1.so
1031 $(+link-pie)
1033 generated += ifuncmain1pie ifuncmain1pie.out
1035 $(objpfx)ifuncmain1staticpie.out: $(objpfx)ifuncmain1staticpie
1036 $(elf-objpfx)$(rtld-installed-name) \
1037 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
1038 $< > $@
1040 $(objpfx)ifuncmain1staticpie: $(objpfx)ifuncmain1staticpie.o $(objpfx)ifuncdep1pic.o
1041 $(+link-pie)
1043 generated += ifuncmain1staticpie ifuncmain1staticpie.out
1045 $(objpfx)ifuncmain1vispie.out: $(objpfx)ifuncmain1vispie
1046 $(elf-objpfx)$(rtld-installed-name) \
1047 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
1048 $< > $@
1050 $(objpfx)ifuncmain1vispie: $(objpfx)ifuncmain1vispie.o $(objpfx)ifuncmod1.so
1051 $(+link-pie)
1053 generated += ifuncmain1vispie ifuncmain1vispie.out
1055 $(objpfx)ifuncmain5pie.out: $(objpfx)ifuncmain5pie
1056 $(elf-objpfx)$(rtld-installed-name) \
1057 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
1058 $< > $@
1060 $(objpfx)ifuncmain5pie: $(objpfx)ifuncmain5pie.o $(objpfx)ifuncmod5.so
1061 $(+link-pie)
1063 generated += ifuncmain5pie ifuncmain5pie.out
1065 $(objpfx)ifuncmain6pie.out: $(objpfx)ifuncmain6pie
1066 $(elf-objpfx)$(rtld-installed-name) \
1067 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
1068 $< > $@
1070 $(objpfx)ifuncmain6pie: $(objpfx)ifuncmain6pie.o $(objpfx)ifuncmod6.so
1071 $(+link-pie)
1073 generated += ifuncmain6pie ifuncmain6pie.out
1075 $(objpfx)ifuncmain7pie.out: $(objpfx)ifuncmain7pie
1076 $(elf-objpfx)$(rtld-installed-name) \
1077 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
1078 $< > $@
1080 $(objpfx)ifuncmain7pie: $(objpfx)ifuncmain7pie.o
1081 $(+link-pie)
1083 generated += ifuncmain7pie ifuncmain7pie.out
1084 endif
1086 $(objpfx)ifuncmain1: $(addprefix $(objpfx),ifuncmod1.so)
1087 $(objpfx)ifuncmain1pic: $(addprefix $(objpfx),ifuncmod1.so)
1088 $(objpfx)ifuncmain1staticpic: $(addprefix $(objpfx),ifuncdep1pic.o)
1089 $(objpfx)ifuncmain1static: $(addprefix $(objpfx),ifuncdep1.o)
1090 $(objpfx)ifuncmain1picstatic: $(addprefix $(objpfx),ifuncdep1pic.o)
1091 $(objpfx)ifuncmain1vis: $(addprefix $(objpfx),ifuncmod1.so)
1092 $(objpfx)ifuncmain1vispic: $(addprefix $(objpfx),ifuncmod1.so)
1093 $(objpfx)ifuncmain2: $(addprefix $(objpfx),ifuncdep2.o)
1094 $(objpfx)ifuncmain2pic: $(addprefix $(objpfx),ifuncdep2pic.o)
1095 $(objpfx)ifuncmain2static: $(addprefix $(objpfx),ifuncdep2.o)
1096 $(objpfx)ifuncmain2picstatic: $(addprefix $(objpfx),ifuncdep2pic.o)
1098 $(objpfx)ifuncmain3: $(libdl)
1099 $(objpfx)ifuncmain3.out: $(objpfx)ifuncmod3.so
1101 $(objpfx)ifuncmain5: $(addprefix $(objpfx),ifuncmod5.so)
1102 $(objpfx)ifuncmain5pic: $(addprefix $(objpfx),ifuncmod5.so)
1103 $(objpfx)ifuncmain5static: $(addprefix $(objpfx),ifuncdep5.o)
1104 $(objpfx)ifuncmain5staticpic: $(addprefix $(objpfx),ifuncdep5pic.o)
1105 $(objpfx)ifuncmain5picstatic: $(addprefix $(objpfx),ifuncdep5pic.o)