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