Fix configure logic for disabling multi-arch.
[glibc.git] / elf / Makefile
blob8234ba7a514c55f37f99712832bc9b6b22bd472a
1 # Copyright (C) 1995-2011, 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 distribute := rtld-Rules \
45 $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \
46 dl-cache.h dl-hash.h soinit.c sofini.c ldd.bash.in \
47 genrtldtbl.awk atomicity.h dl-procinfo.h ldsodefs.h \
48 dl-librecon.h interp.c sln.c dl-dst.h hp-timing.h \
49 dl-lookupcfg.h sprof.c gen-trusted-dirs.awk \
50 testobj1.c testobj2.c testobj3.c testobj4.c testobj5.c \
51 testobj6.c testobj1_1.c failobj.c unloadmod.c \
52 ldconfig.h ldconfig.c cache.c readlib.c readelflib.c \
53 chroot_canon.c gccframe.h \
54 dep1.c dep2.c dep3.c dep4.c dl-dtprocnum.h unsecvars.h \
55 vismain.c vismod1.c vismod2.c vismod3.c \
56 constload2.c constload3.c filtmod1.c filtmod2.c \
57 nodlopenmod.c nodelete.c nodelmod1.c nodelmod2.c \
58 nodelmod3.c nodelmod4.c nodlopen.c dl-osinfo.h \
59 reldepmod1.c reldepmod2.c reldepmod3.c reldepmod4.c \
60 reldepmod5.c reldepmod6.c \
61 reldep4mod1.c reldep4mod2.c reldep4mod3.c reldep4mod4.c \
62 nextmod1.c nextmod2.c pathoptobj.c tst-pathopt.sh \
63 neededobj1.c neededobj2.c neededobj3.c neededobj4.c \
64 neededobj5.c neededobj6.c firstobj.c \
65 unload2mod.c unload2dep.c ltglobmod1.c ltglobmod2.c \
66 testobj.h vismod.h globalmod1.c \
67 dblloadmod1.c dblloadmod2.c dblloadmod3.c \
68 reldep6mod4.c reldep6mod3.c reldep6mod2.c reldep6mod1.c \
69 reldep6mod0.c reldep7mod1.c reldep7mod2.c \
70 unwind-dw2.c unwind-dw2-fde.c unwind.h unwind-pe.h \
71 unwind-dw2-fde.h dwarf2.h dl-procinfo.c tls.h dl-tls.h \
72 tst-tlsmod1.c tst-tlsmod2.c tst-tlsmod3.c tst-tlsmod4.c \
73 tst-tlsmod5.c tst-tlsmod6.c tst-tlsmod7.c tst-tlsmod8.c \
74 tst-tlsmod9.c tst-tlsmod10.c tst-tlsmod11.c \
75 tst-tlsmod12.c tst-tls10.h tst-alignmod.c tst-alignmod2.c \
76 circlemod1.c circlemod1a.c circlemod2.c circlemod2a.c \
77 circlemod3.c circlemod3a.c nodlopenmod2.c \
78 tst-tls19mod1.c tst-tls19mod2.c tst-tls19mod3.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 unload8mod1.c unload8mod1x.c unload8mod2.c unload8mod3.c \
93 tst-audit1.c tst-audit2.c tst-audit3.c tst-audit4.c \
94 tst-auditmod1.c tst-auditmod3a.c tst-auditmod3b.c \
95 tst-auditmod4a.c tst-auditmod4b.c \
96 tst-audit5.c tst-auditmod5a.c tst-auditmod5b.c \
97 tst-audit6.c tst-auditmod6a.c tst-auditmod6b.c \
98 tst-auditmod6c.c \
99 tst-audit7.c tst-auditmod7a.c tst-auditmod7b.c \
100 order2mod1.c order2mod2.c order2mod3.c order2mod4.c \
101 tst-stackguard1.c tst-stackguard1-static.c \
102 tst-array5.c tst-array5-static.c tst-array5dep.c \
103 tst-array5.exp tst-leaks1.c check-execstack.c \
104 ifuncmain1.c ifuncmain1pic.c ifuncmain1vis.c \
105 ifuncmain1vispic.c ifuncmain1static.c \
106 ifuncmain1staticpic.c ifuncmain1picstatic.c \
107 ifuncdep1.c ifuncdep1pic.c ifuncmod1.c \
108 ifuncmain1pie.c ifuncmain1vispie.c \
109 ifuncmain1staticpie.c \
110 ifuncmain2.c ifuncmain2static.c ifuncdep2.c \
111 ifuncmain2pic.c ifuncmain2picstatic.c ifuncdep2pic.c \
112 ifuncmain3.c ifuncmod3.c \
113 ifuncmain4.c ifuncmain4static.c ifuncmain4picstatic.c \
114 ifuncmain5.c ifuncmain5pic.c ifuncmain5picstatic.c \
115 ifuncmain5pie.c ifuncmain5static.c \
116 ifuncmain5staticpic.c \
117 ifuncdep5.c ifuncdep5pic.c ifuncmod5.c \
118 ifuncmain6pie.c ifuncmod6.c \
119 ifuncmain7.c ifuncmain7pic.c ifuncmain7picstatic.c \
120 ifuncmain7pie.c ifuncmain7static.c \
121 tst-unique1.c tst-unique1mod1.c tst-unique1mod2.c \
122 tst-unique2.c tst-unique2mod1.c tst-unique2mod2.c \
123 tst-initordera1.c tst-initordera2.c tst-initorderb1.c \
124 tst-initorderb2.c tst-initordera3.c tst-initordera4.c \
125 tst-initorder.c \
126 tst-initorder2.c \
127 tst-relsort1.c tst-relsort1mod1.c tst-relsort1mod2.c
129 CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
130 CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
131 CFLAGS-dl-iterate-phdr.c = $(uses-callbacks)
133 include ../Makeconfig
135 ifeq ($(unwind-find-fde),yes)
136 routines += unwind-dw2-fde-glibc
137 shared-only-routines += unwind-dw2-fde-glibc
138 endif
140 before-compile = $(objpfx)trusted-dirs.h
141 generated := trusted-dirs.h trusted-dirs.st for-renamed/renamed.so
142 generated-dirs := for-renamed
144 ifeq ($(versioning),yes)
145 ld-map = $(common-objpfx)ld.map
146 endif
148 ifeq (yes,$(build-shared))
149 extra-objs = $(all-rtld-routines:%=%.os) soinit.os sofini.os interp.os
150 generated += librtld.os dl-allobjs.os ld.so ldd
151 install-others = $(inst_slibdir)/$(rtld-installed-name)
152 install-bin-script = ldd
153 endif
155 others = sprof sln pldd
156 install-bin = sprof pldd
157 others-static = sln
158 install-rootsbin = sln
160 ifeq (yes,$(use-ldconfig))
161 ifeq (yes,$(build-shared))
162 others-static += ldconfig
163 others += ldconfig
164 install-rootsbin += ldconfig
166 ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon
167 extra-objs += $(ldconfig-modules:=.o)
169 pldd-modules := xmalloc
171 # To find xmalloc.c and xstrdup.c
172 vpath %.c ../locale/programs
174 endif
175 endif
177 ifeq ($(have-ksh)$(build-shared),yesyes)
178 extra-objs += sotruss-lib.os sotruss-lib.so
179 install-others += $(inst_auditdir)/sotruss-lib.so
180 install-bin-script += sotruss
181 generated += sotruss
182 CPPFLAGS-sotruss-lib = -DNOT_IN_libc
183 $(objpfx)sotruss-lib.so: $(objpfx)sotruss-lib.os
184 $(build-module-asneeded)
185 $(objpfx)sotruss-lib.so: $(common-objpfx)libc.so $(objpfx)ld.so \
186 $(common-objpfx)libc_nonshared.a
188 $(objpfx)sotruss: sotruss.ksh $(common-objpfx)config.make
189 sed -e 's%@KSH@%$(KSH)%g' \
190 -e 's%@VERSION@%$(version)%g' \
191 -e 's%@TEXTDOMAINDIR@%$(msgcatdir)%g' \
192 -e 's%@PREFIX@%$(prefix)%g' < $< > $@.new
193 chmod 555 $@.new
194 mv -f $@.new $@
195 $(inst_auditdir)/sotruss-lib.so: $(objpfx)sotruss-lib.so $(+force)
196 $(do-install-program)
197 endif
199 tests = tst-tls1 tst-tls2 tst-tls9 tst-leaks1
200 ifeq (yes,$(have-initfini-array))
201 tests += tst-array1 tst-array2 tst-array3 tst-array4 tst-array5
202 endif
203 tests-static = tst-tls1-static tst-tls2-static tst-stackguard1-static
204 ifeq (yes,$(build-shared))
205 tests-static += tst-tls9-static
206 tst-tls9-static-ENV = \
207 LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn
208 endif
209 ifeq (yes,$(have-initfini-array))
210 tests-static += tst-array1-static tst-array5-static
211 endif
212 tests += $(tests-static)
213 ifeq (yes,$(build-shared))
214 tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
215 constload1 order vismain noload filter unload \
216 reldep reldep2 reldep3 reldep4 nodelete nodelete2 \
217 nodlopen nodlopen2 neededtest neededtest2 \
218 neededtest3 neededtest4 unload2 lateglobal initfirst global \
219 restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
220 circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \
221 tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-tls15 \
222 tst-tls16 tst-tls17 tst-tls18 tst-tls19 tst-tls-dlinfo \
223 tst-align tst-align2 $(tests-execstack-$(have-z-execstack)) \
224 tst-dlmodcount tst-dlopenrpath tst-deep1 \
225 tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
226 unload3 unload4 unload5 unload6 unload7 unload8 tst-global1 order2 \
227 tst-audit1 tst-audit2 \
228 tst-stackguard1 tst-addr1 tst-thrlock \
229 tst-unique1 tst-unique2 tst-unique3 tst-unique4 \
230 tst-initorder tst-initorder2 tst-relsort1
231 # reldep9
232 test-srcs = tst-pathopt
233 selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
234 ifneq ($(selinux-enabled),1)
235 tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
236 endif
237 ifeq (x86_64,$(config-machine))
238 tests += tst-audit3 tst-audit4 tst-audit5
239 ifeq (yes,$(config-cflags-avx))
240 tests += tst-audit6 tst-audit7
241 endif
242 endif
243 endif
244 tests: $(objpfx)tst-leaks1-mem $(objpfx)noload-mem
245 tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
246 tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
247 tlsmod17a-modules = $(addprefix tst-tlsmod17a, $(tlsmod17a-suffixes))
248 tlsmod18a-modules = $(addprefix tst-tlsmod18a, $(tlsmod17a-suffixes))
249 extra-test-objs += $(tlsmod17a-modules:=.os) $(tlsmod18a-modules:=.os)
250 test-extras += tst-tlsmod17a tst-tlsmod18a
251 modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
252 testobj1_1 failobj constload2 constload3 unloadmod \
253 dep1 dep2 dep3 dep4 vismod1 vismod2 vismod3 \
254 nodelmod1 nodelmod2 nodelmod3 nodelmod4 \
255 nodel2mod1 nodel2mod2 nodel2mod3 \
256 nodlopenmod nodlopenmod2 filtmod1 filtmod2 \
257 reldepmod1 reldepmod2 reldepmod3 reldepmod4 nextmod1 nextmod2 \
258 reldep4mod1 reldep4mod2 reldep4mod3 reldep4mod4 \
259 neededobj1 neededobj2 neededobj3 neededobj4 \
260 neededobj5 neededobj6 firstobj globalmod1 \
261 unload2mod unload2dep ltglobmod1 ltglobmod2 pathoptobj \
262 dblloadmod1 dblloadmod2 dblloadmod3 reldepmod5 reldepmod6 \
263 reldep6mod0 reldep6mod1 reldep6mod2 reldep6mod3 reldep6mod4 \
264 reldep7mod1 reldep7mod2 \
265 tst-tlsmod1 tst-tlsmod2 tst-tlsmod3 tst-tlsmod4 \
266 tst-tlsmod5 tst-tlsmod6 tst-tlsmod7 tst-tlsmod8 \
267 tst-tlsmod9 tst-tlsmod10 tst-tlsmod11 tst-tlsmod12 \
268 tst-tlsmod13 tst-tlsmod13a tst-tlsmod14a tst-tlsmod14b \
269 tst-tlsmod15a tst-tlsmod15b tst-tlsmod16a tst-tlsmod16b \
270 $(tlsmod17a-modules) tst-tlsmod17b $(tlsmod18a-modules) \
271 tst-tls19mod1 tst-tls19mod2 tst-tls19mod3 \
272 circlemod1 circlemod1a circlemod2 circlemod2a \
273 circlemod3 circlemod3a \
274 reldep8mod1 reldep8mod2 reldep8mod3 \
275 reldep9mod1 reldep9mod2 reldep9mod3 \
276 tst-alignmod tst-alignmod2 \
277 $(modules-execstack-$(have-z-execstack)) \
278 tst-dlopenrpathmod tst-deep1mod1 tst-deep1mod2 tst-deep1mod3 \
279 tst-dlmopen1mod tst-auditmod1 \
280 unload3mod1 unload3mod2 unload3mod3 unload3mod4 \
281 unload4mod1 unload4mod2 unload4mod3 unload4mod4 \
282 unload6mod1 unload6mod2 unload6mod3 \
283 unload7mod1 unload7mod2 \
284 unload8mod1 unload8mod1x unload8mod2 unload8mod3 \
285 order2mod1 order2mod2 order2mod3 order2mod4 \
286 tst-unique1mod1 tst-unique1mod2 \
287 tst-unique2mod1 tst-unique2mod2 \
288 tst-unique3lib tst-unique3lib2 \
289 tst-unique4lib \
290 tst-initordera1 tst-initorderb1 \
291 tst-initordera2 tst-initorderb2 \
292 tst-initordera3 tst-initordera4 \
293 tst-initorder2a tst-initorder2b tst-initorder2c \
294 tst-initorder2d \
295 tst-relsort1mod1 tst-relsort1mod2
296 ifeq (yes,$(have-initfini-array))
297 modules-names += tst-array2dep tst-array5dep
298 endif
299 ifeq (yesyes,$(have-fpie)$(build-shared))
300 modules-names += tst-piemod1
301 tests += tst-pie1
302 tests-pie += tst-pie1
303 endif
304 ifeq (x86_64,$(config-machine))
305 modules-names += tst-auditmod3a tst-auditmod3b \
306 tst-auditmod4a tst-auditmod4b \
307 tst-auditmod5a tst-auditmod5b \
308 tst-auditmod6a tst-auditmod6b tst-auditmod6c \
309 tst-auditmod7a tst-auditmod7b
310 endif
311 modules-execstack-yes = tst-execstack-mod
312 extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
313 # We need this variable to be sure the test modules get the right CPPFLAGS.
314 test-extras += $(modules-names)
316 # filtmod1.so has a special rule
317 modules-names-nobuild := filtmod1
319 ifneq (no,$(multi-arch))
320 tests-static += ifuncmain1static ifuncmain1picstatic \
321 ifuncmain2static ifuncmain2picstatic \
322 ifuncmain4static ifuncmain4picstatic \
323 ifuncmain5static ifuncmain5picstatic \
324 ifuncmain7static ifuncmain7picstatic
326 ifeq (yes,$(build-shared))
327 tests += ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \
328 ifuncmain1staticpic \
329 ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \
330 ifuncmain5 ifuncmain5pic ifuncmain5staticpic \
331 ifuncmain7 ifuncmain7pic
332 ifunc-test-modules = ifuncdep1 ifuncdep1pic ifuncdep2 ifuncdep2pic \
333 ifuncdep5 ifuncdep5pic
334 extra-test-objs += $(ifunc-test-modules:=.o)
335 test-extras += $(ifunc-test-modules)
336 ifeq (yes,$(have-fpie))
337 ifunc-pie-tests = ifuncmain1pie ifuncmain1vispie ifuncmain1staticpie \
338 ifuncmain5pie ifuncmain6pie ifuncmain7pie
339 tests += $(ifunc-pie-tests)
340 tests-pie += $(ifunc-pie-tests)
341 endif
342 modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6
343 endif
344 endif
347 include ../Rules
349 check-abi: check-abi-ld
350 update-abi: update-abi-ld
352 ifeq (yes,$(build-shared))
353 # Make sure these things are built in the `make lib' pass so they can be used
354 # to run programs during the `make others' pass.
355 lib-noranlib: $(objpfx)$(rtld-installed-name) \
356 $(addprefix $(objpfx),$(extra-objs))
357 endif
359 # Command to link into a larger single relocatable object.
360 reloc-link = $(LINK.o) -nostdlib -nostartfiles -r
362 $(objpfx)sotruss-lib.so: $(shlib-lds)
364 $(objpfx)dl-allobjs.os: $(all-rtld-routines:%=$(objpfx)%.os)
365 $(reloc-link) -o $@ $^
367 # Link together the dynamic linker into a single relocatable object.
368 # First we do a link against libc_pic.a just to get a link map,
369 # and discard the object produced by that link. From the link map
370 # we can glean all the libc modules that need to go into the dynamic
371 # linker. Then we do a recursive make that goes into all the subdirs
372 # those modules come from and builds special rtld-foo.os versions that
373 # are compiled with special flags, and puts these modules into rtld-libc.a
374 # for us. Then we do the real link using rtld-libc.a instead of libc_pic.a.
376 $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
377 @-rm -f $@T
378 $(reloc-link) -o $@.o '-Wl,-(' $^ -lgcc '-Wl,-)' -Wl,-Map,$@T
379 rm -f $@.o
380 mv -f $@T $@
382 $(objpfx)librtld.mk: $(objpfx)librtld.map Makefile
383 LC_ALL=C \
384 sed -n 's@^$(common-objpfx)\([^(]*\)(\([^)]*\.os\)) *.*$$@\1 \2@p' \
385 $< | \
386 while read lib file; do \
387 case $$lib in \
388 libc_pic.a) \
389 LC_ALL=C fgrep -l /$$file \
390 $(common-objpfx)stamp.os $(common-objpfx)*/stamp.os | \
391 LC_ALL=C \
392 sed 's@^$(common-objpfx)\([^/]*\)/stamp\.os$$@rtld-\1'" +=$$file@"\
393 ;; \
394 */*.a) \
395 echo rtld-$${lib%%/*} += $$file ;; \
396 *) echo "Wasn't expecting $$lib($$file)" >&2; exit 1 ;; \
397 esac; \
398 done > $@T
399 echo rtld-subdirs = `LC_ALL=C sed 's/^rtld-\([^ ]*\).*$$/\1/' $@T \
400 | LC_ALL=C sort -u` >> $@T
401 mv -f $@T $@
403 $(objpfx)rtld-libc.a: $(objpfx)librtld.mk FORCE
404 $(MAKE) -f $< -f rtld-Rules
406 $(objpfx)librtld.os: $(objpfx)dl-allobjs.os $(objpfx)rtld-libc.a
407 $(LINK.o) -nostdlib -nostartfiles -r -o $@ '-Wl,-(' $^ -lgcc '-Wl,-)' \
408 -Wl,-Map,$@.map
410 generated += librtld.map librtld.mk rtld-libc.a librtld.os.map
412 z-now-yes = -Wl,-z,now
414 $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
415 $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
416 $(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \
417 $(filter-out $(map-file),$^) $(load-map-file) \
418 -Wl,-soname=$(rtld-installed-name) \
419 -Wl,-defsym=_begin=0
420 readelf -s $@ \
421 | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
423 # interp.c exists just to get this string into the libraries.
424 CFLAGS-interp.c = -D'RUNTIME_LINKER="$(slibdir)/$(rtld-installed-name)"' \
425 -DNOT_IN_libc=1
426 $(objpfx)interp.os: $(common-objpfx)config.make
428 ifneq (ld.so,$(rtld-installed-name))
429 # Make sure ld.so.1 exists in the build directory so we can link
430 # against it.
431 $(objpfx)$(rtld-installed-name): $(objpfx)ld.so
432 rm -f $@
433 ln -s $(<F) $@
434 generated += $(rtld-installed-name)
435 endif
437 # Build a file mentioning all trustworthy directories to look for shared
438 # libraries when using LD_LIBRARY_PATH in a setuid program. The user can
439 # add directories to the list by defining $(user-defined-trusted-dirs)
440 # before starting make.
441 $(objpfx)trusted-dirs.h: $(objpfx)trusted-dirs.st; @:
442 $(objpfx)trusted-dirs.st: Makefile $(..)Makeconfig
443 $(make-target-directory)
444 echo "$(subst :, ,$(default-rpath) $(user-defined-trusted-dirs))" \
445 | $(AWK) -f gen-trusted-dirs.awk > ${@:st=T};
446 echo '#define DL_DST_LIB "$(notdir $(slibdir))"' >> ${@:st=T}
447 $(move-if-change) ${@:st=T} ${@:st=h}
448 touch $@
449 CPPFLAGS-dl-load.c = -I$(objpfx). -I$(csu-objpfx).
451 ifeq (yes,$(build-shared))
452 $(inst_slibdir)/$(rtld-version-installed-name): $(objpfx)ld.so $(+force)
453 $(make-target-directory)
454 $(do-install-program)
456 $(inst_slibdir)/$(rtld-installed-name): \
457 $(inst_slibdir)/$(rtld-version-installed-name) \
458 $(inst_slibdir)/libc-$(version).so
459 $(make-shlib-link)
461 # Special target called by parent to install just the dynamic linker.
462 .PHONY: ldso_install
463 ldso_install: $(inst_slibdir)/$(rtld-installed-name)
464 endif
467 common-ldd-rewrite = -e 's%@RTLD@%$(slibdir)/$(rtld-installed-name)%g' \
468 -e 's%@VERSION@%$(version)%g'
469 sh-ldd-rewrite = $(common-ldd-rewrite) -e 's%@BASH@%/bin/sh%g;s/\$$"/"/g'
470 bash-ldd-rewrite = $(common-ldd-rewrite) -e 's%@BASH@%$(BASH)%g' \
471 -e 's%@TEXTDOMAINDIR@%$(msgcatdir)%g'
473 ifneq ($(have-bash2),yes)
474 ldd-shell = sh
475 else
476 ldd-shell = bash
477 endif
479 ifeq ($(ldd-rewrite-script),no)
480 define gen-ldd
481 LC_ALL=C sed $($(ldd-shell)-ldd-rewrite) < $< > $@.new
482 endef
483 else
484 define gen-ldd
485 LC_ALL=C sed $($(ldd-shell)-ldd-rewrite) < $< \
486 | LC_ALL=C sed -f $(patsubst $(..)/%,/%,$(..)$(ldd-rewrite-script)) > $@.new
487 endef
488 endif
490 $(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \
491 $(common-objpfx)config.make
492 $(gen-ldd)
493 chmod 555 $@.new
494 mv -f $@.new $@
496 $(objpfx)sprof: $(libdl)
498 $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
500 $(objpfx)pldd: $(pldd-modules:%=$(objpfx)%.o)
502 SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
503 CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
504 -D'SLIBDIR="$(slibdir)"' -DIS_IN_ldconfig=1
505 CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
506 CFLAGS-cache.c = $(SYSCONF-FLAGS)
508 CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),-DNOT_IN_libc=1 -DIS_IN_rtld=1)
510 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
511 generated += $(addsuffix .so,$(strip $(modules-names)))
513 ifeq (yes,$(build-shared))
514 ifeq ($(cross-compiling),no)
515 tests: $(objpfx)tst-pathopt.out
516 endif
517 endif
519 $(objpfx)testobj1.so: $(libdl)
520 $(objpfx)testobj1_1.so: $(objpfx)testobj1.so $(libdl)
521 $(objpfx)testobj2.so: $(objpfx)testobj1.so $(libdl)
522 $(objpfx)testobj3.so: $(libdl)
523 $(objpfx)testobj4.so: $(libdl)
524 $(objpfx)testobj5.so: $(libdl)
525 $(objpfx)testobj6.so: $(objpfx)testobj1.so $(objpfx)testobj2.so $(libdl)
526 $(objpfx)failobj.so: $(objpfx)testobj6.so
527 $(objpfx)dep1.so: $(objpfx)dep2.so $(objpfx)dep4.so
528 $(objpfx)dep2.so: $(objpfx)dep3.so $(objpfx)dep4.so
529 $(objpfx)dep4.so: $(objpfx)dep3.so
530 $(objpfx)nodelmod3.so: $(objpfx)nodelmod4.so
531 $(objpfx)nextmod1.so: $(libdl)
532 $(objpfx)neededobj1.so: $(libdl)
533 $(objpfx)neededobj2.so: $(objpfx)neededobj1.so $(libdl)
534 $(objpfx)neededobj3.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so $(libdl)
535 $(objpfx)neededobj4.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
536 $(objpfx)neededobj3.so $(libdl)
537 $(objpfx)neededobj6.so: $(objpfx)neededobj5.so
538 $(objpfx)unload2mod.so: $(objpfx)unload2dep.so
539 $(objpfx)ltglobmod2.so: $(libdl)
540 $(objpfx)firstobj.so: $(shared-thread-library)
541 $(objpfx)globalmod1.so: $(libdl)
542 $(objpfx)reldep4mod1.so: $(objpfx)reldep4mod3.so
543 $(objpfx)reldep4mod2.so: $(objpfx)reldep4mod4.so
544 $(objpfx)dblloadmod1.so: $(objpfx)dblloadmod3.so
545 $(objpfx)dblloadmod2.so: $(objpfx)dblloadmod3.so
546 $(objpfx)reldepmod5.so: $(objpfx)reldepmod2.so
547 $(objpfx)reldepmod6.so: $(objpfx)reldepmod2.so
548 $(objpfx)reldep6mod1.so: $(objpfx)reldep6mod0.so
549 $(objpfx)reldep6mod2.so: $(objpfx)reldep6mod1.so
550 $(objpfx)reldep6mod3.so: $(objpfx)reldep6mod2.so
551 $(objpfx)reldep6mod4.so: $(objpfx)reldep6mod1.so
552 $(objpfx)tst-tlsmod3.so: $(objpfx)tst-tlsmod2.so
553 $(objpfx)tst-tlsmod8.so: $(objpfx)tst-tlsmod7.so
554 $(objpfx)tst-tlsmod10.so: $(objpfx)tst-tlsmod9.so
555 $(objpfx)tst-tlsmod12.so: $(objpfx)tst-tlsmod11.so
556 $(objpfx)tst-tlsmod13a.so: $(objpfx)tst-tlsmod13.so
557 # For tst-tls9-static, make sure the modules it dlopens have libc.so in DT_NEEDED
558 $(objpfx)tst-tlsmod5.so: $(common-objpfx)libc.so
559 $(objpfx)tst-tlsmod6.so: $(common-objpfx)libc.so
560 $(objpfx)tst-tls19mod1.so: $(objpfx)tst-tls19mod2.so $(objpfx)tst-tls19mod3.so
561 $(objpfx)tst-tls19mod3.so: $(objpfx)ld.so
562 $(objpfx)reldep8mod3.so: $(objpfx)reldep8mod1.so $(objpfx)reldep8mod2.so
563 $(objpfx)nodel2mod3.so: $(objpfx)nodel2mod1.so $(objpfx)nodel2mod2.so
564 $(objpfx)reldep9mod2.so: $(objpfx)reldep9mod1.so
565 $(objpfx)reldep9mod3.so: $(objpfx)reldep9mod1.so $(objpfx)reldep9mod2.so
566 $(objpfx)unload3mod1.so: $(objpfx)unload3mod3.so
567 $(objpfx)unload3mod2.so: $(objpfx)unload3mod3.so
568 $(objpfx)unload3mod3.so: $(objpfx)unload3mod4.so
569 $(objpfx)unload4mod1.so: $(objpfx)unload4mod2.so $(objpfx)unload4mod3.so
570 $(objpfx)unload4mod2.so: $(objpfx)unload4mod4.so $(objpfx)unload4mod3.so
571 $(objpfx)unload6mod1.so: $(libdl)
572 $(objpfx)unload6mod2.so: $(libdl)
573 $(objpfx)unload6mod3.so: $(libdl)
574 $(objpfx)unload7mod1.so: $(libdl)
575 $(objpfx)unload7mod2.so: $(objpfx)unload7mod1.so
576 $(objpfx)unload8mod1.so: $(objpfx)unload8mod2.so
577 $(objpfx)unload8mod2.so: $(objpfx)unload8mod3.so
578 $(objpfx)unload8mod3.so: $(libdl)
579 $(objpfx)tst-initordera2.so: $(objpfx)tst-initordera1.so
580 $(objpfx)tst-initorderb2.so: $(objpfx)tst-initorderb1.so $(objpfx)tst-initordera2.so
581 $(objpfx)tst-initordera3.so: $(objpfx)tst-initorderb2.so $(objpfx)tst-initorderb1.so
582 $(objpfx)tst-initordera4.so: $(objpfx)tst-initordera3.so
583 $(objpfx)tst-initorder: $(objpfx)tst-initordera4.so $(objpfx)tst-initordera1.so $(objpfx)tst-initorderb2.so
585 LDFLAGS-tst-tlsmod5.so = -nostdlib
586 LDFLAGS-tst-tlsmod6.so = -nostdlib
588 testobj1.so-no-z-defs = yes
589 testobj3.so-no-z-defs = yes
590 testobj4.so-no-z-defs = yes
591 testobj5.so-no-z-defs = yes
592 testobj6.so-no-z-defs = yes
593 failobj.so-no-z-defs = yes
594 constload2.so-no-z-defs = yes
595 constload3.so-no-z-defs = yes
596 nodelmod1.so-no-z-defs = yes
597 nodelmod2.so-no-z-defs = yes
598 nodelmod4.so-no-z-defs = yes
599 nodel2mod2.so-no-z-defs = yes
600 reldepmod2.so-no-z-defs = yes
601 reldepmod3.so-no-z-defs = yes
602 reldepmod4.so-no-z-defs = yes
603 reldep4mod4.so-no-z-defs = yes
604 reldep4mod2.so-no-z-defs = yes
605 ltglobmod2.so-no-z-defs = yes
606 dblloadmod3.so-no-z-defs = yes
607 tst-tlsmod1.so-no-z-defs = yes
608 tst-tlsmod2.so-no-z-defs = yes
609 tst-tlsmod3.so-no-z-defs = yes
610 tst-tlsmod4.so-no-z-defs = yes
611 tst-tlsmod7.so-no-z-defs = yes
612 tst-tlsmod8.so-no-z-defs = yes
613 tst-tlsmod9.so-no-z-defs = yes
614 tst-tlsmod10.so-no-z-defs = yes
615 tst-tlsmod12.so-no-z-defs = yes
616 tst-tlsmod14a.so-no-z-defs = yes
617 tst-tlsmod14b.so-no-z-defs = yes
618 tst-tlsmod15a.so-no-z-defs = yes
619 tst-tlsmod16b.so-no-z-defs = yes
620 circlemod2.so-no-z-defs = yes
621 circlemod3.so-no-z-defs = yes
622 circlemod3a.so-no-z-defs = yes
623 reldep8mod2.so-no-z-defs = yes
624 reldep9mod1.so-no-z-defs = yes
625 unload3mod4.so-no-z-defs = yes
626 unload4mod1.so-no-z-defs = yes
627 ifuncmod1.so-no-z-defs = yes
628 ifuncmod5.so-no-z-defs = yes
629 ifuncmod6.so-no-z-defs = yes
631 ifeq ($(build-shared),yes)
632 # Build all the modules even when not actually running test programs.
633 tests: $(test-modules)
634 endif
636 $(objpfx)loadtest: $(libdl)
637 LDFLAGS-loadtest = -rdynamic
639 $(objpfx)loadtest.out: $(test-modules)
641 $(objpfx)neededtest: $(libdl)
642 $(objpfx)neededtest.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
643 $(objpfx)neededobj3.so
645 $(objpfx)neededtest2: $(libdl)
646 $(objpfx)neededtest2.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
647 $(objpfx)neededobj3.so
649 $(objpfx)neededtest3: $(libdl)
650 $(objpfx)neededtest3.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
651 $(objpfx)neededobj3.so $(objpfx)neededobj4.so
653 neededtest4-ENV = LC_ALL=C LANGUAGE=C
654 $(objpfx)neededtest4: $(libdl) $(objpfx)neededobj1.so
655 $(objpfx)neededtest4.out: $(objpfx)neededobj5.so $(objpfx)neededobj6.so
657 $(objpfx)restest1: $(objpfx)testobj1.so $(objpfx)testobj1_1.so $(libdl)
658 LDFLAGS-restest1 = -rdynamic
660 $(objpfx)restest2: $(libdl)
661 LDFLAGS-restest2 = -rdynamic
663 $(objpfx)restest1.out: $(test-modules)
665 preloadtest-preloads = testobj1 testobj2 testobj3 testobj4 testobj5
666 $(objpfx)preloadtest: $(objpfx)testobj6.so
667 LDFLAGS-preloadtest = -rdynamic
668 $(objpfx)preloadtest.out: $(preloadtest-preloads:%=$(objpfx)%.so)
669 preloadtest-ENV = \
670 LD_PRELOAD=$(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
672 $(objpfx)loadfail: $(libdl)
673 LDFLAGS-loadfail = -rdynamic
675 $(objpfx)loadfail.out: $(objpfx)failobj.so
677 $(objpfx)multiload: $(libdl)
678 LDFLAGS-multiload = -rdynamic
679 CFLAGS-multiload.c = -DOBJDIR=\"$(elf-objpfx)\"
681 $(objpfx)multiload.out: $(objpfx)testobj1.so
683 $(objpfx)origtest: $(libdl)
684 LDFLAGS-origtest = -rdynamic
685 $(objpfx)origtest.out: $(objpfx)testobj1.so
687 ifeq ($(have-thread-library),yes)
688 $(objpfx)resolvfail: $(libdl) $(shared-thread-library)
689 else
690 $(objpfx)resolvfail: $(libdl)
691 endif
693 $(objpfx)constload1: $(libdl)
694 $(objpfx)constload1.out: $(objpfx)constload2.so $(objpfx)constload3.so
696 $(objpfx)circleload1: $(libdl)
697 $(objpfx)circleload1.out: $(objpfx)circlemod1.so \
698 $(objpfx)circlemod1a.so
700 $(objpfx)circlemod1.so: $(objpfx)circlemod2.so
701 $(objpfx)circlemod2.so: $(objpfx)circlemod3.so
702 $(objpfx)circlemod1a.so: $(objpfx)circlemod2a.so
703 $(objpfx)circlemod2a.so: $(objpfx)circlemod3a.so
705 $(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so)
707 $(objpfx)order.out: $(objpfx)order
708 $(elf-objpfx)$(rtld-installed-name) \
709 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
710 $(objpfx)order > $@
711 (echo "0123456789" | cmp $@ -) > /dev/null
713 $(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so)
714 $(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
715 vismain-ENV = LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
717 $(objpfx)noload: $(objpfx)testobj1.so $(common-objpfx)dlfcn/libdl.so
718 LDFLAGS-noload = -rdynamic
719 $(objpfx)noload.out: $(objpfx)testobj5.so
721 $(objpfx)noload-mem: $(objpfx)noload.out
722 $(common-objpfx)malloc/mtrace $(objpfx)noload.mtrace > $@
723 noload-ENV = MALLOC_TRACE=$(objpfx)noload.mtrace
725 LDFLAGS-nodelete = -rdynamic
726 LDFLAGS-nodelmod1.so = -Wl,--enable-new-dtags,-z,nodelete
727 LDFLAGS-nodelmod4.so = -Wl,--enable-new-dtags,-z,nodelete
728 $(objpfx)nodelete: $(libdl)
729 $(objpfx)nodelete.out: $(objpfx)nodelmod1.so $(objpfx)nodelmod2.so \
730 $(objpfx)nodelmod3.so
732 LDFLAGS-nodlopenmod.so = -Wl,--enable-new-dtags,-z,nodlopen
733 $(objpfx)nodlopen: $(libdl)
734 $(objpfx)nodlopen.out: $(objpfx)nodlopenmod.so
736 $(objpfx)nodlopenmod2.so: $(objpfx)nodlopenmod.so
737 $(objpfx)nodlopen2: $(libdl)
738 $(objpfx)nodlopen2.out: $(objpfx)nodlopenmod2.so
740 $(objpfx)filtmod1.so: $(objpfx)filtmod1.os $(objpfx)filtmod2.so
741 $(LINK.o) -shared -o $@ -B$(csu-objpfx) $(LDFLAGS.so) \
742 -L$(subst :, -L,$(rpath-link)) \
743 -Wl,-rpath-link=$(rpath-link) \
744 $< -Wl,-F,$(objpfx)filtmod2.so
745 $(objpfx)filter: $(objpfx)filtmod1.so
747 $(objpfx)unload: $(libdl)
748 $(objpfx)unload.out: $(objpfx)unloadmod.so
750 $(objpfx)reldep: $(libdl)
751 $(objpfx)reldep.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod2.so
753 $(objpfx)reldep2: $(libdl)
754 $(objpfx)reldep2.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod3.so
756 $(objpfx)reldep3: $(libdl)
757 $(objpfx)reldep3.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
759 $(objpfx)reldep4: $(libdl)
760 $(objpfx)reldep4.out: $(objpfx)reldep4mod1.so $(objpfx)reldep4mod2.so
762 $(objpfx)next: $(objpfx)nextmod1.so $(objpfx)nextmod2.so $(libdl)
764 $(objpfx)unload2: $(libdl)
765 $(objpfx)unload2.out: $(objpfx)unload2mod.so $(objpfx)unload2dep.so
767 $(objpfx)lateglobal: $(libdl)
768 $(objpfx)lateglobal.out: $(objpfx)ltglobmod1.so $(objpfx)ltglobmod2.so
770 $(objpfx)tst-pathopt: $(libdl)
771 $(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \
772 $(objpfx)pathoptobj.so
773 $(SHELL) -e $< $(common-objpfx)
775 $(objpfx)initfirst: $(libdl)
776 $(objpfx)initfirst.out: $(objpfx)firstobj.so
778 $(objpfx)global: $(objpfx)globalmod1.so
779 $(objpfx)global.out: $(objpfx)reldepmod1.so
781 $(objpfx)dblload: $(libdl)
782 $(objpfx)dblload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
784 $(objpfx)dblunload: $(libdl)
785 $(objpfx)dblunload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
787 $(objpfx)reldep5: $(libdl)
788 $(objpfx)reldep5.out: $(objpfx)reldepmod5.so $(objpfx)reldepmod6.so
790 $(objpfx)reldep6: $(libdl)
791 $(objpfx)reldep6.out: $(objpfx)reldep6mod3.so $(objpfx)reldep6mod4.so
793 $(objpfx)reldep7: $(libdl)
794 $(objpfx)reldep7.out: $(objpfx)reldep7mod1.so $(objpfx)reldep7mod2.so
796 $(objpfx)reldep8: $(libdl)
797 $(objpfx)reldep8.out: $(objpfx)reldep8mod3.so
799 LDFLAGS-nodel2mod2.so = -Wl,--enable-new-dtags,-z,nodelete
800 $(objpfx)nodelete2: $(libdl)
801 $(objpfx)nodelete2.out: $(objpfx)nodel2mod3.so
803 $(objpfx)reldep9: $(libdl)
804 $(objpfx)reldep9.out: $(objpfx)reldep9mod3.so
806 $(objpfx)tst-tls3: $(objpfx)tst-tlsmod1.so
808 $(objpfx)tst-tls4: $(libdl)
809 $(objpfx)tst-tls4.out: $(objpfx)tst-tlsmod2.so
811 $(objpfx)tst-tls5: $(libdl)
812 $(objpfx)tst-tls5.out: $(objpfx)tst-tlsmod2.so
814 $(objpfx)tst-tls6: $(libdl)
815 $(objpfx)tst-tls6.out: $(objpfx)tst-tlsmod2.so
817 $(objpfx)tst-tls7: $(libdl)
818 $(objpfx)tst-tls7.out: $(objpfx)tst-tlsmod3.so
820 $(objpfx)tst-tls8: $(libdl)
821 $(objpfx)tst-tls8.out: $(objpfx)tst-tlsmod3.so $(objpfx)tst-tlsmod4.so
823 $(objpfx)tst-tls9: $(libdl)
824 $(objpfx)tst-tls9.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
826 $(objpfx)tst-tls10: $(objpfx)tst-tlsmod8.so $(objpfx)tst-tlsmod7.so
828 $(objpfx)tst-tls11: $(objpfx)tst-tlsmod10.so $(objpfx)tst-tlsmod9.so
830 $(objpfx)tst-tls12: $(objpfx)tst-tlsmod12.so $(objpfx)tst-tlsmod11.so
832 $(objpfx)tst-tls13: $(libdl)
833 $(objpfx)tst-tls13.out: $(objpfx)tst-tlsmod13a.so
835 $(objpfx)tst-tls14: $(objpfx)tst-tlsmod14a.so $(libdl)
836 $(objpfx)tst-tls14.out: $(objpfx)tst-tlsmod14b.so
838 $(objpfx)tst-tls15: $(libdl)
839 $(objpfx)tst-tls15.out: $(objpfx)tst-tlsmod15a.so $(objpfx)tst-tlsmod15b.so
841 $(objpfx)tst-tls-dlinfo: $(libdl)
842 $(objpfx)tst-tls-dlinfo.out: $(objpfx)tst-tlsmod2.so
846 $(objpfx)tst-tls16: $(libdl)
847 $(objpfx)tst-tls16.out: $(objpfx)tst-tlsmod16a.so $(objpfx)tst-tlsmod16b.so
849 $(objpfx)tst-tls17: $(libdl)
850 $(objpfx)tst-tls17.out: $(objpfx)tst-tlsmod17b.so
851 $(patsubst %,$(objpfx)%.os,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.os: tst-tlsmod17a.c
852 $(compile-command.c) -DN=$*
853 $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.so: $(objpfx)ld.so
854 $(objpfx)tst-tlsmod17b.so: $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules))
856 $(objpfx)tst-tls18: $(libdl)
857 $(objpfx)tst-tls18.out: $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules))
858 $(patsubst %,$(objpfx)%.os,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.os : tst-tlsmod18a.c
859 $(compile-command.c) -DN=$*
860 $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.so: $(objpfx)ld.so
862 $(objpfx)tst-tls19: $(libdl)
863 $(objpfx)tst-tls19.out: $(objpfx)tst-tls19mod1.so
865 CFLAGS-tst-align.c = $(stack-align-test-flags)
866 CFLAGS-tst-align2.c = $(stack-align-test-flags)
867 CFLAGS-tst-alignmod.c = $(stack-align-test-flags)
868 CFLAGS-tst-alignmod2.c = $(stack-align-test-flags)
869 $(objpfx)tst-align: $(libdl)
870 $(objpfx)tst-align.out: $(objpfx)tst-alignmod.so
871 $(objpfx)tst-align2: $(objpfx)tst-alignmod2.so
873 $(objpfx)unload3: $(libdl)
874 $(objpfx)unload3.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
875 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
877 $(objpfx)unload4: $(libdl)
878 $(objpfx)unload4.out: $(objpfx)unload4mod1.so $(objpfx)unload4mod3.so
880 $(objpfx)unload5: $(libdl)
881 $(objpfx)unload5.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
882 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
884 $(objpfx)unload6: $(libdl)
885 $(objpfx)unload6.out: $(objpfx)unload6mod1.so $(objpfx)unload6mod2.so \
886 $(objpfx)unload6mod3.so
888 $(objpfx)unload7: $(libdl)
889 $(objpfx)unload7.out: $(objpfx)unload7mod1.so $(objpfx)unload7mod2.so
890 unload7-ENV = MALLOC_PERTURB_=85
892 $(objpfx)unload8: $(libdl)
893 $(objpfx)unload8.out: $(objpfx)unload8mod1.so $(objpfx)unload8mod1x.so
895 ifdef libdl
896 $(objpfx)tst-tls9-static: $(common-objpfx)dlfcn/libdl.a
897 $(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
898 endif
900 ifeq ($(have-z-execstack),yes)
901 $(objpfx)tst-execstack: $(libdl)
902 $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
903 LDFLAGS-tst-execstack = -Wl,-z,noexecstack
904 LDFLAGS-tst-execstack-mod = -Wl,-z,execstack
906 $(objpfx)tst-execstack-needed: $(objpfx)tst-execstack-mod.so
907 LDFLAGS-tst-execstack-needed = -Wl,-z,noexecstack
909 LDFLAGS-tst-execstack-prog = -Wl,-z,execstack
910 endif
912 $(objpfx)tst-array1.out: $(objpfx)tst-array1
913 $(elf-objpfx)$(rtld-installed-name) \
914 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
915 $(objpfx)tst-array1 > $@
916 cmp $@ tst-array1.exp > /dev/null
918 $(objpfx)tst-array1-static.out: $(objpfx)tst-array1-static
919 $(objpfx)tst-array1-static > $@
920 cmp $@ tst-array1.exp > /dev/null
922 $(objpfx)tst-array2: $(objpfx)tst-array2dep.so
923 $(objpfx)tst-array2.out: $(objpfx)tst-array2
924 $(elf-objpfx)$(rtld-installed-name) \
925 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
926 $(objpfx)tst-array2 > $@
927 cmp $@ tst-array2.exp > /dev/null
929 $(objpfx)tst-array3.out: $(objpfx)tst-array3
930 $(elf-objpfx)$(rtld-installed-name) \
931 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
932 $(objpfx)tst-array3 > $@
933 cmp $@ tst-array1.exp > /dev/null
935 $(objpfx)tst-array4: $(libdl)
936 $(objpfx)tst-array4.out: $(objpfx)tst-array4 $(objpfx)tst-array2dep.so
937 $(elf-objpfx)$(rtld-installed-name) \
938 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
939 $< > $@
940 cmp $@ tst-array4.exp > /dev/null
942 $(objpfx)tst-array5: $(objpfx)tst-array5dep.so
943 $(objpfx)tst-array5.out: $(objpfx)tst-array5
944 $(elf-objpfx)$(rtld-installed-name) \
945 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
946 $(objpfx)tst-array5 > $@
947 cmp $@ tst-array5.exp > /dev/null
949 $(objpfx)tst-array5-static.out: $(objpfx)tst-array5-static
950 $(objpfx)tst-array5-static > $@
951 cmp $@ tst-array5-static.exp > /dev/null
953 CFLAGS-tst-pie1.c += $(pie-ccflag)
955 $(objpfx)tst-pie1: $(objpfx)tst-piemod1.so
957 check-textrel-CFLAGS = -O -Wall -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
958 $(objpfx)check-textrel: check-textrel.c
959 $(native-compile)
961 check-execstack-CFLAGS = -O -Wall -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -std=gnu99 \
962 $(objpfx:%/=-I%)
963 $(objpfx)check-execstack: check-execstack.c $(objpfx)check-execstack.h
964 $(native-compile)
965 $(objpfx)check-execstack.h: $(first-word $(wildcard $(sysdirs:%=%/stackinfo.h)))
966 $(make-target-directory)
967 { echo '#include <stackinfo.h>'; echo '@@@DEFAULT_STACK_PERMS@@@'; } | \
968 $(CC) $(CFLAGS) $(CPPFLAGS) -E -x c-header - | \
969 sed -n -e 's/^@@@\(.*\)@@@/#define DEFAULT_STACK_PERMS \1/p' > $@T
970 mv -f $@T $@
971 generated += check-execstack.h
973 check-localplt-CFLAGS = -O -Wall -D_GNU_SOURCE -std=gnu99
974 $(objpfx)check-localplt: check-localplt.c
975 $(native-compile)
977 ifeq (yes,$(build-shared))
978 tests: $(objpfx)check-textrel.out $(objpfx)check-execstack.out
980 all-built-dso = $(common-objpfx)libc.so \
981 $(filter-out $(common-objpfx)linkobj/libc.so, \
982 $(sort $(wildcard $(common-objpfx)*/lib*.so \
983 $(common-objpfx)iconvdata/*.so)))
985 $(objpfx)check-textrel.out: $(objpfx)check-textrel $(all-built-dso)
986 $(dir $<)$(notdir $<) $(filter-out $<, $^) > $@
987 generated += check-textrel check-textrel.out
989 $(objpfx)check-execstack.out: $(objpfx)check-execstack $(all-built-dso)
990 $(dir $<)$(notdir $<) $(filter-out $<, $^) > $@
991 generated += check-execstack check-execstack.out
993 $(objpfx)tst-dlmodcount: $(libdl)
994 $(objpfx)tst-dlmodcount.out: $(test-modules)
996 check-data := $(firstword $(wildcard \
997 $(foreach D,$(add-ons) scripts,\
998 $(patsubst %,$(..)$D/data/localplt-%.data,\
999 $(abi-name) \
1000 $(addsuffix -$(config-os),\
1001 $(config-machine) \
1002 $(base-machine)) \
1003 generic))))
1005 tests: $(objpfx)check-localplt.out
1007 ifeq ($(have-thread-library),yes)
1008 thread-dso := $(filter-out %_nonshared.a, $(shared-thread-library))
1009 endif
1011 $(objpfx)check-localplt.out: $(objpfx)check-localplt \
1012 $(common-objpfx)libc.so \
1013 $(common-objpfx)math/libm.so $(thread-dso) \
1014 $(common-objpfx)rt/librt.so \
1015 $(common-objpfx)dlfcn/libdl.so \
1016 $(common-objpfx)resolv/libresolv.so \
1017 $(common-objpfx)crypt/libcrypt.so \
1018 $(check-data)
1019 $(dir $<)$(notdir $<) $(filter-out $< $(check-data),$^) | \
1020 LC_ALL=C sort | \
1021 diff -u $(check-data) - > $@
1022 endif
1024 $(objpfx)tst-dlopenrpathmod.so: $(libdl)
1025 $(objpfx)tst-dlopenrpath: $(objpfx)tst-dlopenrpathmod.so $(libdl)
1026 CFLAGS-tst-dlopenrpath.c += -DPFX=\"$(objpfx)\"
1027 LDFLAGS-tst-dlopenrpathmod.so += -Wl,-rpath,\$$ORIGIN/test-subdir
1028 $(objpfx)tst-dlopenrpath.out: $(objpfx)firstobj.so
1030 $(objpfx)tst-deep1mod2.so: $(objpfx)tst-deep1mod3.so
1031 $(objpfx)tst-deep1: $(libdl) $(objpfx)tst-deep1mod1.so
1032 $(objpfx)tst-deep1.out: $(objpfx)tst-deep1mod2.so
1033 LDFLAGS-tst-deep1 += -rdynamic
1034 tst-deep1mod3.so-no-z-defs = yes
1036 $(objpfx)tst-dlmopen1mod.so: $(libdl)
1037 $(objpfx)tst-dlmopen1: $(libdl)
1038 $(objpfx)tst-dlmopen1.out: $(objpfx)tst-dlmopen1mod.so
1040 $(objpfx)tst-dlmopen2: $(libdl)
1041 $(objpfx)tst-dlmopen2.out: $(objpfx)tst-dlmopen1mod.so
1043 $(objpfx)tst-dlmopen3: $(libdl)
1044 $(objpfx)tst-dlmopen3.out: $(objpfx)tst-dlmopen1mod.so
1046 $(objpfx)tst-audit1.out: $(objpfx)tst-auditmod1.so
1047 tst-audit1-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1049 $(objpfx)tst-audit2.out: $(objpfx)tst-auditmod1.so
1050 tst-audit2-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1052 $(objpfx)tst-audit3: $(objpfx)tst-auditmod3a.so
1053 $(objpfx)tst-audit3.out: $(objpfx)tst-auditmod3b.so
1054 tst-audit3-ENV = LD_AUDIT=$(objpfx)tst-auditmod3b.so
1056 $(objpfx)tst-audit4: $(objpfx)tst-auditmod4a.so
1057 $(objpfx)tst-audit4.out: $(objpfx)tst-auditmod4b.so
1058 tst-audit4-ENV = LD_AUDIT=$(objpfx)tst-auditmod4b.so
1060 $(objpfx)tst-audit5: $(objpfx)tst-auditmod5a.so
1061 $(objpfx)tst-audit5.out: $(objpfx)tst-auditmod5b.so
1062 tst-audit5-ENV = LD_AUDIT=$(objpfx)tst-auditmod5b.so
1064 $(objpfx)tst-audit6: $(objpfx)tst-auditmod6a.so
1065 $(objpfx)tst-audit6.out: $(objpfx)tst-auditmod6b.so \
1066 $(objpfx)tst-auditmod6c.so
1067 tst-audit6-ENV = LD_AUDIT=$(objpfx)tst-auditmod6b.so:$(objpfx)tst-auditmod6c.so
1069 $(objpfx)tst-audit7: $(objpfx)tst-auditmod7a.so
1070 $(objpfx)tst-audit7.out: $(objpfx)tst-auditmod7b.so
1071 tst-audit7-ENV = LD_AUDIT=$(objpfx)tst-auditmod7b.so
1073 $(objpfx)tst-global1: $(libdl)
1074 $(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
1076 $(objpfx)order2: $(libdl)
1077 $(objpfx)order2.out: $(objpfx)order2 $(objpfx)order2mod1.so \
1078 $(objpfx)order2mod2.so
1079 $(elf-objpfx)$(rtld-installed-name) \
1080 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
1081 $(objpfx)order2 > $@
1082 (echo "12345" | cmp $@ -) > /dev/null
1083 $(objpfx)order2mod1.so: $(objpfx)order2mod4.so
1084 $(objpfx)order2mod4.so: $(objpfx)order2mod3.so
1085 $(objpfx)order2mod2.so: $(objpfx)order2mod3.so
1086 order2mod2.so-no-z-defs = yes
1088 tst-stackguard1-ARGS = --command "$(built-program-cmd) --child"
1089 tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
1091 $(objpfx)tst-leaks1: $(libdl)
1092 $(objpfx)tst-leaks1-mem: $(objpfx)tst-leaks1.out
1093 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1.mtrace > $@
1095 tst-leaks1-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1.mtrace
1097 $(objpfx)tst-addr1: $(libdl)
1099 $(objpfx)tst-thrlock: $(libdl) $(shared-thread-library)
1101 CFLAGS-ifuncmain1pic.c += $(pic-ccflag)
1102 CFLAGS-ifuncmain1picstatic.c += $(pic-ccflag)
1103 CFLAGS-ifuncmain1staticpic.c += $(pic-ccflag)
1104 CFLAGS-ifuncdep1pic.c += $(pic-ccflag)
1105 CFLAGS-ifuncmain1vispic.c += $(pic-ccflag)
1106 CFLAGS-ifuncmain2pic.c += $(pic-ccflag)
1107 CFLAGS-ifuncmain2picstatic.c += $(pic-ccflag)
1108 CFLAGS-ifuncdep2pic.c += $(pic-ccflag)
1109 CFLAGS-ifuncmain4picstatic.c += $(pic-ccflag)
1110 CFLAGS-ifuncmain5pic.c += $(pic-ccflag)
1111 CFLAGS-ifuncmain5picstatic.c += $(pic-ccflag)
1112 CFLAGS-ifuncmain5staticpic.c += $(pic-ccflag)
1113 CFLAGS-ifuncdep5pic.c += $(pic-ccflag)
1114 CFLAGS-ifuncmain7pic.c += $(pic-ccflag)
1115 CFLAGS-ifuncmain7picstatic.c += $(pic-ccflag)
1117 LDFLAGS-ifuncmain3 = -Wl,-export-dynamic
1119 CFLAGS-ifuncmain1pie.c += $(pie-ccflag)
1120 CFLAGS-ifuncmain1vispie.c += $(pie-ccflag)
1121 CFLAGS-ifuncmain1staticpie.c += $(pie-ccflag)
1122 CFLAGS-ifuncmain5pie.c += $(pie-ccflag)
1123 CFLAGS-ifuncmain6pie.c += $(pie-ccflag)
1124 CFLAGS-ifuncmain7pie.c += $(pie-ccflag)
1126 $(objpfx)ifuncmain1pie: $(objpfx)ifuncmod1.so
1127 $(objpfx)ifuncmain1staticpie: $(objpfx)ifuncdep1pic.o
1128 $(objpfx)ifuncmain1vispie: $(objpfx)ifuncmod1.so
1129 $(objpfx)ifuncmain5pie: $(objpfx)ifuncmod5.so
1130 $(objpfx)ifuncmain6pie: $(objpfx)ifuncmod6.so
1132 $(objpfx)ifuncmain1: $(addprefix $(objpfx),ifuncmod1.so)
1133 $(objpfx)ifuncmain1pic: $(addprefix $(objpfx),ifuncmod1.so)
1134 $(objpfx)ifuncmain1staticpic: $(addprefix $(objpfx),ifuncdep1pic.o)
1135 $(objpfx)ifuncmain1static: $(addprefix $(objpfx),ifuncdep1.o)
1136 $(objpfx)ifuncmain1picstatic: $(addprefix $(objpfx),ifuncdep1pic.o)
1137 $(objpfx)ifuncmain1vis: $(addprefix $(objpfx),ifuncmod1.so)
1138 $(objpfx)ifuncmain1vispic: $(addprefix $(objpfx),ifuncmod1.so)
1139 $(objpfx)ifuncmain2: $(addprefix $(objpfx),ifuncdep2.o)
1140 $(objpfx)ifuncmain2pic: $(addprefix $(objpfx),ifuncdep2pic.o)
1141 $(objpfx)ifuncmain2static: $(addprefix $(objpfx),ifuncdep2.o)
1142 $(objpfx)ifuncmain2picstatic: $(addprefix $(objpfx),ifuncdep2pic.o)
1144 $(objpfx)ifuncmain3: $(libdl)
1145 $(objpfx)ifuncmain3.out: $(objpfx)ifuncmod3.so
1147 $(objpfx)ifuncmain5: $(addprefix $(objpfx),ifuncmod5.so)
1148 $(objpfx)ifuncmain5pic: $(addprefix $(objpfx),ifuncmod5.so)
1149 $(objpfx)ifuncmain5static: $(addprefix $(objpfx),ifuncdep5.o)
1150 $(objpfx)ifuncmain5staticpic: $(addprefix $(objpfx),ifuncdep5pic.o)
1151 $(objpfx)ifuncmain5picstatic: $(addprefix $(objpfx),ifuncdep5pic.o)
1153 $(objpfx)tst-unique1: $(libdl)
1154 $(objpfx)tst-unique1.out: $(objpfx)tst-unique1mod1.so \
1155 $(objpfx)tst-unique1mod2.so
1157 $(objpfx)tst-unique2: $(libdl) $(objpfx)tst-unique2mod1.so
1158 $(objpfx)tst-unique2.out: $(objpfx)tst-unique2mod2.so
1160 $(objpfx)tst-unique3: $(libdl) $(objpfx)tst-unique3lib.so
1161 $(objpfx)tst-unique3.out: $(objpfx)tst-unique3lib2.so
1163 $(objpfx)tst-unique4: $(objpfx)tst-unique4lib.so
1165 $(objpfx)tst-initorder.out: $(objpfx)tst-initorder
1166 $(elf-objpfx)${rtld-installed-name} \
1167 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
1168 $< > $@
1169 cmp $@ tst-initorder.exp > /dev/null
1171 $(objpfx)tst-initorder2: $(objpfx)tst-initorder2a.so $(objpfx)tst-initorder2d.so $(objpfx)tst-initorder2c.so
1172 $(objpfx)tst-initorder2a.so: $(objpfx)tst-initorder2b.so
1173 $(objpfx)tst-initorder2b.so: $(objpfx)tst-initorder2c.so
1174 $(objpfx)tst-initorder2c.so: $(objpfx)tst-initorder2d.so
1175 define o-iterator-doit
1176 $(objpfx)tst-initorder2$o.os: tst-initorder2.c; \
1177 $$(compile-command.c) -DNAME=\"$o\"
1178 endef
1179 object-suffixes-left := a b c d
1180 include $(o-iterator)
1182 $(objpfx)tst-initorder2.out: $(objpfx)tst-initorder2
1183 $(elf-objpfx)${rtld-installed-name} \
1184 --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
1185 $< > $@
1186 cmp $@ tst-initorder2.exp > /dev/null
1188 ifeq (yes,$(config-cflags-avx))
1189 AVX-CFLAGS=-mavx
1190 ifeq (yes,$(config-cflags-novzeroupper))
1191 AVX-CFLAGS+=-mno-vzeroupper
1192 endif
1193 CFLAGS-tst-audit4.c += $(AVX-CFLAGS)
1194 CFLAGS-tst-auditmod4a.c += $(AVX-CFLAGS)
1195 CFLAGS-tst-auditmod4b.c += $(AVX-CFLAGS)
1196 CFLAGS-tst-auditmod6b.c += $(AVX-CFLAGS)
1197 CFLAGS-tst-auditmod6c.c += $(AVX-CFLAGS)
1198 CFLAGS-tst-auditmod7b.c += $(AVX-CFLAGS)
1199 endif
1201 $(objpfx)tst-relsort1: $(libdl)
1202 $(objpfx)tst-relsort1mod1.so: $(libm) $(objpfx)tst-relsort1mod2.so
1203 $(objpfx)tst-relsort1mod2.so: $(libm)
1204 $(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
1205 $(objpfx)tst-relsort1mod2.so