Use POSIX Portable Character Set in the new mai_NP locale source file instead of...
[glibc.git] / elf / Makefile
blobe758a4c96002ee44ec28a0358b567bcc241c1060
1 # Copyright (C) 1995-2017 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 dl-addr-obj enbl-secure dl-profstub \
27 dl-origin dl-libc dl-sym dl-sysdep dl-error
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 init fini debug misc \
33 version profile tls origin scope \
34 execstack caller open close trampoline)
35 ifeq (yes,$(use-ldconfig))
36 dl-routines += dl-cache
37 endif
39 ifneq (no,$(have-tunables))
40 dl-routines += dl-tunables
41 tunables-type = $(addprefix TUNABLES_FRONTEND_,$(have-tunables))
42 CPPFLAGS-dl-tunables.c = -DTUNABLES_FRONTEND=$(tunables-type)
44 # Make sure that the compiler does not insert any library calls in tunables
45 # code paths.
46 ifeq (yes,$(have-loop-to-function))
47 CFLAGS-dl-tunables.c = -fno-tree-loop-distribute-patterns
48 endif
49 endif
51 all-dl-routines = $(dl-routines) $(sysdep-dl-routines)
52 # But they are absent from the shared libc, because that code is in ld.so.
53 elide-routines.os = $(all-dl-routines) dl-support enbl-secure dl-origin \
54 dl-sysdep
55 shared-only-routines += dl-caller
57 # ld.so uses those routines, plus some special stuff for being the program
58 # interpreter and operating independent of libc.
59 rtld-routines = rtld $(all-dl-routines) dl-sysdep dl-environ dl-minimal \
60 dl-error-minimal dl-conflict
61 all-rtld-routines = $(rtld-routines) $(sysdep-rtld-routines)
63 CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
64 CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
65 CFLAGS-dl-iterate-phdr.c = $(uses-callbacks)
67 # Compile rtld itself without stack protection.
68 # Also compile all routines in the static library that are elided from
69 # the shared libc because they are in libc.a in the same way.
71 define elide-stack-protector
72 $(if $(filter $(@F),$(patsubst %,%$(1),$(2))), $(no-stack-protector))
73 endef
75 CFLAGS-.o += $(call elide-stack-protector,.o,$(elide-routines.os))
76 CFLAGS-.op += $(call elide-stack-protector,.op,$(elide-routines.os))
77 CFLAGS-.os += $(call elide-stack-protector,.os,$(all-rtld-routines))
79 ifeq ($(unwind-find-fde),yes)
80 routines += unwind-dw2-fde-glibc
81 shared-only-routines += unwind-dw2-fde-glibc
82 endif
84 before-compile += $(objpfx)trusted-dirs.h
85 generated += trusted-dirs.h trusted-dirs.st for-renamed/renamed.so
86 generated-dirs += for-renamed
88 ifeq ($(build-shared),yes)
89 ld-map = $(common-objpfx)ld.map
90 endif
92 ifeq (yes,$(build-shared))
93 extra-objs = $(all-rtld-routines:%=%.os) soinit.os sofini.os interp.os
94 generated += librtld.os dl-allobjs.os ld.so ldd
95 install-others = $(inst_rtlddir)/$(rtld-installed-name)
96 install-bin-script = ldd
97 endif
99 others = sprof sln
100 install-bin = sprof
101 others-static = sln
102 install-rootsbin = sln
103 sln-modules := static-stubs
104 extra-objs += $(sln-modules:=.o)
106 ifeq (yes,$(use-ldconfig))
107 ifeq (yes,$(build-shared))
108 others-static += ldconfig
109 others += ldconfig
110 install-rootsbin += ldconfig
112 ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon static-stubs
113 extra-objs += $(ldconfig-modules:=.o)
114 endif
115 endif
117 # To find xmalloc.c and xstrdup.c
118 vpath %.c ../locale/programs
120 ifeq ($(build-shared),yes)
121 extra-objs += sotruss-lib.os sotruss-lib.so
122 install-others += $(inst_auditdir)/sotruss-lib.so
123 install-bin-script += sotruss
124 generated += sotruss
125 libof-sotruss-lib = extramodules
126 $(objpfx)sotruss-lib.so: $(objpfx)sotruss-lib.os
127 $(build-module-asneeded)
128 $(objpfx)sotruss-lib.so: $(common-objpfx)libc.so $(objpfx)ld.so \
129 $(common-objpfx)libc_nonshared.a
131 $(objpfx)sotruss: sotruss.sh $(common-objpfx)config.make
132 sed -e 's%@BASH@%$(BASH)%g' \
133 -e 's%@VERSION@%$(version)%g' \
134 -e 's%@TEXTDOMAINDIR@%$(localedir)%g' \
135 -e 's%@PREFIX@%$(prefix)%g' \
136 -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
137 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' \
138 < $< > $@.new
139 chmod 555 $@.new
140 mv -f $@.new $@
141 $(inst_auditdir)/sotruss-lib.so: $(objpfx)sotruss-lib.so $(+force)
142 $(do-install-program)
143 endif
145 tests-static-normal := tst-leaks1-static tst-array1-static tst-array5-static \
146 tst-dl-iter-static \
147 tst-tlsalign-static tst-tlsalign-extern-static \
148 tst-linkall-static tst-env-setuid tst-env-setuid-tunables
149 tests-static-internal := tst-tls1-static tst-tls2-static \
150 tst-ptrguard1-static tst-stackguard1-static
152 tests := tst-tls9 tst-leaks1 \
153 tst-array1 tst-array2 tst-array3 tst-array4 tst-array5 \
154 tst-auxv
155 tests-internal := tst-tls1 tst-tls2 $(tests-static-internal)
156 tests-static := $(tests-static-normal) $(tests-static-internal)
158 ifeq (yes,$(build-shared))
159 tests-static += tst-tls9-static
160 tst-tls9-static-ENV = \
161 LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn
163 tests += restest1 preloadtest loadfail multiload origtest resolvfail \
164 constload1 order noload filter \
165 reldep reldep2 reldep3 reldep4 nodelete nodelete2 \
166 nodlopen nodlopen2 lateglobal initfirst global \
167 restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
168 tst-tls4 tst-tls5 \
169 tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-tls15 \
170 tst-tls16 tst-tls17 tst-tls18 tst-tls19 tst-tls-dlinfo \
171 tst-align tst-align2 $(tests-execstack-$(have-z-execstack)) \
172 tst-dlmodcount tst-dlopenrpath tst-deep1 \
173 tst-dlmopen1 tst-dlmopen3 \
174 unload3 unload4 unload5 unload6 unload7 unload8 tst-global1 order2 \
175 tst-audit1 tst-audit2 tst-audit8 tst-audit9 \
176 tst-addr1 tst-thrlock \
177 tst-unique1 tst-unique2 $(if $(CXX),tst-unique3 tst-unique4 \
178 tst-nodelete) \
179 tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \
180 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
181 tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error tst-noload \
182 tst-latepthread tst-tls-manydynamic tst-nodelete-dlclose
183 # reldep9
184 tests-internal += loadtest unload unload2 circleload1 \
185 neededtest neededtest2 neededtest3 neededtest4 \
186 tst-tls3 tst-tls6 tst-tls7 tst-tls8 tst-dlmopen2 \
187 tst-ptrguard1 tst-stackguard1
188 ifeq ($(build-hardcoded-path-in-tests),yes)
189 tests += tst-dlopen-aout
190 LDFLAGS-tst-dlopen-aout = $(no-pie-ldflag)
191 endif
192 test-srcs = tst-pathopt
193 selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
194 ifneq ($(selinux-enabled),1)
195 tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
196 endif
197 endif
198 ifeq ($(run-built-tests),yes)
199 tests-special += $(objpfx)tst-leaks1-mem.out \
200 $(objpfx)tst-leaks1-static-mem.out $(objpfx)noload-mem.out \
201 $(objpfx)tst-ldconfig-X.out
202 endif
203 tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
204 tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
205 tlsmod17a-modules = $(addprefix tst-tlsmod17a, $(tlsmod17a-suffixes))
206 tlsmod18a-modules = $(addprefix tst-tlsmod18a, $(tlsmod17a-suffixes))
207 one-hundred = $(foreach x,0 1 2 3 4 5 6 7 8 9, \
208 0$x 1$x 2$x 3$x 4$x 5$x 6$x 7$x 8$x 9$x)
209 tst-tls-many-dynamic-modules := \
210 $(foreach n,$(one-hundred),tst-tls-manydynamic$(n)mod)
211 extra-test-objs += $(tlsmod17a-modules:=.os) $(tlsmod18a-modules:=.os) \
212 tst-tlsalign-vars.o
213 test-extras += tst-tlsmod17a tst-tlsmod18a tst-tlsalign-vars
214 modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
215 testobj1_1 failobj constload2 constload3 unloadmod \
216 dep1 dep2 dep3 dep4 vismod1 vismod2 vismod3 \
217 nodelmod1 nodelmod2 nodelmod3 nodelmod4 \
218 nodel2mod1 nodel2mod2 nodel2mod3 \
219 nodlopenmod nodlopenmod2 filtmod1 filtmod2 \
220 reldepmod1 reldepmod2 reldepmod3 reldepmod4 nextmod1 nextmod2 \
221 reldep4mod1 reldep4mod2 reldep4mod3 reldep4mod4 \
222 neededobj1 neededobj2 neededobj3 neededobj4 \
223 neededobj5 neededobj6 firstobj globalmod1 \
224 unload2mod unload2dep ltglobmod1 ltglobmod2 pathoptobj \
225 dblloadmod1 dblloadmod2 dblloadmod3 reldepmod5 reldepmod6 \
226 reldep6mod0 reldep6mod1 reldep6mod2 reldep6mod3 reldep6mod4 \
227 reldep7mod1 reldep7mod2 \
228 tst-tlsmod1 tst-tlsmod2 tst-tlsmod3 tst-tlsmod4 \
229 tst-tlsmod5 tst-tlsmod6 tst-tlsmod7 tst-tlsmod8 \
230 tst-tlsmod9 tst-tlsmod10 tst-tlsmod11 tst-tlsmod12 \
231 tst-tlsmod13 tst-tlsmod13a tst-tlsmod14a tst-tlsmod14b \
232 tst-tlsmod15a tst-tlsmod15b tst-tlsmod16a tst-tlsmod16b \
233 $(tlsmod17a-modules) tst-tlsmod17b $(tlsmod18a-modules) \
234 tst-tls19mod1 tst-tls19mod2 tst-tls19mod3 \
235 circlemod1 circlemod1a circlemod2 circlemod2a \
236 circlemod3 circlemod3a \
237 reldep8mod1 reldep8mod2 reldep8mod3 \
238 reldep9mod1 reldep9mod2 reldep9mod3 \
239 tst-alignmod tst-alignmod2 \
240 $(modules-execstack-$(have-z-execstack)) \
241 tst-dlopenrpathmod tst-deep1mod1 tst-deep1mod2 tst-deep1mod3 \
242 tst-dlmopen1mod tst-auditmod1 \
243 unload3mod1 unload3mod2 unload3mod3 unload3mod4 \
244 unload4mod1 unload4mod2 unload4mod3 unload4mod4 \
245 unload6mod1 unload6mod2 unload6mod3 \
246 unload7mod1 unload7mod2 \
247 unload8mod1 unload8mod1x unload8mod2 unload8mod3 \
248 order2mod1 order2mod2 order2mod3 order2mod4 \
249 tst-unique1mod1 tst-unique1mod2 \
250 tst-unique2mod1 tst-unique2mod2 \
251 tst-auditmod9a tst-auditmod9b \
252 $(if $(CXX),tst-unique3lib tst-unique3lib2 tst-unique4lib \
253 tst-nodelete-uniquemod tst-nodelete-rtldmod \
254 tst-nodelete-zmod) \
255 tst-initordera1 tst-initorderb1 \
256 tst-initordera2 tst-initorderb2 \
257 tst-initordera3 tst-initordera4 \
258 tst-initorder2a tst-initorder2b tst-initorder2c \
259 tst-initorder2d \
260 tst-relsort1mod1 tst-relsort1mod2 tst-array2dep \
261 tst-array5dep tst-null-argv-lib \
262 tst-tlsalign-lib tst-nodelete-opened-lib tst-nodelete2mod \
263 tst-audit11mod1 tst-audit11mod2 tst-auditmod11 \
264 tst-audit12mod1 tst-audit12mod2 tst-audit12mod3 tst-auditmod12 \
265 tst-latepthreadmod $(tst-tls-many-dynamic-modules) \
266 tst-nodelete-dlclose-dso tst-nodelete-dlclose-plugin
267 ifeq (yes,$(have-mtls-dialect-gnu2))
268 tests += tst-gnu2-tls1
269 modules-names += tst-gnu2-tls1mod
270 $(objpfx)tst-gnu2-tls1: $(objpfx)tst-gnu2-tls1mod.so
271 tst-gnu2-tls1mod.so-no-z-defs = yes
272 CFLAGS-tst-gnu2-tls1mod.c += -mtls-dialect=gnu2
273 endif
274 ifeq (yes,$(have-protected-data))
275 modules-names += tst-protected1moda tst-protected1modb
276 tests += tst-protected1a tst-protected1b
277 $(objpfx)tst-protected1a: $(addprefix $(objpfx),tst-protected1moda.so tst-protected1modb.so)
278 $(objpfx)tst-protected1b: $(addprefix $(objpfx),tst-protected1modb.so tst-protected1moda.so)
279 tst-protected1modb.so-no-z-defs = yes
280 # These tests fail with GCC versions prior to 5.1 and with some versions
281 # of binutils. See https://sourceware.org/bugzilla/show_bug.cgi?id=17709
282 # and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248 for details.
283 # Perhaps in future we can make these XFAILs conditional on some detection
284 # of compiler/linker behavior/version.
285 test-xfail-tst-protected1a = yes
286 test-xfail-tst-protected1b = yes
287 endif
288 ifeq (yesyes,$(have-fpie)$(build-shared))
289 modules-names += tst-piemod1
290 tests += tst-pie1 tst-pie2
291 tests-pie += tst-pie1 tst-pie2
292 tests += vismain
293 tests-pie += vismain
294 CFLAGS-vismain.c = $(PIE-ccflag)
295 endif
296 modules-execstack-yes = tst-execstack-mod
297 extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
299 # filtmod1.so has a special rule
300 modules-names-nobuild := filtmod1
302 tests += $(tests-static)
304 ifneq (no,$(multi-arch))
305 tests-ifuncstatic := ifuncmain1static ifuncmain1picstatic \
306 ifuncmain2static ifuncmain2picstatic \
307 ifuncmain4static ifuncmain4picstatic \
308 ifuncmain5static ifuncmain5picstatic \
309 ifuncmain7static ifuncmain7picstatic
310 tests-static += $(tests-ifuncstatic)
311 tests-internal += $(tests-ifuncstatic)
312 ifeq (yes,$(build-shared))
313 tests-internal += \
314 ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \
315 ifuncmain1staticpic \
316 ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \
317 ifuncmain5 ifuncmain5pic ifuncmain5staticpic \
318 ifuncmain7 ifuncmain7pic
319 ifunc-test-modules = ifuncdep1 ifuncdep1pic ifuncdep2 ifuncdep2pic \
320 ifuncdep5 ifuncdep5pic
321 extra-test-objs += $(ifunc-test-modules:=.o)
322 test-internal-extras += $(ifunc-test-modules)
323 ifeq (yes,$(have-fpie))
324 ifunc-pie-tests = ifuncmain1pie ifuncmain1vispie ifuncmain1staticpie \
325 ifuncmain5pie ifuncmain6pie ifuncmain7pie
326 tests-internal += $(ifunc-pie-tests)
327 tests-pie += $(ifunc-pie-tests)
328 endif
329 modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6
330 endif
331 endif
333 ifeq (yes,$(build-shared))
334 ifeq ($(run-built-tests),yes)
335 tests-special += $(objpfx)tst-pathopt.out $(objpfx)tst-rtld-load-self.out
336 endif
337 tests-special += $(objpfx)check-textrel.out $(objpfx)check-execstack.out \
338 $(objpfx)check-localplt.out
339 endif
341 ifeq ($(run-built-tests),yes)
342 tests-special += $(objpfx)order-cmp.out $(objpfx)tst-array1-cmp.out \
343 $(objpfx)tst-array1-static-cmp.out \
344 $(objpfx)tst-array2-cmp.out $(objpfx)tst-array3-cmp.out \
345 $(objpfx)tst-array4-cmp.out $(objpfx)tst-array5-cmp.out \
346 $(objpfx)tst-array5-static-cmp.out $(objpfx)order2-cmp.out \
347 $(objpfx)tst-initorder-cmp.out \
348 $(objpfx)tst-initorder2-cmp.out $(objpfx)tst-unused-dep.out \
349 $(objpfx)tst-unused-dep-cmp.out
350 endif
352 check-abi: $(objpfx)check-abi-ld.out
353 tests-special += $(objpfx)check-abi-ld.out
354 update-abi: update-abi-ld
355 update-all-abi: update-all-abi-ld
357 ifeq ($(have-glob-dat-reloc),yes)
358 tests += tst-prelink
359 ifeq ($(run-built-tests),yes)
360 tests-special += $(objpfx)tst-prelink-cmp.out
361 endif
362 endif
364 # The test requires shared _and_ PIE because the executable
365 # unit test driver must be able to link with the shared object
366 # that is going to eventually go into an installed DSO.
367 ifeq (yesyes,$(have-fpie)$(build-shared))
368 tests-internal += tst-_dl_addr_inside_object
369 tests-pie += tst-_dl_addr_inside_object
370 $(objpfx)tst-_dl_addr_inside_object: $(objpfx)dl-addr-obj.os
371 CFLAGS-tst-_dl_addr_inside_object.c += $(PIE-ccflag)
372 endif
374 # By default tst-linkall-static should try to use crypt routines to test
375 # static libcrypt use.
376 CFLAGS-tst-linkall-static.c = -DUSE_CRYPT=1
377 # However, if we are using NSS crypto and we don't have a static
378 # library, then we exclude the use of crypt functions in the test.
379 # We similarly exclude libcrypt.a from the static link (see below).
380 ifeq (yesno,$(nss-crypt)$(static-nss-crypt))
381 CFLAGS-tst-linkall-static.c = -DUSE_CRYPT=0
382 endif
384 include ../Rules
386 ifeq (yes,$(build-shared))
387 # Make sure these things are built in the `make lib' pass so they can be used
388 # to run programs during the `make others' pass.
389 lib-noranlib: $(objpfx)$(rtld-installed-name) \
390 $(addprefix $(objpfx),$(extra-objs))
391 endif
393 # Command to link into a larger single relocatable object.
394 reloc-link = $(LINK.o) -nostdlib -nostartfiles -r
396 $(objpfx)sotruss-lib.so: $(shlib-lds)
398 $(objpfx)dl-allobjs.os: $(all-rtld-routines:%=$(objpfx)%.os)
399 $(reloc-link) -o $@ $^
401 # Link together the dynamic linker into a single relocatable object.
402 # First we do a link against libc_pic.a just to get a link map,
403 # and discard the object produced by that link. From the link map
404 # we can glean all the libc modules that need to go into the dynamic
405 # linker. Then we do a recursive make that goes into all the subdirs
406 # those modules come from and builds special rtld-foo.os versions that
407 # are compiled with special flags, and puts these modules into rtld-libc.a
408 # for us. Then we do the real link using rtld-libc.a instead of libc_pic.a.
410 # If the compiler can do SSP, build the mapfile with dummy __stack_chk_fail
411 # and __stack_chk_fail_local symbols defined, to prevent the real things
412 # being dragged into rtld even though rtld is never built with stack-
413 # protection.
415 ifeq ($(have-ssp),yes)
416 dummy-stack-chk-fail := -Wl,--defsym='__stack_chk_fail=0' \
417 -Wl,--defsym='__stack_chk_fail_local=0'
418 else
419 dummy-stack-chk-fail :=
420 endif
422 $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
423 @-rm -f $@T
424 $(reloc-link) -o $@.o $(dummy-stack-chk-fail) \
425 '-Wl,-(' $^ -lgcc '-Wl,-)' -Wl,-Map,$@T
426 rm -f $@.o
427 mv -f $@T $@
429 $(objpfx)librtld.mk: $(objpfx)librtld.map Makefile
430 LC_ALL=C \
431 sed -n 's@^$(common-objpfx)\([^(]*\)(\([^)]*\.os\)) *.*$$@\1 \2@p' \
432 $< | \
433 while read lib file; do \
434 case $$lib in \
435 libc_pic.a) \
436 LC_ALL=C fgrep -l /$$file \
437 $(common-objpfx)stamp.os $(common-objpfx)*/stamp.os | \
438 LC_ALL=C \
439 sed 's@^$(common-objpfx)\([^/]*\)/stamp\.os$$@rtld-\1'" +=$$file@"\
440 ;; \
441 */*.a) \
442 echo rtld-$${lib%%/*} += $$file ;; \
443 *) echo "Wasn't expecting $$lib($$file)" >&2; exit 1 ;; \
444 esac; \
445 done > $@T
446 echo rtld-subdirs = `LC_ALL=C sed 's/^rtld-\([^ ]*\).*$$/\1/' $@T \
447 | LC_ALL=C sort -u` >> $@T
448 mv -f $@T $@
450 $(objpfx)rtld-libc.a: $(objpfx)librtld.mk FORCE
451 $(MAKE) -f $< -f rtld-Rules
453 $(objpfx)librtld.os: $(objpfx)dl-allobjs.os $(objpfx)rtld-libc.a
454 $(LINK.o) -nostdlib -nostartfiles -r -o $@ '-Wl,-(' $^ -lgcc '-Wl,-)' \
455 -Wl,-Map,$@.map
457 generated += librtld.map librtld.mk rtld-libc.a librtld.os.map
459 z-now-yes = -Wl,-z,now
461 $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
462 # Link into a temporary file so that we don't touch $@ at all
463 # if the sanity check below fails.
464 $(LINK.o) -nostdlib -nostartfiles -shared -o $@.new \
465 $(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \
466 $(filter-out $(map-file),$^) $(load-map-file) \
467 -Wl,-soname=$(rtld-installed-name) \
468 -Wl,-defsym=_begin=0
469 $(call after-link,$@.new)
470 $(READELF) -s $@.new \
471 | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
472 mv -f $@.new $@
474 ifeq (yes,$(build-shared))
475 # interp.c exists just to get the runtime linker path into libc.so.
476 $(objpfx)interp.os: $(common-objpfx)runtime-linker.h
477 endif
479 ifneq (ld.so,$(rtld-installed-name))
480 # Make sure ld.so.1 exists in the build directory so we can link
481 # against it.
482 $(objpfx)$(rtld-installed-name): $(objpfx)ld.so
483 $(make-link)
484 generated += $(rtld-installed-name)
485 endif
487 # Build a file mentioning all trustworthy directories to look for shared
488 # libraries when using LD_LIBRARY_PATH in a setuid program. The user can
489 # add directories to the list by defining $(user-defined-trusted-dirs)
490 # before starting make.
491 $(objpfx)trusted-dirs.h: $(objpfx)trusted-dirs.st; @:
492 $(objpfx)trusted-dirs.st: Makefile $(..)Makeconfig
493 $(make-target-directory)
494 echo "$(subst :, ,$(default-rpath) $(user-defined-trusted-dirs))" \
495 | $(AWK) -f gen-trusted-dirs.awk > ${@:st=T};
496 echo '#define DL_DST_LIB "$(notdir $(slibdir))"' >> ${@:st=T}
497 $(move-if-change) ${@:st=T} ${@:st=h}
498 touch $@
499 CPPFLAGS-dl-load.c = -I$(objpfx). -I$(csu-objpfx).
501 ifeq (yes,$(build-shared))
502 $(inst_slibdir)/$(rtld-version-installed-name): $(objpfx)ld.so $(+force)
503 $(make-target-directory)
504 $(do-install-program)
506 $(inst_rtlddir)/$(rtld-installed-name): \
507 $(inst_slibdir)/$(rtld-version-installed-name) \
508 $(inst_slibdir)/libc-$(version).so
509 $(make-target-directory)
510 $(make-shlib-link)
512 # Special target called by parent to install just the dynamic linker.
513 .PHONY: ldso_install
514 ldso_install: $(inst_rtlddir)/$(rtld-installed-name)
515 endif
518 ldd-rewrite = -e 's%@RTLD@%$(rtlddir)/$(rtld-installed-name)%g' \
519 -e 's%@VERSION@%$(version)%g' \
520 -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
521 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' \
522 -e 's%@BASH@%$(BASH)%g' \
523 -e 's%@TEXTDOMAINDIR@%$(localedir)%g'
525 ifeq ($(ldd-rewrite-script),no)
526 define gen-ldd
527 LC_ALL=C sed $(ldd-rewrite) < $< > $@.new
528 endef
529 else
530 define gen-ldd
531 LC_ALL=C sed $(ldd-rewrite) < $< \
532 | LC_ALL=C sed -f $(patsubst $(..)/%,/%,$(..)$(ldd-rewrite-script)) > $@.new
533 endef
534 endif
536 $(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \
537 $(common-objpfx)config.make
538 $(gen-ldd)
539 chmod 555 $@.new
540 mv -f $@.new $@
542 $(objpfx)sprof: $(libdl)
544 $(objpfx)sln: $(sln-modules:%=$(objpfx)%.o)
546 $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
548 SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
549 CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
550 -D'SLIBDIR="$(slibdir)"'
551 libof-ldconfig = ldconfig
552 CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
553 CFLAGS-cache.c = $(SYSCONF-FLAGS)
554 CFLAGS-rtld.c = $(SYSCONF-FLAGS)
556 cpp-srcs-left := $(all-rtld-routines:=.os)
557 lib := rtld
558 include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
560 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
561 generated += $(addsuffix .so,$(strip $(modules-names)))
563 $(objpfx)testobj1.so: $(libdl)
564 $(objpfx)testobj1_1.so: $(objpfx)testobj1.so $(libdl)
565 $(objpfx)testobj2.so: $(objpfx)testobj1.so $(libdl)
566 $(objpfx)testobj3.so: $(libdl)
567 $(objpfx)testobj4.so: $(libdl)
568 $(objpfx)testobj5.so: $(libdl)
569 $(objpfx)testobj6.so: $(objpfx)testobj1.so $(objpfx)testobj2.so $(libdl)
570 $(objpfx)failobj.so: $(objpfx)testobj6.so
571 $(objpfx)dep1.so: $(objpfx)dep2.so $(objpfx)dep4.so
572 $(objpfx)dep2.so: $(objpfx)dep3.so $(objpfx)dep4.so
573 $(objpfx)dep4.so: $(objpfx)dep3.so
574 $(objpfx)nodelmod3.so: $(objpfx)nodelmod4.so
575 $(objpfx)nextmod1.so: $(libdl)
576 $(objpfx)neededobj1.so: $(libdl)
577 $(objpfx)neededobj2.so: $(objpfx)neededobj1.so $(libdl)
578 $(objpfx)neededobj3.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so $(libdl)
579 $(objpfx)neededobj4.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
580 $(objpfx)neededobj3.so $(libdl)
581 $(objpfx)neededobj6.so: $(objpfx)neededobj5.so
582 $(objpfx)unload2mod.so: $(objpfx)unload2dep.so
583 $(objpfx)ltglobmod2.so: $(libdl)
584 $(objpfx)firstobj.so: $(shared-thread-library)
585 $(objpfx)globalmod1.so: $(libdl)
586 $(objpfx)reldep4mod1.so: $(objpfx)reldep4mod3.so
587 $(objpfx)reldep4mod2.so: $(objpfx)reldep4mod4.so
588 $(objpfx)dblloadmod1.so: $(objpfx)dblloadmod3.so
589 $(objpfx)dblloadmod2.so: $(objpfx)dblloadmod3.so
590 $(objpfx)reldepmod5.so: $(objpfx)reldepmod2.so
591 $(objpfx)reldepmod6.so: $(objpfx)reldepmod2.so
592 $(objpfx)reldep6mod1.so: $(objpfx)reldep6mod0.so
593 $(objpfx)reldep6mod2.so: $(objpfx)reldep6mod1.so
594 $(objpfx)reldep6mod3.so: $(objpfx)reldep6mod2.so
595 $(objpfx)reldep6mod4.so: $(objpfx)reldep6mod1.so
596 $(objpfx)tst-tlsmod3.so: $(objpfx)tst-tlsmod2.so
597 $(objpfx)tst-tlsmod8.so: $(objpfx)tst-tlsmod7.so
598 $(objpfx)tst-tlsmod10.so: $(objpfx)tst-tlsmod9.so
599 $(objpfx)tst-tlsmod12.so: $(objpfx)tst-tlsmod11.so
600 $(objpfx)tst-tlsmod13a.so: $(objpfx)tst-tlsmod13.so
601 # For tst-tls9-static, make sure the modules it dlopens have libc.so in DT_NEEDED
602 $(objpfx)tst-tlsmod5.so: $(common-objpfx)libc.so
603 $(objpfx)tst-tlsmod6.so: $(common-objpfx)libc.so
604 $(objpfx)tst-tls19mod1.so: $(objpfx)tst-tls19mod2.so $(objpfx)tst-tls19mod3.so
605 $(objpfx)tst-tls19mod3.so: $(objpfx)ld.so
606 $(objpfx)reldep8mod3.so: $(objpfx)reldep8mod1.so $(objpfx)reldep8mod2.so
607 $(objpfx)nodel2mod3.so: $(objpfx)nodel2mod1.so $(objpfx)nodel2mod2.so
608 $(objpfx)reldep9mod2.so: $(objpfx)reldep9mod1.so
609 $(objpfx)reldep9mod3.so: $(objpfx)reldep9mod1.so $(objpfx)reldep9mod2.so
610 $(objpfx)unload3mod1.so: $(objpfx)unload3mod3.so
611 $(objpfx)unload3mod2.so: $(objpfx)unload3mod3.so
612 $(objpfx)unload3mod3.so: $(objpfx)unload3mod4.so
613 $(objpfx)unload4mod1.so: $(objpfx)unload4mod2.so $(objpfx)unload4mod3.so
614 $(objpfx)unload4mod2.so: $(objpfx)unload4mod4.so $(objpfx)unload4mod3.so
615 $(objpfx)unload6mod1.so: $(libdl)
616 $(objpfx)unload6mod2.so: $(libdl)
617 $(objpfx)unload6mod3.so: $(libdl)
618 $(objpfx)unload7mod1.so: $(libdl)
619 $(objpfx)unload7mod2.so: $(objpfx)unload7mod1.so
620 $(objpfx)unload8mod1.so: $(objpfx)unload8mod2.so
621 $(objpfx)unload8mod2.so: $(objpfx)unload8mod3.so
622 $(objpfx)unload8mod3.so: $(libdl)
623 $(objpfx)tst-initordera2.so: $(objpfx)tst-initordera1.so
624 $(objpfx)tst-initorderb2.so: $(objpfx)tst-initorderb1.so $(objpfx)tst-initordera2.so
625 $(objpfx)tst-initordera3.so: $(objpfx)tst-initorderb2.so $(objpfx)tst-initorderb1.so
626 $(objpfx)tst-initordera4.so: $(objpfx)tst-initordera3.so
627 $(objpfx)tst-initorder: $(objpfx)tst-initordera4.so $(objpfx)tst-initordera1.so $(objpfx)tst-initorderb2.so
628 $(objpfx)tst-null-argv: $(objpfx)tst-null-argv-lib.so
629 $(objpfx)tst-tlsalign: $(objpfx)tst-tlsalign-lib.so
630 $(objpfx)tst-nodelete-opened.out: $(objpfx)tst-nodelete-opened-lib.so
631 $(objpfx)tst-nodelete-opened: $(libdl)
632 $(objpfx)tst-noload: $(libdl)
634 $(objpfx)tst-tlsalign-extern: $(objpfx)tst-tlsalign-vars.o
635 $(objpfx)tst-tlsalign-extern-static: $(objpfx)tst-tlsalign-vars.o
637 tst-null-argv-ENV = LD_DEBUG=all LD_DEBUG_OUTPUT=$(objpfx)tst-null-argv.debug.out
638 LDFLAGS-nodel2mod3.so = $(no-as-needed)
639 LDFLAGS-reldepmod5.so = $(no-as-needed)
640 LDFLAGS-reldep6mod1.so = $(no-as-needed)
641 LDFLAGS-reldep6mod4.so = $(no-as-needed)
642 LDFLAGS-reldep8mod3.so = $(no-as-needed)
643 LDFLAGS-unload4mod1.so = $(no-as-needed)
644 LDFLAGS-unload4mod2.so = $(no-as-needed)
645 LDFLAGS-tst-initorder = $(no-as-needed)
646 LDFLAGS-tst-initordera2.so = $(no-as-needed)
647 LDFLAGS-tst-initordera3.so = $(no-as-needed)
648 LDFLAGS-tst-initordera4.so = $(no-as-needed)
649 LDFLAGS-tst-initorderb2.so = $(no-as-needed)
650 LDFLAGS-tst-tlsmod5.so = -nostdlib $(no-as-needed)
651 LDFLAGS-tst-tlsmod6.so = -nostdlib $(no-as-needed)
653 testobj1.so-no-z-defs = yes
654 testobj3.so-no-z-defs = yes
655 testobj4.so-no-z-defs = yes
656 testobj5.so-no-z-defs = yes
657 testobj6.so-no-z-defs = yes
658 failobj.so-no-z-defs = yes
659 constload2.so-no-z-defs = yes
660 constload3.so-no-z-defs = yes
661 nodelmod1.so-no-z-defs = yes
662 nodelmod2.so-no-z-defs = yes
663 nodelmod4.so-no-z-defs = yes
664 nodel2mod2.so-no-z-defs = yes
665 reldepmod2.so-no-z-defs = yes
666 reldepmod3.so-no-z-defs = yes
667 reldepmod4.so-no-z-defs = yes
668 reldep4mod4.so-no-z-defs = yes
669 reldep4mod2.so-no-z-defs = yes
670 ltglobmod2.so-no-z-defs = yes
671 dblloadmod3.so-no-z-defs = yes
672 tst-tlsmod1.so-no-z-defs = yes
673 tst-tlsmod2.so-no-z-defs = yes
674 tst-tlsmod3.so-no-z-defs = yes
675 tst-tlsmod4.so-no-z-defs = yes
676 tst-tlsmod7.so-no-z-defs = yes
677 tst-tlsmod8.so-no-z-defs = yes
678 tst-tlsmod9.so-no-z-defs = yes
679 tst-tlsmod10.so-no-z-defs = yes
680 tst-tlsmod12.so-no-z-defs = yes
681 tst-tlsmod14a.so-no-z-defs = yes
682 tst-tlsmod14b.so-no-z-defs = yes
683 tst-tlsmod15a.so-no-z-defs = yes
684 tst-tlsmod16b.so-no-z-defs = yes
685 circlemod2.so-no-z-defs = yes
686 circlemod3.so-no-z-defs = yes
687 circlemod3a.so-no-z-defs = yes
688 reldep8mod2.so-no-z-defs = yes
689 reldep9mod1.so-no-z-defs = yes
690 unload3mod4.so-no-z-defs = yes
691 unload4mod1.so-no-z-defs = yes
692 ifuncmod1.so-no-z-defs = yes
693 ifuncmod5.so-no-z-defs = yes
694 ifuncmod6.so-no-z-defs = yes
695 tst-auditmod9a.so-no-z-defs = yes
696 tst-auditmod9b.so-no-z-defs = yes
697 tst-nodelete-uniquemod.so-no-z-defs = yes
698 tst-nodelete-rtldmod.so-no-z-defs = yes
699 tst-nodelete-zmod.so-no-z-defs = yes
700 tst-nodelete2mod.so-no-z-defs = yes
702 ifeq ($(build-shared),yes)
703 # Build all the modules even when not actually running test programs.
704 tests: $(test-modules)
705 endif
707 $(objpfx)loadtest: $(libdl)
708 LDFLAGS-loadtest = -rdynamic
710 $(objpfx)loadtest.out: $(test-modules)
712 $(objpfx)neededtest: $(libdl)
713 $(objpfx)neededtest.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
714 $(objpfx)neededobj3.so
716 $(objpfx)neededtest2: $(libdl)
717 $(objpfx)neededtest2.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
718 $(objpfx)neededobj3.so
720 $(objpfx)neededtest3: $(libdl)
721 $(objpfx)neededtest3.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
722 $(objpfx)neededobj3.so $(objpfx)neededobj4.so
724 $(objpfx)neededtest4: $(libdl) $(objpfx)neededobj1.so
725 $(objpfx)neededtest4.out: $(objpfx)neededobj5.so $(objpfx)neededobj6.so
727 $(objpfx)restest1: $(objpfx)testobj1.so $(objpfx)testobj1_1.so $(libdl)
728 LDFLAGS-restest1 = -rdynamic
730 $(objpfx)restest2: $(libdl)
731 LDFLAGS-restest2 = -rdynamic
733 $(objpfx)restest1.out: $(test-modules)
735 preloadtest-preloads = testobj1 testobj2 testobj3 testobj4 testobj5
736 $(objpfx)preloadtest: $(objpfx)testobj6.so
737 LDFLAGS-preloadtest = -rdynamic
738 $(objpfx)preloadtest.out: $(preloadtest-preloads:%=$(objpfx)%.so)
739 preloadtest-ENV = \
740 LD_PRELOAD=$(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
742 $(objpfx)loadfail: $(libdl)
743 LDFLAGS-loadfail = -rdynamic
745 $(objpfx)loadfail.out: $(objpfx)failobj.so
747 $(objpfx)multiload: $(libdl)
748 LDFLAGS-multiload = -rdynamic
749 CFLAGS-multiload.c = -DOBJDIR=\"$(elf-objpfx)\"
751 $(objpfx)multiload.out: $(objpfx)testobj1.so
753 $(objpfx)origtest: $(libdl)
754 LDFLAGS-origtest = -rdynamic
755 $(objpfx)origtest.out: $(objpfx)testobj1.so
757 ifeq ($(have-thread-library),yes)
758 $(objpfx)resolvfail: $(libdl) $(shared-thread-library)
759 else
760 $(objpfx)resolvfail: $(libdl)
761 endif
763 $(objpfx)constload1: $(libdl)
764 $(objpfx)constload1.out: $(objpfx)constload2.so $(objpfx)constload3.so
766 $(objpfx)circleload1: $(libdl)
767 $(objpfx)circleload1.out: $(objpfx)circlemod1.so \
768 $(objpfx)circlemod1a.so
770 $(objpfx)circlemod1.so: $(objpfx)circlemod2.so
771 $(objpfx)circlemod2.so: $(objpfx)circlemod3.so
772 $(objpfx)circlemod1a.so: $(objpfx)circlemod2a.so
773 $(objpfx)circlemod2a.so: $(objpfx)circlemod3a.so
775 $(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so)
777 $(objpfx)order-cmp.out: $(objpfx)order.out
778 (echo "0123456789" | cmp $< -) > $@; \
779 $(evaluate-test)
781 $(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so)
782 $(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
783 vismain-ENV = LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
785 $(objpfx)noload: $(objpfx)testobj1.so $(libdl)
786 LDFLAGS-noload = -rdynamic $(no-as-needed)
787 $(objpfx)noload.out: $(objpfx)testobj5.so
789 $(objpfx)noload-mem.out: $(objpfx)noload.out
790 $(common-objpfx)malloc/mtrace $(objpfx)noload.mtrace > $@; \
791 $(evaluate-test)
792 noload-ENV = MALLOC_TRACE=$(objpfx)noload.mtrace
794 LDFLAGS-nodelete = -rdynamic
795 LDFLAGS-nodelmod1.so = -Wl,--enable-new-dtags,-z,nodelete
796 LDFLAGS-nodelmod4.so = -Wl,--enable-new-dtags,-z,nodelete
797 $(objpfx)nodelete: $(libdl)
798 $(objpfx)nodelete.out: $(objpfx)nodelmod1.so $(objpfx)nodelmod2.so \
799 $(objpfx)nodelmod3.so
801 LDFLAGS-nodlopenmod.so = -Wl,--enable-new-dtags,-z,nodlopen
802 $(objpfx)nodlopen: $(libdl)
803 $(objpfx)nodlopen.out: $(objpfx)nodlopenmod.so
805 $(objpfx)nodlopenmod2.so: $(objpfx)nodlopenmod.so
806 $(objpfx)nodlopen2: $(libdl)
807 $(objpfx)nodlopen2.out: $(objpfx)nodlopenmod2.so
809 $(objpfx)filtmod1.so: $(objpfx)filtmod1.os $(objpfx)filtmod2.so
810 $(LINK.o) -shared -o $@ -B$(csu-objpfx) $(LDFLAGS.so) \
811 -L$(subst :, -L,$(rpath-link)) \
812 -Wl,-rpath-link=$(rpath-link) \
813 $< -Wl,-F,$(objpfx)filtmod2.so
814 $(objpfx)filter: $(objpfx)filtmod1.so
816 # This does not link against libc.
817 CFLAGS-filtmod1.c = $(no-stack-protector)
819 $(objpfx)unload: $(libdl)
820 $(objpfx)unload.out: $(objpfx)unloadmod.so
822 $(objpfx)reldep: $(libdl)
823 $(objpfx)reldep.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod2.so
825 $(objpfx)reldep2: $(libdl)
826 $(objpfx)reldep2.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod3.so
828 $(objpfx)reldep3: $(libdl)
829 $(objpfx)reldep3.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
831 $(objpfx)reldep4: $(libdl)
832 $(objpfx)reldep4.out: $(objpfx)reldep4mod1.so $(objpfx)reldep4mod2.so
834 $(objpfx)next: $(objpfx)nextmod1.so $(objpfx)nextmod2.so $(libdl)
835 LDFLAGS-next = $(no-as-needed)
837 $(objpfx)unload2: $(libdl)
838 $(objpfx)unload2.out: $(objpfx)unload2mod.so $(objpfx)unload2dep.so
840 $(objpfx)lateglobal: $(libdl)
841 $(objpfx)lateglobal.out: $(objpfx)ltglobmod1.so $(objpfx)ltglobmod2.so
843 $(objpfx)tst-pathopt: $(libdl)
844 $(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \
845 $(objpfx)pathoptobj.so
846 $(SHELL) $< $(common-objpfx) '$(test-wrapper-env)' \
847 '$(run-program-env)'; \
848 $(evaluate-test)
850 $(objpfx)tst-rtld-load-self.out: tst-rtld-load-self.sh $(objpfx)ld.so
851 $(SHELL) $^ '$(test-wrapper)' '$(test-wrapper-env)' > $@; \
852 $(evaluate-test)
854 $(objpfx)initfirst: $(libdl)
855 $(objpfx)initfirst.out: $(objpfx)firstobj.so
857 $(objpfx)global: $(objpfx)globalmod1.so
858 $(objpfx)global.out: $(objpfx)reldepmod1.so
860 $(objpfx)dblload: $(libdl)
861 $(objpfx)dblload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
863 $(objpfx)dblunload: $(libdl)
864 $(objpfx)dblunload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
866 $(objpfx)reldep5: $(libdl)
867 $(objpfx)reldep5.out: $(objpfx)reldepmod5.so $(objpfx)reldepmod6.so
869 $(objpfx)reldep6: $(libdl)
870 $(objpfx)reldep6.out: $(objpfx)reldep6mod3.so $(objpfx)reldep6mod4.so
872 $(objpfx)reldep7: $(libdl)
873 $(objpfx)reldep7.out: $(objpfx)reldep7mod1.so $(objpfx)reldep7mod2.so
875 $(objpfx)reldep8: $(libdl)
876 $(objpfx)reldep8.out: $(objpfx)reldep8mod3.so
878 LDFLAGS-nodel2mod2.so = -Wl,--enable-new-dtags,-z,nodelete
879 $(objpfx)nodelete2: $(libdl)
880 $(objpfx)nodelete2.out: $(objpfx)nodel2mod3.so
882 $(objpfx)reldep9: $(libdl)
883 $(objpfx)reldep9.out: $(objpfx)reldep9mod3.so
885 $(objpfx)tst-tls3: $(objpfx)tst-tlsmod1.so
887 $(objpfx)tst-tls4: $(libdl)
888 $(objpfx)tst-tls4.out: $(objpfx)tst-tlsmod2.so
890 $(objpfx)tst-tls5: $(libdl)
891 $(objpfx)tst-tls5.out: $(objpfx)tst-tlsmod2.so
893 $(objpfx)tst-tls6: $(libdl)
894 $(objpfx)tst-tls6.out: $(objpfx)tst-tlsmod2.so
896 $(objpfx)tst-tls7: $(libdl)
897 $(objpfx)tst-tls7.out: $(objpfx)tst-tlsmod3.so
899 $(objpfx)tst-tls8: $(libdl)
900 $(objpfx)tst-tls8.out: $(objpfx)tst-tlsmod3.so $(objpfx)tst-tlsmod4.so
902 $(objpfx)tst-tls9: $(libdl)
903 $(objpfx)tst-tls9.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
905 $(objpfx)tst-tls10: $(objpfx)tst-tlsmod8.so $(objpfx)tst-tlsmod7.so
907 $(objpfx)tst-tls11: $(objpfx)tst-tlsmod10.so $(objpfx)tst-tlsmod9.so
909 $(objpfx)tst-tls12: $(objpfx)tst-tlsmod12.so $(objpfx)tst-tlsmod11.so
911 $(objpfx)tst-tls13: $(libdl)
912 $(objpfx)tst-tls13.out: $(objpfx)tst-tlsmod13a.so
914 $(objpfx)tst-tls14: $(objpfx)tst-tlsmod14a.so $(libdl)
915 $(objpfx)tst-tls14.out: $(objpfx)tst-tlsmod14b.so
917 $(objpfx)tst-tls15: $(libdl)
918 $(objpfx)tst-tls15.out: $(objpfx)tst-tlsmod15a.so $(objpfx)tst-tlsmod15b.so
920 $(objpfx)tst-tls-dlinfo: $(libdl)
921 $(objpfx)tst-tls-dlinfo.out: $(objpfx)tst-tlsmod2.so
925 $(objpfx)tst-tls16: $(libdl)
926 $(objpfx)tst-tls16.out: $(objpfx)tst-tlsmod16a.so $(objpfx)tst-tlsmod16b.so
928 $(objpfx)tst-tls17: $(libdl)
929 $(objpfx)tst-tls17.out: $(objpfx)tst-tlsmod17b.so
930 $(patsubst %,$(objpfx)%.os,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.os: tst-tlsmod17a.c
931 $(compile-command.c) -DN=$*
932 $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.so: $(objpfx)ld.so
933 $(objpfx)tst-tlsmod17b.so: $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules))
935 $(objpfx)tst-tls18: $(libdl)
936 $(objpfx)tst-tls18.out: $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules))
937 $(patsubst %,$(objpfx)%.os,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.os : tst-tlsmod18a.c
938 $(compile-command.c) -DN=$*
939 $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.so: $(objpfx)ld.so
941 $(objpfx)tst-tls19: $(libdl)
942 $(objpfx)tst-tls19.out: $(objpfx)tst-tls19mod1.so
944 CFLAGS-tst-align.c = $(stack-align-test-flags)
945 CFLAGS-tst-align2.c = $(stack-align-test-flags)
946 CFLAGS-tst-alignmod.c = $(stack-align-test-flags)
947 CFLAGS-tst-alignmod2.c = $(stack-align-test-flags)
948 $(objpfx)tst-align: $(libdl)
949 $(objpfx)tst-align.out: $(objpfx)tst-alignmod.so
950 $(objpfx)tst-align2: $(objpfx)tst-alignmod2.so
952 $(objpfx)unload3: $(libdl)
953 $(objpfx)unload3.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
954 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
956 $(objpfx)unload4: $(libdl)
957 $(objpfx)unload4.out: $(objpfx)unload4mod1.so $(objpfx)unload4mod3.so
959 $(objpfx)unload5: $(libdl)
960 $(objpfx)unload5.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
961 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
963 $(objpfx)unload6: $(libdl)
964 $(objpfx)unload6.out: $(objpfx)unload6mod1.so $(objpfx)unload6mod2.so \
965 $(objpfx)unload6mod3.so
967 $(objpfx)unload7: $(libdl)
968 $(objpfx)unload7.out: $(objpfx)unload7mod1.so $(objpfx)unload7mod2.so
969 unload7-ENV = MALLOC_PERTURB_=85
971 $(objpfx)unload8: $(libdl)
972 $(objpfx)unload8.out: $(objpfx)unload8mod1.so $(objpfx)unload8mod1x.so
974 ifdef libdl
975 $(objpfx)tst-tls9-static: $(common-objpfx)dlfcn/libdl.a
976 $(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
977 endif
979 ifeq ($(have-z-execstack),yes)
980 $(objpfx)tst-execstack: $(libdl)
981 $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
982 CPPFLAGS-tst-execstack.c = -DUSE_PTHREADS=0
983 LDFLAGS-tst-execstack = -Wl,-z,noexecstack
984 LDFLAGS-tst-execstack-mod = -Wl,-z,execstack
986 $(objpfx)tst-execstack-needed: $(objpfx)tst-execstack-mod.so
987 LDFLAGS-tst-execstack-needed = -Wl,-z,noexecstack
989 LDFLAGS-tst-execstack-prog = -Wl,-z,execstack
990 CFLAGS-tst-execstack-prog.c += -Wno-trampolines
991 CFLAGS-tst-execstack-mod.c += -Wno-trampolines
992 endif
994 LDFLAGS-tst-array2 = $(no-as-needed)
995 LDFLAGS-tst-array5 = $(no-as-needed)
997 $(objpfx)tst-array1-cmp.out: tst-array1.exp $(objpfx)tst-array1.out
998 cmp $^ > $@; \
999 $(evaluate-test)
1001 $(objpfx)tst-array1-static-cmp.out: tst-array1.exp \
1002 $(objpfx)tst-array1-static.out
1003 cmp $^ > $@; \
1004 $(evaluate-test)
1006 $(objpfx)tst-array2: $(objpfx)tst-array2dep.so
1007 $(objpfx)tst-array2-cmp.out: tst-array2.exp $(objpfx)tst-array2.out
1008 cmp $^ > $@; \
1009 $(evaluate-test)
1011 $(objpfx)tst-array3-cmp.out: tst-array1.exp $(objpfx)tst-array3.out
1012 cmp $^ > $@; \
1013 $(evaluate-test)
1015 $(objpfx)tst-array4: $(libdl)
1016 $(objpfx)tst-array4.out: $(objpfx)tst-array2dep.so
1017 $(objpfx)tst-array4-cmp.out: tst-array4.exp $(objpfx)tst-array4.out
1018 cmp $^ > $@; \
1019 $(evaluate-test)
1021 $(objpfx)tst-array5: $(objpfx)tst-array5dep.so
1022 $(objpfx)tst-array5-cmp.out: tst-array5.exp $(objpfx)tst-array5.out
1023 cmp $^ > $@; \
1024 $(evaluate-test)
1026 $(objpfx)tst-array5-static-cmp.out: tst-array5-static.exp \
1027 $(objpfx)tst-array5-static.out
1028 cmp $^ > $@; \
1029 $(evaluate-test)
1031 CFLAGS-tst-pie1.c += $(pie-ccflag)
1032 CFLAGS-tst-pie2.c += $(pie-ccflag)
1034 $(objpfx)tst-piemod1.so: $(libsupport)
1035 $(objpfx)tst-pie1: $(objpfx)tst-piemod1.so
1037 ifeq (yes,$(build-shared))
1038 all-built-dso := $(common-objpfx)elf/ld.so $(common-objpfx)libc.so \
1039 $(filter-out $(common-objpfx)linkobj/libc.so, \
1040 $(sort $(wildcard $(addprefix $(common-objpfx), \
1041 */lib*.so \
1042 iconvdata/*.so))))
1044 $(all-built-dso:=.dyn): %.dyn: %
1045 @rm -f $@T
1046 LC_ALL=C $(READELF) -W -d $< > $@T
1047 test -s $@T
1048 mv -f $@T $@
1049 common-generated += $(all-built-dso:$(common-objpfx)%=%.dyn)
1051 $(objpfx)check-textrel.out: $(..)scripts/check-textrel.awk \
1052 $(all-built-dso:=.dyn)
1053 LC_ALL=C $(AWK) -f $^ > $@; \
1054 $(evaluate-test)
1055 generated += check-textrel.out
1057 $(objpfx)execstack-default: $(first-word $(wildcard $(sysdirs:%=%/stackinfo.h)))
1058 $(make-target-directory)
1059 { echo '#include <elf.h>'; \
1060 echo '#include <stackinfo.h>'; \
1061 echo '#if (DEFAULT_STACK_PERMS & PF_X) == 0'; \
1062 echo '@@@execstack-no@@@'; \
1063 echo '#else'; \
1064 echo '@@@execstack-yes@@@'; \
1065 echo '#endif'; } | \
1066 $(CC) $(CFLAGS) $(CPPFLAGS) -E -x c-header - | \
1067 sed -n -e 's/^@@@\(.*\)@@@/\1/p' > $@T
1068 mv -f $@T $@
1069 generated += execstack-default
1071 $(all-built-dso:=.phdr): %.phdr: %
1072 @rm -f $@T
1073 LC_ALL=C $(READELF) -W -l $< > $@T
1074 test -s $@T
1075 mv -f $@T $@
1076 common-generated += $(all-built-dso:$(common-objpfx)%=%.phdr)
1078 $(objpfx)check-execstack.out: $(..)scripts/check-execstack.awk \
1079 $(objpfx)execstack-default \
1080 $(all-built-dso:=.phdr)
1081 LC_ALL=C $(AWK) -f $^ > $@; \
1082 $(evaluate-test)
1083 generated += check-execstack.out
1085 $(objpfx)tst-dlmodcount: $(libdl)
1086 $(objpfx)tst-dlmodcount.out: $(test-modules)
1088 $(all-built-dso:=.jmprel): %.jmprel: % Makefile
1089 @rm -f $@T
1090 LC_ALL=C $(READELF) -W -S -d -r $< > $@T
1091 test -s $@T
1092 mv -f $@T $@
1093 common-generated += $(all-built-dso:$(common-objpfx)%=%.jmprel)
1095 localplt-built-dso := $(addprefix $(common-objpfx),\
1096 libc.so \
1097 elf/ld.so \
1098 math/libm.so \
1099 rt/librt.so \
1100 dlfcn/libdl.so \
1101 resolv/libresolv.so \
1102 crypt/libcrypt.so \
1104 ifeq ($(build-mathvec),yes)
1105 localplt-built-dso += $(addprefix $(common-objpfx), mathvec/libmvec.so)
1106 endif
1107 ifeq ($(have-thread-library),yes)
1108 localplt-built-dso += $(filter-out %_nonshared.a, $(shared-thread-library))
1109 endif
1111 vpath localplt.data $(+sysdep_dirs)
1113 $(objpfx)check-localplt.out: $(..)scripts/check-localplt.awk \
1114 $(..)scripts/localplt.awk \
1115 $(localplt-built-dso:=.jmprel) \
1116 localplt.data
1117 LC_ALL=C $(AWK) -f $(filter-out $< %localplt.data,$^) | \
1118 LC_ALL=C $(AWK) -f $< $(filter %localplt.data,$^) - \
1119 > $@; \
1120 $(evaluate-test)
1121 endif
1123 $(objpfx)tst-dlopenrpathmod.so: $(libdl)
1124 $(objpfx)tst-dlopenrpath: $(objpfx)tst-dlopenrpathmod.so $(libdl)
1125 CFLAGS-tst-dlopenrpath.c += -DPFX=\"$(objpfx)\"
1126 LDFLAGS-tst-dlopenrpathmod.so += -Wl,-rpath,\$$ORIGIN/test-subdir
1127 $(objpfx)tst-dlopenrpath.out: $(objpfx)firstobj.so
1129 $(objpfx)tst-deep1mod2.so: $(objpfx)tst-deep1mod3.so
1130 $(objpfx)tst-deep1: $(libdl) $(objpfx)tst-deep1mod1.so
1131 $(objpfx)tst-deep1.out: $(objpfx)tst-deep1mod2.so
1132 LDFLAGS-tst-deep1 += -rdynamic
1133 tst-deep1mod3.so-no-z-defs = yes
1135 $(objpfx)tst-dlmopen1mod.so: $(libdl)
1136 $(objpfx)tst-dlmopen1: $(libdl)
1137 $(objpfx)tst-dlmopen1.out: $(objpfx)tst-dlmopen1mod.so
1139 $(objpfx)tst-dlmopen2: $(libdl)
1140 $(objpfx)tst-dlmopen2.out: $(objpfx)tst-dlmopen1mod.so
1142 $(objpfx)tst-dlmopen3: $(libdl)
1143 $(objpfx)tst-dlmopen3.out: $(objpfx)tst-dlmopen1mod.so
1145 $(objpfx)tst-audit1.out: $(objpfx)tst-auditmod1.so
1146 tst-audit1-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1148 $(objpfx)tst-audit2: $(libdl)
1149 $(objpfx)tst-audit2.out: $(objpfx)tst-auditmod1.so $(objpfx)tst-auditmod9b.so
1150 # Prevent GCC-5 from translating a malloc/memset pair into calloc
1151 CFLAGS-tst-audit2.c += -fno-builtin
1152 tst-audit2-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1154 $(objpfx)tst-audit9: $(libdl)
1155 $(objpfx)tst-audit9.out: $(objpfx)tst-auditmod9a.so $(objpfx)tst-auditmod9b.so
1156 tst-audit9-ENV = LD_AUDIT=$(objpfx)tst-auditmod9a.so
1158 $(objpfx)tst-audit8: $(libm)
1159 $(objpfx)tst-audit8.out: $(objpfx)tst-auditmod1.so
1160 tst-audit8-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1162 $(objpfx)tst-global1: $(libdl)
1163 $(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
1165 $(objpfx)order2: $(libdl)
1166 $(objpfx)order2.out: $(objpfx)order2mod1.so $(objpfx)order2mod2.so
1167 $(objpfx)order2-cmp.out: $(objpfx)order2.out
1168 (echo "12345" | cmp $< -) > $@; \
1169 $(evaluate-test)
1170 $(objpfx)order2mod1.so: $(objpfx)order2mod4.so
1171 $(objpfx)order2mod4.so: $(objpfx)order2mod3.so
1172 $(objpfx)order2mod2.so: $(objpfx)order2mod3.so
1173 order2mod2.so-no-z-defs = yes
1174 LDFLAGS-order2mod1.so = $(no-as-needed)
1175 LDFLAGS-order2mod2.so = $(no-as-needed)
1177 tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child"
1178 tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
1180 tst-ptrguard1-ARGS = --command "$(host-test-program-cmd) --child"
1181 # When built statically, the pointer guard interface uses
1182 # __pointer_chk_guard_local.
1183 CFLAGS-tst-ptrguard1-static.c = -DPTRGUARD_LOCAL
1184 tst-ptrguard1-static-ARGS = --command "$(objpfx)tst-ptrguard1-static --child"
1186 $(objpfx)tst-leaks1: $(libdl)
1187 $(objpfx)tst-leaks1-mem.out: $(objpfx)tst-leaks1.out
1188 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1.mtrace > $@; \
1189 $(evaluate-test)
1191 $(objpfx)tst-leaks1-static: $(common-objpfx)dlfcn/libdl.a
1192 $(objpfx)tst-leaks1-static-mem.out: $(objpfx)tst-leaks1-static.out
1193 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1-static.mtrace > $@; \
1194 $(evaluate-test)
1196 tst-leaks1-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1.mtrace
1197 tst-leaks1-static-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1-static.mtrace
1199 $(objpfx)tst-addr1: $(libdl)
1201 $(objpfx)tst-thrlock: $(libdl) $(shared-thread-library)
1202 $(objpfx)tst-dlopen-aout: $(libdl) $(shared-thread-library)
1204 CFLAGS-ifuncmain1pic.c += $(pic-ccflag)
1205 CFLAGS-ifuncmain1picstatic.c += $(pic-ccflag)
1206 CFLAGS-ifuncmain1staticpic.c += $(pic-ccflag)
1207 CFLAGS-ifuncdep1pic.c += $(pic-ccflag)
1208 CFLAGS-ifuncmain1vispic.c += $(pic-ccflag)
1209 CFLAGS-ifuncmain2pic.c += $(pic-ccflag)
1210 CFLAGS-ifuncmain2picstatic.c += $(pic-ccflag)
1211 CFLAGS-ifuncdep2pic.c += $(pic-ccflag)
1212 CFLAGS-ifuncmain4picstatic.c += $(pic-ccflag)
1213 CFLAGS-ifuncmain5pic.c += $(pic-ccflag)
1214 CFLAGS-ifuncmain5picstatic.c += $(pic-ccflag)
1215 CFLAGS-ifuncmain5staticpic.c += $(pic-ccflag)
1216 CFLAGS-ifuncdep5pic.c += $(pic-ccflag)
1217 CFLAGS-ifuncmain7pic.c += $(pic-ccflag)
1218 CFLAGS-ifuncmain7picstatic.c += $(pic-ccflag)
1220 LDFLAGS-ifuncmain3 = -Wl,-export-dynamic
1222 CFLAGS-ifuncmain1pie.c += $(pie-ccflag)
1223 CFLAGS-ifuncmain1vispie.c += $(pie-ccflag)
1224 CFLAGS-ifuncmain1staticpie.c += $(pie-ccflag)
1225 CFLAGS-ifuncmain5pie.c += $(pie-ccflag)
1226 CFLAGS-ifuncmain6pie.c += $(pie-ccflag)
1227 CFLAGS-ifuncmain7pie.c += $(pie-ccflag)
1229 $(objpfx)ifuncmain1pie: $(objpfx)ifuncmod1.so
1230 $(objpfx)ifuncmain1staticpie: $(objpfx)ifuncdep1pic.o
1231 $(objpfx)ifuncmain1vispie: $(objpfx)ifuncmod1.so
1232 $(objpfx)ifuncmain5pie: $(objpfx)ifuncmod5.so
1233 $(objpfx)ifuncmain6pie: $(objpfx)ifuncmod6.so
1235 $(objpfx)ifuncmain1: $(addprefix $(objpfx),ifuncmod1.so)
1236 $(objpfx)ifuncmain1pic: $(addprefix $(objpfx),ifuncmod1.so)
1237 $(objpfx)ifuncmain1staticpic: $(addprefix $(objpfx),ifuncdep1pic.o)
1238 $(objpfx)ifuncmain1static: $(addprefix $(objpfx),ifuncdep1.o)
1239 $(objpfx)ifuncmain1picstatic: $(addprefix $(objpfx),ifuncdep1pic.o)
1240 $(objpfx)ifuncmain1vis: $(addprefix $(objpfx),ifuncmod1.so)
1241 $(objpfx)ifuncmain1vispic: $(addprefix $(objpfx),ifuncmod1.so)
1242 $(objpfx)ifuncmain2: $(addprefix $(objpfx),ifuncdep2.o)
1243 $(objpfx)ifuncmain2pic: $(addprefix $(objpfx),ifuncdep2pic.o)
1244 $(objpfx)ifuncmain2static: $(addprefix $(objpfx),ifuncdep2.o)
1245 $(objpfx)ifuncmain2picstatic: $(addprefix $(objpfx),ifuncdep2pic.o)
1247 $(objpfx)ifuncmain3: $(libdl)
1248 $(objpfx)ifuncmain3.out: $(objpfx)ifuncmod3.so
1250 $(objpfx)ifuncmain5: $(addprefix $(objpfx),ifuncmod5.so)
1251 $(objpfx)ifuncmain5pic: $(addprefix $(objpfx),ifuncmod5.so)
1252 $(objpfx)ifuncmain5static: $(addprefix $(objpfx),ifuncdep5.o)
1253 $(objpfx)ifuncmain5staticpic: $(addprefix $(objpfx),ifuncdep5pic.o)
1254 $(objpfx)ifuncmain5picstatic: $(addprefix $(objpfx),ifuncdep5pic.o)
1256 $(objpfx)tst-unique1: $(libdl)
1257 $(objpfx)tst-unique1.out: $(objpfx)tst-unique1mod1.so \
1258 $(objpfx)tst-unique1mod2.so
1260 $(objpfx)tst-unique2: $(libdl) $(objpfx)tst-unique2mod1.so
1261 $(objpfx)tst-unique2.out: $(objpfx)tst-unique2mod2.so
1263 $(objpfx)tst-unique3: $(libdl) $(objpfx)tst-unique3lib.so
1264 $(objpfx)tst-unique3.out: $(objpfx)tst-unique3lib2.so
1266 $(objpfx)tst-unique4: $(objpfx)tst-unique4lib.so
1268 $(objpfx)tst-nodelete: $(libdl)
1269 $(objpfx)tst-nodelete.out: $(objpfx)tst-nodelete-uniquemod.so \
1270 $(objpfx)tst-nodelete-rtldmod.so \
1271 $(objpfx)tst-nodelete-zmod.so
1273 LDFLAGS-tst-nodelete = -rdynamic
1274 LDFLAGS-tst-nodelete-zmod.so = -Wl,--enable-new-dtags,-z,nodelete
1276 $(objpfx)tst-nodelete2: $(libdl)
1277 $(objpfx)tst-nodelete2.out: $(objpfx)tst-nodelete2mod.so
1279 LDFLAGS-tst-nodelete2 = -rdynamic
1281 $(objpfx)tst-initorder-cmp.out: tst-initorder.exp $(objpfx)tst-initorder.out
1282 cmp $^ > $@; \
1283 $(evaluate-test)
1285 $(objpfx)tst-initorder2: $(objpfx)tst-initorder2a.so $(objpfx)tst-initorder2d.so $(objpfx)tst-initorder2c.so
1286 $(objpfx)tst-initorder2a.so: $(objpfx)tst-initorder2b.so
1287 $(objpfx)tst-initorder2b.so: $(objpfx)tst-initorder2c.so
1288 $(objpfx)tst-initorder2c.so: $(objpfx)tst-initorder2d.so
1289 LDFLAGS-tst-initorder2 = $(no-as-needed)
1290 LDFLAGS-tst-initorder2a.so = $(no-as-needed)
1291 LDFLAGS-tst-initorder2b.so = $(no-as-needed)
1292 LDFLAGS-tst-initorder2c.so = $(no-as-needed)
1293 define o-iterator-doit
1294 $(objpfx)tst-initorder2$o.os: tst-initorder2.c; \
1295 $$(compile-command.c) -DNAME=\"$o\"
1296 endef
1297 object-suffixes-left := a b c d
1298 include $(o-iterator)
1300 $(objpfx)tst-initorder2-cmp.out: tst-initorder2.exp $(objpfx)tst-initorder2.out
1301 cmp $^ > $@; \
1302 $(evaluate-test)
1304 $(objpfx)tst-relsort1: $(libdl)
1305 $(objpfx)tst-relsort1mod1.so: $(libm) $(objpfx)tst-relsort1mod2.so
1306 $(objpfx)tst-relsort1mod2.so: $(libm)
1307 $(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
1308 $(objpfx)tst-relsort1mod2.so
1310 $(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so
1311 $(test-wrapper-env) \
1312 LD_TRACE_LOADED_OBJECTS=1 \
1313 LD_DEBUG=unused \
1314 LD_PRELOAD= \
1315 $(rtld-prefix) \
1316 $< > $@; \
1317 $(evaluate-test)
1319 $(objpfx)tst-unused-dep-cmp.out: $(objpfx)tst-unused-dep.out
1320 cmp $< /dev/null > $@; \
1321 $(evaluate-test)
1323 $(objpfx)tst-audit11.out: $(objpfx)tst-auditmod11.so $(objpfx)tst-audit11mod1.so
1324 $(objpfx)tst-audit11: $(libdl)
1325 tst-audit11-ENV = LD_AUDIT=$(objpfx)tst-auditmod11.so
1326 $(objpfx)tst-audit11mod1.so: $(objpfx)tst-audit11mod2.so
1327 LDFLAGS-tst-audit11mod2.so = -Wl,--version-script=tst-audit11mod2.map,-soname,tst-audit11mod2.so
1329 $(objpfx)tst-audit12.out: $(objpfx)tst-auditmod12.so $(objpfx)tst-audit12mod1.so $(objpfx)tst-audit12mod3.so
1330 $(objpfx)tst-audit12: $(libdl)
1331 tst-audit12-ENV = LD_AUDIT=$(objpfx)tst-auditmod12.so
1332 $(objpfx)tst-audit12mod1.so: $(objpfx)tst-audit12mod2.so
1333 LDFLAGS-tst-audit12mod2.so = -Wl,--version-script=tst-audit12mod2.map
1335 # Override -z defs, so that we can reference an undefined symbol.
1336 # Force lazy binding for the same reason.
1337 LDFLAGS-tst-latepthreadmod.so = \
1338 -Wl,-z,lazy -Wl,--unresolved-symbols=ignore-all
1339 # Do not optimize sibling calls as the test relies on a JMP_SLOT relocation for
1340 # function this_function_is_not_defined.
1341 CFLAGS-tst-latepthreadmod.c = -fno-optimize-sibling-calls
1342 $(objpfx)tst-latepthreadmod.so: $(shared-thread-library)
1343 $(objpfx)tst-latepthread: $(libdl)
1344 $(objpfx)tst-latepthread.out: $(objpfx)tst-latepthreadmod.so
1346 # The test modules are parameterized by preprocessor macros.
1347 $(patsubst %,$(objpfx)%.os,$(tst-tls-many-dynamic-modules)): \
1348 $(objpfx)tst-tls-manydynamic%mod.os : tst-tls-manydynamicmod.c
1349 $(compile-command.c) \
1350 -DNAME=tls_global_$* -DSETTER=set_value_$* -DGETTER=get_value_$*
1351 $(objpfx)tst-tls-manydynamic: $(libdl) $(shared-thread-library)
1352 $(objpfx)tst-tls-manydynamic.out: \
1353 $(patsubst %,$(objpfx)%.so,$(tst-tls-many-dynamic-modules))
1355 tst-prelink-ENV = LD_TRACE_PRELINKING=1
1357 $(objpfx)tst-prelink-conflict.out: $(objpfx)tst-prelink.out
1358 grep stdout $< | grep conflict | $(AWK) '{ print $$10, $$11 }' > $@
1360 $(objpfx)tst-prelink-cmp.out: tst-prelink.exp \
1361 $(objpfx)tst-prelink-conflict.out
1362 cmp $^ > $@; \
1363 $(evaluate-test)
1365 $(objpfx)tst-ldconfig-X.out : tst-ldconfig-X.sh $(objpfx)ldconfig
1366 $(SHELL) $< '$(common-objpfx)' '$(test-wrapper-env)' \
1367 '$(run-program-env)' > $@; \
1368 $(evaluate-test)
1370 $(objpfx)tst-dlsym-error: $(libdl)
1372 # Test static linking of all the libraries we can possibly link
1373 # together. Note that in some configurations this may be less than the
1374 # complete list of libraries we build but we try to maxmimize this list.
1375 $(objpfx)tst-linkall-static: \
1376 $(common-objpfx)math/libm.a \
1377 $(common-objpfx)resolv/libresolv.a \
1378 $(common-objpfx)dlfcn/libdl.a \
1379 $(common-objpfx)login/libutil.a \
1380 $(common-objpfx)rt/librt.a \
1381 $(common-objpfx)resolv/libanl.a \
1382 $(static-thread-library)
1384 # If we are using NSS crypto and we have the ability to link statically
1385 # then we include libcrypt.a, otherwise we leave out libcrypt.a and
1386 # link as much as we can into the tst-linkall-static test. This assumes
1387 # that linking with libcrypt.a does everything required to include the
1388 # static NSS crypto library.
1389 ifeq (yesyes,$(nss-crypt)$(static-nss-crypt))
1390 $(objpfx)tst-linkall-static: \
1391 $(common-objpfx)crypt/libcrypt.a
1392 endif
1393 # If we are not using NSS crypto then we always have the ability to link
1394 # with libcrypt.a.
1395 ifeq (no,$(nss-crypt))
1396 $(objpfx)tst-linkall-static: \
1397 $(common-objpfx)crypt/libcrypt.a
1398 endif
1400 # The application depends on the DSO, and the DSO loads the plugin.
1401 # The plugin also depends on the DSO. This creates the circular
1402 # dependency via dlopen that we're testing to make sure works.
1403 $(objpfx)tst-nodelete-dlclose-dso.so: $(libdl)
1404 $(objpfx)tst-nodelete-dlclose-plugin.so: $(objpfx)tst-nodelete-dlclose-dso.so
1405 $(objpfx)tst-nodelete-dlclose: $(objpfx)tst-nodelete-dlclose-dso.so
1406 $(objpfx)tst-nodelete-dlclose.out: $(objpfx)tst-nodelete-dlclose-dso.so \
1407 $(objpfx)tst-nodelete-dlclose-plugin.so
1409 tst-env-setuid-ENV = MALLOC_CHECK_=2 MALLOC_MMAP_THRESHOLD_=4096 \
1410 LD_HWCAP_MASK=0x1
1411 tst-env-setuid-tunables-ENV = \
1412 GLIBC_TUNABLES=glibc.malloc.check=2:glibc.malloc.mmap_threshold=4096