Mark internal netlink functions with attribute_hidden [BZ #18822]
[glibc.git] / elf / Makefile
blobc6edebd4ee2df033811728f3d25d8d33ce1c25eb
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 \
153 tst-tls1-static-non-pie
155 LDFLAGS-tst-tls1-static-non-pie = $(no-pie-ldflag)
157 tests := tst-tls9 tst-leaks1 \
158 tst-array1 tst-array2 tst-array3 tst-array4 tst-array5 \
159 tst-auxv
160 tests-internal := tst-tls1 tst-tls2 $(tests-static-internal)
161 tests-static := $(tests-static-normal) $(tests-static-internal)
163 ifeq (yes,$(build-shared))
164 tests-static += tst-tls9-static
165 tst-tls9-static-ENV = \
166 LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn
168 tests += restest1 preloadtest loadfail multiload origtest resolvfail \
169 constload1 order noload filter \
170 reldep reldep2 reldep3 reldep4 nodelete nodelete2 \
171 nodlopen nodlopen2 lateglobal initfirst global \
172 restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
173 tst-tls4 tst-tls5 \
174 tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-tls15 \
175 tst-tls16 tst-tls17 tst-tls18 tst-tls19 tst-tls-dlinfo \
176 tst-align tst-align2 $(tests-execstack-$(have-z-execstack)) \
177 tst-dlmodcount tst-dlopenrpath tst-deep1 \
178 tst-dlmopen1 tst-dlmopen3 \
179 unload3 unload4 unload5 unload6 unload7 unload8 tst-global1 order2 \
180 tst-audit1 tst-audit2 tst-audit8 tst-audit9 \
181 tst-addr1 tst-thrlock \
182 tst-unique1 tst-unique2 $(if $(CXX),tst-unique3 tst-unique4 \
183 tst-nodelete) \
184 tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \
185 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
186 tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error tst-noload \
187 tst-latepthread tst-tls-manydynamic tst-nodelete-dlclose \
188 tst-debug1
189 # reldep9
190 tests-internal += loadtest unload unload2 circleload1 \
191 neededtest neededtest2 neededtest3 neededtest4 \
192 tst-tls3 tst-tls6 tst-tls7 tst-tls8 tst-dlmopen2 \
193 tst-ptrguard1 tst-stackguard1
194 ifeq ($(build-hardcoded-path-in-tests),yes)
195 tests += tst-dlopen-aout
196 LDFLAGS-tst-dlopen-aout = $(no-pie-ldflag)
197 endif
198 test-srcs = tst-pathopt
199 selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
200 ifneq ($(selinux-enabled),1)
201 tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
202 endif
203 endif
204 ifeq ($(run-built-tests),yes)
205 tests-special += $(objpfx)tst-leaks1-mem.out \
206 $(objpfx)tst-leaks1-static-mem.out $(objpfx)noload-mem.out \
207 $(objpfx)tst-ldconfig-X.out
208 endif
209 tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
210 tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
211 tlsmod17a-modules = $(addprefix tst-tlsmod17a, $(tlsmod17a-suffixes))
212 tlsmod18a-modules = $(addprefix tst-tlsmod18a, $(tlsmod17a-suffixes))
213 one-hundred = $(foreach x,0 1 2 3 4 5 6 7 8 9, \
214 0$x 1$x 2$x 3$x 4$x 5$x 6$x 7$x 8$x 9$x)
215 tst-tls-many-dynamic-modules := \
216 $(foreach n,$(one-hundred),tst-tls-manydynamic$(n)mod)
217 extra-test-objs += $(tlsmod17a-modules:=.os) $(tlsmod18a-modules:=.os) \
218 tst-tlsalign-vars.o
219 test-extras += tst-tlsmod17a tst-tlsmod18a tst-tlsalign-vars
220 modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
221 testobj1_1 failobj constload2 constload3 unloadmod \
222 dep1 dep2 dep3 dep4 vismod1 vismod2 vismod3 \
223 nodelmod1 nodelmod2 nodelmod3 nodelmod4 \
224 nodel2mod1 nodel2mod2 nodel2mod3 \
225 nodlopenmod nodlopenmod2 filtmod1 filtmod2 \
226 reldepmod1 reldepmod2 reldepmod3 reldepmod4 nextmod1 nextmod2 \
227 reldep4mod1 reldep4mod2 reldep4mod3 reldep4mod4 \
228 neededobj1 neededobj2 neededobj3 neededobj4 \
229 neededobj5 neededobj6 firstobj globalmod1 \
230 unload2mod unload2dep ltglobmod1 ltglobmod2 pathoptobj \
231 dblloadmod1 dblloadmod2 dblloadmod3 reldepmod5 reldepmod6 \
232 reldep6mod0 reldep6mod1 reldep6mod2 reldep6mod3 reldep6mod4 \
233 reldep7mod1 reldep7mod2 \
234 tst-tlsmod1 tst-tlsmod2 tst-tlsmod3 tst-tlsmod4 \
235 tst-tlsmod5 tst-tlsmod6 tst-tlsmod7 tst-tlsmod8 \
236 tst-tlsmod9 tst-tlsmod10 tst-tlsmod11 tst-tlsmod12 \
237 tst-tlsmod13 tst-tlsmod13a tst-tlsmod14a tst-tlsmod14b \
238 tst-tlsmod15a tst-tlsmod15b tst-tlsmod16a tst-tlsmod16b \
239 $(tlsmod17a-modules) tst-tlsmod17b $(tlsmod18a-modules) \
240 tst-tls19mod1 tst-tls19mod2 tst-tls19mod3 \
241 circlemod1 circlemod1a circlemod2 circlemod2a \
242 circlemod3 circlemod3a \
243 reldep8mod1 reldep8mod2 reldep8mod3 \
244 reldep9mod1 reldep9mod2 reldep9mod3 \
245 tst-alignmod tst-alignmod2 \
246 $(modules-execstack-$(have-z-execstack)) \
247 tst-dlopenrpathmod tst-deep1mod1 tst-deep1mod2 tst-deep1mod3 \
248 tst-dlmopen1mod tst-auditmod1 \
249 unload3mod1 unload3mod2 unload3mod3 unload3mod4 \
250 unload4mod1 unload4mod2 unload4mod3 unload4mod4 \
251 unload6mod1 unload6mod2 unload6mod3 \
252 unload7mod1 unload7mod2 \
253 unload8mod1 unload8mod1x unload8mod2 unload8mod3 \
254 order2mod1 order2mod2 order2mod3 order2mod4 \
255 tst-unique1mod1 tst-unique1mod2 \
256 tst-unique2mod1 tst-unique2mod2 \
257 tst-auditmod9a tst-auditmod9b \
258 $(if $(CXX),tst-unique3lib tst-unique3lib2 tst-unique4lib \
259 tst-nodelete-uniquemod tst-nodelete-rtldmod \
260 tst-nodelete-zmod) \
261 tst-initordera1 tst-initorderb1 \
262 tst-initordera2 tst-initorderb2 \
263 tst-initordera3 tst-initordera4 \
264 tst-initorder2a tst-initorder2b tst-initorder2c \
265 tst-initorder2d \
266 tst-relsort1mod1 tst-relsort1mod2 tst-array2dep \
267 tst-array5dep tst-null-argv-lib \
268 tst-tlsalign-lib tst-nodelete-opened-lib tst-nodelete2mod \
269 tst-audit11mod1 tst-audit11mod2 tst-auditmod11 \
270 tst-audit12mod1 tst-audit12mod2 tst-audit12mod3 tst-auditmod12 \
271 tst-latepthreadmod $(tst-tls-many-dynamic-modules) \
272 tst-nodelete-dlclose-dso tst-nodelete-dlclose-plugin
273 ifeq (yes,$(have-mtls-dialect-gnu2))
274 tests += tst-gnu2-tls1
275 modules-names += tst-gnu2-tls1mod
276 $(objpfx)tst-gnu2-tls1: $(objpfx)tst-gnu2-tls1mod.so
277 tst-gnu2-tls1mod.so-no-z-defs = yes
278 CFLAGS-tst-gnu2-tls1mod.c += -mtls-dialect=gnu2
279 endif
280 ifeq (yes,$(have-protected-data))
281 modules-names += tst-protected1moda tst-protected1modb
282 tests += tst-protected1a tst-protected1b
283 $(objpfx)tst-protected1a: $(addprefix $(objpfx),tst-protected1moda.so tst-protected1modb.so)
284 $(objpfx)tst-protected1b: $(addprefix $(objpfx),tst-protected1modb.so tst-protected1moda.so)
285 tst-protected1modb.so-no-z-defs = yes
286 # These tests fail with GCC versions prior to 5.1 and with some versions
287 # of binutils. See https://sourceware.org/bugzilla/show_bug.cgi?id=17709
288 # and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248 for details.
289 # Perhaps in future we can make these XFAILs conditional on some detection
290 # of compiler/linker behavior/version.
291 test-xfail-tst-protected1a = yes
292 test-xfail-tst-protected1b = yes
293 endif
294 ifeq (yesyes,$(have-fpie)$(build-shared))
295 modules-names += tst-piemod1
296 tests += tst-pie1 tst-pie2
297 tests-pie += tst-pie1 tst-pie2
298 ifeq (yes,$(have-protected-data))
299 tests += vismain
300 tests-pie += vismain
301 CFLAGS-vismain.c = $(PIE-ccflag)
302 endif
303 endif
304 modules-execstack-yes = tst-execstack-mod
305 extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
307 # filtmod1.so has a special rule
308 modules-names-nobuild := filtmod1
310 tests += $(tests-static)
312 ifneq (no,$(multi-arch))
313 tests-ifuncstatic := ifuncmain1static ifuncmain1picstatic \
314 ifuncmain2static ifuncmain2picstatic \
315 ifuncmain4static ifuncmain4picstatic \
316 ifuncmain5static ifuncmain5picstatic \
317 ifuncmain7static ifuncmain7picstatic
318 tests-static += $(tests-ifuncstatic)
319 tests-internal += $(tests-ifuncstatic)
320 ifeq (yes,$(build-shared))
321 tests-internal += \
322 ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \
323 ifuncmain1staticpic \
324 ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \
325 ifuncmain5 ifuncmain5pic ifuncmain5staticpic \
326 ifuncmain7 ifuncmain7pic
327 ifunc-test-modules = ifuncdep1 ifuncdep1pic ifuncdep2 ifuncdep2pic \
328 ifuncdep5 ifuncdep5pic
329 extra-test-objs += $(ifunc-test-modules:=.o)
330 test-internal-extras += $(ifunc-test-modules)
331 ifeq (yes,$(have-fpie))
332 ifunc-pie-tests = ifuncmain1pie ifuncmain1vispie ifuncmain1staticpie \
333 ifuncmain5pie ifuncmain6pie ifuncmain7pie
334 tests-internal += $(ifunc-pie-tests)
335 tests-pie += $(ifunc-pie-tests)
336 endif
337 modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6
338 endif
339 endif
341 ifeq (yes,$(build-shared))
342 ifeq ($(run-built-tests),yes)
343 tests-special += $(objpfx)tst-pathopt.out $(objpfx)tst-rtld-load-self.out
344 endif
345 tests-special += $(objpfx)check-textrel.out $(objpfx)check-execstack.out \
346 $(objpfx)check-localplt.out
347 endif
349 ifeq ($(run-built-tests),yes)
350 tests-special += $(objpfx)order-cmp.out $(objpfx)tst-array1-cmp.out \
351 $(objpfx)tst-array1-static-cmp.out \
352 $(objpfx)tst-array2-cmp.out $(objpfx)tst-array3-cmp.out \
353 $(objpfx)tst-array4-cmp.out $(objpfx)tst-array5-cmp.out \
354 $(objpfx)tst-array5-static-cmp.out $(objpfx)order2-cmp.out \
355 $(objpfx)tst-initorder-cmp.out \
356 $(objpfx)tst-initorder2-cmp.out $(objpfx)tst-unused-dep.out \
357 $(objpfx)tst-unused-dep-cmp.out
358 endif
360 check-abi: $(objpfx)check-abi-ld.out
361 tests-special += $(objpfx)check-abi-ld.out
362 update-abi: update-abi-ld
363 update-all-abi: update-all-abi-ld
365 ifeq ($(have-glob-dat-reloc),yes)
366 tests += tst-prelink
367 # Don't compile tst-prelink.c with PIE for GLOB_DAT relocation.
368 CFLAGS-tst-prelink.c += -fno-pie
369 LDFLAGS-tst-prelink = $(no-pie-ldflag)
370 ifeq ($(run-built-tests),yes)
371 tests-special += $(objpfx)tst-prelink-cmp.out
372 endif
373 endif
375 # The test requires shared _and_ PIE because the executable
376 # unit test driver must be able to link with the shared object
377 # that is going to eventually go into an installed DSO.
378 ifeq (yesyes,$(have-fpie)$(build-shared))
379 tests-internal += tst-_dl_addr_inside_object
380 tests-pie += tst-_dl_addr_inside_object
381 $(objpfx)tst-_dl_addr_inside_object: $(objpfx)dl-addr-obj.os
382 CFLAGS-tst-_dl_addr_inside_object.c += $(PIE-ccflag)
383 endif
385 # By default tst-linkall-static should try to use crypt routines to test
386 # static libcrypt use.
387 CFLAGS-tst-linkall-static.c = -DUSE_CRYPT=1
388 # However, if we are using NSS crypto and we don't have a static
389 # library, then we exclude the use of crypt functions in the test.
390 # We similarly exclude libcrypt.a from the static link (see below).
391 ifeq (yesno,$(nss-crypt)$(static-nss-crypt))
392 CFLAGS-tst-linkall-static.c = -DUSE_CRYPT=0
393 endif
395 include ../Rules
397 ifeq (yes,$(build-shared))
398 # Make sure these things are built in the `make lib' pass so they can be used
399 # to run programs during the `make others' pass.
400 lib-noranlib: $(objpfx)$(rtld-installed-name) \
401 $(addprefix $(objpfx),$(extra-objs))
402 endif
404 # Command to link into a larger single relocatable object.
405 reloc-link = $(LINK.o) -nostdlib -nostartfiles -r
407 $(objpfx)sotruss-lib.so: $(shlib-lds)
409 $(objpfx)dl-allobjs.os: $(all-rtld-routines:%=$(objpfx)%.os)
410 $(reloc-link) -o $@ $^
412 # Link together the dynamic linker into a single relocatable object.
413 # First we do a link against libc_pic.a just to get a link map,
414 # and discard the object produced by that link. From the link map
415 # we can glean all the libc modules that need to go into the dynamic
416 # linker. Then we do a recursive make that goes into all the subdirs
417 # those modules come from and builds special rtld-foo.os versions that
418 # are compiled with special flags, and puts these modules into rtld-libc.a
419 # for us. Then we do the real link using rtld-libc.a instead of libc_pic.a.
421 # If the compiler can do SSP, build the mapfile with dummy __stack_chk_fail
422 # and __stack_chk_fail_local symbols defined, to prevent the real things
423 # being dragged into rtld even though rtld is never built with stack-
424 # protection.
426 ifeq ($(have-ssp),yes)
427 dummy-stack-chk-fail := -Wl,--defsym='__stack_chk_fail=0' \
428 -Wl,--defsym='__stack_chk_fail_local=0'
429 else
430 dummy-stack-chk-fail :=
431 endif
433 $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
434 @-rm -f $@T
435 $(reloc-link) -o $@.o $(dummy-stack-chk-fail) \
436 '-Wl,-(' $^ -lgcc '-Wl,-)' -Wl,-Map,$@T
437 rm -f $@.o
438 mv -f $@T $@
440 $(objpfx)librtld.mk: $(objpfx)librtld.map Makefile
441 LC_ALL=C \
442 sed -n 's@^$(common-objpfx)\([^(]*\)(\([^)]*\.os\)) *.*$$@\1 \2@p' \
443 $< | \
444 while read lib file; do \
445 case $$lib in \
446 libc_pic.a) \
447 LC_ALL=C fgrep -l /$$file \
448 $(common-objpfx)stamp.os $(common-objpfx)*/stamp.os | \
449 LC_ALL=C \
450 sed 's@^$(common-objpfx)\([^/]*\)/stamp\.os$$@rtld-\1'" +=$$file@"\
451 ;; \
452 */*.a) \
453 echo rtld-$${lib%%/*} += $$file ;; \
454 *) echo "Wasn't expecting $$lib($$file)" >&2; exit 1 ;; \
455 esac; \
456 done > $@T
457 echo rtld-subdirs = `LC_ALL=C sed 's/^rtld-\([^ ]*\).*$$/\1/' $@T \
458 | LC_ALL=C sort -u` >> $@T
459 mv -f $@T $@
461 $(objpfx)rtld-libc.a: $(objpfx)librtld.mk FORCE
462 $(MAKE) -f $< -f rtld-Rules
464 $(objpfx)librtld.os: $(objpfx)dl-allobjs.os $(objpfx)rtld-libc.a
465 $(LINK.o) -nostdlib -nostartfiles -r -o $@ '-Wl,-(' $^ -lgcc '-Wl,-)' \
466 -Wl,-Map,$@.map
468 generated += librtld.map librtld.mk rtld-libc.a librtld.os.map
470 z-now-yes = -Wl,-z,now
472 $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
473 # Link into a temporary file so that we don't touch $@ at all
474 # if the sanity check below fails.
475 $(LINK.o) -nostdlib -nostartfiles -shared -o $@.new \
476 $(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \
477 $(filter-out $(map-file),$^) $(load-map-file) \
478 -Wl,-soname=$(rtld-installed-name) \
479 -Wl,-defsym=_begin=0
480 $(call after-link,$@.new)
481 $(READELF) -s $@.new \
482 | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
483 mv -f $@.new $@
485 ifeq (yes,$(build-shared))
486 # interp.c exists just to get the runtime linker path into libc.so.
487 $(objpfx)interp.os: $(common-objpfx)runtime-linker.h
488 endif
490 ifneq (ld.so,$(rtld-installed-name))
491 # Make sure ld.so.1 exists in the build directory so we can link
492 # against it.
493 $(objpfx)$(rtld-installed-name): $(objpfx)ld.so
494 $(make-link)
495 generated += $(rtld-installed-name)
496 endif
498 # Build a file mentioning all trustworthy directories to look for shared
499 # libraries when using LD_LIBRARY_PATH in a setuid program. The user can
500 # add directories to the list by defining $(user-defined-trusted-dirs)
501 # before starting make.
502 $(objpfx)trusted-dirs.h: $(objpfx)trusted-dirs.st; @:
503 $(objpfx)trusted-dirs.st: Makefile $(..)Makeconfig
504 $(make-target-directory)
505 echo "$(subst :, ,$(default-rpath) $(user-defined-trusted-dirs))" \
506 | $(AWK) -f gen-trusted-dirs.awk > ${@:st=T};
507 echo '#define DL_DST_LIB "$(notdir $(slibdir))"' >> ${@:st=T}
508 $(move-if-change) ${@:st=T} ${@:st=h}
509 touch $@
510 CPPFLAGS-dl-load.c = -I$(objpfx). -I$(csu-objpfx).
512 ifeq (yes,$(build-shared))
513 $(inst_slibdir)/$(rtld-version-installed-name): $(objpfx)ld.so $(+force)
514 $(make-target-directory)
515 $(do-install-program)
517 $(inst_rtlddir)/$(rtld-installed-name): \
518 $(inst_slibdir)/$(rtld-version-installed-name) \
519 $(inst_slibdir)/libc-$(version).so
520 $(make-target-directory)
521 $(make-shlib-link)
523 # Special target called by parent to install just the dynamic linker.
524 .PHONY: ldso_install
525 ldso_install: $(inst_rtlddir)/$(rtld-installed-name)
526 endif
529 ldd-rewrite = -e 's%@RTLD@%$(rtlddir)/$(rtld-installed-name)%g' \
530 -e 's%@VERSION@%$(version)%g' \
531 -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
532 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' \
533 -e 's%@BASH@%$(BASH)%g' \
534 -e 's%@TEXTDOMAINDIR@%$(localedir)%g'
536 ifeq ($(ldd-rewrite-script),no)
537 define gen-ldd
538 LC_ALL=C sed $(ldd-rewrite) < $< > $@.new
539 endef
540 else
541 define gen-ldd
542 LC_ALL=C sed $(ldd-rewrite) < $< \
543 | LC_ALL=C sed -f $(patsubst $(..)/%,/%,$(..)$(ldd-rewrite-script)) > $@.new
544 endef
545 endif
547 $(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \
548 $(common-objpfx)config.make
549 $(gen-ldd)
550 chmod 555 $@.new
551 mv -f $@.new $@
553 $(objpfx)sprof: $(libdl)
555 $(objpfx)sln: $(sln-modules:%=$(objpfx)%.o)
557 $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
559 SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
560 CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
561 -D'SLIBDIR="$(slibdir)"'
562 libof-ldconfig = ldconfig
563 CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
564 CFLAGS-cache.c = $(SYSCONF-FLAGS)
565 CFLAGS-rtld.c = $(SYSCONF-FLAGS)
567 cpp-srcs-left := $(all-rtld-routines:=.os)
568 lib := rtld
569 include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
571 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
572 generated += $(addsuffix .so,$(strip $(modules-names)))
574 $(objpfx)testobj1.so: $(libdl)
575 $(objpfx)testobj1_1.so: $(objpfx)testobj1.so $(libdl)
576 $(objpfx)testobj2.so: $(objpfx)testobj1.so $(libdl)
577 $(objpfx)testobj3.so: $(libdl)
578 $(objpfx)testobj4.so: $(libdl)
579 $(objpfx)testobj5.so: $(libdl)
580 $(objpfx)testobj6.so: $(objpfx)testobj1.so $(objpfx)testobj2.so $(libdl)
581 $(objpfx)failobj.so: $(objpfx)testobj6.so
582 $(objpfx)dep1.so: $(objpfx)dep2.so $(objpfx)dep4.so
583 $(objpfx)dep2.so: $(objpfx)dep3.so $(objpfx)dep4.so
584 $(objpfx)dep4.so: $(objpfx)dep3.so
585 $(objpfx)nodelmod3.so: $(objpfx)nodelmod4.so
586 $(objpfx)nextmod1.so: $(libdl)
587 $(objpfx)neededobj1.so: $(libdl)
588 $(objpfx)neededobj2.so: $(objpfx)neededobj1.so $(libdl)
589 $(objpfx)neededobj3.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so $(libdl)
590 $(objpfx)neededobj4.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
591 $(objpfx)neededobj3.so $(libdl)
592 $(objpfx)neededobj6.so: $(objpfx)neededobj5.so
593 $(objpfx)unload2mod.so: $(objpfx)unload2dep.so
594 $(objpfx)ltglobmod2.so: $(libdl)
595 $(objpfx)firstobj.so: $(shared-thread-library)
596 $(objpfx)globalmod1.so: $(libdl)
597 $(objpfx)reldep4mod1.so: $(objpfx)reldep4mod3.so
598 $(objpfx)reldep4mod2.so: $(objpfx)reldep4mod4.so
599 $(objpfx)dblloadmod1.so: $(objpfx)dblloadmod3.so
600 $(objpfx)dblloadmod2.so: $(objpfx)dblloadmod3.so
601 $(objpfx)reldepmod5.so: $(objpfx)reldepmod2.so
602 $(objpfx)reldepmod6.so: $(objpfx)reldepmod2.so
603 $(objpfx)reldep6mod1.so: $(objpfx)reldep6mod0.so
604 $(objpfx)reldep6mod2.so: $(objpfx)reldep6mod1.so
605 $(objpfx)reldep6mod3.so: $(objpfx)reldep6mod2.so
606 $(objpfx)reldep6mod4.so: $(objpfx)reldep6mod1.so
607 $(objpfx)tst-tlsmod3.so: $(objpfx)tst-tlsmod2.so
608 $(objpfx)tst-tlsmod8.so: $(objpfx)tst-tlsmod7.so
609 $(objpfx)tst-tlsmod10.so: $(objpfx)tst-tlsmod9.so
610 $(objpfx)tst-tlsmod12.so: $(objpfx)tst-tlsmod11.so
611 $(objpfx)tst-tlsmod13a.so: $(objpfx)tst-tlsmod13.so
612 # For tst-tls9-static, make sure the modules it dlopens have libc.so in DT_NEEDED
613 $(objpfx)tst-tlsmod5.so: $(common-objpfx)libc.so
614 $(objpfx)tst-tlsmod6.so: $(common-objpfx)libc.so
615 $(objpfx)tst-tls19mod1.so: $(objpfx)tst-tls19mod2.so $(objpfx)tst-tls19mod3.so
616 $(objpfx)tst-tls19mod3.so: $(objpfx)ld.so
617 $(objpfx)reldep8mod3.so: $(objpfx)reldep8mod1.so $(objpfx)reldep8mod2.so
618 $(objpfx)nodel2mod3.so: $(objpfx)nodel2mod1.so $(objpfx)nodel2mod2.so
619 $(objpfx)reldep9mod2.so: $(objpfx)reldep9mod1.so
620 $(objpfx)reldep9mod3.so: $(objpfx)reldep9mod1.so $(objpfx)reldep9mod2.so
621 $(objpfx)unload3mod1.so: $(objpfx)unload3mod3.so
622 $(objpfx)unload3mod2.so: $(objpfx)unload3mod3.so
623 $(objpfx)unload3mod3.so: $(objpfx)unload3mod4.so
624 $(objpfx)unload4mod1.so: $(objpfx)unload4mod2.so $(objpfx)unload4mod3.so
625 $(objpfx)unload4mod2.so: $(objpfx)unload4mod4.so $(objpfx)unload4mod3.so
626 $(objpfx)unload6mod1.so: $(libdl)
627 $(objpfx)unload6mod2.so: $(libdl)
628 $(objpfx)unload6mod3.so: $(libdl)
629 $(objpfx)unload7mod1.so: $(libdl)
630 $(objpfx)unload7mod2.so: $(objpfx)unload7mod1.so
631 $(objpfx)unload8mod1.so: $(objpfx)unload8mod2.so
632 $(objpfx)unload8mod2.so: $(objpfx)unload8mod3.so
633 $(objpfx)unload8mod3.so: $(libdl)
634 $(objpfx)tst-initordera2.so: $(objpfx)tst-initordera1.so
635 $(objpfx)tst-initorderb2.so: $(objpfx)tst-initorderb1.so $(objpfx)tst-initordera2.so
636 $(objpfx)tst-initordera3.so: $(objpfx)tst-initorderb2.so $(objpfx)tst-initorderb1.so
637 $(objpfx)tst-initordera4.so: $(objpfx)tst-initordera3.so
638 $(objpfx)tst-initorder: $(objpfx)tst-initordera4.so $(objpfx)tst-initordera1.so $(objpfx)tst-initorderb2.so
639 $(objpfx)tst-null-argv: $(objpfx)tst-null-argv-lib.so
640 $(objpfx)tst-tlsalign: $(objpfx)tst-tlsalign-lib.so
641 $(objpfx)tst-nodelete-opened.out: $(objpfx)tst-nodelete-opened-lib.so
642 $(objpfx)tst-nodelete-opened: $(libdl)
643 $(objpfx)tst-noload: $(libdl)
645 $(objpfx)tst-tlsalign-extern: $(objpfx)tst-tlsalign-vars.o
646 $(objpfx)tst-tlsalign-extern-static: $(objpfx)tst-tlsalign-vars.o
648 tst-null-argv-ENV = LD_DEBUG=all LD_DEBUG_OUTPUT=$(objpfx)tst-null-argv.debug.out
649 LDFLAGS-nodel2mod3.so = $(no-as-needed)
650 LDFLAGS-reldepmod5.so = $(no-as-needed)
651 LDFLAGS-reldep6mod1.so = $(no-as-needed)
652 LDFLAGS-reldep6mod4.so = $(no-as-needed)
653 LDFLAGS-reldep8mod3.so = $(no-as-needed)
654 LDFLAGS-unload4mod1.so = $(no-as-needed)
655 LDFLAGS-unload4mod2.so = $(no-as-needed)
656 LDFLAGS-tst-initorder = $(no-as-needed)
657 LDFLAGS-tst-initordera2.so = $(no-as-needed)
658 LDFLAGS-tst-initordera3.so = $(no-as-needed)
659 LDFLAGS-tst-initordera4.so = $(no-as-needed)
660 LDFLAGS-tst-initorderb2.so = $(no-as-needed)
661 LDFLAGS-tst-tlsmod5.so = -nostdlib $(no-as-needed)
662 LDFLAGS-tst-tlsmod6.so = -nostdlib $(no-as-needed)
664 testobj1.so-no-z-defs = yes
665 testobj3.so-no-z-defs = yes
666 testobj4.so-no-z-defs = yes
667 testobj5.so-no-z-defs = yes
668 testobj6.so-no-z-defs = yes
669 failobj.so-no-z-defs = yes
670 constload2.so-no-z-defs = yes
671 constload3.so-no-z-defs = yes
672 nodelmod1.so-no-z-defs = yes
673 nodelmod2.so-no-z-defs = yes
674 nodelmod4.so-no-z-defs = yes
675 nodel2mod2.so-no-z-defs = yes
676 reldepmod2.so-no-z-defs = yes
677 reldepmod3.so-no-z-defs = yes
678 reldepmod4.so-no-z-defs = yes
679 reldep4mod4.so-no-z-defs = yes
680 reldep4mod2.so-no-z-defs = yes
681 ltglobmod2.so-no-z-defs = yes
682 dblloadmod3.so-no-z-defs = yes
683 tst-tlsmod1.so-no-z-defs = yes
684 tst-tlsmod2.so-no-z-defs = yes
685 tst-tlsmod3.so-no-z-defs = yes
686 tst-tlsmod4.so-no-z-defs = yes
687 tst-tlsmod7.so-no-z-defs = yes
688 tst-tlsmod8.so-no-z-defs = yes
689 tst-tlsmod9.so-no-z-defs = yes
690 tst-tlsmod10.so-no-z-defs = yes
691 tst-tlsmod12.so-no-z-defs = yes
692 tst-tlsmod14a.so-no-z-defs = yes
693 tst-tlsmod14b.so-no-z-defs = yes
694 tst-tlsmod15a.so-no-z-defs = yes
695 tst-tlsmod16b.so-no-z-defs = yes
696 circlemod2.so-no-z-defs = yes
697 circlemod3.so-no-z-defs = yes
698 circlemod3a.so-no-z-defs = yes
699 reldep8mod2.so-no-z-defs = yes
700 reldep9mod1.so-no-z-defs = yes
701 unload3mod4.so-no-z-defs = yes
702 unload4mod1.so-no-z-defs = yes
703 ifuncmod1.so-no-z-defs = yes
704 ifuncmod5.so-no-z-defs = yes
705 ifuncmod6.so-no-z-defs = yes
706 tst-auditmod9a.so-no-z-defs = yes
707 tst-auditmod9b.so-no-z-defs = yes
708 tst-nodelete-uniquemod.so-no-z-defs = yes
709 tst-nodelete-rtldmod.so-no-z-defs = yes
710 tst-nodelete-zmod.so-no-z-defs = yes
711 tst-nodelete2mod.so-no-z-defs = yes
713 ifeq ($(build-shared),yes)
714 # Build all the modules even when not actually running test programs.
715 tests: $(test-modules)
716 endif
718 $(objpfx)loadtest: $(libdl)
719 LDFLAGS-loadtest = -rdynamic
721 $(objpfx)loadtest.out: $(test-modules)
723 $(objpfx)neededtest: $(libdl)
724 $(objpfx)neededtest.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
725 $(objpfx)neededobj3.so
727 $(objpfx)neededtest2: $(libdl)
728 $(objpfx)neededtest2.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
729 $(objpfx)neededobj3.so
731 $(objpfx)neededtest3: $(libdl)
732 $(objpfx)neededtest3.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
733 $(objpfx)neededobj3.so $(objpfx)neededobj4.so
735 $(objpfx)neededtest4: $(libdl) $(objpfx)neededobj1.so
736 $(objpfx)neededtest4.out: $(objpfx)neededobj5.so $(objpfx)neededobj6.so
738 $(objpfx)restest1: $(objpfx)testobj1.so $(objpfx)testobj1_1.so $(libdl)
739 LDFLAGS-restest1 = -rdynamic
741 $(objpfx)restest2: $(libdl)
742 LDFLAGS-restest2 = -rdynamic
744 $(objpfx)restest1.out: $(test-modules)
746 preloadtest-preloads = testobj1 testobj2 testobj3 testobj4 testobj5
747 $(objpfx)preloadtest: $(objpfx)testobj6.so
748 LDFLAGS-preloadtest = -rdynamic
749 $(objpfx)preloadtest.out: $(preloadtest-preloads:%=$(objpfx)%.so)
750 preloadtest-ENV = \
751 LD_PRELOAD=$(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
753 $(objpfx)loadfail: $(libdl)
754 LDFLAGS-loadfail = -rdynamic
756 $(objpfx)loadfail.out: $(objpfx)failobj.so
758 $(objpfx)multiload: $(libdl)
759 LDFLAGS-multiload = -rdynamic
760 CFLAGS-multiload.c = -DOBJDIR=\"$(elf-objpfx)\"
762 $(objpfx)multiload.out: $(objpfx)testobj1.so
764 $(objpfx)origtest: $(libdl)
765 LDFLAGS-origtest = -rdynamic
766 $(objpfx)origtest.out: $(objpfx)testobj1.so
768 ifeq ($(have-thread-library),yes)
769 $(objpfx)resolvfail: $(libdl) $(shared-thread-library)
770 else
771 $(objpfx)resolvfail: $(libdl)
772 endif
774 $(objpfx)constload1: $(libdl)
775 $(objpfx)constload1.out: $(objpfx)constload2.so $(objpfx)constload3.so
777 $(objpfx)circleload1: $(libdl)
778 $(objpfx)circleload1.out: $(objpfx)circlemod1.so \
779 $(objpfx)circlemod1a.so
781 $(objpfx)circlemod1.so: $(objpfx)circlemod2.so
782 $(objpfx)circlemod2.so: $(objpfx)circlemod3.so
783 $(objpfx)circlemod1a.so: $(objpfx)circlemod2a.so
784 $(objpfx)circlemod2a.so: $(objpfx)circlemod3a.so
786 $(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so)
788 $(objpfx)order-cmp.out: $(objpfx)order.out
789 (echo "0123456789" | cmp $< -) > $@; \
790 $(evaluate-test)
792 $(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so)
793 $(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
794 vismain-ENV = LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
796 $(objpfx)noload: $(objpfx)testobj1.so $(libdl)
797 LDFLAGS-noload = -rdynamic $(no-as-needed)
798 $(objpfx)noload.out: $(objpfx)testobj5.so
800 $(objpfx)noload-mem.out: $(objpfx)noload.out
801 $(common-objpfx)malloc/mtrace $(objpfx)noload.mtrace > $@; \
802 $(evaluate-test)
803 noload-ENV = MALLOC_TRACE=$(objpfx)noload.mtrace
805 LDFLAGS-nodelete = -rdynamic
806 LDFLAGS-nodelmod1.so = -Wl,--enable-new-dtags,-z,nodelete
807 LDFLAGS-nodelmod4.so = -Wl,--enable-new-dtags,-z,nodelete
808 $(objpfx)nodelete: $(libdl)
809 $(objpfx)nodelete.out: $(objpfx)nodelmod1.so $(objpfx)nodelmod2.so \
810 $(objpfx)nodelmod3.so
812 LDFLAGS-nodlopenmod.so = -Wl,--enable-new-dtags,-z,nodlopen
813 $(objpfx)nodlopen: $(libdl)
814 $(objpfx)nodlopen.out: $(objpfx)nodlopenmod.so
816 $(objpfx)nodlopenmod2.so: $(objpfx)nodlopenmod.so
817 $(objpfx)nodlopen2: $(libdl)
818 $(objpfx)nodlopen2.out: $(objpfx)nodlopenmod2.so
820 $(objpfx)filtmod1.so: $(objpfx)filtmod1.os $(objpfx)filtmod2.so
821 $(LINK.o) -shared -o $@ -B$(csu-objpfx) $(LDFLAGS.so) \
822 -L$(subst :, -L,$(rpath-link)) \
823 -Wl,-rpath-link=$(rpath-link) \
824 $< -Wl,-F,$(objpfx)filtmod2.so
825 $(objpfx)filter: $(objpfx)filtmod1.so
827 # This does not link against libc.
828 CFLAGS-filtmod1.c = $(no-stack-protector)
830 $(objpfx)unload: $(libdl)
831 $(objpfx)unload.out: $(objpfx)unloadmod.so
833 $(objpfx)reldep: $(libdl)
834 $(objpfx)reldep.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod2.so
836 $(objpfx)reldep2: $(libdl)
837 $(objpfx)reldep2.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod3.so
839 $(objpfx)reldep3: $(libdl)
840 $(objpfx)reldep3.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
842 $(objpfx)reldep4: $(libdl)
843 $(objpfx)reldep4.out: $(objpfx)reldep4mod1.so $(objpfx)reldep4mod2.so
845 $(objpfx)next: $(objpfx)nextmod1.so $(objpfx)nextmod2.so $(libdl)
846 LDFLAGS-next = $(no-as-needed)
848 $(objpfx)unload2: $(libdl)
849 $(objpfx)unload2.out: $(objpfx)unload2mod.so $(objpfx)unload2dep.so
851 $(objpfx)lateglobal: $(libdl)
852 $(objpfx)lateglobal.out: $(objpfx)ltglobmod1.so $(objpfx)ltglobmod2.so
854 $(objpfx)tst-pathopt: $(libdl)
855 $(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \
856 $(objpfx)pathoptobj.so
857 $(SHELL) $< $(common-objpfx) '$(test-wrapper-env)' \
858 '$(run-program-env)' > $@; \
859 $(evaluate-test)
861 $(objpfx)tst-rtld-load-self.out: tst-rtld-load-self.sh $(objpfx)ld.so
862 $(SHELL) $^ '$(test-wrapper)' '$(test-wrapper-env)' > $@; \
863 $(evaluate-test)
865 $(objpfx)initfirst: $(libdl)
866 $(objpfx)initfirst.out: $(objpfx)firstobj.so
868 $(objpfx)global: $(objpfx)globalmod1.so
869 $(objpfx)global.out: $(objpfx)reldepmod1.so
871 $(objpfx)dblload: $(libdl)
872 $(objpfx)dblload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
874 $(objpfx)dblunload: $(libdl)
875 $(objpfx)dblunload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
877 $(objpfx)reldep5: $(libdl)
878 $(objpfx)reldep5.out: $(objpfx)reldepmod5.so $(objpfx)reldepmod6.so
880 $(objpfx)reldep6: $(libdl)
881 $(objpfx)reldep6.out: $(objpfx)reldep6mod3.so $(objpfx)reldep6mod4.so
883 $(objpfx)reldep7: $(libdl)
884 $(objpfx)reldep7.out: $(objpfx)reldep7mod1.so $(objpfx)reldep7mod2.so
886 $(objpfx)reldep8: $(libdl)
887 $(objpfx)reldep8.out: $(objpfx)reldep8mod3.so
889 LDFLAGS-nodel2mod2.so = -Wl,--enable-new-dtags,-z,nodelete
890 $(objpfx)nodelete2: $(libdl)
891 $(objpfx)nodelete2.out: $(objpfx)nodel2mod3.so
893 $(objpfx)reldep9: $(libdl)
894 $(objpfx)reldep9.out: $(objpfx)reldep9mod3.so
896 $(objpfx)tst-tls3: $(objpfx)tst-tlsmod1.so
898 $(objpfx)tst-tls4: $(libdl)
899 $(objpfx)tst-tls4.out: $(objpfx)tst-tlsmod2.so
901 $(objpfx)tst-tls5: $(libdl)
902 $(objpfx)tst-tls5.out: $(objpfx)tst-tlsmod2.so
904 $(objpfx)tst-tls6: $(libdl)
905 $(objpfx)tst-tls6.out: $(objpfx)tst-tlsmod2.so
907 $(objpfx)tst-tls7: $(libdl)
908 $(objpfx)tst-tls7.out: $(objpfx)tst-tlsmod3.so
910 $(objpfx)tst-tls8: $(libdl)
911 $(objpfx)tst-tls8.out: $(objpfx)tst-tlsmod3.so $(objpfx)tst-tlsmod4.so
913 $(objpfx)tst-tls9: $(libdl)
914 $(objpfx)tst-tls9.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
916 $(objpfx)tst-tls10: $(objpfx)tst-tlsmod8.so $(objpfx)tst-tlsmod7.so
918 $(objpfx)tst-tls11: $(objpfx)tst-tlsmod10.so $(objpfx)tst-tlsmod9.so
920 $(objpfx)tst-tls12: $(objpfx)tst-tlsmod12.so $(objpfx)tst-tlsmod11.so
922 $(objpfx)tst-tls13: $(libdl)
923 $(objpfx)tst-tls13.out: $(objpfx)tst-tlsmod13a.so
925 $(objpfx)tst-tls14: $(objpfx)tst-tlsmod14a.so $(libdl)
926 $(objpfx)tst-tls14.out: $(objpfx)tst-tlsmod14b.so
928 $(objpfx)tst-tls15: $(libdl)
929 $(objpfx)tst-tls15.out: $(objpfx)tst-tlsmod15a.so $(objpfx)tst-tlsmod15b.so
931 $(objpfx)tst-tls-dlinfo: $(libdl)
932 $(objpfx)tst-tls-dlinfo.out: $(objpfx)tst-tlsmod2.so
936 $(objpfx)tst-tls16: $(libdl)
937 $(objpfx)tst-tls16.out: $(objpfx)tst-tlsmod16a.so $(objpfx)tst-tlsmod16b.so
939 $(objpfx)tst-tls17: $(libdl)
940 $(objpfx)tst-tls17.out: $(objpfx)tst-tlsmod17b.so
941 $(patsubst %,$(objpfx)%.os,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.os: tst-tlsmod17a.c
942 $(compile-command.c) -DN=$*
943 $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.so: $(objpfx)ld.so
944 $(objpfx)tst-tlsmod17b.so: $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules))
946 $(objpfx)tst-tls18: $(libdl)
947 $(objpfx)tst-tls18.out: $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules))
948 $(patsubst %,$(objpfx)%.os,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.os : tst-tlsmod18a.c
949 $(compile-command.c) -DN=$*
950 $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.so: $(objpfx)ld.so
952 $(objpfx)tst-tls19: $(libdl)
953 $(objpfx)tst-tls19.out: $(objpfx)tst-tls19mod1.so
955 CFLAGS-tst-align.c = $(stack-align-test-flags)
956 CFLAGS-tst-align2.c = $(stack-align-test-flags)
957 CFLAGS-tst-alignmod.c = $(stack-align-test-flags)
958 CFLAGS-tst-alignmod2.c = $(stack-align-test-flags)
959 $(objpfx)tst-align: $(libdl)
960 $(objpfx)tst-align.out: $(objpfx)tst-alignmod.so
961 $(objpfx)tst-align2: $(objpfx)tst-alignmod2.so
963 $(objpfx)unload3: $(libdl)
964 $(objpfx)unload3.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
965 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
967 $(objpfx)unload4: $(libdl)
968 $(objpfx)unload4.out: $(objpfx)unload4mod1.so $(objpfx)unload4mod3.so
970 $(objpfx)unload5: $(libdl)
971 $(objpfx)unload5.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
972 $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
974 $(objpfx)unload6: $(libdl)
975 $(objpfx)unload6.out: $(objpfx)unload6mod1.so $(objpfx)unload6mod2.so \
976 $(objpfx)unload6mod3.so
978 $(objpfx)unload7: $(libdl)
979 $(objpfx)unload7.out: $(objpfx)unload7mod1.so $(objpfx)unload7mod2.so
980 unload7-ENV = MALLOC_PERTURB_=85
982 $(objpfx)unload8: $(libdl)
983 $(objpfx)unload8.out: $(objpfx)unload8mod1.so $(objpfx)unload8mod1x.so
985 ifdef libdl
986 $(objpfx)tst-tls9-static: $(common-objpfx)dlfcn/libdl.a
987 $(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
988 endif
990 ifeq ($(have-z-execstack),yes)
991 $(objpfx)tst-execstack: $(libdl)
992 $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
993 CPPFLAGS-tst-execstack.c = -DUSE_PTHREADS=0
994 LDFLAGS-tst-execstack = -Wl,-z,noexecstack
995 LDFLAGS-tst-execstack-mod = -Wl,-z,execstack
997 $(objpfx)tst-execstack-needed: $(objpfx)tst-execstack-mod.so
998 LDFLAGS-tst-execstack-needed = -Wl,-z,noexecstack
1000 LDFLAGS-tst-execstack-prog = -Wl,-z,execstack
1001 CFLAGS-tst-execstack-prog.c += -Wno-trampolines
1002 CFLAGS-tst-execstack-mod.c += -Wno-trampolines
1003 endif
1005 LDFLAGS-tst-array2 = $(no-as-needed)
1006 LDFLAGS-tst-array5 = $(no-as-needed)
1008 $(objpfx)tst-array1-cmp.out: tst-array1.exp $(objpfx)tst-array1.out
1009 cmp $^ > $@; \
1010 $(evaluate-test)
1012 $(objpfx)tst-array1-static-cmp.out: tst-array1.exp \
1013 $(objpfx)tst-array1-static.out
1014 cmp $^ > $@; \
1015 $(evaluate-test)
1017 $(objpfx)tst-array2: $(objpfx)tst-array2dep.so
1018 $(objpfx)tst-array2-cmp.out: tst-array2.exp $(objpfx)tst-array2.out
1019 cmp $^ > $@; \
1020 $(evaluate-test)
1022 $(objpfx)tst-array3-cmp.out: tst-array1.exp $(objpfx)tst-array3.out
1023 cmp $^ > $@; \
1024 $(evaluate-test)
1026 $(objpfx)tst-array4: $(libdl)
1027 $(objpfx)tst-array4.out: $(objpfx)tst-array2dep.so
1028 $(objpfx)tst-array4-cmp.out: tst-array4.exp $(objpfx)tst-array4.out
1029 cmp $^ > $@; \
1030 $(evaluate-test)
1032 $(objpfx)tst-array5: $(objpfx)tst-array5dep.so
1033 $(objpfx)tst-array5-cmp.out: tst-array5.exp $(objpfx)tst-array5.out
1034 cmp $^ > $@; \
1035 $(evaluate-test)
1037 $(objpfx)tst-array5-static-cmp.out: tst-array5-static.exp \
1038 $(objpfx)tst-array5-static.out
1039 cmp $^ > $@; \
1040 $(evaluate-test)
1042 CFLAGS-tst-pie1.c += $(pie-ccflag)
1043 CFLAGS-tst-pie2.c += $(pie-ccflag)
1045 $(objpfx)tst-piemod1.so: $(libsupport)
1046 $(objpfx)tst-pie1: $(objpfx)tst-piemod1.so
1048 ifeq (yes,$(build-shared))
1049 all-built-dso := $(common-objpfx)elf/ld.so $(common-objpfx)libc.so \
1050 $(filter-out $(common-objpfx)linkobj/libc.so, \
1051 $(sort $(wildcard $(addprefix $(common-objpfx), \
1052 */lib*.so \
1053 iconvdata/*.so))))
1055 $(all-built-dso:=.dyn): %.dyn: %
1056 @rm -f $@T
1057 LC_ALL=C $(READELF) -W -d $< > $@T
1058 test -s $@T
1059 mv -f $@T $@
1060 common-generated += $(all-built-dso:$(common-objpfx)%=%.dyn)
1062 $(objpfx)check-textrel.out: $(..)scripts/check-textrel.awk \
1063 $(all-built-dso:=.dyn)
1064 LC_ALL=C $(AWK) -f $^ > $@; \
1065 $(evaluate-test)
1066 generated += check-textrel.out
1068 $(objpfx)execstack-default: $(first-word $(wildcard $(sysdirs:%=%/stackinfo.h)))
1069 $(make-target-directory)
1070 { echo '#include <elf.h>'; \
1071 echo '#include <stackinfo.h>'; \
1072 echo '#if (DEFAULT_STACK_PERMS & PF_X) == 0'; \
1073 echo '@@@execstack-no@@@'; \
1074 echo '#else'; \
1075 echo '@@@execstack-yes@@@'; \
1076 echo '#endif'; } | \
1077 $(CC) $(CFLAGS) $(CPPFLAGS) -E -x c-header - | \
1078 sed -n -e 's/^@@@\(.*\)@@@/\1/p' > $@T
1079 mv -f $@T $@
1080 generated += execstack-default
1082 $(all-built-dso:=.phdr): %.phdr: %
1083 @rm -f $@T
1084 LC_ALL=C $(READELF) -W -l $< > $@T
1085 test -s $@T
1086 mv -f $@T $@
1087 common-generated += $(all-built-dso:$(common-objpfx)%=%.phdr)
1089 $(objpfx)check-execstack.out: $(..)scripts/check-execstack.awk \
1090 $(objpfx)execstack-default \
1091 $(all-built-dso:=.phdr)
1092 LC_ALL=C $(AWK) -f $^ > $@; \
1093 $(evaluate-test)
1094 generated += check-execstack.out
1096 $(objpfx)tst-dlmodcount: $(libdl)
1097 $(objpfx)tst-dlmodcount.out: $(test-modules)
1099 $(all-built-dso:=.jmprel): %.jmprel: % Makefile
1100 @rm -f $@T
1101 LC_ALL=C $(READELF) -W -S -d -r $< > $@T
1102 test -s $@T
1103 mv -f $@T $@
1104 common-generated += $(all-built-dso:$(common-objpfx)%=%.jmprel)
1106 localplt-built-dso := $(addprefix $(common-objpfx),\
1107 libc.so \
1108 elf/ld.so \
1109 math/libm.so \
1110 rt/librt.so \
1111 dlfcn/libdl.so \
1112 resolv/libresolv.so \
1113 crypt/libcrypt.so \
1115 ifeq ($(build-mathvec),yes)
1116 localplt-built-dso += $(addprefix $(common-objpfx), mathvec/libmvec.so)
1117 endif
1118 ifeq ($(have-thread-library),yes)
1119 localplt-built-dso += $(filter-out %_nonshared.a, $(shared-thread-library))
1120 endif
1122 vpath localplt.data $(+sysdep_dirs)
1124 $(objpfx)check-localplt.out: $(..)scripts/check-localplt.awk \
1125 $(..)scripts/localplt.awk \
1126 $(localplt-built-dso:=.jmprel) \
1127 localplt.data
1128 LC_ALL=C $(AWK) -f $(filter-out $< %localplt.data,$^) | \
1129 LC_ALL=C $(AWK) -f $< $(filter %localplt.data,$^) - \
1130 > $@; \
1131 $(evaluate-test)
1132 endif
1134 $(objpfx)tst-dlopenrpathmod.so: $(libdl)
1135 $(objpfx)tst-dlopenrpath: $(objpfx)tst-dlopenrpathmod.so $(libdl)
1136 CFLAGS-tst-dlopenrpath.c += -DPFX=\"$(objpfx)\"
1137 LDFLAGS-tst-dlopenrpathmod.so += -Wl,-rpath,\$$ORIGIN/test-subdir
1138 $(objpfx)tst-dlopenrpath.out: $(objpfx)firstobj.so
1140 $(objpfx)tst-deep1mod2.so: $(objpfx)tst-deep1mod3.so
1141 $(objpfx)tst-deep1: $(libdl) $(objpfx)tst-deep1mod1.so
1142 $(objpfx)tst-deep1.out: $(objpfx)tst-deep1mod2.so
1143 LDFLAGS-tst-deep1 += -rdynamic
1144 tst-deep1mod3.so-no-z-defs = yes
1146 $(objpfx)tst-dlmopen1mod.so: $(libdl)
1147 $(objpfx)tst-dlmopen1: $(libdl)
1148 $(objpfx)tst-dlmopen1.out: $(objpfx)tst-dlmopen1mod.so
1150 $(objpfx)tst-dlmopen2: $(libdl)
1151 $(objpfx)tst-dlmopen2.out: $(objpfx)tst-dlmopen1mod.so
1153 $(objpfx)tst-dlmopen3: $(libdl)
1154 $(objpfx)tst-dlmopen3.out: $(objpfx)tst-dlmopen1mod.so
1156 $(objpfx)tst-audit1.out: $(objpfx)tst-auditmod1.so
1157 tst-audit1-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1159 $(objpfx)tst-audit2: $(libdl)
1160 $(objpfx)tst-audit2.out: $(objpfx)tst-auditmod1.so $(objpfx)tst-auditmod9b.so
1161 # Prevent GCC-5 from translating a malloc/memset pair into calloc
1162 CFLAGS-tst-audit2.c += -fno-builtin
1163 tst-audit2-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1165 $(objpfx)tst-audit9: $(libdl)
1166 $(objpfx)tst-audit9.out: $(objpfx)tst-auditmod9a.so $(objpfx)tst-auditmod9b.so
1167 tst-audit9-ENV = LD_AUDIT=$(objpfx)tst-auditmod9a.so
1169 $(objpfx)tst-audit8: $(libm)
1170 $(objpfx)tst-audit8.out: $(objpfx)tst-auditmod1.so
1171 tst-audit8-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
1173 $(objpfx)tst-global1: $(libdl)
1174 $(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
1176 $(objpfx)order2: $(libdl)
1177 $(objpfx)order2.out: $(objpfx)order2mod1.so $(objpfx)order2mod2.so
1178 $(objpfx)order2-cmp.out: $(objpfx)order2.out
1179 (echo "12345" | cmp $< -) > $@; \
1180 $(evaluate-test)
1181 $(objpfx)order2mod1.so: $(objpfx)order2mod4.so
1182 $(objpfx)order2mod4.so: $(objpfx)order2mod3.so
1183 $(objpfx)order2mod2.so: $(objpfx)order2mod3.so
1184 order2mod2.so-no-z-defs = yes
1185 LDFLAGS-order2mod1.so = $(no-as-needed)
1186 LDFLAGS-order2mod2.so = $(no-as-needed)
1188 tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child"
1189 tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
1191 tst-ptrguard1-ARGS = --command "$(host-test-program-cmd) --child"
1192 # When built statically, the pointer guard interface uses
1193 # __pointer_chk_guard_local.
1194 CFLAGS-tst-ptrguard1-static.c = -DPTRGUARD_LOCAL
1195 tst-ptrguard1-static-ARGS = --command "$(objpfx)tst-ptrguard1-static --child"
1197 $(objpfx)tst-leaks1: $(libdl)
1198 $(objpfx)tst-leaks1-mem.out: $(objpfx)tst-leaks1.out
1199 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1.mtrace > $@; \
1200 $(evaluate-test)
1202 $(objpfx)tst-leaks1-static: $(common-objpfx)dlfcn/libdl.a
1203 $(objpfx)tst-leaks1-static-mem.out: $(objpfx)tst-leaks1-static.out
1204 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1-static.mtrace > $@; \
1205 $(evaluate-test)
1207 tst-leaks1-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1.mtrace
1208 tst-leaks1-static-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1-static.mtrace
1210 $(objpfx)tst-addr1: $(libdl)
1212 $(objpfx)tst-thrlock: $(libdl) $(shared-thread-library)
1213 $(objpfx)tst-dlopen-aout: $(libdl) $(shared-thread-library)
1215 CFLAGS-ifuncmain1pic.c += $(pic-ccflag)
1216 CFLAGS-ifuncmain1picstatic.c += $(pic-ccflag)
1217 CFLAGS-ifuncmain1staticpic.c += $(pic-ccflag)
1218 CFLAGS-ifuncdep1pic.c += $(pic-ccflag)
1219 CFLAGS-ifuncmain1vispic.c += $(pic-ccflag)
1220 CFLAGS-ifuncmain2pic.c += $(pic-ccflag)
1221 CFLAGS-ifuncmain2picstatic.c += $(pic-ccflag)
1222 CFLAGS-ifuncdep2pic.c += $(pic-ccflag)
1223 CFLAGS-ifuncmain4picstatic.c += $(pic-ccflag)
1224 CFLAGS-ifuncmain5pic.c += $(pic-ccflag)
1225 CFLAGS-ifuncmain5picstatic.c += $(pic-ccflag)
1226 CFLAGS-ifuncmain5staticpic.c += $(pic-ccflag)
1227 CFLAGS-ifuncdep5pic.c += $(pic-ccflag)
1228 CFLAGS-ifuncmain7pic.c += $(pic-ccflag)
1229 CFLAGS-ifuncmain7picstatic.c += $(pic-ccflag)
1231 LDFLAGS-ifuncmain3 = -Wl,-export-dynamic
1233 CFLAGS-ifuncmain1pie.c += $(pie-ccflag)
1234 CFLAGS-ifuncmain1vispie.c += $(pie-ccflag)
1235 CFLAGS-ifuncmain1staticpie.c += $(pie-ccflag)
1236 CFLAGS-ifuncmain5pie.c += $(pie-ccflag)
1237 CFLAGS-ifuncmain6pie.c += $(pie-ccflag)
1238 CFLAGS-ifuncmain7pie.c += $(pie-ccflag)
1240 $(objpfx)ifuncmain1pie: $(objpfx)ifuncmod1.so
1241 $(objpfx)ifuncmain1staticpie: $(objpfx)ifuncdep1pic.o
1242 $(objpfx)ifuncmain1vispie: $(objpfx)ifuncmod1.so
1243 $(objpfx)ifuncmain5pie: $(objpfx)ifuncmod5.so
1244 $(objpfx)ifuncmain6pie: $(objpfx)ifuncmod6.so
1246 $(objpfx)ifuncmain1: $(addprefix $(objpfx),ifuncmod1.so)
1247 $(objpfx)ifuncmain1pic: $(addprefix $(objpfx),ifuncmod1.so)
1248 $(objpfx)ifuncmain1staticpic: $(addprefix $(objpfx),ifuncdep1pic.o)
1249 $(objpfx)ifuncmain1static: $(addprefix $(objpfx),ifuncdep1.o)
1250 $(objpfx)ifuncmain1picstatic: $(addprefix $(objpfx),ifuncdep1pic.o)
1251 $(objpfx)ifuncmain1vis: $(addprefix $(objpfx),ifuncmod1.so)
1252 $(objpfx)ifuncmain1vispic: $(addprefix $(objpfx),ifuncmod1.so)
1253 $(objpfx)ifuncmain2: $(addprefix $(objpfx),ifuncdep2.o)
1254 $(objpfx)ifuncmain2pic: $(addprefix $(objpfx),ifuncdep2pic.o)
1255 $(objpfx)ifuncmain2static: $(addprefix $(objpfx),ifuncdep2.o)
1256 $(objpfx)ifuncmain2picstatic: $(addprefix $(objpfx),ifuncdep2pic.o)
1258 $(objpfx)ifuncmain3: $(libdl)
1259 $(objpfx)ifuncmain3.out: $(objpfx)ifuncmod3.so
1261 $(objpfx)ifuncmain5: $(addprefix $(objpfx),ifuncmod5.so)
1262 $(objpfx)ifuncmain5pic: $(addprefix $(objpfx),ifuncmod5.so)
1263 $(objpfx)ifuncmain5static: $(addprefix $(objpfx),ifuncdep5.o)
1264 $(objpfx)ifuncmain5staticpic: $(addprefix $(objpfx),ifuncdep5pic.o)
1265 $(objpfx)ifuncmain5picstatic: $(addprefix $(objpfx),ifuncdep5pic.o)
1267 $(objpfx)tst-unique1: $(libdl)
1268 $(objpfx)tst-unique1.out: $(objpfx)tst-unique1mod1.so \
1269 $(objpfx)tst-unique1mod2.so
1271 $(objpfx)tst-unique2: $(libdl) $(objpfx)tst-unique2mod1.so
1272 $(objpfx)tst-unique2.out: $(objpfx)tst-unique2mod2.so
1274 $(objpfx)tst-unique3: $(libdl) $(objpfx)tst-unique3lib.so
1275 $(objpfx)tst-unique3.out: $(objpfx)tst-unique3lib2.so
1277 $(objpfx)tst-unique4: $(objpfx)tst-unique4lib.so
1279 $(objpfx)tst-nodelete: $(libdl)
1280 $(objpfx)tst-nodelete.out: $(objpfx)tst-nodelete-uniquemod.so \
1281 $(objpfx)tst-nodelete-rtldmod.so \
1282 $(objpfx)tst-nodelete-zmod.so
1284 LDFLAGS-tst-nodelete = -rdynamic
1285 LDFLAGS-tst-nodelete-zmod.so = -Wl,--enable-new-dtags,-z,nodelete
1287 $(objpfx)tst-nodelete2: $(libdl)
1288 $(objpfx)tst-nodelete2.out: $(objpfx)tst-nodelete2mod.so
1290 LDFLAGS-tst-nodelete2 = -rdynamic
1292 $(objpfx)tst-initorder-cmp.out: tst-initorder.exp $(objpfx)tst-initorder.out
1293 cmp $^ > $@; \
1294 $(evaluate-test)
1296 $(objpfx)tst-initorder2: $(objpfx)tst-initorder2a.so $(objpfx)tst-initorder2d.so $(objpfx)tst-initorder2c.so
1297 $(objpfx)tst-initorder2a.so: $(objpfx)tst-initorder2b.so
1298 $(objpfx)tst-initorder2b.so: $(objpfx)tst-initorder2c.so
1299 $(objpfx)tst-initorder2c.so: $(objpfx)tst-initorder2d.so
1300 LDFLAGS-tst-initorder2 = $(no-as-needed)
1301 LDFLAGS-tst-initorder2a.so = $(no-as-needed)
1302 LDFLAGS-tst-initorder2b.so = $(no-as-needed)
1303 LDFLAGS-tst-initorder2c.so = $(no-as-needed)
1304 define o-iterator-doit
1305 $(objpfx)tst-initorder2$o.os: tst-initorder2.c; \
1306 $$(compile-command.c) -DNAME=\"$o\"
1307 endef
1308 object-suffixes-left := a b c d
1309 include $(o-iterator)
1311 $(objpfx)tst-initorder2-cmp.out: tst-initorder2.exp $(objpfx)tst-initorder2.out
1312 cmp $^ > $@; \
1313 $(evaluate-test)
1315 $(objpfx)tst-relsort1: $(libdl)
1316 $(objpfx)tst-relsort1mod1.so: $(libm) $(objpfx)tst-relsort1mod2.so
1317 $(objpfx)tst-relsort1mod2.so: $(libm)
1318 $(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
1319 $(objpfx)tst-relsort1mod2.so
1321 $(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so
1322 $(test-wrapper-env) \
1323 LD_TRACE_LOADED_OBJECTS=1 \
1324 LD_DEBUG=unused \
1325 LD_PRELOAD= \
1326 $(rtld-prefix) \
1327 $< > $@; \
1328 $(evaluate-test)
1330 $(objpfx)tst-unused-dep-cmp.out: $(objpfx)tst-unused-dep.out
1331 cmp $< /dev/null > $@; \
1332 $(evaluate-test)
1334 $(objpfx)tst-audit11.out: $(objpfx)tst-auditmod11.so $(objpfx)tst-audit11mod1.so
1335 $(objpfx)tst-audit11: $(libdl)
1336 tst-audit11-ENV = LD_AUDIT=$(objpfx)tst-auditmod11.so
1337 $(objpfx)tst-audit11mod1.so: $(objpfx)tst-audit11mod2.so
1338 LDFLAGS-tst-audit11mod2.so = -Wl,--version-script=tst-audit11mod2.map,-soname,tst-audit11mod2.so
1340 $(objpfx)tst-audit12.out: $(objpfx)tst-auditmod12.so $(objpfx)tst-audit12mod1.so $(objpfx)tst-audit12mod3.so
1341 $(objpfx)tst-audit12: $(libdl)
1342 tst-audit12-ENV = LD_AUDIT=$(objpfx)tst-auditmod12.so
1343 $(objpfx)tst-audit12mod1.so: $(objpfx)tst-audit12mod2.so
1344 LDFLAGS-tst-audit12mod2.so = -Wl,--version-script=tst-audit12mod2.map
1346 # Override -z defs, so that we can reference an undefined symbol.
1347 # Force lazy binding for the same reason.
1348 LDFLAGS-tst-latepthreadmod.so = \
1349 -Wl,-z,lazy -Wl,--unresolved-symbols=ignore-all
1350 # Do not optimize sibling calls as the test relies on a JMP_SLOT relocation for
1351 # function this_function_is_not_defined.
1352 CFLAGS-tst-latepthreadmod.c = -fno-optimize-sibling-calls
1353 $(objpfx)tst-latepthreadmod.so: $(shared-thread-library)
1354 $(objpfx)tst-latepthread: $(libdl)
1355 $(objpfx)tst-latepthread.out: $(objpfx)tst-latepthreadmod.so
1357 # The test modules are parameterized by preprocessor macros.
1358 $(patsubst %,$(objpfx)%.os,$(tst-tls-many-dynamic-modules)): \
1359 $(objpfx)tst-tls-manydynamic%mod.os : tst-tls-manydynamicmod.c
1360 $(compile-command.c) \
1361 -DNAME=tls_global_$* -DSETTER=set_value_$* -DGETTER=get_value_$*
1362 $(objpfx)tst-tls-manydynamic: $(libdl) $(shared-thread-library)
1363 $(objpfx)tst-tls-manydynamic.out: \
1364 $(patsubst %,$(objpfx)%.so,$(tst-tls-many-dynamic-modules))
1366 tst-prelink-ENV = LD_TRACE_PRELINKING=1
1368 $(objpfx)tst-prelink-conflict.out: $(objpfx)tst-prelink.out
1369 grep stdout $< | grep conflict | $(AWK) '{ print $$10, $$11 }' > $@
1371 $(objpfx)tst-prelink-cmp.out: tst-prelink.exp \
1372 $(objpfx)tst-prelink-conflict.out
1373 cmp $^ > $@; \
1374 $(evaluate-test)
1376 $(objpfx)tst-ldconfig-X.out : tst-ldconfig-X.sh $(objpfx)ldconfig
1377 $(SHELL) $< '$(common-objpfx)' '$(test-wrapper-env)' \
1378 '$(run-program-env)' > $@; \
1379 $(evaluate-test)
1381 $(objpfx)tst-dlsym-error: $(libdl)
1383 # Test static linking of all the libraries we can possibly link
1384 # together. Note that in some configurations this may be less than the
1385 # complete list of libraries we build but we try to maxmimize this list.
1386 $(objpfx)tst-linkall-static: \
1387 $(common-objpfx)math/libm.a \
1388 $(common-objpfx)resolv/libresolv.a \
1389 $(common-objpfx)dlfcn/libdl.a \
1390 $(common-objpfx)login/libutil.a \
1391 $(common-objpfx)rt/librt.a \
1392 $(common-objpfx)resolv/libanl.a \
1393 $(static-thread-library)
1395 # If we are using NSS crypto and we have the ability to link statically
1396 # then we include libcrypt.a, otherwise we leave out libcrypt.a and
1397 # link as much as we can into the tst-linkall-static test. This assumes
1398 # that linking with libcrypt.a does everything required to include the
1399 # static NSS crypto library.
1400 ifeq (yesyes,$(nss-crypt)$(static-nss-crypt))
1401 $(objpfx)tst-linkall-static: \
1402 $(common-objpfx)crypt/libcrypt.a
1403 endif
1404 # If we are not using NSS crypto then we always have the ability to link
1405 # with libcrypt.a.
1406 ifeq (no,$(nss-crypt))
1407 $(objpfx)tst-linkall-static: \
1408 $(common-objpfx)crypt/libcrypt.a
1409 endif
1411 # The application depends on the DSO, and the DSO loads the plugin.
1412 # The plugin also depends on the DSO. This creates the circular
1413 # dependency via dlopen that we're testing to make sure works.
1414 $(objpfx)tst-nodelete-dlclose-dso.so: $(libdl)
1415 $(objpfx)tst-nodelete-dlclose-plugin.so: $(objpfx)tst-nodelete-dlclose-dso.so
1416 $(objpfx)tst-nodelete-dlclose: $(objpfx)tst-nodelete-dlclose-dso.so
1417 $(objpfx)tst-nodelete-dlclose.out: $(objpfx)tst-nodelete-dlclose-dso.so \
1418 $(objpfx)tst-nodelete-dlclose-plugin.so
1420 tst-env-setuid-ENV = MALLOC_CHECK_=2 MALLOC_MMAP_THRESHOLD_=4096 \
1421 LD_HWCAP_MASK=0x1
1422 tst-env-setuid-tunables-ENV = \
1423 GLIBC_TUNABLES=glibc.malloc.check=2:glibc.malloc.mmap_threshold=4096
1425 $(objpfx)tst-debug1: $(libdl)
1426 $(objpfx)tst-debug1.out: $(objpfx)tst-debug1mod1.so
1428 $(objpfx)tst-debug1mod1.so: $(objpfx)testobj1.so
1429 $(OBJCOPY) --only-keep-debug $< $@