Hurd: Fix mlock in all cases except non-readable pages.
[glibc.git] / elf / Makefile
blob8743ee0cebacceb3321b9e735364c597fa2a39ce
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 headers = elf.h bits/elfclass.h link.h bits/link.h
23 routines = $(dl-routines) dl-support dl-iteratephdr \
24 dl-addr enbl-secure dl-profstub \
25 dl-origin dl-libc dl-sym dl-tsd dl-sysdep
27 # The core dynamic linking functions are in libc for the static and
28 # profiled libraries.
29 dl-routines = $(addprefix dl-,load cache lookup object reloc deps \
30 runtime error init fini debug misc \
31 version profile conflict tls origin scope \
32 execstack caller open close trampoline)
33 all-dl-routines = $(dl-routines) $(sysdep-dl-routines)
34 # But they are absent from the shared libc, because that code is in ld.so.
35 elide-routines.os = $(all-dl-routines) dl-support enbl-secure dl-origin \
36 dl-sysdep
37 shared-only-routines += dl-caller
39 # ld.so uses those routines, plus some special stuff for being the program
40 # interpreter and operating independent of libc.
41 rtld-routines := rtld $(dl-routines) dl-sysdep dl-environ dl-minimal
42 all-rtld-routines = $(rtld-routines) $(sysdep-rtld-routines)
44 CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
45 CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
46 CFLAGS-dl-iterate-phdr.c = $(uses-callbacks)
48 include ../Makeconfig
50 ifeq ($(unwind-find-fde),yes)
51 routines += unwind-dw2-fde-glibc
52 shared-only-routines += unwind-dw2-fde-glibc
53 endif
55 before-compile = $(objpfx)trusted-dirs.h
56 generated := trusted-dirs.h trusted-dirs.st for-renamed/renamed.so
57 generated-dirs := for-renamed
59 ifeq ($(versioning),yes)
60 ld-map = $(common-objpfx)ld.map
61 endif
63 ifeq (yes,$(build-shared))
64 extra-objs = $(all-rtld-routines:%=%.os) soinit.os sofini.os interp.os
65 generated += librtld.os dl-allobjs.os ld.so ldd
66 install-others = $(inst_slibdir)/$(rtld-installed-name)
67 install-bin-script = ldd
68 endif
70 others = sprof sln pldd
71 install-bin = sprof pldd
72 others-static = sln
73 install-rootsbin = sln
75 ifeq (yes,$(use-ldconfig))
76 ifeq (yes,$(build-shared))
77 others-static += ldconfig
78 others += ldconfig
79 install-rootsbin += ldconfig
81 ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon
82 extra-objs += $(ldconfig-modules:=.o)
84 pldd-modules := xmalloc
86 # To find xmalloc.c and xstrdup.c
87 vpath %.c ../locale/programs
89 endif
90 endif
92 ifeq ($(have-ksh)$(build-shared),yesyes)
93 extra-objs += sotruss-lib.os sotruss-lib.so
94 install-others += $(inst_auditdir)/sotruss-lib.so
95 install-bin-script += sotruss
96 generated += sotruss
97 CPPFLAGS-sotruss-lib = -DNOT_IN_libc
98 $(objpfx)sotruss-lib.so: $(objpfx)sotruss-lib.os
99 $(build-module-asneeded)
100 $(objpfx)sotruss-lib.so: $(common-objpfx)libc.so $(objpfx)ld.so \
101 $(common-objpfx)libc_nonshared.a
103 $(objpfx)sotruss: sotruss.ksh $(common-objpfx)config.make
104 sed -e 's%@KSH@%$(KSH)%g' \
105 -e 's%@VERSION@%$(version)%g' \
106 -e 's%@TEXTDOMAINDIR@%$(msgcatdir)%g' \
107 -e 's%@PREFIX@%$(prefix)%g' < $< > $@.new
108 chmod 555 $@.new
109 mv -f $@.new $@
110 $(inst_auditdir)/sotruss-lib.so: $(objpfx)sotruss-lib.so $(+force)
111 $(do-install-program)
112 endif
114 tests = tst-tls1 tst-tls2 tst-tls9 tst-leaks1
115 ifeq (yes,$(have-initfini-array))
116 tests += tst-array1 tst-array2 tst-array3 tst-array4 tst-array5
117 endif
118 tests-static = tst-tls1-static tst-tls2-static tst-stackguard1-static
119 ifeq (yes,$(build-shared))
120 tests-static += tst-tls9-static
121 tst-tls9-static-ENV = \
122 LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn
123 endif
124 ifeq (yes,$(have-initfini-array))
125 tests-static += tst-array1-static tst-array5-static
126 endif
127 tests += $(tests-static)
128 ifeq (yes,$(build-shared))
129 tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
130 constload1 order vismain noload filter unload \
131 reldep reldep2 reldep3 reldep4 nodelete nodelete2 \
132 nodlopen nodlopen2 neededtest neededtest2 \
133 neededtest3 neededtest4 unload2 lateglobal initfirst global \
134 restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
135 circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \
136 tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-tls15 \
137 tst-tls16 tst-tls17 tst-tls18 tst-tls19 tst-tls-dlinfo \
138 tst-align tst-align2 $(tests-execstack-$(have-z-execstack)) \
139 tst-dlmodcount tst-dlopenrpath tst-deep1 \
140 tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
141 unload3 unload4 unload5 unload6 unload7 unload8 tst-global1 order2 \
142 tst-audit1 tst-audit2 \
143 tst-stackguard1 tst-addr1 tst-thrlock \
144 tst-unique1 tst-unique2 tst-unique3 tst-unique4 \
145 tst-initorder tst-initorder2 tst-relsort1
146 # reldep9
147 test-srcs = tst-pathopt
148 selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
149 ifneq ($(selinux-enabled),1)
150 tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
151 endif
152 ifeq (x86_64,$(config-machine))
153 tests += tst-audit3 tst-audit4 tst-audit5
154 ifeq (yes,$(config-cflags-avx))
155 tests += tst-audit6 tst-audit7
156 endif
157 endif
158 endif
159 ifeq ($(cross-compiling),no)
160 tests: $(objpfx)tst-leaks1-mem $(objpfx)noload-mem
161 endif
162 tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
163 tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
164 tlsmod17a-modules = $(addprefix tst-tlsmod17a, $(tlsmod17a-suffixes))
165 tlsmod18a-modules = $(addprefix tst-tlsmod18a, $(tlsmod17a-suffixes))
166 extra-test-objs += $(tlsmod17a-modules:=.os) $(tlsmod18a-modules:=.os)
167 test-extras += tst-tlsmod17a tst-tlsmod18a
168 modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
169 testobj1_1 failobj constload2 constload3 unloadmod \
170 dep1 dep2 dep3 dep4 vismod1 vismod2 vismod3 \
171 nodelmod1 nodelmod2 nodelmod3 nodelmod4 \
172 nodel2mod1 nodel2mod2 nodel2mod3 \
173 nodlopenmod nodlopenmod2 filtmod1 filtmod2 \
174 reldepmod1 reldepmod2 reldepmod3 reldepmod4 nextmod1 nextmod2 \
175 reldep4mod1 reldep4mod2 reldep4mod3 reldep4mod4 \
176 neededobj1 neededobj2 neededobj3 neededobj4 \
177 neededobj5 neededobj6 firstobj globalmod1 \
178 unload2mod unload2dep ltglobmod1 ltglobmod2 pathoptobj \
179 dblloadmod1 dblloadmod2 dblloadmod3 reldepmod5 reldepmod6 \
180 reldep6mod0 reldep6mod1 reldep6mod2 reldep6mod3 reldep6mod4 \
181 reldep7mod1 reldep7mod2 \
182 tst-tlsmod1 tst-tlsmod2 tst-tlsmod3 tst-tlsmod4 \
183 tst-tlsmod5 tst-tlsmod6 tst-tlsmod7 tst-tlsmod8 \
184 tst-tlsmod9 tst-tlsmod10 tst-tlsmod11 tst-tlsmod12 \
185 tst-tlsmod13 tst-tlsmod13a tst-tlsmod14a tst-tlsmod14b \
186 tst-tlsmod15a tst-tlsmod15b tst-tlsmod16a tst-tlsmod16b \
187 $(tlsmod17a-modules) tst-tlsmod17b $(tlsmod18a-modules) \
188 tst-tls19mod1 tst-tls19mod2 tst-tls19mod3 \
189 circlemod1 circlemod1a circlemod2 circlemod2a \
190 circlemod3 circlemod3a \
191 reldep8mod1 reldep8mod2 reldep8mod3 \
192 reldep9mod1 reldep9mod2 reldep9mod3 \
193 tst-alignmod tst-alignmod2 \
194 $(modules-execstack-$(have-z-execstack)) \
195 tst-dlopenrpathmod tst-deep1mod1 tst-deep1mod2 tst-deep1mod3 \
196 tst-dlmopen1mod tst-auditmod1 \
197 unload3mod1 unload3mod2 unload3mod3 unload3mod4 \
198 unload4mod1 unload4mod2 unload4mod3 unload4mod4 \
199 unload6mod1 unload6mod2 unload6mod3 \
200 unload7mod1 unload7mod2 \
201 unload8mod1 unload8mod1x unload8mod2 unload8mod3 \
202 order2mod1 order2mod2 order2mod3 order2mod4 \
203 tst-unique1mod1 tst-unique1mod2 \
204 tst-unique2mod1 tst-unique2mod2 \
205 tst-unique3lib tst-unique3lib2 \
206 tst-unique4lib \
207 tst-initordera1 tst-initorderb1 \
208 tst-initordera2 tst-initorderb2 \
209 tst-initordera3 tst-initordera4 \
210 tst-initorder2a tst-initorder2b tst-initorder2c \
211 tst-initorder2d \
212 tst-relsort1mod1 tst-relsort1mod2
213 ifeq (yes,$(have-initfini-array))
214 modules-names += tst-array2dep tst-array5dep
215 endif
216 ifeq (yesyes,$(have-fpie)$(build-shared))
217 modules-names += tst-piemod1
218 tests += tst-pie1
219 tests-pie += tst-pie1
220 endif
221 ifeq (x86_64,$(config-machine))
222 modules-names += tst-auditmod3a tst-auditmod3b \
223 tst-auditmod4a tst-auditmod4b \
224 tst-auditmod5a tst-auditmod5b \
225 tst-auditmod6a tst-auditmod6b tst-auditmod6c \
226 tst-auditmod7a tst-auditmod7b
227 endif
228 modules-execstack-yes = tst-execstack-mod
229 extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
230 # We need this variable to be sure the test modules get the right CPPFLAGS.
231 test-extras += $(modules-names)
233 # filtmod1.so has a special rule
234 modules-names-nobuild := filtmod1
236 ifneq (no,$(multi-arch))
237 tests-static += ifuncmain1static ifuncmain1picstatic \
238 ifuncmain2static ifuncmain2picstatic \
239 ifuncmain4static ifuncmain4picstatic \
240 ifuncmain5static ifuncmain5picstatic \
241 ifuncmain7static ifuncmain7picstatic
243 ifeq (yes,$(build-shared))
244 tests += ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \
245 ifuncmain1staticpic \
246 ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \
247 ifuncmain5 ifuncmain5pic ifuncmain5staticpic \
248 ifuncmain7 ifuncmain7pic
249 ifunc-test-modules = ifuncdep1 ifuncdep1pic ifuncdep2 ifuncdep2pic \
250 ifuncdep5 ifuncdep5pic
251 extra-test-objs += $(ifunc-test-modules:=.o)
252 test-extras += $(ifunc-test-modules)
253 ifeq (yes,$(have-fpie))
254 ifunc-pie-tests = ifuncmain1pie ifuncmain1vispie ifuncmain1staticpie \
255 ifuncmain5pie ifuncmain6pie ifuncmain7pie
256 tests += $(ifunc-pie-tests)
257 tests-pie += $(ifunc-pie-tests)
258 endif
259 modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6
260 endif
261 endif
264 include ../Rules
266 check-abi: check-abi-ld
267 update-abi: update-abi-ld
269 ifeq (yes,$(build-shared))
270 # Make sure these things are built in the `make lib' pass so they can be used
271 # to run programs during the `make others' pass.
272 lib-noranlib: $(objpfx)$(rtld-installed-name) \
273 $(addprefix $(objpfx),$(extra-objs))
274 endif
276 # Command to link into a larger single relocatable object.
277 reloc-link = $(LINK.o) -nostdlib -nostartfiles -r
279 $(objpfx)sotruss-lib.so: $(shlib-lds)
281 $(objpfx)dl-allobjs.os: $(all-rtld-routines:%=$(objpfx)%.os)
282 $(reloc-link) -o $@ $^
284 # Link together the dynamic linker into a single relocatable object.
285 # First we do a link against libc_pic.a just to get a link map,
286 # and discard the object produced by that link. From the link map
287 # we can glean all the libc modules that need to go into the dynamic
288 # linker. Then we do a recursive make that goes into all the subdirs
289 # those modules come from and builds special rtld-foo.os versions that
290 # are compiled with special flags, and puts these modules into rtld-libc.a
291 # for us. Then we do the real link using rtld-libc.a instead of libc_pic.a.
293 $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
294 @-rm -f $@T
295 $(reloc-link) -o $@.o '-Wl,-(' $^ -lgcc '-Wl,-)' -Wl,-Map,$@T
296 rm -f $@.o
297 mv -f $@T $@
299 $(objpfx)librtld.mk: $(objpfx)librtld.map Makefile
300 LC_ALL=C \
301 sed -n 's@^$(common-objpfx)\([^(]*\)(\([^)]*\.os\)) *.*$$@\1 \2@p' \
302 $< | \
303 while read lib file; do \
304 case $$lib in \
305 libc_pic.a) \
306 LC_ALL=C fgrep -l /$$file \
307 $(common-objpfx)stamp.os $(common-objpfx)*/stamp.os | \
308 LC_ALL=C \
309 sed 's@^$(common-objpfx)\([^/]*\)/stamp\.os$$@rtld-\1'" +=$$file@"\
310 ;; \
311 */*.a) \
312 echo rtld-$${lib%%/*} += $$file ;; \
313 *) echo "Wasn't expecting $$lib($$file)" >&2; exit 1 ;; \
314 esac; \
315 done > $@T
316 echo rtld-subdirs = `LC_ALL=C sed 's/^rtld-\([^ ]*\).*$$/\1/' $@T \
317 | LC_ALL=C sort -u` >> $@T
318 mv -f $@T $@
320 $(objpfx)rtld-libc.a: $(objpfx)librtld.mk FORCE
321 $(MAKE) -f $< -f rtld-Rules
323 $(objpfx)librtld.os: $(objpfx)dl-allobjs.os $(objpfx)rtld-libc.a
324 $(LINK.o) -nostdlib -nostartfiles -r -o $@ '-Wl,-(' $^ -lgcc '-Wl,-)' \
325 -Wl,-Map,$@.map
327 generated += librtld.map librtld.mk rtld-libc.a librtld.os.map
329 z-now-yes = -Wl,-z,now
331 $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
332 $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
333 $(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \
334 $(filter-out $(map-file),$^) $(load-map-file) \
335 -Wl,-soname=$(rtld-installed-name) \
336 -Wl,-defsym=_begin=0
337 readelf -s $@ \
338 | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
340 # interp.c exists just to get this string into the libraries.
341 CFLAGS-interp.c = -D'RUNTIME_LINKER="$(slibdir)/$(rtld-installed-name)"' \
342 -DNOT_IN_libc=1
343 $(objpfx)interp.os: $(common-objpfx)config.make
345 ifneq (ld.so,$(rtld-installed-name))
346 # Make sure ld.so.1 exists in the build directory so we can link
347 # against it.
348 $(objpfx)$(rtld-installed-name): $(objpfx)ld.so
349 rm -f $@
350 ln -s $(<F) $@
351 generated += $(rtld-installed-name)
352 endif
354 # Build a file mentioning all trustworthy directories to look for shared
355 # libraries when using LD_LIBRARY_PATH in a setuid program. The user can
356 # add directories to the list by defining $(user-defined-trusted-dirs)
357 # before starting make.
358 $(objpfx)trusted-dirs.h: $(objpfx)trusted-dirs.st; @:
359 $(objpfx)trusted-dirs.st: Makefile $(..)Makeconfig
360 $(make-target-directory)
361 echo "$(subst :, ,$(default-rpath) $(user-defined-trusted-dirs))" \
362 | $(AWK) -f gen-trusted-dirs.awk > ${@:st=T};
363 echo '#define DL_DST_LIB "$(notdir $(slibdir))"' >> ${@:st=T}
364 $(move-if-change) ${@:st=T} ${@:st=h}
365 touch $@
366 CPPFLAGS-dl-load.c = -I$(objpfx). -I$(csu-objpfx).
368 ifeq (yes,$(build-shared))
369 $(inst_slibdir)/$(rtld-version-installed-name): $(objpfx)ld.so $(+force)
370 $(make-target-directory)
371 $(do-install-program)
373 $(inst_slibdir)/$(rtld-installed-name): \
374 $(inst_slibdir)/$(rtld-version-installed-name) \
375 $(inst_slibdir)/libc-$(version).so
376 $(make-shlib-link)
378 # Special target called by parent to install just the dynamic linker.
379 .PHONY: ldso_install
380 ldso_install: $(inst_slibdir)/$(rtld-installed-name)
381 endif
384 common-ldd-rewrite = -e 's%@RTLD@%$(slibdir)/$(rtld-installed-name)%g' \
385 -e 's%@VERSION@%$(version)%g'
386 sh-ldd-rewrite = $(common-ldd-rewrite) -e 's%@BASH@%/bin/sh%g;s/\$$"/"/g'
387 bash-ldd-rewrite = $(common-ldd-rewrite) -e 's%@BASH@%$(BASH)%g' \
388 -e 's%@TEXTDOMAINDIR@%$(msgcatdir)%g'
390 ifneq ($(have-bash2),yes)
391 ldd-shell = sh
392 else
393 ldd-shell = bash
394 endif
396 ifeq ($(ldd-rewrite-script),no)
397 define gen-ldd
398 LC_ALL=C sed $($(ldd-shell)-ldd-rewrite) < $< > $@.new
399 endef
400 else
401 define gen-ldd
402 LC_ALL=C sed $($(ldd-shell)-ldd-rewrite) < $< \
403 | LC_ALL=C sed -f $(patsubst $(..)/%,/%,$(..)$(ldd-rewrite-script)) > $@.new
404 endef
405 endif
407 $(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \
408 $(common-objpfx)config.make
409 $(gen-ldd)
410 chmod 555 $@.new
411 mv -f $@.new $@
413 $(objpfx)sprof: $(libdl)
415 $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
417 $(objpfx)pldd: $(pldd-modules:%=$(objpfx)%.o)
419 SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
420 CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
421 -D'SLIBDIR="$(slibdir)"' -DIS_IN_ldconfig=1
422 CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
423 CFLAGS-cache.c = $(SYSCONF-FLAGS)
424 CFLAGS-rtld.c = $(SYSCONF-FLAGS)
426 CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),-DNOT_IN_libc=1 -DIS_IN_rtld=1)
428 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
429 generated += $(addsuffix .so,$(strip $(modules-names)))
431 ifeq (yes,$(build-shared))
432 ifeq ($(cross-compiling),no)
433 tests: $(objpfx)tst-pathopt.out
434 endif
435 endif
437 $(objpfx)testobj1.so: $(libdl)
438 $(objpfx)testobj1_1.so: $(objpfx)testobj1.so $(libdl)
439 $(objpfx)testobj2.so: $(objpfx)testobj1.so $(libdl)
440 $(objpfx)testobj3.so: $(libdl)
441 $(objpfx)testobj4.so: $(libdl)
442 $(objpfx)testobj5.so: $(libdl)
443 $(objpfx)testobj6.so: $(objpfx)testobj1.so $(objpfx)testobj2.so $(libdl)
444 $(objpfx)failobj.so: $(objpfx)testobj6.so
445 $(objpfx)dep1.so: $(objpfx)dep2.so $(objpfx)dep4.so
446 $(objpfx)dep2.so: $(objpfx)dep3.so $(objpfx)dep4.so
447 $(objpfx)dep4.so: $(objpfx)dep3.so
448 $(objpfx)nodelmod3.so: $(objpfx)nodelmod4.so
449 $(objpfx)nextmod1.so: $(libdl)
450 $(objpfx)neededobj1.so: $(libdl)
451 $(objpfx)neededobj2.so: $(objpfx)neededobj1.so $(libdl)
452 $(objpfx)neededobj3.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so $(libdl)
453 $(objpfx)neededobj4.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
454 $(objpfx)neededobj3.so $(libdl)
455 $(objpfx)neededobj6.so: $(objpfx)neededobj5.so
456 $(objpfx)unload2mod.so: $(objpfx)unload2dep.so
457 $(objpfx)ltglobmod2.so: $(libdl)
458 $(objpfx)firstobj.so: $(shared-thread-library)
459 $(objpfx)globalmod1.so: $(libdl)
460 $(objpfx)reldep4mod1.so: $(objpfx)reldep4mod3.so
461 $(objpfx)reldep4mod2.so: $(objpfx)reldep4mod4.so
462 $(objpfx)dblloadmod1.so: $(objpfx)dblloadmod3.so
463 $(objpfx)dblloadmod2.so: $(objpfx)dblloadmod3.so
464 $(objpfx)reldepmod5.so: $(objpfx)reldepmod2.so
465 $(objpfx)reldepmod6.so: $(objpfx)reldepmod2.so
466 $(objpfx)reldep6mod1.so: $(objpfx)reldep6mod0.so
467 $(objpfx)reldep6mod2.so: $(objpfx)reldep6mod1.so
468 $(objpfx)reldep6mod3.so: $(objpfx)reldep6mod2.so
469 $(objpfx)reldep6mod4.so: $(objpfx)reldep6mod1.so
470 $(objpfx)tst-tlsmod3.so: $(objpfx)tst-tlsmod2.so
471 $(objpfx)tst-tlsmod8.so: $(objpfx)tst-tlsmod7.so
472 $(objpfx)tst-tlsmod10.so: $(objpfx)tst-tlsmod9.so
473 $(objpfx)tst-tlsmod12.so: $(objpfx)tst-tlsmod11.so
474 $(objpfx)tst-tlsmod13a.so: $(objpfx)tst-tlsmod13.so
475 # For tst-tls9-static, make sure the modules it dlopens have libc.so in DT_NEEDED
476 $(objpfx)tst-tlsmod5.so: $(common-objpfx)libc.so
477 $(objpfx)tst-tlsmod6.so: $(common-objpfx)libc.so
478 $(objpfx)tst-tls19mod1.so: $(objpfx)tst-tls19mod2.so $(objpfx)tst-tls19mod3.so
479 $(objpfx)tst-tls19mod3.so: $(objpfx)ld.so
480 $(objpfx)reldep8mod3.so: $(objpfx)reldep8mod1.so $(objpfx)reldep8mod2.so
481 $(objpfx)nodel2mod3.so: $(objpfx)nodel2mod1.so $(objpfx)nodel2mod2.so
482 $(objpfx)reldep9mod2.so: $(objpfx)reldep9mod1.so
483 $(objpfx)reldep9mod3.so: $(objpfx)reldep9mod1.so $(objpfx)reldep9mod2.so
484 $(objpfx)unload3mod1.so: $(objpfx)unload3mod3.so
485 $(objpfx)unload3mod2.so: $(objpfx)unload3mod3.so
486 $(objpfx)unload3mod3.so: $(objpfx)unload3mod4.so
487 $(objpfx)unload4mod1.so: $(objpfx)unload4mod2.so $(objpfx)unload4mod3.so
488 $(objpfx)unload4mod2.so: $(objpfx)unload4mod4.so $(objpfx)unload4mod3.so
489 $(objpfx)unload6mod1.so: $(libdl)
490 $(objpfx)unload6mod2.so: $(libdl)
491 $(objpfx)unload6mod3.so: $(libdl)
492 $(objpfx)unload7mod1.so: $(libdl)
493 $(objpfx)unload7mod2.so: $(objpfx)unload7mod1.so
494 $(objpfx)unload8mod1.so: $(objpfx)unload8mod2.so
495 $(objpfx)unload8mod2.so: $(objpfx)unload8mod3.so
496 $(objpfx)unload8mod3.so: $(libdl)
497 $(objpfx)tst-initordera2.so: $(objpfx)tst-initordera1.so
498 $(objpfx)tst-initorderb2.so: $(objpfx)tst-initorderb1.so $(objpfx)tst-initordera2.so
499 $(objpfx)tst-initordera3.so: $(objpfx)tst-initorderb2.so $(objpfx)tst-initorderb1.so
500 $(objpfx)tst-initordera4.so: $(objpfx)tst-initordera3.so
501 $(objpfx)tst-initorder: $(objpfx)tst-initordera4.so $(objpfx)tst-initordera1.so $(objpfx)tst-initorderb2.so
503 LDFLAGS-nodel2mod3.so = $(no-as-needed)
504 LDFLAGS-reldepmod5.so = $(no-as-needed)
505 LDFLAGS-reldep6mod1.so = $(no-as-needed)
506 LDFLAGS-reldep6mod4.so = $(no-as-needed)
507 LDFLAGS-reldep8mod3.so = $(no-as-needed)
508 LDFLAGS-unload4mod1.so = $(no-as-needed)
509 LDFLAGS-unload4mod2.so = $(no-as-needed)
510 LDFLAGS-tst-initorder = $(no-as-needed)
511 LDFLAGS-tst-initordera2.so = $(no-as-needed)
512 LDFLAGS-tst-initordera3.so = $(no-as-needed)
513 LDFLAGS-tst-initordera4.so = $(no-as-needed)
514 LDFLAGS-tst-initorderb2.so = $(no-as-needed)
515 LDFLAGS-tst-tlsmod5.so = -nostdlib
516 LDFLAGS-tst-tlsmod6.so = -nostdlib
518 testobj1.so-no-z-defs = yes
519 testobj3.so-no-z-defs = yes
520 testobj4.so-no-z-defs = yes
521 testobj5.so-no-z-defs = yes
522 testobj6.so-no-z-defs = yes
523 failobj.so-no-z-defs = yes
524 constload2.so-no-z-defs = yes
525 constload3.so-no-z-defs = yes
526 nodelmod1.so-no-z-defs = yes
527 nodelmod2.so-no-z-defs = yes
528 nodelmod4.so-no-z-defs = yes
529 nodel2mod2.so-no-z-defs = yes
530 reldepmod2.so-no-z-defs = yes
531 reldepmod3.so-no-z-defs = yes
532 reldepmod4.so-no-z-defs = yes
533 reldep4mod4.so-no-z-defs = yes
534 reldep4mod2.so-no-z-defs = yes
535 ltglobmod2.so-no-z-defs = yes
536 dblloadmod3.so-no-z-defs = yes
537 tst-tlsmod1.so-no-z-defs = yes
538 tst-tlsmod2.so-no-z-defs = yes
539 tst-tlsmod3.so-no-z-defs = yes
540 tst-tlsmod4.so-no-z-defs = yes
541 tst-tlsmod7.so-no-z-defs = yes
542 tst-tlsmod8.so-no-z-defs = yes
543 tst-tlsmod9.so-no-z-defs = yes
544 tst-tlsmod10.so-no-z-defs = yes
545 tst-tlsmod12.so-no-z-defs = yes
546 tst-tlsmod14a.so-no-z-defs = yes
547 tst-tlsmod14b.so-no-z-defs = yes
548 tst-tlsmod15a.so-no-z-defs = yes
549 tst-tlsmod16b.so-no-z-defs = yes
550 circlemod2.so-no-z-defs = yes
551 circlemod3.so-no-z-defs = yes
552 circlemod3a.so-no-z-defs = yes
553 reldep8mod2.so-no-z-defs = yes
554 reldep9mod1.so-no-z-defs = yes
555 unload3mod4.so-no-z-defs = yes
556 unload4mod1.so-no-z-defs = yes
557 ifuncmod1.so-no-z-defs = yes
558 ifuncmod5.so-no-z-defs = yes
559 ifuncmod6.so-no-z-defs = yes
561 ifeq ($(build-shared),yes)
562 # Build all the modules even when not actually running test programs.
563 tests: $(test-modules)
564 endif
566 $(objpfx)loadtest: $(libdl)
567 LDFLAGS-loadtest = -rdynamic
569 $(objpfx)loadtest.out: $(test-modules)
571 $(objpfx)neededtest: $(libdl)
572 $(objpfx)neededtest.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
573 $(objpfx)neededobj3.so
575 $(objpfx)neededtest2: $(libdl)
576 $(objpfx)neededtest2.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
577 $(objpfx)neededobj3.so
579 $(objpfx)neededtest3: $(libdl)
580 $(objpfx)neededtest3.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
581 $(objpfx)neededobj3.so $(objpfx)neededobj4.so
583 neededtest4-ENV = LC_ALL=C LANGUAGE=C
584 $(objpfx)neededtest4: $(libdl) $(objpfx)neededobj1.so
585 $(objpfx)neededtest4.out: $(objpfx)neededobj5.so $(objpfx)neededobj6.so
587 $(objpfx)restest1: $(objpfx)testobj1.so $(objpfx)testobj1_1.so $(libdl)
588 LDFLAGS-restest1 = -rdynamic
590 $(objpfx)restest2: $(libdl)
591 LDFLAGS-restest2 = -rdynamic
593 $(objpfx)restest1.out: $(test-modules)
595 preloadtest-preloads = testobj1 testobj2 testobj3 testobj4 testobj5
596 $(objpfx)preloadtest: $(objpfx)testobj6.so
597 LDFLAGS-preloadtest = -rdynamic
598 $(objpfx)preloadtest.out: $(preloadtest-preloads:%=$(objpfx)%.so)
599 preloadtest-ENV = \
600 LD_PRELOAD=$(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
602 $(objpfx)loadfail: $(libdl)
603 LDFLAGS-loadfail = -rdynamic
605 $(objpfx)loadfail.out: $(objpfx)failobj.so
607 $(objpfx)multiload: $(libdl)
608 LDFLAGS-multiload = -rdynamic
609 CFLAGS-multiload.c = -DOBJDIR=\"$(elf-objpfx)\"
611 $(objpfx)multiload.out: $(objpfx)testobj1.so
613 $(objpfx)origtest: $(libdl)
614 LDFLAGS-origtest = -rdynamic
615 $(objpfx)origtest.out: $(objpfx)testobj1.so
617 ifeq ($(have-thread-library),yes)
618 $(objpfx)resolvfail: $(libdl) $(shared-thread-library)
619 else
620 $(objpfx)resolvfail: $(libdl)
621 endif
623 $(objpfx)constload1: $(libdl)
624 $(objpfx)constload1.out: $(objpfx)constload2.so $(objpfx)constload3.so
626 $(objpfx)circleload1: $(libdl)
627 $(objpfx)circleload1.out: $(objpfx)circlemod1.so \
628 $(objpfx)circlemod1a.so
630 $(objpfx)circlemod1.so: $(objpfx)circlemod2.so
631 $(objpfx)circlemod2.so: $(objpfx)circlemod3.so
632 $(objpfx)circlemod1a.so: $(objpfx)circlemod2a.so
633 $(objpfx)circlemod2a.so: $(objpfx)circlemod3a.so
635 $(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so)
637 $(objpfx)order.out: $(objpfx)order
638 $(elf-objpfx)$(rtld-installed-name) \
639 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
640 $(objpfx)order > $@
641 (echo "0123456789" | cmp $@ -) > /dev/null
643 $(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so)
644 $(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
645 vismain-ENV = LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
647 $(objpfx)noload: $(objpfx)testobj1.so $(common-objpfx)dlfcn/libdl.so
648 LDFLAGS-noload = -rdynamic $(no-as-needed)
649 $(objpfx)noload.out: $(objpfx)testobj5.so
651 $(objpfx)noload-mem: $(objpfx)noload.out
652 $(common-objpfx)malloc/mtrace $(objpfx)noload.mtrace > $@
653 noload-ENV = MALLOC_TRACE=$(objpfx)noload.mtrace
655 LDFLAGS-nodelete = -rdynamic
656 LDFLAGS-nodelmod1.so = -Wl,--enable-new-dtags,-z,nodelete
657 LDFLAGS-nodelmod4.so = -Wl,--enable-new-dtags,-z,nodelete
658 $(objpfx)nodelete: $(libdl)
659 $(objpfx)nodelete.out: $(objpfx)nodelmod1.so $(objpfx)nodelmod2.so \
660 $(objpfx)nodelmod3.so
662 LDFLAGS-nodlopenmod.so = -Wl,--enable-new-dtags,-z,nodlopen
663 $(objpfx)nodlopen: $(libdl)
664 $(objpfx)nodlopen.out: $(objpfx)nodlopenmod.so
666 $(objpfx)nodlopenmod2.so: $(objpfx)nodlopenmod.so
667 $(objpfx)nodlopen2: $(libdl)
668 $(objpfx)nodlopen2.out: $(objpfx)nodlopenmod2.so
670 $(objpfx)filtmod1.so: $(objpfx)filtmod1.os $(objpfx)filtmod2.so
671 $(LINK.o) -shared -o $@ -B$(csu-objpfx) $(LDFLAGS.so) \
672 -L$(subst :, -L,$(rpath-link)) \
673 -Wl,-rpath-link=$(rpath-link) \
674 $< -Wl,-F,$(objpfx)filtmod2.so
675 $(objpfx)filter: $(objpfx)filtmod1.so
677 $(objpfx)unload: $(libdl)
678 $(objpfx)unload.out: $(objpfx)unloadmod.so
680 $(objpfx)reldep: $(libdl)
681 $(objpfx)reldep.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod2.so
683 $(objpfx)reldep2: $(libdl)
684 $(objpfx)reldep2.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod3.so
686 $(objpfx)reldep3: $(libdl)
687 $(objpfx)reldep3.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
689 $(objpfx)reldep4: $(libdl)
690 $(objpfx)reldep4.out: $(objpfx)reldep4mod1.so $(objpfx)reldep4mod2.so
692 $(objpfx)next: $(objpfx)nextmod1.so $(objpfx)nextmod2.so $(libdl)
693 LDFLAGS-next = $(no-as-needed)
695 $(objpfx)unload2: $(libdl)
696 $(objpfx)unload2.out: $(objpfx)unload2mod.so $(objpfx)unload2dep.so
698 $(objpfx)lateglobal: $(libdl)
699 $(objpfx)lateglobal.out: $(objpfx)ltglobmod1.so $(objpfx)ltglobmod2.so
701 $(objpfx)tst-pathopt: $(libdl)
702 $(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \
703 $(objpfx)pathoptobj.so
704 $(SHELL) -e $< $(common-objpfx)
706 $(objpfx)initfirst: $(libdl)
707 $(objpfx)initfirst.out: $(objpfx)firstobj.so
709 $(objpfx)global: $(objpfx)globalmod1.so
710 $(objpfx)global.out: $(objpfx)reldepmod1.so
712 $(objpfx)dblload: $(libdl)
713 $(objpfx)dblload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
715 $(objpfx)dblunload: $(libdl)
716 $(objpfx)dblunload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
718 $(objpfx)reldep5: $(libdl)
719 $(objpfx)reldep5.out: $(objpfx)reldepmod5.so $(objpfx)reldepmod6.so
721 $(objpfx)reldep6: $(libdl)
722 $(objpfx)reldep6.out: $(objpfx)reldep6mod3.so $(objpfx)reldep6mod4.so
724 $(objpfx)reldep7: $(libdl)
725 $(objpfx)reldep7.out: $(objpfx)reldep7mod1.so $(objpfx)reldep7mod2.so
727 $(objpfx)reldep8: $(libdl)
728 $(objpfx)reldep8.out: $(objpfx)reldep8mod3.so
730 LDFLAGS-nodel2mod2.so = -Wl,--enable-new-dtags,-z,nodelete
731 $(objpfx)nodelete2: $(libdl)
732 $(objpfx)nodelete2.out: $(objpfx)nodel2mod3.so
734 $(objpfx)reldep9: $(libdl)
735 $(objpfx)reldep9.out: $(objpfx)reldep9mod3.so
737 $(objpfx)tst-tls3: $(objpfx)tst-tlsmod1.so
739 $(objpfx)tst-tls4: $(libdl)
740 $(objpfx)tst-tls4.out: $(objpfx)tst-tlsmod2.so
742 $(objpfx)tst-tls5: $(libdl)
743 $(objpfx)tst-tls5.out: $(objpfx)tst-tlsmod2.so
745 $(objpfx)tst-tls6: $(libdl)
746 $(objpfx)tst-tls6.out: $(objpfx)tst-tlsmod2.so
748 $(objpfx)tst-tls7: $(libdl)
749 $(objpfx)tst-tls7.out: $(objpfx)tst-tlsmod3.so
751 $(objpfx)tst-tls8: $(libdl)
752 $(objpfx)tst-tls8.out: $(objpfx)tst-tlsmod3.so $(objpfx)tst-tlsmod4.so
754 $(objpfx)tst-tls9: $(libdl)
755 $(objpfx)tst-tls9.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
757 $(objpfx)tst-tls10: $(objpfx)tst-tlsmod8.so $(objpfx)tst-tlsmod7.so
759 $(objpfx)tst-tls11: $(objpfx)tst-tlsmod10.so $(objpfx)tst-tlsmod9.so
761 $(objpfx)tst-tls12: $(objpfx)tst-tlsmod12.so $(objpfx)tst-tlsmod11.so
763 $(objpfx)tst-tls13: $(libdl)
764 $(objpfx)tst-tls13.out: $(objpfx)tst-tlsmod13a.so
766 $(objpfx)tst-tls14: $(objpfx)tst-tlsmod14a.so $(libdl)
767 $(objpfx)tst-tls14.out: $(objpfx)tst-tlsmod14b.so
769 $(objpfx)tst-tls15: $(libdl)
770 $(objpfx)tst-tls15.out: $(objpfx)tst-tlsmod15a.so $(objpfx)tst-tlsmod15b.so
772 $(objpfx)tst-tls-dlinfo: $(libdl)
773 $(objpfx)tst-tls-dlinfo.out: $(objpfx)tst-tlsmod2.so
777 $(objpfx)tst-tls16: $(libdl)
778 $(objpfx)tst-tls16.out: $(objpfx)tst-tlsmod16a.so $(objpfx)tst-tlsmod16b.so
780 $(objpfx)tst-tls17: $(libdl)
781 $(objpfx)tst-tls17.out: $(objpfx)tst-tlsmod17b.so
782 $(patsubst %,$(objpfx)%.os,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.os: tst-tlsmod17a.c
783 $(compile-command.c) -DN=$*
784 $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.so: $(objpfx)ld.so
785 $(objpfx)tst-tlsmod17b.so: $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules))
787 $(objpfx)tst-tls18: $(libdl)
788 $(objpfx)tst-tls18.out: $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules))
789 $(patsubst %,$(objpfx)%.os,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.os : tst-tlsmod18a.c
790 $(compile-command.c) -DN=$*
791 $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.so: $(objpfx)ld.so
793 $(objpfx)tst-tls19: $(libdl)
794 $(objpfx)tst-tls19.out: $(objpfx)tst-tls19mod1.so
796 CFLAGS-tst-align.c = $(stack-align-test-flags)
797 CFLAGS-tst-align2.c = $(stack-align-test-flags)
798 CFLAGS-tst-alignmod.c = $(stack-align-test-flags)
799 CFLAGS-tst-alignmod2.c = $(stack-align-test-flags)
800 $(objpfx)tst-align: $(libdl)
801 $(objpfx)tst-align.out: $(objpfx)tst-alignmod.so
802 $(objpfx)tst-align2: $(objpfx)tst-alignmod2.so
804 $(objpfx)unload3: $(libdl)
805 $(objpfx)unload3.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
806 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
808 $(objpfx)unload4: $(libdl)
809 $(objpfx)unload4.out: $(objpfx)unload4mod1.so $(objpfx)unload4mod3.so
811 $(objpfx)unload5: $(libdl)
812 $(objpfx)unload5.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
813 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
815 $(objpfx)unload6: $(libdl)
816 $(objpfx)unload6.out: $(objpfx)unload6mod1.so $(objpfx)unload6mod2.so \
817 $(objpfx)unload6mod3.so
819 $(objpfx)unload7: $(libdl)
820 $(objpfx)unload7.out: $(objpfx)unload7mod1.so $(objpfx)unload7mod2.so
821 unload7-ENV = MALLOC_PERTURB_=85
823 $(objpfx)unload8: $(libdl)
824 $(objpfx)unload8.out: $(objpfx)unload8mod1.so $(objpfx)unload8mod1x.so
826 ifdef libdl
827 $(objpfx)tst-tls9-static: $(common-objpfx)dlfcn/libdl.a
828 $(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
829 endif
831 ifeq ($(have-z-execstack),yes)
832 $(objpfx)tst-execstack: $(libdl)
833 $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
834 LDFLAGS-tst-execstack = -Wl,-z,noexecstack
835 LDFLAGS-tst-execstack-mod = -Wl,-z,execstack
837 $(objpfx)tst-execstack-needed: $(objpfx)tst-execstack-mod.so
838 LDFLAGS-tst-execstack-needed = -Wl,-z,noexecstack
840 LDFLAGS-tst-execstack-prog = -Wl,-z,execstack
841 endif
843 $(objpfx)tst-array1.out: $(objpfx)tst-array1
844 $(elf-objpfx)$(rtld-installed-name) \
845 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
846 $(objpfx)tst-array1 > $@
847 cmp $@ tst-array1.exp > /dev/null
849 $(objpfx)tst-array1-static.out: $(objpfx)tst-array1-static
850 $(objpfx)tst-array1-static > $@
851 cmp $@ tst-array1.exp > /dev/null
853 $(objpfx)tst-array2: $(objpfx)tst-array2dep.so
854 $(objpfx)tst-array2.out: $(objpfx)tst-array2
855 $(elf-objpfx)$(rtld-installed-name) \
856 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
857 $(objpfx)tst-array2 > $@
858 cmp $@ tst-array2.exp > /dev/null
860 $(objpfx)tst-array3.out: $(objpfx)tst-array3
861 $(elf-objpfx)$(rtld-installed-name) \
862 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
863 $(objpfx)tst-array3 > $@
864 cmp $@ tst-array1.exp > /dev/null
866 $(objpfx)tst-array4: $(libdl)
867 $(objpfx)tst-array4.out: $(objpfx)tst-array4 $(objpfx)tst-array2dep.so
868 $(elf-objpfx)$(rtld-installed-name) \
869 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
870 $< > $@
871 cmp $@ tst-array4.exp > /dev/null
873 $(objpfx)tst-array5: $(objpfx)tst-array5dep.so
874 $(objpfx)tst-array5.out: $(objpfx)tst-array5
875 $(elf-objpfx)$(rtld-installed-name) \
876 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
877 $(objpfx)tst-array5 > $@
878 cmp $@ tst-array5.exp > /dev/null
880 $(objpfx)tst-array5-static.out: $(objpfx)tst-array5-static
881 $(objpfx)tst-array5-static > $@
882 cmp $@ tst-array5-static.exp > /dev/null
884 CFLAGS-tst-pie1.c += $(pie-ccflag)
886 $(objpfx)tst-pie1: $(objpfx)tst-piemod1.so
888 ifeq (yes,$(build-shared))
889 tests: $(objpfx)check-textrel.out $(objpfx)check-execstack.out
891 all-built-dso := $(common-objpfx)libc.so \
892 $(filter-out $(common-objpfx)linkobj/libc.so, \
893 $(sort $(wildcard $(addprefix $(common-objpfx), \
894 */lib*.so \
895 iconvdata/*.so))))
897 $(all-built-dso:=.dyn): %.dyn: %
898 @rm -f $@T
899 LC_ALL=C $(READELF) -W -d $< > $@T
900 test -s $@T
901 mv -f $@T $@
902 common-generated += $(all-built-dso:$(common-objpfx)%=%.dyn)
904 $(objpfx)check-textrel.out: $(..)scripts/check-textrel.awk \
905 $(all-built-dso:=.dyn)
906 LC_ALL=C $(AWK) -f $^ > $@
907 generated += check-textrel.out
909 $(objpfx)execstack-default: $(first-word $(wildcard $(sysdirs:%=%/stackinfo.h)))
910 $(make-target-directory)
911 { echo '#include <elf.h>'; \
912 echo '#include <stackinfo.h>'; \
913 echo '#if (DEFAULT_STACK_PERMS & PF_X) == 0'; \
914 echo '@@@execstack-no@@@'; \
915 echo '#else'; \
916 echo '@@@execstack-yes@@@'; \
917 echo '#endif'; } | \
918 $(CC) $(CFLAGS) $(CPPFLAGS) -E -x c-header - | \
919 sed -n -e 's/^@@@\(.*\)@@@/\1/p' > $@T
920 mv -f $@T $@
921 generated += execstack-default
923 $(all-built-dso:=.phdr): %.phdr: %
924 @rm -f $@T
925 LC_ALL=C $(READELF) -W -l $< > $@T
926 test -s $@T
927 mv -f $@T $@
928 common-generated += $(all-built-dso:$(common-objpfx)%=%.phdr)
930 $(objpfx)check-execstack.out: $(..)scripts/check-execstack.awk \
931 $(objpfx)execstack-default \
932 $(all-built-dso:=.phdr)
933 LC_ALL=C $(AWK) -f $^ > $@
934 generated += check-execstack.out
936 $(objpfx)tst-dlmodcount: $(libdl)
937 $(objpfx)tst-dlmodcount.out: $(test-modules)
939 $(all-built-dso:=.jmprel): %.jmprel: % Makefile
940 @rm -f $@T
941 LC_ALL=C $(READELF) -W -S -d -r $< > $@T
942 test -s $@T
943 mv -f $@T $@
944 common-generated += $(all-built-dso:$(common-objpfx)%=%.jmprel)
946 check-data := $(firstword $(wildcard \
947 $(foreach D,$(add-ons) scripts,\
948 $(patsubst %,$(..)$D/data/localplt-%.data,\
949 $(abi-name) \
950 $(addsuffix -$(config-os),\
951 $(config-machine) \
952 $(base-machine)) \
953 generic))))
955 tests: $(objpfx)check-localplt.out
957 localplt-built-dso := $(addprefix $(common-objpfx),\
958 libc.so \
959 math/libm.so \
960 rt/librt.so \
961 dlfcn/libdl.so \
962 resolv/libresolv.so \
963 crypt/libcrypt.so \
965 ifeq ($(have-thread-library),yes)
966 localplt-built-dso += $(filter-out %_nonshared.a, $(shared-thread-library))
967 endif
969 $(objpfx)check-localplt.out: $(..)scripts/check-localplt.awk \
970 $(..)scripts/localplt.awk \
971 $(localplt-built-dso:=.jmprel) \
972 $(check-data)
973 LC_ALL=C $(AWK) -f $(filter-out $< $(check-data),$^) | \
974 LC_ALL=C $(AWK) -f $< $(check-data) - \
975 > $@
976 endif
978 $(objpfx)tst-dlopenrpathmod.so: $(libdl)
979 $(objpfx)tst-dlopenrpath: $(objpfx)tst-dlopenrpathmod.so $(libdl)
980 CFLAGS-tst-dlopenrpath.c += -DPFX=\"$(objpfx)\"
981 LDFLAGS-tst-dlopenrpathmod.so += -Wl,-rpath,\$$ORIGIN/test-subdir
982 $(objpfx)tst-dlopenrpath.out: $(objpfx)firstobj.so
984 $(objpfx)tst-deep1mod2.so: $(objpfx)tst-deep1mod3.so
985 $(objpfx)tst-deep1: $(libdl) $(objpfx)tst-deep1mod1.so
986 $(objpfx)tst-deep1.out: $(objpfx)tst-deep1mod2.so
987 LDFLAGS-tst-deep1 += -rdynamic
988 tst-deep1mod3.so-no-z-defs = yes
990 $(objpfx)tst-dlmopen1mod.so: $(libdl)
991 $(objpfx)tst-dlmopen1: $(libdl)
992 $(objpfx)tst-dlmopen1.out: $(objpfx)tst-dlmopen1mod.so
994 $(objpfx)tst-dlmopen2: $(libdl)
995 $(objpfx)tst-dlmopen2.out: $(objpfx)tst-dlmopen1mod.so
997 $(objpfx)tst-dlmopen3: $(libdl)
998 $(objpfx)tst-dlmopen3.out: $(objpfx)tst-dlmopen1mod.so
1000 $(objpfx)tst-audit1.out: $(objpfx)tst-auditmod1.so
1001 tst-audit1-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1003 $(objpfx)tst-audit2.out: $(objpfx)tst-auditmod1.so
1004 tst-audit2-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1006 $(objpfx)tst-audit3: $(objpfx)tst-auditmod3a.so
1007 $(objpfx)tst-audit3.out: $(objpfx)tst-auditmod3b.so
1008 tst-audit3-ENV = LD_AUDIT=$(objpfx)tst-auditmod3b.so
1010 $(objpfx)tst-audit4: $(objpfx)tst-auditmod4a.so
1011 $(objpfx)tst-audit4.out: $(objpfx)tst-auditmod4b.so
1012 tst-audit4-ENV = LD_AUDIT=$(objpfx)tst-auditmod4b.so
1014 $(objpfx)tst-audit5: $(objpfx)tst-auditmod5a.so
1015 $(objpfx)tst-audit5.out: $(objpfx)tst-auditmod5b.so
1016 tst-audit5-ENV = LD_AUDIT=$(objpfx)tst-auditmod5b.so
1018 $(objpfx)tst-audit6: $(objpfx)tst-auditmod6a.so
1019 $(objpfx)tst-audit6.out: $(objpfx)tst-auditmod6b.so \
1020 $(objpfx)tst-auditmod6c.so
1021 tst-audit6-ENV = LD_AUDIT=$(objpfx)tst-auditmod6b.so:$(objpfx)tst-auditmod6c.so
1023 $(objpfx)tst-audit7: $(objpfx)tst-auditmod7a.so
1024 $(objpfx)tst-audit7.out: $(objpfx)tst-auditmod7b.so
1025 tst-audit7-ENV = LD_AUDIT=$(objpfx)tst-auditmod7b.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 $(elf-objpfx)$(rtld-installed-name) \
1034 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
1035 $(objpfx)order2 > $@
1036 (echo "12345" | cmp $@ -) > /dev/null
1037 $(objpfx)order2mod1.so: $(objpfx)order2mod4.so
1038 $(objpfx)order2mod4.so: $(objpfx)order2mod3.so
1039 $(objpfx)order2mod2.so: $(objpfx)order2mod3.so
1040 order2mod2.so-no-z-defs = yes
1041 LDFLAGS-order2mod1.so = $(no-as-needed)
1042 LDFLAGS-order2mod2.so = $(no-as-needed)
1044 tst-stackguard1-ARGS = --command "$(built-program-cmd) --child"
1045 tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
1047 $(objpfx)tst-leaks1: $(libdl)
1048 $(objpfx)tst-leaks1-mem: $(objpfx)tst-leaks1.out
1049 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1.mtrace > $@
1051 tst-leaks1-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1.mtrace
1053 $(objpfx)tst-addr1: $(libdl)
1055 $(objpfx)tst-thrlock: $(libdl) $(shared-thread-library)
1057 CFLAGS-ifuncmain1pic.c += $(pic-ccflag)
1058 CFLAGS-ifuncmain1picstatic.c += $(pic-ccflag)
1059 CFLAGS-ifuncmain1staticpic.c += $(pic-ccflag)
1060 CFLAGS-ifuncdep1pic.c += $(pic-ccflag)
1061 CFLAGS-ifuncmain1vispic.c += $(pic-ccflag)
1062 CFLAGS-ifuncmain2pic.c += $(pic-ccflag)
1063 CFLAGS-ifuncmain2picstatic.c += $(pic-ccflag)
1064 CFLAGS-ifuncdep2pic.c += $(pic-ccflag)
1065 CFLAGS-ifuncmain4picstatic.c += $(pic-ccflag)
1066 CFLAGS-ifuncmain5pic.c += $(pic-ccflag)
1067 CFLAGS-ifuncmain5picstatic.c += $(pic-ccflag)
1068 CFLAGS-ifuncmain5staticpic.c += $(pic-ccflag)
1069 CFLAGS-ifuncdep5pic.c += $(pic-ccflag)
1070 CFLAGS-ifuncmain7pic.c += $(pic-ccflag)
1071 CFLAGS-ifuncmain7picstatic.c += $(pic-ccflag)
1073 LDFLAGS-ifuncmain3 = -Wl,-export-dynamic
1075 CFLAGS-ifuncmain1pie.c += $(pie-ccflag)
1076 CFLAGS-ifuncmain1vispie.c += $(pie-ccflag)
1077 CFLAGS-ifuncmain1staticpie.c += $(pie-ccflag)
1078 CFLAGS-ifuncmain5pie.c += $(pie-ccflag)
1079 CFLAGS-ifuncmain6pie.c += $(pie-ccflag)
1080 CFLAGS-ifuncmain7pie.c += $(pie-ccflag)
1082 $(objpfx)ifuncmain1pie: $(objpfx)ifuncmod1.so
1083 $(objpfx)ifuncmain1staticpie: $(objpfx)ifuncdep1pic.o
1084 $(objpfx)ifuncmain1vispie: $(objpfx)ifuncmod1.so
1085 $(objpfx)ifuncmain5pie: $(objpfx)ifuncmod5.so
1086 $(objpfx)ifuncmain6pie: $(objpfx)ifuncmod6.so
1088 $(objpfx)ifuncmain1: $(addprefix $(objpfx),ifuncmod1.so)
1089 $(objpfx)ifuncmain1pic: $(addprefix $(objpfx),ifuncmod1.so)
1090 $(objpfx)ifuncmain1staticpic: $(addprefix $(objpfx),ifuncdep1pic.o)
1091 $(objpfx)ifuncmain1static: $(addprefix $(objpfx),ifuncdep1.o)
1092 $(objpfx)ifuncmain1picstatic: $(addprefix $(objpfx),ifuncdep1pic.o)
1093 $(objpfx)ifuncmain1vis: $(addprefix $(objpfx),ifuncmod1.so)
1094 $(objpfx)ifuncmain1vispic: $(addprefix $(objpfx),ifuncmod1.so)
1095 $(objpfx)ifuncmain2: $(addprefix $(objpfx),ifuncdep2.o)
1096 $(objpfx)ifuncmain2pic: $(addprefix $(objpfx),ifuncdep2pic.o)
1097 $(objpfx)ifuncmain2static: $(addprefix $(objpfx),ifuncdep2.o)
1098 $(objpfx)ifuncmain2picstatic: $(addprefix $(objpfx),ifuncdep2pic.o)
1100 $(objpfx)ifuncmain3: $(libdl)
1101 $(objpfx)ifuncmain3.out: $(objpfx)ifuncmod3.so
1103 $(objpfx)ifuncmain5: $(addprefix $(objpfx),ifuncmod5.so)
1104 $(objpfx)ifuncmain5pic: $(addprefix $(objpfx),ifuncmod5.so)
1105 $(objpfx)ifuncmain5static: $(addprefix $(objpfx),ifuncdep5.o)
1106 $(objpfx)ifuncmain5staticpic: $(addprefix $(objpfx),ifuncdep5pic.o)
1107 $(objpfx)ifuncmain5picstatic: $(addprefix $(objpfx),ifuncdep5pic.o)
1109 $(objpfx)tst-unique1: $(libdl)
1110 $(objpfx)tst-unique1.out: $(objpfx)tst-unique1mod1.so \
1111 $(objpfx)tst-unique1mod2.so
1113 $(objpfx)tst-unique2: $(libdl) $(objpfx)tst-unique2mod1.so
1114 $(objpfx)tst-unique2.out: $(objpfx)tst-unique2mod2.so
1116 $(objpfx)tst-unique3: $(libdl) $(objpfx)tst-unique3lib.so
1117 $(objpfx)tst-unique3.out: $(objpfx)tst-unique3lib2.so
1119 $(objpfx)tst-unique4: $(objpfx)tst-unique4lib.so
1121 $(objpfx)tst-initorder.out: $(objpfx)tst-initorder
1122 $(elf-objpfx)${rtld-installed-name} \
1123 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
1124 $< > $@
1125 cmp $@ tst-initorder.exp > /dev/null
1127 $(objpfx)tst-initorder2: $(objpfx)tst-initorder2a.so $(objpfx)tst-initorder2d.so $(objpfx)tst-initorder2c.so
1128 $(objpfx)tst-initorder2a.so: $(objpfx)tst-initorder2b.so
1129 $(objpfx)tst-initorder2b.so: $(objpfx)tst-initorder2c.so
1130 $(objpfx)tst-initorder2c.so: $(objpfx)tst-initorder2d.so
1131 LDFLAGS-tst-initorder2 = $(no-as-needed)
1132 LDFLAGS-tst-initorder2a.so = $(no-as-needed)
1133 LDFLAGS-tst-initorder2b.so = $(no-as-needed)
1134 LDFLAGS-tst-initorder2c.so = $(no-as-needed)
1135 define o-iterator-doit
1136 $(objpfx)tst-initorder2$o.os: tst-initorder2.c; \
1137 $$(compile-command.c) -DNAME=\"$o\"
1138 endef
1139 object-suffixes-left := a b c d
1140 include $(o-iterator)
1142 $(objpfx)tst-initorder2.out: $(objpfx)tst-initorder2
1143 $(elf-objpfx)${rtld-installed-name} \
1144 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
1145 $< > $@
1146 cmp $@ tst-initorder2.exp > /dev/null
1148 ifeq (yes,$(config-cflags-avx))
1149 AVX-CFLAGS=-mavx
1150 ifeq (yes,$(config-cflags-novzeroupper))
1151 AVX-CFLAGS+=-mno-vzeroupper
1152 endif
1153 CFLAGS-tst-audit4.c += $(AVX-CFLAGS)
1154 CFLAGS-tst-auditmod4a.c += $(AVX-CFLAGS)
1155 CFLAGS-tst-auditmod4b.c += $(AVX-CFLAGS)
1156 CFLAGS-tst-auditmod6b.c += $(AVX-CFLAGS)
1157 CFLAGS-tst-auditmod6c.c += $(AVX-CFLAGS)
1158 CFLAGS-tst-auditmod7b.c += $(AVX-CFLAGS)
1159 endif
1161 $(objpfx)tst-relsort1: $(libdl)
1162 $(objpfx)tst-relsort1mod1.so: $(libm) $(objpfx)tst-relsort1mod2.so
1163 $(objpfx)tst-relsort1mod2.so: $(libm)
1164 $(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
1165 $(objpfx)tst-relsort1mod2.so
1167 ifeq ($(cross-compiling),no)
1168 tests: $(objpfx)tst-unused-dep.out
1169 endif
1171 $(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so
1172 LD_TRACE_LOADED_OBJECTS=1 \
1173 LD_DEBUG=unused \
1174 LD_PRELOAD= \
1175 $(elf-objpfx)${rtld-installed-name} \
1176 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
1177 $< > $@
1178 cmp $@ /dev/null > /dev/null