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