math/test-fenvinline: Cast fe_exc to unsigned int before printing
[glibc.git] / elf / Makefile
blobe852b5fcaa2c2d8c4ad08b2bce879ae00649351d
1 # Copyright (C) 1995-2015 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, see
16 # <http://www.gnu.org/licenses/>.
18 # Makefile for elf subdirectory of GNU C Library.
20 subdir := elf
22 include ../Makeconfig
24 headers = elf.h bits/elfclass.h link.h bits/link.h
25 routines = $(all-dl-routines) dl-support dl-iteratephdr \
26 dl-addr enbl-secure dl-profstub \
27 dl-origin dl-libc dl-sym dl-tsd dl-sysdep
29 # The core dynamic linking functions are in libc for the static and
30 # profiled libraries.
31 dl-routines = $(addprefix dl-,load lookup object reloc deps hwcaps \
32 runtime error init fini debug misc \
33 version profile conflict tls origin scope \
34 execstack caller open close trampoline)
35 ifeq (yes,$(use-ldconfig))
36 dl-routines += dl-cache
37 endif
38 all-dl-routines = $(dl-routines) $(sysdep-dl-routines)
39 # But they are absent from the shared libc, because that code is in ld.so.
40 elide-routines.os = $(all-dl-routines) dl-support enbl-secure dl-origin \
41 dl-sysdep
42 shared-only-routines += dl-caller
44 # ld.so uses those routines, plus some special stuff for being the program
45 # interpreter and operating independent of libc.
46 rtld-routines = rtld $(all-dl-routines) dl-sysdep dl-environ dl-minimal
47 all-rtld-routines = $(rtld-routines) $(sysdep-rtld-routines)
49 CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
50 CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
51 CFLAGS-dl-iterate-phdr.c = $(uses-callbacks)
53 ifeq ($(unwind-find-fde),yes)
54 routines += unwind-dw2-fde-glibc
55 shared-only-routines += unwind-dw2-fde-glibc
56 endif
58 before-compile += $(objpfx)trusted-dirs.h
59 generated += trusted-dirs.h trusted-dirs.st for-renamed/renamed.so
60 generated-dirs += for-renamed
62 ifeq ($(build-shared),yes)
63 ld-map = $(common-objpfx)ld.map
64 endif
66 ifeq (yes,$(build-shared))
67 extra-objs = $(all-rtld-routines:%=%.os) soinit.os sofini.os interp.os
68 generated += librtld.os dl-allobjs.os ld.so ldd
69 install-others = $(inst_rtlddir)/$(rtld-installed-name)
70 install-bin-script = ldd
71 endif
73 others = sprof sln
74 install-bin = sprof
75 others-static = sln
76 install-rootsbin = sln
77 sln-modules := static-stubs
78 extra-objs += $(sln-modules:=.o)
80 ifeq (yes,$(use-ldconfig))
81 ifeq (yes,$(build-shared))
82 others-static += ldconfig
83 others += ldconfig
84 install-rootsbin += ldconfig
86 ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon static-stubs
87 extra-objs += $(ldconfig-modules:=.o)
88 endif
89 endif
91 # To find xmalloc.c and xstrdup.c
92 vpath %.c ../locale/programs
94 ifeq ($(build-shared),yes)
95 extra-objs += sotruss-lib.os sotruss-lib.so
96 install-others += $(inst_auditdir)/sotruss-lib.so
97 install-bin-script += sotruss
98 generated += sotruss
99 libof-sotruss-lib = extramodules
100 $(objpfx)sotruss-lib.so: $(objpfx)sotruss-lib.os
101 $(build-module-asneeded)
102 $(objpfx)sotruss-lib.so: $(common-objpfx)libc.so $(objpfx)ld.so \
103 $(common-objpfx)libc_nonshared.a
105 $(objpfx)sotruss: sotruss.sh $(common-objpfx)config.make
106 sed -e 's%@BASH@%$(BASH)%g' \
107 -e 's%@VERSION@%$(version)%g' \
108 -e 's%@TEXTDOMAINDIR@%$(msgcatdir)%g' \
109 -e 's%@PREFIX@%$(prefix)%g' \
110 -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
111 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' \
112 < $< > $@.new
113 chmod 555 $@.new
114 mv -f $@.new $@
115 $(inst_auditdir)/sotruss-lib.so: $(objpfx)sotruss-lib.so $(+force)
116 $(do-install-program)
117 endif
119 tests = tst-tls1 tst-tls2 tst-tls9 tst-leaks1 \
120 tst-array1 tst-array2 tst-array3 tst-array4 tst-array5 \
121 tst-auxv
122 tests-static = tst-tls1-static tst-tls2-static tst-stackguard1-static \
123 tst-leaks1-static tst-array1-static tst-array5-static \
124 tst-ptrguard1-static tst-dl-iter-static
125 ifeq (yes,$(build-shared))
126 tests-static += tst-tls9-static
127 tst-tls9-static-ENV = \
128 LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn
129 endif
130 tests += $(tests-static)
131 ifeq (yes,$(build-shared))
132 tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
133 constload1 order noload filter unload \
134 reldep reldep2 reldep3 reldep4 nodelete nodelete2 \
135 nodlopen nodlopen2 neededtest neededtest2 \
136 neededtest3 neededtest4 unload2 lateglobal initfirst global \
137 restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
138 circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \
139 tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-tls15 \
140 tst-tls16 tst-tls17 tst-tls18 tst-tls19 tst-tls-dlinfo \
141 tst-align tst-align2 $(tests-execstack-$(have-z-execstack)) \
142 tst-dlmodcount tst-dlopenrpath tst-deep1 \
143 tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
144 unload3 unload4 unload5 unload6 unload7 unload8 tst-global1 order2 \
145 tst-audit1 tst-audit2 tst-audit8 tst-audit9 \
146 tst-stackguard1 tst-addr1 tst-thrlock \
147 tst-unique1 tst-unique2 $(if $(CXX),tst-unique3 tst-unique4) \
148 tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \
149 tst-ptrguard1
150 # reldep9
151 ifeq ($(build-hardcoded-path-in-tests),yes)
152 tests += tst-dlopen-aout
153 endif
154 test-srcs = tst-pathopt
155 selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
156 ifneq ($(selinux-enabled),1)
157 tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
158 endif
159 endif
160 ifeq ($(run-built-tests),yes)
161 tests-special += $(objpfx)tst-leaks1-mem.out \
162 $(objpfx)tst-leaks1-static-mem.out $(objpfx)noload-mem.out
163 endif
164 tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
165 tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
166 tlsmod17a-modules = $(addprefix tst-tlsmod17a, $(tlsmod17a-suffixes))
167 tlsmod18a-modules = $(addprefix tst-tlsmod18a, $(tlsmod17a-suffixes))
168 extra-test-objs += $(tlsmod17a-modules:=.os) $(tlsmod18a-modules:=.os)
169 test-extras += tst-tlsmod17a tst-tlsmod18a
170 modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
171 testobj1_1 failobj constload2 constload3 unloadmod \
172 dep1 dep2 dep3 dep4 vismod1 vismod2 vismod3 \
173 nodelmod1 nodelmod2 nodelmod3 nodelmod4 \
174 nodel2mod1 nodel2mod2 nodel2mod3 \
175 nodlopenmod nodlopenmod2 filtmod1 filtmod2 \
176 reldepmod1 reldepmod2 reldepmod3 reldepmod4 nextmod1 nextmod2 \
177 reldep4mod1 reldep4mod2 reldep4mod3 reldep4mod4 \
178 neededobj1 neededobj2 neededobj3 neededobj4 \
179 neededobj5 neededobj6 firstobj globalmod1 \
180 unload2mod unload2dep ltglobmod1 ltglobmod2 pathoptobj \
181 dblloadmod1 dblloadmod2 dblloadmod3 reldepmod5 reldepmod6 \
182 reldep6mod0 reldep6mod1 reldep6mod2 reldep6mod3 reldep6mod4 \
183 reldep7mod1 reldep7mod2 \
184 tst-tlsmod1 tst-tlsmod2 tst-tlsmod3 tst-tlsmod4 \
185 tst-tlsmod5 tst-tlsmod6 tst-tlsmod7 tst-tlsmod8 \
186 tst-tlsmod9 tst-tlsmod10 tst-tlsmod11 tst-tlsmod12 \
187 tst-tlsmod13 tst-tlsmod13a tst-tlsmod14a tst-tlsmod14b \
188 tst-tlsmod15a tst-tlsmod15b tst-tlsmod16a tst-tlsmod16b \
189 $(tlsmod17a-modules) tst-tlsmod17b $(tlsmod18a-modules) \
190 tst-tls19mod1 tst-tls19mod2 tst-tls19mod3 \
191 circlemod1 circlemod1a circlemod2 circlemod2a \
192 circlemod3 circlemod3a \
193 reldep8mod1 reldep8mod2 reldep8mod3 \
194 reldep9mod1 reldep9mod2 reldep9mod3 \
195 tst-alignmod tst-alignmod2 \
196 $(modules-execstack-$(have-z-execstack)) \
197 tst-dlopenrpathmod tst-deep1mod1 tst-deep1mod2 tst-deep1mod3 \
198 tst-dlmopen1mod tst-auditmod1 \
199 unload3mod1 unload3mod2 unload3mod3 unload3mod4 \
200 unload4mod1 unload4mod2 unload4mod3 unload4mod4 \
201 unload6mod1 unload6mod2 unload6mod3 \
202 unload7mod1 unload7mod2 \
203 unload8mod1 unload8mod1x unload8mod2 unload8mod3 \
204 order2mod1 order2mod2 order2mod3 order2mod4 \
205 tst-unique1mod1 tst-unique1mod2 \
206 tst-unique2mod1 tst-unique2mod2 \
207 tst-auditmod9a tst-auditmod9b \
208 $(if $(CXX),tst-unique3lib tst-unique3lib2 tst-unique4lib) \
209 tst-initordera1 tst-initorderb1 \
210 tst-initordera2 tst-initorderb2 \
211 tst-initordera3 tst-initordera4 \
212 tst-initorder2a tst-initorder2b tst-initorder2c \
213 tst-initorder2d \
214 tst-relsort1mod1 tst-relsort1mod2 tst-array2dep \
215 tst-array5dep tst-null-argv-lib
216 ifeq (yes,$(have-protected-data))
217 modules-names += tst-protected1moda tst-protected1modb
218 tests += tst-protected1a tst-protected1b
219 $(objpfx)tst-protected1a: $(addprefix $(objpfx),tst-protected1moda.so tst-protected1modb.so)
220 $(objpfx)tst-protected1b: $(addprefix $(objpfx),tst-protected1modb.so tst-protected1moda.so)
221 tst-protected1modb.so-no-z-defs = yes
222 endif
223 ifeq (yesyes,$(have-fpie)$(build-shared))
224 modules-names += tst-piemod1
225 tests += tst-pie1 tst-pie2
226 tests-pie += tst-pie1 tst-pie2
227 tests += vismain
228 tests-pie += vismain
229 CFLAGS-vismain.c = $(PIE-ccflag)
230 endif
231 modules-execstack-yes = tst-execstack-mod
232 extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
233 # We need this variable to be sure the test modules get the right CPPFLAGS.
234 test-extras += $(modules-names)
236 # filtmod1.so has a special rule
237 modules-names-nobuild := filtmod1
239 ifneq (no,$(multi-arch))
240 tests-static += ifuncmain1static ifuncmain1picstatic \
241 ifuncmain2static ifuncmain2picstatic \
242 ifuncmain4static ifuncmain4picstatic \
243 ifuncmain5static ifuncmain5picstatic \
244 ifuncmain7static ifuncmain7picstatic
246 ifeq (yes,$(build-shared))
247 tests += ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \
248 ifuncmain1staticpic \
249 ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \
250 ifuncmain5 ifuncmain5pic ifuncmain5staticpic \
251 ifuncmain7 ifuncmain7pic
252 ifunc-test-modules = ifuncdep1 ifuncdep1pic ifuncdep2 ifuncdep2pic \
253 ifuncdep5 ifuncdep5pic
254 extra-test-objs += $(ifunc-test-modules:=.o)
255 test-extras += $(ifunc-test-modules)
256 ifeq (yes,$(have-fpie))
257 ifunc-pie-tests = ifuncmain1pie ifuncmain1vispie ifuncmain1staticpie \
258 ifuncmain5pie ifuncmain6pie ifuncmain7pie
259 tests += $(ifunc-pie-tests)
260 tests-pie += $(ifunc-pie-tests)
261 endif
262 modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6
263 endif
264 endif
266 ifeq (yes,$(build-shared))
267 ifeq ($(run-built-tests),yes)
268 tests-special += $(objpfx)tst-pathopt.out $(objpfx)tst-rtld-load-self.out
269 endif
270 tests-special += $(objpfx)check-textrel.out $(objpfx)check-execstack.out \
271 $(objpfx)check-localplt.out
272 endif
274 ifeq ($(run-built-tests),yes)
275 tests-special += $(objpfx)order-cmp.out $(objpfx)tst-array1-cmp.out \
276 $(objpfx)tst-array1-static-cmp.out \
277 $(objpfx)tst-array2-cmp.out $(objpfx)tst-array3-cmp.out \
278 $(objpfx)tst-array4-cmp.out $(objpfx)tst-array5-cmp.out \
279 $(objpfx)tst-array5-static-cmp.out $(objpfx)order2-cmp.out \
280 $(objpfx)tst-initorder-cmp.out \
281 $(objpfx)tst-initorder2-cmp.out $(objpfx)tst-unused-dep.out \
282 $(objpfx)tst-unused-dep-cmp.out
283 endif
285 check-abi: $(objpfx)check-abi-ld.out
286 tests-special += $(objpfx)check-abi-ld.out
287 update-abi: update-abi-ld
289 include ../Rules
291 ifeq (yes,$(build-shared))
292 # Make sure these things are built in the `make lib' pass so they can be used
293 # to run programs during the `make others' pass.
294 lib-noranlib: $(objpfx)$(rtld-installed-name) \
295 $(addprefix $(objpfx),$(extra-objs))
296 endif
298 # Command to link into a larger single relocatable object.
299 reloc-link = $(LINK.o) -nostdlib -nostartfiles -r
301 $(objpfx)sotruss-lib.so: $(shlib-lds)
303 $(objpfx)dl-allobjs.os: $(all-rtld-routines:%=$(objpfx)%.os)
304 $(reloc-link) -o $@ $^
306 # Link together the dynamic linker into a single relocatable object.
307 # First we do a link against libc_pic.a just to get a link map,
308 # and discard the object produced by that link. From the link map
309 # we can glean all the libc modules that need to go into the dynamic
310 # linker. Then we do a recursive make that goes into all the subdirs
311 # those modules come from and builds special rtld-foo.os versions that
312 # are compiled with special flags, and puts these modules into rtld-libc.a
313 # for us. Then we do the real link using rtld-libc.a instead of libc_pic.a.
315 $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
316 @-rm -f $@T
317 $(reloc-link) -o $@.o '-Wl,-(' $^ -lgcc '-Wl,-)' -Wl,-Map,$@T
318 rm -f $@.o
319 mv -f $@T $@
321 $(objpfx)librtld.mk: $(objpfx)librtld.map Makefile
322 LC_ALL=C \
323 sed -n 's@^$(common-objpfx)\([^(]*\)(\([^)]*\.os\)) *.*$$@\1 \2@p' \
324 $< | \
325 while read lib file; do \
326 case $$lib in \
327 libc_pic.a) \
328 LC_ALL=C fgrep -l /$$file \
329 $(common-objpfx)stamp.os $(common-objpfx)*/stamp.os | \
330 LC_ALL=C \
331 sed 's@^$(common-objpfx)\([^/]*\)/stamp\.os$$@rtld-\1'" +=$$file@"\
332 ;; \
333 */*.a) \
334 echo rtld-$${lib%%/*} += $$file ;; \
335 *) echo "Wasn't expecting $$lib($$file)" >&2; exit 1 ;; \
336 esac; \
337 done > $@T
338 echo rtld-subdirs = `LC_ALL=C sed 's/^rtld-\([^ ]*\).*$$/\1/' $@T \
339 | LC_ALL=C sort -u` >> $@T
340 mv -f $@T $@
342 $(objpfx)rtld-libc.a: $(objpfx)librtld.mk FORCE
343 $(MAKE) -f $< -f rtld-Rules
345 $(objpfx)librtld.os: $(objpfx)dl-allobjs.os $(objpfx)rtld-libc.a
346 $(LINK.o) -nostdlib -nostartfiles -r -o $@ '-Wl,-(' $^ -lgcc '-Wl,-)' \
347 -Wl,-Map,$@.map
349 generated += librtld.map librtld.mk rtld-libc.a librtld.os.map
351 z-now-yes = -Wl,-z,now
353 $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
354 # Link into a temporary file so that we don't touch $@ at all
355 # if the sanity check below fails.
356 $(LINK.o) -nostdlib -nostartfiles -shared -o $@.new \
357 $(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \
358 $(filter-out $(map-file),$^) $(load-map-file) \
359 -Wl,-soname=$(rtld-installed-name) \
360 -Wl,-defsym=_begin=0
361 $(call after-link,$@.new)
362 $(READELF) -s $@.new \
363 | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
364 mv -f $@.new $@
366 # interp.c exists just to get the runtime linker path into libc.so.
367 $(objpfx)interp.os: $(elf-objpfx)runtime-linker.h
369 $(elf-objpfx)runtime-linker.h: $(elf-objpfx)runtime-linker.st; @:
370 $(elf-objpfx)runtime-linker.st: $(common-objpfx)config.make
371 $(make-target-directory)
372 echo '#define RUNTIME_LINKER "$(rtlddir)/$(rtld-installed-name)"' \
373 > ${@:st=T}
374 $(move-if-change) ${@:st=T} ${@:st=h}
375 touch $@
377 ifneq (ld.so,$(rtld-installed-name))
378 # Make sure ld.so.1 exists in the build directory so we can link
379 # against it.
380 $(objpfx)$(rtld-installed-name): $(objpfx)ld.so
381 rm -f $@
382 ln -s $(<F) $@
383 generated += $(rtld-installed-name)
384 endif
386 # Build a file mentioning all trustworthy directories to look for shared
387 # libraries when using LD_LIBRARY_PATH in a setuid program. The user can
388 # add directories to the list by defining $(user-defined-trusted-dirs)
389 # before starting make.
390 $(objpfx)trusted-dirs.h: $(objpfx)trusted-dirs.st; @:
391 $(objpfx)trusted-dirs.st: Makefile $(..)Makeconfig
392 $(make-target-directory)
393 echo "$(subst :, ,$(default-rpath) $(user-defined-trusted-dirs))" \
394 | $(AWK) -f gen-trusted-dirs.awk > ${@:st=T};
395 echo '#define DL_DST_LIB "$(notdir $(slibdir))"' >> ${@:st=T}
396 $(move-if-change) ${@:st=T} ${@:st=h}
397 touch $@
398 CPPFLAGS-dl-load.c = -I$(objpfx). -I$(csu-objpfx).
400 ifeq (yes,$(build-shared))
401 $(inst_slibdir)/$(rtld-version-installed-name): $(objpfx)ld.so $(+force)
402 $(make-target-directory)
403 $(do-install-program)
405 $(inst_rtlddir)/$(rtld-installed-name): \
406 $(inst_slibdir)/$(rtld-version-installed-name) \
407 $(inst_slibdir)/libc-$(version).so
408 $(make-target-directory)
409 $(make-shlib-link)
411 # Special target called by parent to install just the dynamic linker.
412 .PHONY: ldso_install
413 ldso_install: $(inst_rtlddir)/$(rtld-installed-name)
414 endif
417 ldd-rewrite = -e 's%@RTLD@%$(rtlddir)/$(rtld-installed-name)%g' \
418 -e 's%@VERSION@%$(version)%g' \
419 -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
420 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' \
421 -e 's%@BASH@%$(BASH)%g' \
422 -e 's%@TEXTDOMAINDIR@%$(msgcatdir)%g'
424 ifeq ($(ldd-rewrite-script),no)
425 define gen-ldd
426 LC_ALL=C sed $(ldd-rewrite) < $< > $@.new
427 endef
428 else
429 define gen-ldd
430 LC_ALL=C sed $(ldd-rewrite) < $< \
431 | LC_ALL=C sed -f $(patsubst $(..)/%,/%,$(..)$(ldd-rewrite-script)) > $@.new
432 endef
433 endif
435 $(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \
436 $(common-objpfx)config.make
437 $(gen-ldd)
438 chmod 555 $@.new
439 mv -f $@.new $@
441 $(objpfx)sprof: $(libdl)
443 $(objpfx)sln: $(sln-modules:%=$(objpfx)%.o)
445 $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
447 SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
448 CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
449 -D'SLIBDIR="$(slibdir)"'
450 libof-ldconfig = ldconfig
451 CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
452 CFLAGS-cache.c = $(SYSCONF-FLAGS)
453 CFLAGS-rtld.c = $(SYSCONF-FLAGS)
455 cpp-srcs-left := $(all-rtld-routines:=.os)
456 lib := rtld
457 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
459 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
460 generated += $(addsuffix .so,$(strip $(modules-names)))
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)tst-tls19mod1.so: $(objpfx)tst-tls19mod2.so $(objpfx)tst-tls19mod3.so
504 $(objpfx)tst-tls19mod3.so: $(objpfx)ld.so
505 $(objpfx)reldep8mod3.so: $(objpfx)reldep8mod1.so $(objpfx)reldep8mod2.so
506 $(objpfx)nodel2mod3.so: $(objpfx)nodel2mod1.so $(objpfx)nodel2mod2.so
507 $(objpfx)reldep9mod2.so: $(objpfx)reldep9mod1.so
508 $(objpfx)reldep9mod3.so: $(objpfx)reldep9mod1.so $(objpfx)reldep9mod2.so
509 $(objpfx)unload3mod1.so: $(objpfx)unload3mod3.so
510 $(objpfx)unload3mod2.so: $(objpfx)unload3mod3.so
511 $(objpfx)unload3mod3.so: $(objpfx)unload3mod4.so
512 $(objpfx)unload4mod1.so: $(objpfx)unload4mod2.so $(objpfx)unload4mod3.so
513 $(objpfx)unload4mod2.so: $(objpfx)unload4mod4.so $(objpfx)unload4mod3.so
514 $(objpfx)unload6mod1.so: $(libdl)
515 $(objpfx)unload6mod2.so: $(libdl)
516 $(objpfx)unload6mod3.so: $(libdl)
517 $(objpfx)unload7mod1.so: $(libdl)
518 $(objpfx)unload7mod2.so: $(objpfx)unload7mod1.so
519 $(objpfx)unload8mod1.so: $(objpfx)unload8mod2.so
520 $(objpfx)unload8mod2.so: $(objpfx)unload8mod3.so
521 $(objpfx)unload8mod3.so: $(libdl)
522 $(objpfx)tst-initordera2.so: $(objpfx)tst-initordera1.so
523 $(objpfx)tst-initorderb2.so: $(objpfx)tst-initorderb1.so $(objpfx)tst-initordera2.so
524 $(objpfx)tst-initordera3.so: $(objpfx)tst-initorderb2.so $(objpfx)tst-initorderb1.so
525 $(objpfx)tst-initordera4.so: $(objpfx)tst-initordera3.so
526 $(objpfx)tst-initorder: $(objpfx)tst-initordera4.so $(objpfx)tst-initordera1.so $(objpfx)tst-initorderb2.so
527 $(objpfx)tst-null-argv: $(objpfx)tst-null-argv-lib.so
529 tst-null-argv-ENV = LD_DEBUG=all LD_DEBUG_OUTPUT=$(objpfx)tst-null-argv.debug.out
530 LDFLAGS-nodel2mod3.so = $(no-as-needed)
531 LDFLAGS-reldepmod5.so = $(no-as-needed)
532 LDFLAGS-reldep6mod1.so = $(no-as-needed)
533 LDFLAGS-reldep6mod4.so = $(no-as-needed)
534 LDFLAGS-reldep8mod3.so = $(no-as-needed)
535 LDFLAGS-unload4mod1.so = $(no-as-needed)
536 LDFLAGS-unload4mod2.so = $(no-as-needed)
537 LDFLAGS-tst-initorder = $(no-as-needed)
538 LDFLAGS-tst-initordera2.so = $(no-as-needed)
539 LDFLAGS-tst-initordera3.so = $(no-as-needed)
540 LDFLAGS-tst-initordera4.so = $(no-as-needed)
541 LDFLAGS-tst-initorderb2.so = $(no-as-needed)
542 LDFLAGS-tst-tlsmod5.so = -nostdlib $(no-as-needed)
543 LDFLAGS-tst-tlsmod6.so = -nostdlib $(no-as-needed)
545 testobj1.so-no-z-defs = yes
546 testobj3.so-no-z-defs = yes
547 testobj4.so-no-z-defs = yes
548 testobj5.so-no-z-defs = yes
549 testobj6.so-no-z-defs = yes
550 failobj.so-no-z-defs = yes
551 constload2.so-no-z-defs = yes
552 constload3.so-no-z-defs = yes
553 nodelmod1.so-no-z-defs = yes
554 nodelmod2.so-no-z-defs = yes
555 nodelmod4.so-no-z-defs = yes
556 nodel2mod2.so-no-z-defs = yes
557 reldepmod2.so-no-z-defs = yes
558 reldepmod3.so-no-z-defs = yes
559 reldepmod4.so-no-z-defs = yes
560 reldep4mod4.so-no-z-defs = yes
561 reldep4mod2.so-no-z-defs = yes
562 ltglobmod2.so-no-z-defs = yes
563 dblloadmod3.so-no-z-defs = yes
564 tst-tlsmod1.so-no-z-defs = yes
565 tst-tlsmod2.so-no-z-defs = yes
566 tst-tlsmod3.so-no-z-defs = yes
567 tst-tlsmod4.so-no-z-defs = yes
568 tst-tlsmod7.so-no-z-defs = yes
569 tst-tlsmod8.so-no-z-defs = yes
570 tst-tlsmod9.so-no-z-defs = yes
571 tst-tlsmod10.so-no-z-defs = yes
572 tst-tlsmod12.so-no-z-defs = yes
573 tst-tlsmod14a.so-no-z-defs = yes
574 tst-tlsmod14b.so-no-z-defs = yes
575 tst-tlsmod15a.so-no-z-defs = yes
576 tst-tlsmod16b.so-no-z-defs = yes
577 circlemod2.so-no-z-defs = yes
578 circlemod3.so-no-z-defs = yes
579 circlemod3a.so-no-z-defs = yes
580 reldep8mod2.so-no-z-defs = yes
581 reldep9mod1.so-no-z-defs = yes
582 unload3mod4.so-no-z-defs = yes
583 unload4mod1.so-no-z-defs = yes
584 ifuncmod1.so-no-z-defs = yes
585 ifuncmod5.so-no-z-defs = yes
586 ifuncmod6.so-no-z-defs = yes
587 tst-auditmod9a.so-no-z-defs = yes
588 tst-auditmod9b.so-no-z-defs = yes
590 ifeq ($(build-shared),yes)
591 # Build all the modules even when not actually running test programs.
592 tests: $(test-modules)
593 endif
595 $(objpfx)loadtest: $(libdl)
596 LDFLAGS-loadtest = -rdynamic
598 $(objpfx)loadtest.out: $(test-modules)
600 $(objpfx)neededtest: $(libdl)
601 $(objpfx)neededtest.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
602 $(objpfx)neededobj3.so
604 $(objpfx)neededtest2: $(libdl)
605 $(objpfx)neededtest2.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
606 $(objpfx)neededobj3.so
608 $(objpfx)neededtest3: $(libdl)
609 $(objpfx)neededtest3.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
610 $(objpfx)neededobj3.so $(objpfx)neededobj4.so
612 $(objpfx)neededtest4: $(libdl) $(objpfx)neededobj1.so
613 $(objpfx)neededtest4.out: $(objpfx)neededobj5.so $(objpfx)neededobj6.so
615 $(objpfx)restest1: $(objpfx)testobj1.so $(objpfx)testobj1_1.so $(libdl)
616 LDFLAGS-restest1 = -rdynamic
618 $(objpfx)restest2: $(libdl)
619 LDFLAGS-restest2 = -rdynamic
621 $(objpfx)restest1.out: $(test-modules)
623 preloadtest-preloads = testobj1 testobj2 testobj3 testobj4 testobj5
624 $(objpfx)preloadtest: $(objpfx)testobj6.so
625 LDFLAGS-preloadtest = -rdynamic
626 $(objpfx)preloadtest.out: $(preloadtest-preloads:%=$(objpfx)%.so)
627 preloadtest-ENV = \
628 LD_PRELOAD=$(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
630 $(objpfx)loadfail: $(libdl)
631 LDFLAGS-loadfail = -rdynamic
633 $(objpfx)loadfail.out: $(objpfx)failobj.so
635 $(objpfx)multiload: $(libdl)
636 LDFLAGS-multiload = -rdynamic
637 CFLAGS-multiload.c = -DOBJDIR=\"$(elf-objpfx)\"
639 $(objpfx)multiload.out: $(objpfx)testobj1.so
641 $(objpfx)origtest: $(libdl)
642 LDFLAGS-origtest = -rdynamic
643 $(objpfx)origtest.out: $(objpfx)testobj1.so
645 ifeq ($(have-thread-library),yes)
646 $(objpfx)resolvfail: $(libdl) $(shared-thread-library)
647 else
648 $(objpfx)resolvfail: $(libdl)
649 endif
651 $(objpfx)constload1: $(libdl)
652 $(objpfx)constload1.out: $(objpfx)constload2.so $(objpfx)constload3.so
654 $(objpfx)circleload1: $(libdl)
655 $(objpfx)circleload1.out: $(objpfx)circlemod1.so \
656 $(objpfx)circlemod1a.so
658 $(objpfx)circlemod1.so: $(objpfx)circlemod2.so
659 $(objpfx)circlemod2.so: $(objpfx)circlemod3.so
660 $(objpfx)circlemod1a.so: $(objpfx)circlemod2a.so
661 $(objpfx)circlemod2a.so: $(objpfx)circlemod3a.so
663 $(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so)
665 $(objpfx)order-cmp.out: $(objpfx)order.out
666 (echo "0123456789" | cmp $< -) > $@; \
667 $(evaluate-test)
669 $(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so)
670 $(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
671 vismain-ENV = LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
673 $(objpfx)noload: $(objpfx)testobj1.so $(libdl)
674 LDFLAGS-noload = -rdynamic $(no-as-needed)
675 $(objpfx)noload.out: $(objpfx)testobj5.so
677 $(objpfx)noload-mem.out: $(objpfx)noload.out
678 $(common-objpfx)malloc/mtrace $(objpfx)noload.mtrace > $@; \
679 $(evaluate-test)
680 noload-ENV = MALLOC_TRACE=$(objpfx)noload.mtrace
682 LDFLAGS-nodelete = -rdynamic
683 LDFLAGS-nodelmod1.so = -Wl,--enable-new-dtags,-z,nodelete
684 LDFLAGS-nodelmod4.so = -Wl,--enable-new-dtags,-z,nodelete
685 $(objpfx)nodelete: $(libdl)
686 $(objpfx)nodelete.out: $(objpfx)nodelmod1.so $(objpfx)nodelmod2.so \
687 $(objpfx)nodelmod3.so
689 LDFLAGS-nodlopenmod.so = -Wl,--enable-new-dtags,-z,nodlopen
690 $(objpfx)nodlopen: $(libdl)
691 $(objpfx)nodlopen.out: $(objpfx)nodlopenmod.so
693 $(objpfx)nodlopenmod2.so: $(objpfx)nodlopenmod.so
694 $(objpfx)nodlopen2: $(libdl)
695 $(objpfx)nodlopen2.out: $(objpfx)nodlopenmod2.so
697 $(objpfx)filtmod1.so: $(objpfx)filtmod1.os $(objpfx)filtmod2.so
698 $(LINK.o) -shared -o $@ -B$(csu-objpfx) $(LDFLAGS.so) \
699 -L$(subst :, -L,$(rpath-link)) \
700 -Wl,-rpath-link=$(rpath-link) \
701 $< -Wl,-F,$(objpfx)filtmod2.so
702 $(objpfx)filter: $(objpfx)filtmod1.so
704 $(objpfx)unload: $(libdl)
705 $(objpfx)unload.out: $(objpfx)unloadmod.so
707 $(objpfx)reldep: $(libdl)
708 $(objpfx)reldep.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod2.so
710 $(objpfx)reldep2: $(libdl)
711 $(objpfx)reldep2.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod3.so
713 $(objpfx)reldep3: $(libdl)
714 $(objpfx)reldep3.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
716 $(objpfx)reldep4: $(libdl)
717 $(objpfx)reldep4.out: $(objpfx)reldep4mod1.so $(objpfx)reldep4mod2.so
719 $(objpfx)next: $(objpfx)nextmod1.so $(objpfx)nextmod2.so $(libdl)
720 LDFLAGS-next = $(no-as-needed)
722 $(objpfx)unload2: $(libdl)
723 $(objpfx)unload2.out: $(objpfx)unload2mod.so $(objpfx)unload2dep.so
725 $(objpfx)lateglobal: $(libdl)
726 $(objpfx)lateglobal.out: $(objpfx)ltglobmod1.so $(objpfx)ltglobmod2.so
728 $(objpfx)tst-pathopt: $(libdl)
729 $(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \
730 $(objpfx)pathoptobj.so
731 $(SHELL) $< $(common-objpfx) '$(test-wrapper-env)' \
732 '$(run-program-env)'; \
733 $(evaluate-test)
735 $(objpfx)tst-rtld-load-self.out: tst-rtld-load-self.sh $(objpfx)ld.so
736 $(SHELL) $^ '$(test-wrapper)' '$(test-wrapper-env)' > $@; \
737 $(evaluate-test)
739 $(objpfx)initfirst: $(libdl)
740 $(objpfx)initfirst.out: $(objpfx)firstobj.so
742 $(objpfx)global: $(objpfx)globalmod1.so
743 $(objpfx)global.out: $(objpfx)reldepmod1.so
745 $(objpfx)dblload: $(libdl)
746 $(objpfx)dblload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
748 $(objpfx)dblunload: $(libdl)
749 $(objpfx)dblunload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
751 $(objpfx)reldep5: $(libdl)
752 $(objpfx)reldep5.out: $(objpfx)reldepmod5.so $(objpfx)reldepmod6.so
754 $(objpfx)reldep6: $(libdl)
755 $(objpfx)reldep6.out: $(objpfx)reldep6mod3.so $(objpfx)reldep6mod4.so
757 $(objpfx)reldep7: $(libdl)
758 $(objpfx)reldep7.out: $(objpfx)reldep7mod1.so $(objpfx)reldep7mod2.so
760 $(objpfx)reldep8: $(libdl)
761 $(objpfx)reldep8.out: $(objpfx)reldep8mod3.so
763 LDFLAGS-nodel2mod2.so = -Wl,--enable-new-dtags,-z,nodelete
764 $(objpfx)nodelete2: $(libdl)
765 $(objpfx)nodelete2.out: $(objpfx)nodel2mod3.so
767 $(objpfx)reldep9: $(libdl)
768 $(objpfx)reldep9.out: $(objpfx)reldep9mod3.so
770 $(objpfx)tst-tls3: $(objpfx)tst-tlsmod1.so
772 $(objpfx)tst-tls4: $(libdl)
773 $(objpfx)tst-tls4.out: $(objpfx)tst-tlsmod2.so
775 $(objpfx)tst-tls5: $(libdl)
776 $(objpfx)tst-tls5.out: $(objpfx)tst-tlsmod2.so
778 $(objpfx)tst-tls6: $(libdl)
779 $(objpfx)tst-tls6.out: $(objpfx)tst-tlsmod2.so
781 $(objpfx)tst-tls7: $(libdl)
782 $(objpfx)tst-tls7.out: $(objpfx)tst-tlsmod3.so
784 $(objpfx)tst-tls8: $(libdl)
785 $(objpfx)tst-tls8.out: $(objpfx)tst-tlsmod3.so $(objpfx)tst-tlsmod4.so
787 $(objpfx)tst-tls9: $(libdl)
788 $(objpfx)tst-tls9.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
790 $(objpfx)tst-tls10: $(objpfx)tst-tlsmod8.so $(objpfx)tst-tlsmod7.so
792 $(objpfx)tst-tls11: $(objpfx)tst-tlsmod10.so $(objpfx)tst-tlsmod9.so
794 $(objpfx)tst-tls12: $(objpfx)tst-tlsmod12.so $(objpfx)tst-tlsmod11.so
796 $(objpfx)tst-tls13: $(libdl)
797 $(objpfx)tst-tls13.out: $(objpfx)tst-tlsmod13a.so
799 $(objpfx)tst-tls14: $(objpfx)tst-tlsmod14a.so $(libdl)
800 $(objpfx)tst-tls14.out: $(objpfx)tst-tlsmod14b.so
802 $(objpfx)tst-tls15: $(libdl)
803 $(objpfx)tst-tls15.out: $(objpfx)tst-tlsmod15a.so $(objpfx)tst-tlsmod15b.so
805 $(objpfx)tst-tls-dlinfo: $(libdl)
806 $(objpfx)tst-tls-dlinfo.out: $(objpfx)tst-tlsmod2.so
810 $(objpfx)tst-tls16: $(libdl)
811 $(objpfx)tst-tls16.out: $(objpfx)tst-tlsmod16a.so $(objpfx)tst-tlsmod16b.so
813 $(objpfx)tst-tls17: $(libdl)
814 $(objpfx)tst-tls17.out: $(objpfx)tst-tlsmod17b.so
815 $(patsubst %,$(objpfx)%.os,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.os: tst-tlsmod17a.c
816 $(compile-command.c) -DN=$*
817 $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.so: $(objpfx)ld.so
818 $(objpfx)tst-tlsmod17b.so: $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules))
820 $(objpfx)tst-tls18: $(libdl)
821 $(objpfx)tst-tls18.out: $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules))
822 $(patsubst %,$(objpfx)%.os,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.os : tst-tlsmod18a.c
823 $(compile-command.c) -DN=$*
824 $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.so: $(objpfx)ld.so
826 $(objpfx)tst-tls19: $(libdl)
827 $(objpfx)tst-tls19.out: $(objpfx)tst-tls19mod1.so
829 CFLAGS-tst-align.c = $(stack-align-test-flags)
830 CFLAGS-tst-align2.c = $(stack-align-test-flags)
831 CFLAGS-tst-alignmod.c = $(stack-align-test-flags)
832 CFLAGS-tst-alignmod2.c = $(stack-align-test-flags)
833 $(objpfx)tst-align: $(libdl)
834 $(objpfx)tst-align.out: $(objpfx)tst-alignmod.so
835 $(objpfx)tst-align2: $(objpfx)tst-alignmod2.so
837 $(objpfx)unload3: $(libdl)
838 $(objpfx)unload3.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
839 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
841 $(objpfx)unload4: $(libdl)
842 $(objpfx)unload4.out: $(objpfx)unload4mod1.so $(objpfx)unload4mod3.so
844 $(objpfx)unload5: $(libdl)
845 $(objpfx)unload5.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
846 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
848 $(objpfx)unload6: $(libdl)
849 $(objpfx)unload6.out: $(objpfx)unload6mod1.so $(objpfx)unload6mod2.so \
850 $(objpfx)unload6mod3.so
852 $(objpfx)unload7: $(libdl)
853 $(objpfx)unload7.out: $(objpfx)unload7mod1.so $(objpfx)unload7mod2.so
854 unload7-ENV = MALLOC_PERTURB_=85
856 $(objpfx)unload8: $(libdl)
857 $(objpfx)unload8.out: $(objpfx)unload8mod1.so $(objpfx)unload8mod1x.so
859 ifdef libdl
860 $(objpfx)tst-tls9-static: $(common-objpfx)dlfcn/libdl.a
861 $(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
862 endif
864 ifeq ($(have-z-execstack),yes)
865 $(objpfx)tst-execstack: $(libdl)
866 $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
867 LDFLAGS-tst-execstack = -Wl,-z,noexecstack
868 LDFLAGS-tst-execstack-mod = -Wl,-z,execstack
870 $(objpfx)tst-execstack-needed: $(objpfx)tst-execstack-mod.so
871 LDFLAGS-tst-execstack-needed = -Wl,-z,noexecstack
873 LDFLAGS-tst-execstack-prog = -Wl,-z,execstack
874 CFLAGS-tst-execstack-prog.c += -Wno-trampolines
875 CFLAGS-tst-execstack-mod.c += -Wno-trampolines
876 endif
878 LDFLAGS-tst-array2 = $(no-as-needed)
879 LDFLAGS-tst-array5 = $(no-as-needed)
881 $(objpfx)tst-array1-cmp.out: tst-array1.exp $(objpfx)tst-array1.out
882 cmp $^ > $@; \
883 $(evaluate-test)
885 $(objpfx)tst-array1-static-cmp.out: tst-array1.exp \
886 $(objpfx)tst-array1-static.out
887 cmp $^ > $@; \
888 $(evaluate-test)
890 $(objpfx)tst-array2: $(objpfx)tst-array2dep.so
891 $(objpfx)tst-array2-cmp.out: tst-array2.exp $(objpfx)tst-array2.out
892 cmp $^ > $@; \
893 $(evaluate-test)
895 $(objpfx)tst-array3-cmp.out: tst-array1.exp $(objpfx)tst-array3.out
896 cmp $^ > $@; \
897 $(evaluate-test)
899 $(objpfx)tst-array4: $(libdl)
900 $(objpfx)tst-array4.out: $(objpfx)tst-array2dep.so
901 $(objpfx)tst-array4-cmp.out: tst-array4.exp $(objpfx)tst-array4.out
902 cmp $^ > $@; \
903 $(evaluate-test)
905 $(objpfx)tst-array5: $(objpfx)tst-array5dep.so
906 $(objpfx)tst-array5-cmp.out: tst-array5.exp $(objpfx)tst-array5.out
907 cmp $^ > $@; \
908 $(evaluate-test)
910 $(objpfx)tst-array5-static-cmp.out: tst-array5-static.exp \
911 $(objpfx)tst-array5-static.out
912 cmp $^ > $@; \
913 $(evaluate-test)
915 CFLAGS-tst-pie1.c += $(pie-ccflag)
916 CFLAGS-tst-pie2.c += $(pie-ccflag)
918 $(objpfx)tst-pie1: $(objpfx)tst-piemod1.so
920 ifeq (yes,$(build-shared))
921 all-built-dso := $(common-objpfx)elf/ld.so $(common-objpfx)libc.so \
922 $(filter-out $(common-objpfx)linkobj/libc.so, \
923 $(sort $(wildcard $(addprefix $(common-objpfx), \
924 */lib*.so \
925 iconvdata/*.so))))
927 $(all-built-dso:=.dyn): %.dyn: %
928 @rm -f $@T
929 LC_ALL=C $(READELF) -W -d $< > $@T
930 test -s $@T
931 mv -f $@T $@
932 common-generated += $(all-built-dso:$(common-objpfx)%=%.dyn)
934 $(objpfx)check-textrel.out: $(..)scripts/check-textrel.awk \
935 $(all-built-dso:=.dyn)
936 LC_ALL=C $(AWK) -f $^ > $@; \
937 $(evaluate-test)
938 generated += check-textrel.out
940 $(objpfx)execstack-default: $(first-word $(wildcard $(sysdirs:%=%/stackinfo.h)))
941 $(make-target-directory)
942 { echo '#include <elf.h>'; \
943 echo '#include <stackinfo.h>'; \
944 echo '#if (DEFAULT_STACK_PERMS & PF_X) == 0'; \
945 echo '@@@execstack-no@@@'; \
946 echo '#else'; \
947 echo '@@@execstack-yes@@@'; \
948 echo '#endif'; } | \
949 $(CC) $(CFLAGS) $(CPPFLAGS) -E -x c-header - | \
950 sed -n -e 's/^@@@\(.*\)@@@/\1/p' > $@T
951 mv -f $@T $@
952 generated += execstack-default
954 $(all-built-dso:=.phdr): %.phdr: %
955 @rm -f $@T
956 LC_ALL=C $(READELF) -W -l $< > $@T
957 test -s $@T
958 mv -f $@T $@
959 common-generated += $(all-built-dso:$(common-objpfx)%=%.phdr)
961 $(objpfx)check-execstack.out: $(..)scripts/check-execstack.awk \
962 $(objpfx)execstack-default \
963 $(all-built-dso:=.phdr)
964 LC_ALL=C $(AWK) -f $^ > $@; \
965 $(evaluate-test)
966 generated += check-execstack.out
968 $(objpfx)tst-dlmodcount: $(libdl)
969 $(objpfx)tst-dlmodcount.out: $(test-modules)
971 $(all-built-dso:=.jmprel): %.jmprel: % Makefile
972 @rm -f $@T
973 LC_ALL=C $(READELF) -W -S -d -r $< > $@T
974 test -s $@T
975 mv -f $@T $@
976 common-generated += $(all-built-dso:$(common-objpfx)%=%.jmprel)
978 localplt-built-dso := $(addprefix $(common-objpfx),\
979 libc.so \
980 elf/ld.so \
981 math/libm.so \
982 rt/librt.so \
983 dlfcn/libdl.so \
984 resolv/libresolv.so \
985 crypt/libcrypt.so \
987 ifeq ($(have-thread-library),yes)
988 localplt-built-dso += $(filter-out %_nonshared.a, $(shared-thread-library))
989 endif
991 vpath localplt.data $(+sysdep_dirs)
993 $(objpfx)check-localplt.out: $(..)scripts/check-localplt.awk \
994 $(..)scripts/localplt.awk \
995 $(localplt-built-dso:=.jmprel) \
996 localplt.data
997 LC_ALL=C $(AWK) -f $(filter-out $< %localplt.data,$^) | \
998 LC_ALL=C $(AWK) -f $< $(filter %localplt.data,$^) - \
999 > $@; \
1000 $(evaluate-test)
1001 endif
1003 $(objpfx)tst-dlopenrpathmod.so: $(libdl)
1004 $(objpfx)tst-dlopenrpath: $(objpfx)tst-dlopenrpathmod.so $(libdl)
1005 CFLAGS-tst-dlopenrpath.c += -DPFX=\"$(objpfx)\"
1006 LDFLAGS-tst-dlopenrpathmod.so += -Wl,-rpath,\$$ORIGIN/test-subdir
1007 $(objpfx)tst-dlopenrpath.out: $(objpfx)firstobj.so
1009 $(objpfx)tst-deep1mod2.so: $(objpfx)tst-deep1mod3.so
1010 $(objpfx)tst-deep1: $(libdl) $(objpfx)tst-deep1mod1.so
1011 $(objpfx)tst-deep1.out: $(objpfx)tst-deep1mod2.so
1012 LDFLAGS-tst-deep1 += -rdynamic
1013 tst-deep1mod3.so-no-z-defs = yes
1015 $(objpfx)tst-dlmopen1mod.so: $(libdl)
1016 $(objpfx)tst-dlmopen1: $(libdl)
1017 $(objpfx)tst-dlmopen1.out: $(objpfx)tst-dlmopen1mod.so
1019 $(objpfx)tst-dlmopen2: $(libdl)
1020 $(objpfx)tst-dlmopen2.out: $(objpfx)tst-dlmopen1mod.so
1022 $(objpfx)tst-dlmopen3: $(libdl)
1023 $(objpfx)tst-dlmopen3.out: $(objpfx)tst-dlmopen1mod.so
1025 $(objpfx)tst-audit1.out: $(objpfx)tst-auditmod1.so
1026 tst-audit1-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1028 $(objpfx)tst-audit2.out: $(objpfx)tst-auditmod1.so
1029 # Prevent GCC-5 from translating a malloc/memset pair into calloc
1030 CFLAGS-tst-audit2.c += -fno-builtin
1031 tst-audit2-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1033 $(objpfx)tst-audit9: $(libdl)
1034 $(objpfx)tst-audit9.out: $(objpfx)tst-auditmod9a.so $(objpfx)tst-auditmod9b.so
1035 tst-audit9-ENV = LD_AUDIT=$(objpfx)tst-auditmod9a.so
1037 $(objpfx)tst-audit8: $(libm)
1038 $(objpfx)tst-audit8.out: $(objpfx)tst-auditmod1.so
1039 tst-audit8-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1041 $(objpfx)tst-global1: $(libdl)
1042 $(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
1044 $(objpfx)order2: $(libdl)
1045 $(objpfx)order2.out: $(objpfx)order2mod1.so $(objpfx)order2mod2.so
1046 $(objpfx)order2-cmp.out: $(objpfx)order2.out
1047 (echo "12345" | cmp $< -) > $@; \
1048 $(evaluate-test)
1049 $(objpfx)order2mod1.so: $(objpfx)order2mod4.so
1050 $(objpfx)order2mod4.so: $(objpfx)order2mod3.so
1051 $(objpfx)order2mod2.so: $(objpfx)order2mod3.so
1052 order2mod2.so-no-z-defs = yes
1053 LDFLAGS-order2mod1.so = $(no-as-needed)
1054 LDFLAGS-order2mod2.so = $(no-as-needed)
1056 tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child"
1057 tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
1059 tst-ptrguard1-ARGS = --command "$(host-test-program-cmd) --child"
1060 # When built statically, the pointer guard interface uses
1061 # __pointer_chk_guard_local.
1062 CFLAGS-tst-ptrguard1-static.c = -DPTRGUARD_LOCAL
1063 tst-ptrguard1-static-ARGS = --command "$(objpfx)tst-ptrguard1-static --child"
1065 $(objpfx)tst-leaks1: $(libdl)
1066 $(objpfx)tst-leaks1-mem.out: $(objpfx)tst-leaks1.out
1067 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1.mtrace > $@; \
1068 $(evaluate-test)
1070 $(objpfx)tst-leaks1-static: $(common-objpfx)dlfcn/libdl.a
1071 $(objpfx)tst-leaks1-static-mem.out: $(objpfx)tst-leaks1-static.out
1072 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1-static.mtrace > $@; \
1073 $(evaluate-test)
1075 tst-leaks1-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1.mtrace
1076 tst-leaks1-static-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1-static.mtrace
1078 $(objpfx)tst-addr1: $(libdl)
1080 $(objpfx)tst-thrlock: $(libdl) $(shared-thread-library)
1081 $(objpfx)tst-dlopen-aout: $(libdl) $(shared-thread-library)
1083 CFLAGS-ifuncmain1pic.c += $(pic-ccflag)
1084 CFLAGS-ifuncmain1picstatic.c += $(pic-ccflag)
1085 CFLAGS-ifuncmain1staticpic.c += $(pic-ccflag)
1086 CFLAGS-ifuncdep1pic.c += $(pic-ccflag)
1087 CFLAGS-ifuncmain1vispic.c += $(pic-ccflag)
1088 CFLAGS-ifuncmain2pic.c += $(pic-ccflag)
1089 CFLAGS-ifuncmain2picstatic.c += $(pic-ccflag)
1090 CFLAGS-ifuncdep2pic.c += $(pic-ccflag)
1091 CFLAGS-ifuncmain4picstatic.c += $(pic-ccflag)
1092 CFLAGS-ifuncmain5pic.c += $(pic-ccflag)
1093 CFLAGS-ifuncmain5picstatic.c += $(pic-ccflag)
1094 CFLAGS-ifuncmain5staticpic.c += $(pic-ccflag)
1095 CFLAGS-ifuncdep5pic.c += $(pic-ccflag)
1096 CFLAGS-ifuncmain7pic.c += $(pic-ccflag)
1097 CFLAGS-ifuncmain7picstatic.c += $(pic-ccflag)
1099 LDFLAGS-ifuncmain3 = -Wl,-export-dynamic
1101 CFLAGS-ifuncmain1pie.c += $(pie-ccflag)
1102 CFLAGS-ifuncmain1vispie.c += $(pie-ccflag)
1103 CFLAGS-ifuncmain1staticpie.c += $(pie-ccflag)
1104 CFLAGS-ifuncmain5pie.c += $(pie-ccflag)
1105 CFLAGS-ifuncmain6pie.c += $(pie-ccflag)
1106 CFLAGS-ifuncmain7pie.c += $(pie-ccflag)
1108 $(objpfx)ifuncmain1pie: $(objpfx)ifuncmod1.so
1109 $(objpfx)ifuncmain1staticpie: $(objpfx)ifuncdep1pic.o
1110 $(objpfx)ifuncmain1vispie: $(objpfx)ifuncmod1.so
1111 $(objpfx)ifuncmain5pie: $(objpfx)ifuncmod5.so
1112 $(objpfx)ifuncmain6pie: $(objpfx)ifuncmod6.so
1114 $(objpfx)ifuncmain1: $(addprefix $(objpfx),ifuncmod1.so)
1115 $(objpfx)ifuncmain1pic: $(addprefix $(objpfx),ifuncmod1.so)
1116 $(objpfx)ifuncmain1staticpic: $(addprefix $(objpfx),ifuncdep1pic.o)
1117 $(objpfx)ifuncmain1static: $(addprefix $(objpfx),ifuncdep1.o)
1118 $(objpfx)ifuncmain1picstatic: $(addprefix $(objpfx),ifuncdep1pic.o)
1119 $(objpfx)ifuncmain1vis: $(addprefix $(objpfx),ifuncmod1.so)
1120 $(objpfx)ifuncmain1vispic: $(addprefix $(objpfx),ifuncmod1.so)
1121 $(objpfx)ifuncmain2: $(addprefix $(objpfx),ifuncdep2.o)
1122 $(objpfx)ifuncmain2pic: $(addprefix $(objpfx),ifuncdep2pic.o)
1123 $(objpfx)ifuncmain2static: $(addprefix $(objpfx),ifuncdep2.o)
1124 $(objpfx)ifuncmain2picstatic: $(addprefix $(objpfx),ifuncdep2pic.o)
1126 $(objpfx)ifuncmain3: $(libdl)
1127 $(objpfx)ifuncmain3.out: $(objpfx)ifuncmod3.so
1129 $(objpfx)ifuncmain5: $(addprefix $(objpfx),ifuncmod5.so)
1130 $(objpfx)ifuncmain5pic: $(addprefix $(objpfx),ifuncmod5.so)
1131 $(objpfx)ifuncmain5static: $(addprefix $(objpfx),ifuncdep5.o)
1132 $(objpfx)ifuncmain5staticpic: $(addprefix $(objpfx),ifuncdep5pic.o)
1133 $(objpfx)ifuncmain5picstatic: $(addprefix $(objpfx),ifuncdep5pic.o)
1135 $(objpfx)tst-unique1: $(libdl)
1136 $(objpfx)tst-unique1.out: $(objpfx)tst-unique1mod1.so \
1137 $(objpfx)tst-unique1mod2.so
1139 $(objpfx)tst-unique2: $(libdl) $(objpfx)tst-unique2mod1.so
1140 $(objpfx)tst-unique2.out: $(objpfx)tst-unique2mod2.so
1142 $(objpfx)tst-unique3: $(libdl) $(objpfx)tst-unique3lib.so
1143 $(objpfx)tst-unique3.out: $(objpfx)tst-unique3lib2.so
1145 $(objpfx)tst-unique4: $(objpfx)tst-unique4lib.so
1147 $(objpfx)tst-initorder-cmp.out: tst-initorder.exp $(objpfx)tst-initorder.out
1148 cmp $^ > $@; \
1149 $(evaluate-test)
1151 $(objpfx)tst-initorder2: $(objpfx)tst-initorder2a.so $(objpfx)tst-initorder2d.so $(objpfx)tst-initorder2c.so
1152 $(objpfx)tst-initorder2a.so: $(objpfx)tst-initorder2b.so
1153 $(objpfx)tst-initorder2b.so: $(objpfx)tst-initorder2c.so
1154 $(objpfx)tst-initorder2c.so: $(objpfx)tst-initorder2d.so
1155 LDFLAGS-tst-initorder2 = $(no-as-needed)
1156 LDFLAGS-tst-initorder2a.so = $(no-as-needed)
1157 LDFLAGS-tst-initorder2b.so = $(no-as-needed)
1158 LDFLAGS-tst-initorder2c.so = $(no-as-needed)
1159 define o-iterator-doit
1160 $(objpfx)tst-initorder2$o.os: tst-initorder2.c; \
1161 $$(compile-command.c) -DNAME=\"$o\"
1162 endef
1163 object-suffixes-left := a b c d
1164 include $(o-iterator)
1166 $(objpfx)tst-initorder2-cmp.out: tst-initorder2.exp $(objpfx)tst-initorder2.out
1167 cmp $^ > $@; \
1168 $(evaluate-test)
1170 $(objpfx)tst-relsort1: $(libdl)
1171 $(objpfx)tst-relsort1mod1.so: $(libm) $(objpfx)tst-relsort1mod2.so
1172 $(objpfx)tst-relsort1mod2.so: $(libm)
1173 $(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
1174 $(objpfx)tst-relsort1mod2.so
1176 $(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so
1177 $(test-wrapper-env) \
1178 LD_TRACE_LOADED_OBJECTS=1 \
1179 LD_DEBUG=unused \
1180 LD_PRELOAD= \
1181 $(rtld-prefix) \
1182 $< > $@; \
1183 $(evaluate-test)
1185 $(objpfx)tst-unused-dep-cmp.out: $(objpfx)tst-unused-dep.out
1186 cmp $< /dev/null > $@; \
1187 $(evaluate-test)