1 # Copyright (C) 1995-2002, 2003, 2004 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, write to the Free
16 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 # Makefile for elf subdirectory of GNU C Library.
23 headers
= elf.h bits
/elfclass.h link.h
24 routines
= $(dl-routines
) dl-open dl-close dl-support dl-iteratephdr \
25 dl-addr enbl-secure dl-profstub \
26 dl-origin dl-libc dl-sym dl-tsd
28 # The core dynamic linking functions are in libc for the static and
30 dl-routines
= $(addprefix dl-
,load cache lookup object reloc deps \
31 runtime error init fini debug misc \
32 version profile conflict tls
origin \
34 all-dl-routines
= $(dl-routines
) $(sysdep-dl-routines
)
35 # But they are absent from the shared libc, because that code is in ld.so.
36 elide-routines.os
= $(all-dl-routines
) dl-support enbl-secure dl-origin
37 shared-only-routines
+= dl-caller
39 # ld.so uses those routines, plus some special stuff for being the program
40 # interpreter and operating independent of libc.
41 rtld-routines
:= rtld
$(dl-routines
) dl-sysdep dl-environ dl-minimal
42 all-rtld-routines
= $(rtld-routines
) $(sysdep-rtld-routines
)
44 distribute
:= rtld-Rules \
45 $(rtld-routines
:=.c
) dynamic-link.h do-rel.h dl-machine.h \
46 dl-cache.h dl-hash.h soinit.c sofini.c ldd.bash.in \
47 genrtldtbl.awk atomicity.h dl-procinfo.h ldsodefs.h \
48 dl-librecon.h interp.c sln.c dl-dst.h hp-timing.h \
49 do-lookup.h dl-lookupcfg.h sprof.c gen-trusted-dirs.awk \
50 testobj1.c testobj2.c testobj3.c testobj4.c testobj5.c \
51 testobj6.c testobj1_1.c failobj.c unloadmod.c \
52 ldconfig.h ldconfig.c cache.c readlib.c readelflib.c \
53 chroot_canon.c gccframe.h \
54 dep1.c dep2.c dep3.c dep4.c dl-dtprocnum.h unsecvars.h \
55 vismain.c vismod1.c vismod2.c vismod3.c \
56 constload2.c constload3.c filtmod1.c filtmod2.c \
57 nodlopenmod.c nodelete.c nodelmod1.c nodelmod2.c \
58 nodelmod3.c nodelmod4.c nodlopen.c dl-osinfo.h \
59 reldepmod1.c reldepmod2.c reldepmod3.c reldepmod4.c \
60 reldepmod5.c reldepmod6.c \
61 reldep4mod1.c reldep4mod2.c reldep4mod3.c reldep4mod4.c \
62 nextmod1.c nextmod2.c pathoptobj.c tst-pathopt.sh \
63 neededobj1.c neededobj2.c neededobj3.c neededobj4.c \
64 neededobj5.c neededobj6.c firstobj.c \
65 unload2mod.c unload2dep.c ltglobmod1.c ltglobmod2.c \
66 testobj.h vismod.h globalmod1.c \
67 dblloadmod1.c dblloadmod2.c dblloadmod3.c \
68 reldep6mod4.c reldep6mod3.c reldep6mod2.c reldep6mod1.c \
69 reldep6mod0.c reldep7mod1.c reldep7mod2.c \
70 unwind-dw2.c unwind-dw2-fde.c unwind.h unwind-pe.h \
71 unwind-dw2-fde.h dwarf2.h dl-procinfo.c tls.h dl-tls.h \
72 tst-tlsmod1.c tst-tlsmod2.c tst-tlsmod3.c tst-tlsmod4.c \
73 tst-tlsmod5.c tst-tlsmod6.c tst-tlsmod7.c tst-tlsmod8.c \
74 tst-tlsmod9.c tst-tlsmod10.c tst-tlsmod11.c \
75 tst-tlsmod12.c tst-tls10.h tst-alignmod.c tst-alignmod2.c \
76 circlemod1.c circlemod1a.c circlemod2.c circlemod2a.c \
77 circlemod3.c circlemod3a.c nodlopenmod2.c \
79 reldep8mod1.c reldep8mod2.c reldep8mod3.c \
80 nodel2mod1.c nodel2mod2.c nodel2mod3.c \
81 reldep9.c reldep9mod1.c reldep9mod2.c reldep9mod3.c \
82 tst-array1.exp tst-array2.exp tst-array4.exp \
83 tst-array2dep.c tst-piemod1.c \
84 tst-execstack-mod.c tst-dlmodcount.c \
85 check-textrel.c dl-sysdep.h test-dlopenrpathmod.c \
86 tst-deep1mod1.c tst-deep1mod2.c tst-deep1mod3.c \
87 unload3mod1.c unload3mod2.c unload3mod3.c unload3mod4.c \
88 unload4mod1.c unload4mod2.c unload4mod3.c unload4mod4.c \
89 unload6mod1.c unload6mod2.c unload6mod3.c \
90 order2mod1.c order2mod2.c order2mod3.c order2mod4.c
92 CFLAGS-dl-runtime.c
= -fexceptions
-fasynchronous-unwind-tables
93 CFLAGS-dl-lookup.c
= -fexceptions
-fasynchronous-unwind-tables
94 CFLAGS-dl-iterate-phdr.c
= $(uses-callbacks
)
98 ifeq ($(unwind-find-fde
),yes
)
99 routines
+= unwind-dw2-fde-glibc
100 shared-only-routines
+= unwind-dw2-fde-glibc
103 before-compile
= $(objpfx
)trusted-dirs.h
104 generated
:= trusted-dirs.h trusted-dirs.st for-renamed
/renamed.so
105 generated-dirs
:= for-renamed
107 ifeq ($(versioning
),yes
)
108 ld-map
= $(common-objpfx
)ld.map
111 ifeq (yes
,$(build-shared
))
112 extra-objs
= $(all-rtld-routines
:%=%.os
) soinit.os sofini.os interp.os
113 generated
+= librtld.os dl-allobjs.os
ld.so ldd
114 install-others
= $(inst_slibdir
)/$(rtld-installed-name
)
115 install-bin-script
= ldd
121 install-rootsbin
= sln
123 ifeq (yes
,$(use-ldconfig
))
124 ifeq (yes
,$(build-shared
))
125 others-static
+= ldconfig
127 install-rootsbin
+= ldconfig
129 ldconfig-modules
:= cache readlib xmalloc xstrdup chroot_canon
130 extra-objs
+= $(ldconfig-modules
:=.o
)
132 # To find xmalloc.c and xstrdup.c
133 vpath
%.c ..
/locale
/programs
138 tests
= tst-tls1 tst-tls2 tst-tls9
139 ifeq (yes
,$(have-initfini-array
))
140 tests
+= tst-array1 tst-array2 tst-array3 tst-array4
142 ifeq (yes
,$(build-static
))
143 tests-static
= tst-tls1-static tst-tls2-static
144 ifeq (yesyesyes
,$(build-static
)$(build-shared
)$(elf
))
145 tests-static
+= tst-tls9-static
146 tst-tls9-static-ENV
= \
147 LD_LIBRARY_PATH
=$(objpfx
):$(common-objpfx
):$(common-objpfx
)dlfcn
149 tests
+= $(tests-static
)
151 ifeq (yes
,$(build-shared
))
152 tests
+= loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
153 constload1 order
$(tests-vis-
$(have-protected
)) noload
filter unload \
154 reldep reldep2 reldep3 reldep4
$(tests-nodelete-
$(have-z-nodelete
)) \
155 $(tests-nodlopen-
$(have-z-nodlopen
)) neededtest neededtest2 \
156 neededtest3 neededtest4 unload2 lateglobal initfirst global \
157 restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
158 circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \
159 tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-align \
160 tst-align2
$(tests-execstack-
$(have-z-execstack
)) tst-dlmodcount \
161 tst-dlopenrpath tst-deep1 tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
162 unload3 unload4 unload5 unload6 tst-global1 order2
164 test-srcs
= tst-pathopt
165 tests-vis-yes
= vismain
166 tests-nodelete-yes
= nodelete nodelete2
167 tests-nodlopen-yes
= nodlopen nodlopen2
168 tests-execstack-yes
= tst-execstack tst-execstack-needed tst-execstack-prog
170 ifeq (yesyes
,$(have-fpie
)$(build-shared
))
171 tests
: $(objpfx
)tst-pie1.out
173 modules-names
= testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
174 testobj1_1 failobj constload2 constload3 unloadmod \
175 dep1 dep2 dep3 dep4
$(modules-vis-
$(have-protected
)) \
176 $(modules-nodelete-
$(have-z-nodelete
)) \
177 $(modules-nodlopen-
$(have-z-nodlopen
)) filtmod1 filtmod2 \
178 reldepmod1 reldepmod2 reldepmod3 reldepmod4 nextmod1 nextmod2 \
179 reldep4mod1 reldep4mod2 reldep4mod3 reldep4mod4 \
180 neededobj1 neededobj2 neededobj3 neededobj4 \
181 neededobj5 neededobj6 firstobj globalmod1 \
182 unload2mod unload2dep ltglobmod1 ltglobmod2 pathoptobj \
183 dblloadmod1 dblloadmod2 dblloadmod3 reldepmod5 reldepmod6 \
184 reldep6mod0 reldep6mod1 reldep6mod2 reldep6mod3 reldep6mod4 \
185 reldep7mod1 reldep7mod2 \
186 tst-tlsmod1 tst-tlsmod2 tst-tlsmod3 tst-tlsmod4 \
187 tst-tlsmod5 tst-tlsmod6 tst-tlsmod7 tst-tlsmod8 \
188 tst-tlsmod9 tst-tlsmod10 tst-tlsmod11 tst-tlsmod12 \
189 tst-tlsmod13 tst-tlsmod13a tst-tlsmod14a tst-tlsmod14b \
190 circlemod1 circlemod1a circlemod2 circlemod2a \
191 circlemod3 circlemod3a \
192 reldep8mod1 reldep8mod2 reldep8mod3 \
193 reldep9mod1 reldep9mod2 reldep9mod3 \
194 tst-alignmod tst-alignmod2 \
195 $(modules-execstack-
$(have-z-execstack
)) \
196 tst-dlopenrpathmod tst-deep1mod1 tst-deep1mod2 tst-deep1mod3 \
198 unload3mod1 unload3mod2 unload3mod3 unload3mod4 \
199 unload4mod1 unload4mod2 unload4mod3 unload4mod4 \
200 unload6mod1 unload6mod2 unload6mod3 \
201 order2mod1 order2mod2 order2mod3 order2mod4
202 ifeq (yes
,$(have-initfini-array
))
203 modules-names
+= tst-array2dep
205 ifeq (yesyes
,$(have-fpie
)$(build-shared
))
206 modules-names
+= tst-piemod1
208 modules-vis-yes
= vismod1 vismod2 vismod3
209 modules-nodelete-yes
= nodelmod1 nodelmod2 nodelmod3 nodelmod4 \
210 nodel2mod1 nodel2mod2 nodel2mod3
211 modules-nodlopen-yes
= nodlopenmod nodlopenmod2
212 modules-execstack-yes
= tst-execstack-mod
213 extra-objs
+= $(addsuffix .os
,$(strip $(modules-names
)))
214 # We need this variable to be sure the test modules get the right CPPFLAGS.
215 test-extras
+= $(modules-names
)
219 check-abi
: check-abi-ld
220 update-abi
: update-abi-ld
222 ifeq (yes
,$(build-shared
))
223 # Make sure these things are built in the `make lib' pass so they can be used
224 # to run programs during the `make others' pass.
225 lib-noranlib
: $(objpfx
)$(rtld-installed-name
) \
226 $(addprefix $(objpfx
),$(extra-objs
))
229 # Command to link into a larger single relocatable object.
230 reloc-link
= $(LINK.o
) -nostdlib
-nostartfiles
-r
232 $(objpfx
)dl-allobjs.os
: $(all-rtld-routines
:%=$(objpfx
)%.os
)
233 $(reloc-link
) -o
$@
$^
235 # Link together the dynamic linker into a single relocatable object.
236 # First we do a link against libc_pic.a just to get a link map,
237 # and discard the object produced by that link. From the link map
238 # we can glean all the libc modules that need to go into the dynamic
239 # linker. Then we do a recursive make that goes into all the subdirs
240 # those modules come from and builds special rtld-foo.os versions that
241 # are compiled with special flags, and puts these modules into rtld-libc.a
242 # for us. Then we do the real link using rtld-libc.a instead of libc_pic.a.
244 $(objpfx
)librtld.map
: $(objpfx
)dl-allobjs.os
$(common-objpfx
)libc_pic.a
246 $(reloc-link
) -o
$@.o
'-Wl,-(' $^
-lgcc
'-Wl,-)' -Wl
,-Map
,$@T
250 $(objpfx
)librtld.mk
: $(objpfx
)librtld.map Makefile
252 sed
-n
's@^$(common-objpfx)\([^(]*\)(\([^)]*\.os\)) *.*$$@\1 \2@p' \
254 while read lib file
; do \
257 LC_ALL
=C fgrep
-l
/$$file \
258 $(common-objpfx
)stamp.os
$(common-objpfx
)*/stamp.os | \
260 sed
's@^$(common-objpfx)\([^/]*\)/stamp\.os$$@rtld-\1'" +=$$file@"\
263 echo rtld-
$${lib
%%/*} += $$file ;; \
264 *) echo
"Wasn't expecting $$lib($$file)" >&2; exit
1 ;; \
267 echo rtld-subdirs
= `LC_ALL=C sed 's/^rtld-\([^ ]*\).*$$/\1/' $@T \
268 | LC_ALL=C sort -u` >> $@T
271 $(objpfx
)rtld-libc.a
: $(objpfx
)librtld.mk FORCE
272 $(MAKE
) -f
$< -f rtld-Rules
274 $(objpfx
)librtld.os
: $(objpfx
)dl-allobjs.os
$(objpfx
)rtld-libc.a
275 $(LINK.o
) -nostdlib
-nostartfiles
-r
-o
$@
'-Wl,-(' $^
-lgcc
'-Wl,-)' \
278 generated
+= librtld.map librtld.mk rtld-libc.a librtld.os.map
280 z-now-yes
= -Wl
,-z
,now
282 $(objpfx
)ld.so
: $(objpfx
)librtld.os
$(ld-map
)
284 $(LINK.o
) -nostdlib
-nostartfiles
-shared
$(z-now-
$(bind-now
)) \
285 $(LDFLAGS-rtld
) -Wl
,-z
,defs
-Wl
,--verbose
2>&1 | \
287 sed
-e
'/^=========/,/^=========/!d;/^=========/d' \
288 -e
's/\. = 0 + SIZEOF_HEADERS;/& _begin = . - SIZEOF_HEADERS;/' \
290 $(LINK.o
) -nostdlib
-nostartfiles
-shared
-o
$@ \
291 $(LDFLAGS-rtld
) -Wl
,-z
,defs
$(z-now-
$(bind-now
)) \
292 $(filter-out $(map-file
),$^
) $(load-map-file
) \
293 -Wl
,-soname
=$(rtld-installed-name
) -T
$@.lds
296 # interp.c exists just to get this string into the libraries.
297 CFLAGS-interp.c
= -D
'RUNTIME_LINKER="$(slibdir)/$(rtld-installed-name)"' \
299 $(objpfx
)interp.os
: $(common-objpfx
)config.make
301 ifneq (ld.so
,$(rtld-installed-name
))
302 # Make sure ld.so.1 exists in the build directory so we can link
304 $(objpfx
)$(rtld-installed-name
): $(objpfx
)ld.so
307 generated
+= $(rtld-installed-name
)
310 # Build a file mentioning all trustworthy directories to look for shared
311 # libraries when using LD_LIBRARY_PATH in a setuid program. The user can
312 # add directories to the list by defining $(user-defined-trusted-dirs)
313 # before starting make.
314 $(objpfx
)trusted-dirs.h
: $(objpfx
)trusted-dirs.st
; @
:
315 $(objpfx
)trusted-dirs.st
: Makefile
$(..
)Makeconfig
316 $(make-target-directory
)
317 echo
"$(subst :, ,$(default-rpath) $(user-defined-trusted-dirs))" \
318 |
$(AWK
) -f gen-trusted-dirs.awk
> ${@
:st
=T
};
319 echo
'#define DL_DST_LIB "$(notdir $(slibdir))"' >> ${@
:st
=T
}
320 $(move-if-change
) ${@
:st
=T
} ${@
:st
=h
}
322 CPPFLAGS-dl-load.c
= -I
$(objpfx
).
-I
$(csu-objpfx
).
324 ifeq (yes
,$(build-shared
))
325 $(inst_slibdir
)/$(rtld-version-installed-name
): $(objpfx
)ld.so
$(+force)
326 $(make-target-directory
)
327 $(do-install-program
)
329 $(inst_slibdir
)/$(rtld-installed-name
): \
330 $(inst_slibdir
)/$(rtld-version-installed-name
) \
331 $(inst_slibdir
)/libc-
$(version
).so
334 # Special target called by parent to install just the dynamic linker.
336 ldso_install
: $(inst_slibdir
)/$(rtld-installed-name
)
340 common-ldd-rewrite
= -e
's%@RTLD@%$(slibdir)/$(rtld-installed-name)%g' \
341 -e
's%@VERSION@%$(version)%g'
342 sh-ldd-rewrite
= $(common-ldd-rewrite
) -e
's%@BASH@%/bin/sh%g;s/\$$"/"/g'
343 bash-ldd-rewrite
= $(common-ldd-rewrite
) -e
's%@BASH@%$(BASH)%g' \
344 -e
's%@TEXTDOMAINDIR@%$(msgcatdir)%g'
346 ifneq ($(have-bash2
),yes
)
352 ifeq ($(ldd-rewrite-script
),no
)
354 LC_ALL
=C sed
$($(ldd-shell
)-ldd-rewrite
) < $< > $@.new
358 LC_ALL
=C sed
$($(ldd-shell
)-ldd-rewrite
) < $< | LC_ALL
=C sed
-f
$(ldd-rewrite-script
) > $@.new
362 $(objpfx
)ldd
: ldd.bash.in
$(common-objpfx
)soversions.mk \
363 $(common-objpfx
)config.make
368 $(objpfx
)sprof
: $(libdl
)
370 $(objpfx
)ldconfig
: $(ldconfig-modules
:%=$(objpfx
)%.o
)
371 SYSCONF-FLAGS
:= -D
'SYSCONFDIR="$(sysconfdir)"'
372 CFLAGS-ldconfig.c
= $(SYSCONF-FLAGS
) -D
'LIBDIR="$(libdir)"' \
373 -D
'SLIBDIR="$(slibdir)"' -DIS_IN_ldconfig
=1
374 CFLAGS-dl-cache.c
= $(SYSCONF-FLAGS
)
375 CFLAGS-cache.c
= $(SYSCONF-FLAGS
)
377 CPPFLAGS-.os
+= $(if
$(filter $(@F
),$(patsubst %,%.os
,$(all-rtld-routines
))),-DNOT_IN_libc
=1 -DIS_IN_rtld
=1)
379 test-modules
= $(addprefix $(objpfx
),$(addsuffix .so
,$(strip $(modules-names
))))
380 generated
+= $(addsuffix .so
,$(strip $(modules-names
)))
382 ifeq (yes
,$(build-shared
))
383 ifeq ($(cross-compiling
),no
)
384 tests
: $(objpfx
)tst-pathopt.out
388 $(objpfx
)testobj1.so
: $(libdl
)
389 $(objpfx
)testobj1_1.so
: $(objpfx
)testobj1.so
$(libdl
)
390 $(objpfx
)testobj2.so
: $(objpfx
)testobj1.so
$(libdl
)
391 $(objpfx
)testobj3.so
: $(libdl
)
392 $(objpfx
)testobj4.so
: $(libdl
)
393 $(objpfx
)testobj5.so
: $(libdl
)
394 $(objpfx
)testobj6.so
: $(objpfx
)testobj1.so
$(objpfx
)testobj2.so
$(libdl
)
395 $(objpfx
)failobj.so
: $(objpfx
)testobj6.so
396 $(objpfx
)dep1.so
: $(objpfx
)dep2.so
$(objpfx
)dep4.so
397 $(objpfx
)dep2.so
: $(objpfx
)dep3.so
$(objpfx
)dep4.so
398 $(objpfx
)dep4.so
: $(objpfx
)dep3.so
399 $(objpfx
)nodelmod3.so
: $(objpfx
)nodelmod4.so
400 $(objpfx
)nextmod1.so
: $(libdl
)
401 $(objpfx
)neededobj1.so
: $(libdl
)
402 $(objpfx
)neededobj2.so
: $(objpfx
)neededobj1.so
$(libdl
)
403 $(objpfx
)neededobj3.so
: $(objpfx
)neededobj1.so
$(objpfx
)neededobj2.so
$(libdl
)
404 $(objpfx
)neededobj4.so
: $(objpfx
)neededobj1.so
$(objpfx
)neededobj2.so \
405 $(objpfx
)neededobj3.so
$(libdl
)
406 $(objpfx
)neededobj6.so
: $(objpfx
)neededobj5.so
407 $(objpfx
)unload2mod.so
: $(objpfx
)unload2dep.so
408 $(objpfx
)ltglobmod2.so
: $(libdl
)
409 $(objpfx
)firstobj.so
: $(shared-thread-library
)
410 $(objpfx
)globalmod1.so
: $(libdl
)
411 $(objpfx
)reldep4mod1.so
: $(objpfx
)reldep4mod3.so
412 $(objpfx
)reldep4mod2.so
: $(objpfx
)reldep4mod4.so
413 $(objpfx
)dblloadmod1.so
: $(objpfx
)dblloadmod3.so
414 $(objpfx
)dblloadmod2.so
: $(objpfx
)dblloadmod3.so
415 $(objpfx
)reldepmod5.so
: $(objpfx
)reldepmod2.so
416 $(objpfx
)reldepmod6.so
: $(objpfx
)reldepmod2.so
417 $(objpfx
)reldep6mod1.so
: $(objpfx
)reldep6mod0.so
418 $(objpfx
)reldep6mod2.so
: $(objpfx
)reldep6mod1.so
419 $(objpfx
)reldep6mod3.so
: $(objpfx
)reldep6mod2.so
420 $(objpfx
)reldep6mod4.so
: $(objpfx
)reldep6mod1.so
421 $(objpfx
)tst-tlsmod3.so
: $(objpfx
)tst-tlsmod2.so
422 $(objpfx
)tst-tlsmod8.so
: $(objpfx
)tst-tlsmod7.so
423 $(objpfx
)tst-tlsmod10.so
: $(objpfx
)tst-tlsmod9.so
424 $(objpfx
)tst-tlsmod12.so
: $(objpfx
)tst-tlsmod11.so
425 $(objpfx
)tst-tlsmod13a.so
: $(objpfx
)tst-tlsmod13.so
426 # For tst-tls9-static, make sure the modules it dlopens have libc.so in DT_NEEDED
427 $(objpfx
)tst-tlsmod5.so
: $(common-objpfx
)libc.so
428 $(objpfx
)tst-tlsmod6.so
: $(common-objpfx
)libc.so
429 $(objpfx
)reldep8mod3.so
: $(objpfx
)reldep8mod1.so
$(objpfx
)reldep8mod2.so
430 $(objpfx
)nodel2mod3.so
: $(objpfx
)nodel2mod1.so
$(objpfx
)nodel2mod2.so
431 $(objpfx
)reldep9mod2.so
: $(objpfx
)reldep9mod1.so
432 $(objpfx
)reldep9mod3.so
: $(objpfx
)reldep9mod1.so
$(objpfx
)reldep9mod2.so
433 $(objpfx
)unload3mod1.so
: $(objpfx
)unload3mod3.so
434 $(objpfx
)unload3mod2.so
: $(objpfx
)unload3mod3.so
435 $(objpfx
)unload3mod3.so
: $(objpfx
)unload3mod4.so
436 $(objpfx
)unload4mod1.so
: $(objpfx
)unload4mod2.so
$(objpfx
)unload4mod3.so
437 $(objpfx
)unload4mod2.so
: $(objpfx
)unload4mod4.so
$(objpfx
)unload4mod3.so
438 $(objpfx
)unload6mod1.so
: $(libdl
)
439 $(objpfx
)unload6mod2.so
: $(libdl
)
440 $(objpfx
)unload6mod3.so
: $(libdl
)
442 LDFLAGS-tst-tlsmod5.so
= -nostdlib
443 LDFLAGS-tst-tlsmod6.so
= -nostdlib
445 testobj1.so-no-z-defs
= yes
446 testobj3.so-no-z-defs
= yes
447 testobj4.so-no-z-defs
= yes
448 testobj5.so-no-z-defs
= yes
449 testobj6.so-no-z-defs
= yes
450 failobj.so-no-z-defs
= yes
451 constload2.so-no-z-defs
= yes
452 constload3.so-no-z-defs
= yes
453 nodelmod1.so-no-z-defs
= yes
454 nodelmod2.so-no-z-defs
= yes
455 nodelmod4.so-no-z-defs
= yes
456 nodel2mod2.so-no-z-defs
= yes
457 reldepmod2.so-no-z-defs
= yes
458 reldepmod3.so-no-z-defs
= yes
459 reldepmod4.so-no-z-defs
= yes
460 reldep4mod4.so-no-z-defs
= yes
461 reldep4mod2.so-no-z-defs
= yes
462 ltglobmod2.so-no-z-defs
= yes
463 dblloadmod3.so-no-z-defs
= yes
464 tst-tlsmod1.so-no-z-defs
= yes
465 tst-tlsmod2.so-no-z-defs
= yes
466 tst-tlsmod3.so-no-z-defs
= yes
467 tst-tlsmod4.so-no-z-defs
= yes
468 tst-tlsmod7.so-no-z-defs
= yes
469 tst-tlsmod8.so-no-z-defs
= yes
470 tst-tlsmod9.so-no-z-defs
= yes
471 tst-tlsmod10.so-no-z-defs
= yes
472 tst-tlsmod12.so-no-z-defs
= yes
473 tst-tlsmod14a.so-no-z-defs
= yes
474 tst-tlsmod14b.so-no-z-defs
= yes
475 circlemod2.so-no-z-defs
= yes
476 circlemod3.so-no-z-defs
= yes
477 circlemod3a.so-no-z-defs
= yes
478 reldep8mod2.so-no-z-defs
= yes
479 reldep9mod1.so-no-z-defs
= yes
480 unload3mod4.so-no-z-defs
= yes
481 unload4mod1.so-no-z-defs
= yes
483 # filtmod1.so has a special rule
484 $(filter-out $(objpfx
)filtmod1.so
, $(test-modules
)): $(objpfx
)%.so
: $(objpfx
)%.os
487 ifeq ($(build-shared
),yes
)
488 # Build all the modules even when not actually running test programs.
489 tests
: $(test-modules
)
492 $(objpfx
)loadtest
: $(libdl
)
493 LDFLAGS-loadtest
= -rdynamic
495 $(objpfx
)loadtest.out
: $(test-modules
)
497 $(objpfx
)neededtest
: $(libdl
)
498 $(objpfx
)neededtest.out
: $(objpfx
)neededobj1.so
$(objpfx
)neededobj2.so \
499 $(objpfx
)neededobj3.so
501 $(objpfx
)neededtest2
: $(libdl
)
502 $(objpfx
)neededtest2.out
: $(objpfx
)neededobj1.so
$(objpfx
)neededobj2.so \
503 $(objpfx
)neededobj3.so
505 $(objpfx
)neededtest3
: $(libdl
)
506 $(objpfx
)neededtest3.out
: $(objpfx
)neededobj1.so
$(objpfx
)neededobj2.so \
507 $(objpfx
)neededobj3.so
$(objpfx
)neededobj4.so
509 neededtest4-ENV
= LC_ALL
=C LANGUAGE
=C
510 $(objpfx
)neededtest4
: $(libdl
) $(objpfx
)neededobj1.so
511 $(objpfx
)neededtest4.out
: $(objpfx
)neededobj5.so
$(objpfx
)neededobj6.so
513 $(objpfx
)restest1
: $(objpfx
)testobj1.so
$(objpfx
)testobj1_1.so
$(libdl
)
514 LDFLAGS-restest1
= -rdynamic
516 $(objpfx
)restest2
: $(libdl
)
517 LDFLAGS-restest2
= -rdynamic
519 $(objpfx
)restest1.out
: $(test-modules
)
521 preloadtest-preloads
= testobj1 testobj2 testobj3 testobj4 testobj5
522 $(objpfx
)preloadtest
: $(objpfx
)testobj6.so
523 LDFLAGS-preloadtest
= -rdynamic
524 $(objpfx
)preloadtest.out
: $(preloadtest-preloads
:%=$(objpfx
)%.so
)
526 LD_PRELOAD
=$(subst $(empty
) ,:,$(strip $(preloadtest-preloads
:=.so
)))
528 $(objpfx
)loadfail
: $(libdl
)
529 LDFLAGS-loadfail
= -rdynamic
531 $(objpfx
)loadfail.out
: $(objpfx
)failobj.so
533 $(objpfx
)multiload
: $(libdl
)
534 LDFLAGS-multiload
= -rdynamic
535 CFLAGS-multiload.c
= -DOBJDIR
=\"$(elf-objpfx
)\"
537 $(objpfx
)multiload.out
: $(objpfx
)testobj1.so
539 $(objpfx
)origtest
: $(libdl
)
540 LDFLAGS-origtest
= -rdynamic
541 $(objpfx
)origtest.out
: $(objpfx
)testobj1.so
543 ifeq ($(have-thread-library
),yes
)
544 $(objpfx
)resolvfail
: $(libdl
) $(shared-thread-library
)
546 $(objpfx
)resolvfail
: $(libdl
)
549 $(objpfx
)constload1
: $(libdl
)
550 $(objpfx
)constload1.out
: $(objpfx
)constload2.so
$(objpfx
)constload3.so
552 $(objpfx
)circleload1
: $(libdl
)
553 $(objpfx
)circleload1.out
: $(objpfx
)circlemod1.so \
554 $(objpfx
)circlemod1a.so
556 $(objpfx
)circlemod1.so
: $(objpfx
)circlemod2.so
557 $(objpfx
)circlemod2.so
: $(objpfx
)circlemod3.so
558 $(objpfx
)circlemod1a.so
: $(objpfx
)circlemod2a.so
559 $(objpfx
)circlemod2a.so
: $(objpfx
)circlemod3a.so
561 $(objpfx
)order
: $(addprefix $(objpfx
),dep4.so dep3.so dep2.so dep1.so
)
563 $(objpfx
)order.out
: $(objpfx
)order
564 $(elf-objpfx
)$(rtld-installed-name
) \
565 --library-path
$(rpath-link
)$(patsubst %,:%,$(sysdep-library-path
)) \
567 (echo
"0123456789" | cmp
$@
-) > /dev
/null
569 $(objpfx
)vismain
: $(addprefix $(objpfx
),vismod1.so vismod2.so
)
570 $(objpfx
)vismain.out
: $(addprefix $(objpfx
),vismod3.so
)
571 vismain-ENV
= LD_PRELOAD
=$(addprefix $(objpfx
),vismod3.so
)
573 $(objpfx
)noload
: $(objpfx
)testobj1.so
574 LDFLAGS-noload
= -rdynamic
575 $(objpfx
)noload.out
: $(objpfx
)testobj5.so
577 LDFLAGS-nodelete
= -rdynamic
578 LDFLAGS-nodelmod1.so
= -Wl
,--enable-new-dtags
,-z
,nodelete
579 LDFLAGS-nodelmod4.so
= -Wl
,--enable-new-dtags
,-z
,nodelete
580 $(objpfx
)nodelete
: $(libdl
)
581 $(objpfx
)nodelete.out
: $(objpfx
)nodelmod1.so
$(objpfx
)nodelmod2.so \
582 $(objpfx
)nodelmod3.so
584 LDFLAGS-nodlopenmod.so
= -Wl
,--enable-new-dtags
,-z
,nodlopen
585 $(objpfx
)nodlopen
: $(libdl
)
586 $(objpfx
)nodlopen.out
: $(objpfx
)nodlopenmod.so
588 $(objpfx
)nodlopenmod2.so
: $(objpfx
)nodlopenmod.so
589 $(objpfx
)nodlopen2
: $(libdl
)
590 $(objpfx
)nodlopen2.out
: $(objpfx
)nodlopenmod2.so
592 $(objpfx
)filtmod1.so
: $(objpfx
)filtmod1.os
$(objpfx
)filtmod2.so
593 $(LINK.o
) -shared
-o
$@
-B
$(csu-objpfx
) $(LDFLAGS.so
) \
594 -L
$(subst :, -L
,$(rpath-link
)) \
595 -Wl
,-rpath-link
=$(rpath-link
) \
596 $< -Wl
,-F
,$(objpfx
)filtmod2.so
597 $(objpfx
)filter: $(objpfx
)filtmod1.so
599 $(objpfx
)unload
: $(libdl
)
600 $(objpfx
)unload.out
: $(objpfx
)unloadmod.so
602 $(objpfx
)reldep
: $(libdl
)
603 $(objpfx
)reldep.out
: $(objpfx
)reldepmod1.so
$(objpfx
)reldepmod2.so
605 $(objpfx
)reldep2
: $(libdl
)
606 $(objpfx
)reldep2.out
: $(objpfx
)reldepmod1.so
$(objpfx
)reldepmod3.so
608 $(objpfx
)reldep3
: $(libdl
)
609 $(objpfx
)reldep3.out
: $(objpfx
)reldepmod1.so
$(objpfx
)reldepmod4.so
611 $(objpfx
)reldep4
: $(libdl
)
612 $(objpfx
)reldep4.out
: $(objpfx
)reldep4mod1.so
$(objpfx
)reldep4mod2.so
614 $(objpfx
)next
: $(objpfx
)nextmod1.so
$(objpfx
)nextmod2.so
$(libdl
)
616 $(objpfx
)unload2
: $(libdl
)
617 $(objpfx
)unload2.out
: $(objpfx
)unload2mod.so
$(objpfx
)unload2dep.so
619 $(objpfx
)lateglobal
: $(libdl
)
620 $(objpfx
)lateglobal.out
: $(objpfx
)ltglobmod1.so
$(objpfx
)ltglobmod2.so
622 $(objpfx
)tst-pathopt
: $(libdl
)
623 $(objpfx
)tst-pathopt.out
: tst-pathopt.sh
$(objpfx
)tst-pathopt \
624 $(objpfx
)pathoptobj.so
625 $(SHELL
) -e
$< $(common-objpfx
)
627 $(objpfx
)initfirst
: $(libdl
)
628 $(objpfx
)initfirst.out
: $(objpfx
)firstobj.so
630 $(objpfx
)global
: $(objpfx
)globalmod1.so
631 $(objpfx
)global.out
: $(objpfx
)reldepmod1.so
633 $(objpfx
)dblload
: $(libdl
)
634 $(objpfx
)dblload.out
: $(objpfx
)dblloadmod1.so
$(objpfx
)dblloadmod2.so
636 $(objpfx
)dblunload
: $(libdl
)
637 $(objpfx
)dblunload.out
: $(objpfx
)dblloadmod1.so
$(objpfx
)dblloadmod2.so
639 $(objpfx
)reldep5
: $(libdl
)
640 $(objpfx
)reldep5.out
: $(objpfx
)reldepmod5.so
$(objpfx
)reldepmod5.so
642 $(objpfx
)reldep6
: $(libdl
)
643 $(objpfx
)reldep6.out
: $(objpfx
)reldep6mod3.so
$(objpfx
)reldep6mod4.so
645 $(objpfx
)reldep7
: $(libdl
)
646 $(objpfx
)reldep7.out
: $(objpfx
)reldep7mod1.so
$(objpfx
)reldep7mod2.so
648 $(objpfx
)reldep8
: $(libdl
)
649 $(objpfx
)reldep8.out
: $(objpfx
)reldep8mod3.so
651 LDFLAGS-nodel2mod2.so
= -Wl
,--enable-new-dtags
,-z
,nodelete
652 $(objpfx
)nodelete2
: $(libdl
)
653 $(objpfx
)nodelete2.out
: $(objpfx
)nodel2mod3.so
655 $(objpfx
)reldep9
: $(libdl
)
656 $(objpfx
)reldep9.out
: $(objpfx
)reldep9mod3.so
658 $(objpfx
)tst-tls3
: $(objpfx
)tst-tlsmod1.so
660 $(objpfx
)tst-tls4
: $(libdl
)
661 $(objpfx
)tst-tls4.out
: $(objpfx
)tst-tlsmod2.so
663 $(objpfx
)tst-tls5
: $(libdl
)
664 $(objpfx
)tst-tls5.out
: $(objpfx
)tst-tlsmod2.so
666 $(objpfx
)tst-tls6
: $(libdl
)
667 $(objpfx
)tst-tls6.out
: $(objpfx
)tst-tlsmod2.so
669 $(objpfx
)tst-tls7
: $(libdl
)
670 $(objpfx
)tst-tls7.out
: $(objpfx
)tst-tlsmod3.so
672 $(objpfx
)tst-tls8
: $(libdl
)
673 $(objpfx
)tst-tls8.out
: $(objpfx
)tst-tlsmod3.so
$(objpfx
)tst-tlsmod4.so
675 $(objpfx
)tst-tls9
: $(libdl
)
676 $(objpfx
)tst-tls9.out
: $(objpfx
)tst-tlsmod5.so
$(objpfx
)tst-tlsmod6.so
678 $(objpfx
)tst-tls10
: $(objpfx
)tst-tlsmod8.so
680 $(objpfx
)tst-tls11
: $(objpfx
)tst-tlsmod10.so
682 $(objpfx
)tst-tls12
: $(objpfx
)tst-tlsmod12.so
684 $(objpfx
)tst-tls13
: $(libdl
)
685 $(objpfx
)tst-tls13.out
: $(objpfx
)tst-tlsmod13a.so
687 $(objpfx
)tst-tls14
: $(objpfx
)tst-tlsmod14a.so
$(libdl
)
688 $(objpfx
)tst-tls14.out
:$(objpfx
)tst-tlsmod14b.so
690 CFLAGS-tst-align.c
= $(stack-align-test-flags
)
691 CFLAGS-tst-align2.c
= $(stack-align-test-flags
)
692 CFLAGS-tst-alignmod.c
= $(stack-align-test-flags
)
693 CFLAGS-tst-alignmod2.c
= $(stack-align-test-flags
)
694 $(objpfx
)tst-align
: $(libdl
)
695 $(objpfx
)tst-align.out
: $(objpfx
)tst-alignmod.so
696 $(objpfx
)tst-align2
: $(objpfx
)tst-alignmod2.so
698 $(objpfx
)unload3
: $(libdl
)
699 $(objpfx
)unload3.out
: $(objpfx
)unload3mod1.so
$(objpfx
)unload3mod2.so \
700 $(objpfx
)unload3mod3.so
$(objpfx
)unload3mod4.so
702 $(objpfx
)unload4
: $(libdl
)
703 $(objpfx
)unload4.out
: $(objpfx
)unload4mod1.so
$(objpfx
)unload4mod3.so
705 $(objpfx
)unload5
: $(libdl
)
706 $(objpfx
)unload5.out
: $(objpfx
)unload3mod1.so
$(objpfx
)unload3mod2.so \
707 $(objpfx
)unload3mod3.so
$(objpfx
)unload3mod4.so
709 $(objpfx
)unload6
: $(libdl
)
710 $(objpfx
)unload6.out
: $(objpfx
)unload6mod1.so
$(objpfx
)unload6mod2.so \
711 $(objpfx
)unload6mod3.so
714 $(objpfx
)tst-tls9-static
: $(common-objpfx
)dlfcn
/libdl.a
715 $(objpfx
)tst-tls9-static.out
: $(objpfx
)tst-tlsmod5.so
$(objpfx
)tst-tlsmod6.so
718 ifeq ($(have-z-execstack
),yes
)
719 $(objpfx
)tst-execstack
: $(libdl
)
720 $(objpfx
)tst-execstack.out
: $(objpfx
)tst-execstack-mod.so
721 LDFLAGS-tst-execstack
= -Wl
,-z
,noexecstack
722 LDFLAGS-tst-execstack-mod
= -Wl
,-z
,execstack
724 $(objpfx
)tst-execstack-needed
: $(objpfx
)tst-execstack-mod.so
725 LDFLAGS-tst-execstack-needed
= -Wl
,-z
,noexecstack
727 LDFLAGS-tst-execstack-prog
= -Wl
,-z
,execstack
730 $(objpfx
)tst-array1.out
: $(objpfx
)tst-array1
731 $(elf-objpfx
)$(rtld-installed-name
) \
732 --library-path
$(rpath-link
)$(patsubst %,:%,$(sysdep-library-path
)) \
733 $(objpfx
)tst-array1
> $@
734 cmp
$@ tst-array1.exp
> /dev
/null
736 $(objpfx
)tst-array2
: $(objpfx
)tst-array2dep.so
737 $(objpfx
)tst-array2.out
: $(objpfx
)tst-array2
738 $(elf-objpfx
)$(rtld-installed-name
) \
739 --library-path
$(rpath-link
)$(patsubst %,:%,$(sysdep-library-path
)) \
740 $(objpfx
)tst-array2
> $@
741 cmp
$@ tst-array2.exp
> /dev
/null
743 $(objpfx
)tst-array3.out
: $(objpfx
)tst-array3
744 $(elf-objpfx
)$(rtld-installed-name
) \
745 --library-path
$(rpath-link
)$(patsubst %,:%,$(sysdep-library-path
)) \
746 $(objpfx
)tst-array3
> $@
747 cmp
$@ tst-array1.exp
> /dev
/null
749 $(objpfx
)tst-array4
: $(libdl
)
750 $(objpfx
)tst-array4.out
: $(objpfx
)tst-array4
$(objpfx
)tst-array2dep.so
751 $(elf-objpfx
)$(rtld-installed-name
) \
752 --library-path
$(rpath-link
)$(patsubst %,:%,$(sysdep-library-path
)) \
754 cmp
$@ tst-array4.exp
> /dev
/null
756 ifeq (yesyes
,$(have-fpie
)$(build-shared
))
757 CFLAGS-tst-pie1.c
+= -fpie
759 $(objpfx
)tst-pie1.out
: $(objpfx
)tst-pie1
760 $(elf-objpfx
)$(rtld-installed-name
) \
761 --library-path
$(rpath-link
)$(patsubst %,:%,$(sysdep-library-path
)) \
764 $(objpfx
)tst-pie1
: $(objpfx
)tst-pie1.o
$(objpfx
)tst-piemod1.so
765 $(LINK.o
) -pie
-Wl
,-O1 \
766 $(sysdep-LDFLAGS
) $(config-LDFLAGS
) \
767 $(extra-B-
$(@F
:lib
%.so
=%).so
) -B
$(csu-objpfx
) \
768 $(extra-B-
$(@F
:lib
%.so
=%).so
) $(load-map-file
) \
769 $(LDFLAGS
) $(LDFLAGS-
$(@F
)) \
770 -L
$(subst :, -L
,$(rpath-link
)) -Wl
,-rpath-link
=$(rpath-link
) \
771 -o
$@
$(objpfx
)tst-pie1.o
$(objpfx
)tst-piemod1.so \
772 $(common-objpfx
)libc_nonshared.a
774 generated
+= tst-pie1 tst-pie1.out tst-pie1.o
777 check-textrel-CFLAGS
= -O
-Wall
-D_XOPEN_SOURCE
=600 -D_BSD_SOURCE
778 $(objpfx
)check-textrel
: check-textrel.c
781 ifeq (yes
,$(build-shared
))
782 tests
: $(objpfx
)check-textrel.out
784 $(objpfx
)check-textrel.out
: $(objpfx
)check-textrel
785 $(dir $<)$(notdir $<) $(common-objpfx
)libc.so \
786 $(sort $(wildcard $(common-objpfx
)*/lib
*.so \
787 $(common-objpfx
)iconvdata
/*.so
)) > $@
788 generated
+= check-textrel check-textrel.out
790 $(objpfx
)tst-dlmodcount
: $(libdl
)
791 $(objpfx
)tst-dlmodcount.out
: $(test-modules
)
795 $(objpfx
)tst-dlopenrpathmod.so
: $(libdl
)
796 $(objpfx
)tst-dlopenrpath
: $(objpfx
)tst-dlopenrpathmod.so
$(libdl
)
797 CFLAGS-tst-dlopenrpath.c
+= -DPFX
=\"$(objpfx
)\"
798 LDFLAGS-tst-dlopenrpathmod.so
+= -Wl
,-rpath
,\
$$ORIGIN/test-subdir
799 $(objpfx
)tst-dlopenrpath.out
: $(objpfx
)firstobj.so
801 $(objpfx
)tst-deep1mod2.so
: $(objpfx
)tst-deep1mod3.so
802 $(objpfx
)tst-deep1
: $(libdl
) $(objpfx
)tst-deep1mod1.so
803 $(objpfx
)tst-deep1.out
: $(objpfx
)tst-deep1mod2.so
804 LDFLAGS-tst-deep1
+= -rdynamic
805 tst-deep1mod3.so-no-z-defs
= yes
807 $(objpfx
)tst-dlmopen1mod.so
: $(libdl
)
808 $(objpfx
)tst-dlmopen1
: $(libdl
)
809 $(objpfx
)tst-dlmopen1.out
: $(objpfx
)tst-dlmopen1mod.so
811 $(objpfx
)tst-dlmopen2
: $(libdl
)
812 $(objpfx
)tst-dlmopen2.out
: $(objpfx
)tst-dlmopen1mod.so
814 $(objpfx
)tst-dlmopen3
: $(libdl
)
815 $(objpfx
)tst-dlmopen3.out
: $(objpfx
)tst-dlmopen1mod.so
817 $(objpfx
)tst-global1
: $(libdl
)
818 $(objpfx
)tst-global1.out
: $(objpfx
)testobj6.so
$(objpfx
)testobj2.so
820 $(objpfx
)order2
: $(libdl
)
821 $(objpfx
)order2.out
: $(objpfx
)order2
$(objpfx
)order2mod1.so \
822 $(objpfx
)order2mod2.so
823 $(elf-objpfx
)$(rtld-installed-name
) \
824 --library-path
$(rpath-link
)$(patsubst %,:%,$(sysdep-library-path
)) \
826 (echo
"12345" | cmp
$@
-) > /dev
/null
827 $(objpfx
)order2mod1.so
: $(objpfx
)order2mod4.so
828 $(objpfx
)order2mod4.so
: $(objpfx
)order2mod3.so
829 $(objpfx
)order2mod2.so
: $(objpfx
)order2mod3.so
830 order2mod2.so-no-z-defs
= yes