Add rules to build and run reldep9 test.
[kopensolaris-gnu/glibc.git] / elf / Makefile
1 # Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
3
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.
8
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.
13
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
17 # 02111-1307 USA.
18
19 # Makefile for elf subdirectory of GNU C Library.
20
21 subdir          := elf
22
23 headers         = elf.h bits/elfclass.h link.h
24 routines        = $(dl-routines) dl-open dl-close dl-support dl-iteratephdr \
25                   dl-iteratephdr-static dl-addr enbl-secure dl-profstub \
26                   dl-origin dl-libc dl-sym dl-tsd
27
28 # The core dynamic linking functions are in libc for the static and
29 # profiled libraries.
30 dl-routines     = $(addprefix dl-,load cache lookup object reloc deps \
31                                   runtime error init fini debug misc \
32                                   version profile conflict tls origin)
33 all-dl-routines = $(dl-routines) $(sysdep-dl-routines)
34 # But they are absent from the shared libc, because that code is in ld.so.
35 elide-routines.os = $(all-dl-routines) dl-support enbl-secure \
36                     dl-iteratephdr-static dl-origin
37
38 # ld.so uses those routines, plus some special stuff for being the program
39 # interpreter and operating independent of libc.
40 rtld-routines   := rtld $(dl-routines) dl-sysdep dl-environ dl-minimal
41 all-rtld-routines = $(rtld-routines) $(sysdep-rtld-routines)
42
43 distribute      := rtld-Rules \
44                    $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \
45                    dl-cache.h dl-hash.h soinit.c sofini.c ldd.bash.in \
46                    genrtldtbl.awk atomicity.h dl-procinfo.h ldsodefs.h \
47                    dl-librecon.h interp.c sln.c dl-dst.h hp-timing.h \
48                    do-lookup.h dl-lookupcfg.h sprof.c gen-trusted-dirs.awk \
49                    testobj1.c testobj2.c testobj3.c testobj4.c testobj5.c \
50                    testobj6.c testobj1_1.c failobj.c unloadmod.c \
51                    ldconfig.h ldconfig.c cache.c readlib.c readelflib.c \
52                    chroot_canon.c gccframe.h \
53                    dep1.c dep2.c dep3.c dep4.c dl-dtprocnum.h unsecvars.h \
54                    vismain.c vismod1.c vismod2.c vismod3.c \
55                    constload2.c constload3.c filtmod1.c filtmod2.c \
56                    nodlopenmod.c nodelete.c nodelmod1.c nodelmod2.c \
57                    nodelmod3.c nodelmod4.c nodlopen.c dl-osinfo.h \
58                    reldepmod1.c reldepmod2.c reldepmod3.c reldepmod4.c \
59                    reldepmod5.c reldepmod6.c \
60                    reldep4mod1.c reldep4mod2.c reldep4mod3.c reldep4mod4.c \
61                    nextmod1.c nextmod2.c pathoptobj.c tst-pathopt.sh \
62                    neededobj1.c neededobj2.c neededobj3.c neededobj4.c \
63                    neededobj5.c neededobj6.c firstobj.c \
64                    unload2mod.c unload2dep.c ltglobmod1.c ltglobmod2.c \
65                    testobj.h vismod.h globalmod1.c \
66                    dblloadmod1.c dblloadmod2.c dblloadmod3.c \
67                    reldep6mod4.c reldep6mod3.c reldep6mod2.c reldep6mod1.c \
68                    reldep6mod0.c reldep7mod1.c reldep7mod2.c \
69                    unwind-dw2.c unwind-dw2-fde.c unwind.h unwind-pe.h \
70                    unwind-dw2-fde.h dwarf2.h dl-procinfo.c tls.h dl-tls.h \
71                    tst-tlsmod1.c tst-tlsmod2.c tst-tlsmod3.c tst-tlsmod4.c \
72                    tst-tlsmod5.c tst-tlsmod6.c \
73                    circlemod1.c circlemod1a.c circlemod2.c circlemod2a.c \
74                    circlemod3.c circlemod3a.c nodlopenmod2.c \
75                    tls-macros.h \
76                    reldep8mod1.c reldep8mod2.c reldep8mod3.c \
77                    nodel2mod1.c nodel2mod2.c nodel2mod3.c \
78                    reldep9mod1.c reldep9mod2.c reldep9mod3.c
79
80 include ../Makeconfig
81
82 ifeq ($(unwind-find-fde),yes)
83 routines += unwind-dw2-fde-glibc
84 shared-only-routines = unwind-dw2-fde-glibc
85 endif
86
87 before-compile  = $(objpfx)trusted-dirs.h
88 generated       := trusted-dirs.h trusted-dirs.st for-renamed/renamed.so
89 generated-dirs  := for-renamed
90
91 ifeq ($(versioning),yes)
92 ld-map          = $(common-objpfx)ld.map
93 endif
94
95 ifeq (yes,$(build-shared))
96 extra-objs      = $(all-rtld-routines:%=%.os) soinit.os sofini.os interp.os
97 generated       += librtld.os dl-allobjs.os ld.so ldd
98 install-others  = $(inst_slibdir)/$(rtld-installed-name)
99 install-bin-script = ldd
100 endif
101
102 others          = sprof sln
103 install-bin     = sprof
104 others-static   = sln
105 install-rootsbin = sln
106
107 ifeq (yes,$(use-ldconfig))
108 ifeq (yes,$(build-shared))
109 others-static   += ldconfig
110 others          += ldconfig
111 install-rootsbin += ldconfig
112
113 ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon
114 extra-objs      += $(ldconfig-modules:=.o)
115
116 # To find xmalloc.c and xstrdup.c
117 vpath %.c ../locale/programs
118
119 endif
120 endif
121
122 tests = tst-tls1 tst-tls2 tst-tls9
123 ifeq (yes,$(have-initfini-array))
124 tests += tst-array1 tst-array2 tst-array3
125 endif
126 ifeq (yes,$(build-static))
127 tests-static = tst-tls1-static tst-tls2-static
128 ifeq (yesyesyes,$(build-static)$(build-shared)$(elf))
129 tests-static += tst-tls9-static
130 tst-tls9-static-ENV = \
131         LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn
132 endif
133 tests += $(tests-static)
134 endif
135 ifeq (yes,$(build-shared))
136 tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
137          constload1 order $(tests-vis-$(have-protected)) noload filter unload \
138          reldep reldep2 reldep3 reldep4 $(tests-nodelete-$(have-z-nodelete)) \
139          $(tests-nodlopen-$(have-z-nodlopen)) neededtest neededtest2 \
140          neededtest3 neededtest4 unload2 lateglobal initfirst global \
141          restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
142          circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8
143 #        reldep9
144 test-srcs = tst-pathopt
145 tests-vis-yes = vismain
146 tests-nodelete-yes = nodelete nodelete2
147 tests-nodlopen-yes = nodlopen nodlopen2
148 endif
149 modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
150                 testobj1_1 failobj constload2 constload3 unloadmod \
151                 dep1 dep2 dep3 dep4 $(modules-vis-$(have-protected)) \
152                 $(modules-nodelete-$(have-z-nodelete)) \
153                 $(modules-nodlopen-$(have-z-nodlopen)) filtmod1 filtmod2 \
154                 reldepmod1 reldepmod2 reldepmod3 reldepmod4 nextmod1 nextmod2 \
155                 reldep4mod1 reldep4mod2 reldep4mod3 reldep4mod4 \
156                 neededobj1 neededobj2 neededobj3 neededobj4 \
157                 neededobj5 neededobj6 firstobj globalmod1 \
158                 unload2mod unload2dep ltglobmod1 ltglobmod2 pathoptobj \
159                 dblloadmod1 dblloadmod2 dblloadmod3 reldepmod5 reldepmod6 \
160                 reldep6mod0 reldep6mod1 reldep6mod2 reldep6mod3 reldep6mod4 \
161                 reldep7mod1 reldep7mod2 \
162                 tst-tlsmod1 tst-tlsmod2 tst-tlsmod3 tst-tlsmod4 \
163                 tst-tlsmod5 tst-tlsmod6 \
164                 circlemod1 circlemod1a circlemod2 circlemod2a \
165                 circlemod3 circlemod3a \
166                 reldep8mod1 reldep8mod2 reldep8mod3 \
167                 reldep9mod1 reldep9mod2 reldep9mod3
168 ifeq (yes,$(have-initfini-array))
169 modules-names += tst-array2dep
170 endif
171 modules-vis-yes = vismod1 vismod2 vismod3
172 modules-nodelete-yes = nodelmod1 nodelmod2 nodelmod3 nodelmod4 \
173                        nodel2mod1 nodel2mod2 nodel2mod3
174 modules-nodlopen-yes = nodlopenmod nodlopenmod2
175 extra-objs += $(addsuffix .os,$(strip $(modules-names)))
176 # We need this variable to be sure the test modules get the right CPPFLAGS.
177 test-extras += $(modules-names)
178
179 include ../Rules
180
181 ifeq (yes,$(build-shared))
182 # Make sure these things are built in the `make lib' pass so they can be used
183 # to run programs during the `make others' pass.
184 lib-noranlib: $(objpfx)$(rtld-installed-name) \
185               $(addprefix $(objpfx),$(extra-objs))
186 endif
187
188 # Command to link into a larger single relocatable object.
189 reloc-link = $(LINK.o) -nostdlib -nostartfiles -r
190
191 $(objpfx)dl-allobjs.os: $(all-rtld-routines:%=$(objpfx)%.os)
192         $(reloc-link) -o $@ $^
193
194 # Link together the dynamic linker into a single relocatable object.
195 # First we do a link against libc_pic.a just to get a link map,
196 # and discard the object produced by that link.  From the link map
197 # we can glean all the libc modules that need to go into the dynamic
198 # linker.  Then we do a recursive make that goes into all the subdirs
199 # those modules come from and builds special rtld-foo.os versions that
200 # are compiled with special flags, and puts these modules into rtld-libc.a
201 # for us.  Then we do the real link using rtld-libc.a instead of libc_pic.a.
202
203 $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
204         @-rm -f $@T
205         $(reloc-link) -o $@.o '-Wl,-(' $^ -lgcc '-Wl,-)' -Wl,-Map,$@T
206         rm -f $@.o
207         mv -f $@T $@
208
209 $(objpfx)librtld.mk: $(objpfx)librtld.map Makefile
210         sed -n 's@^$(common-objpfx)\([^(]*\)(\([^)]*\.os\))$$@\1 \2@p' $< | \
211         while read lib file; do \
212           case $$lib in \
213           libc_pic.a) \
214             fgrep -l /$$file \
215                   $(common-objpfx)stamp.os $(common-objpfx)*/stamp.os | \
216             sed 's@^$(common-objpfx)\([^/]*\)/stamp\.os$$@rtld-\1'" +=$$file@"\
217             ;; \
218           */*.a) \
219             echo rtld-$${lib%%/*} += $$file ;; \
220           *) echo "Wasn't expecting $$lib($$file)" >&2; exit 1 ;; \
221           esac; \
222         done > $@T
223         echo rtld-subdirs = `sed 's/^rtld-\([^ ]*\).*$$/\1/' $@T \
224                              | sort -u` >> $@T
225         mv -f $@T $@
226
227 $(objpfx)rtld-libc.a: $(objpfx)librtld.mk FORCE
228         $(MAKE) -f $< -f rtld-Rules
229
230 generated += librtld.map librtld.mk rtld-libc.a
231
232 $(objpfx)librtld.os: $(objpfx)dl-allobjs.os $(objpfx)rtld-libc.a
233         $(LINK.o) -nostdlib -nostartfiles -r -o $@ '-Wl,-(' $^ -lgcc '-Wl,-)'
234
235 $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
236         @rm -f $@.lds
237         $(LINK.o) -nostdlib -nostartfiles -shared                       \
238                   $(LDFLAGS-rtld) -Wl,--verbose 2>&1 |                  \
239                   sed -e '/^=========/,/^=========/!d;/^=========/d'    \
240                       -e 's/\. = 0 + SIZEOF_HEADERS;/& _begin = . - SIZEOF_HEADERS;/' \
241                   > $@.lds
242         $(LINK.o) -nostdlib -nostartfiles -shared -o $@ $(LDFLAGS-rtld) \
243                   $(filter-out $(map-file),$^) $(load-map-file)         \
244                   -Wl,-soname=$(rtld-installed-name) -T $@.lds
245         rm -f $@.lds
246
247 # interp.c exists just to get this string into the libraries.
248 CFLAGS-interp.c = -D'RUNTIME_LINKER="$(slibdir)/$(rtld-installed-name)"'
249 $(objpfx)interp.os: $(common-objpfx)config.make
250
251 ifneq (ld.so,$(rtld-installed-name))
252 # Make sure ld.so.1 exists in the build directory so we can link
253 # against it.
254 $(objpfx)$(rtld-installed-name): $(objpfx)ld.so
255         rm -f $@
256         ln -s $(<F) $@
257 generated += $(rtld-installed-name)
258 endif
259
260 # Build a file mentioning all trustworthy directories to look for shared
261 # libraries when using LD_LIBRARY_PATH in a setuid program.  The user can
262 # add directories to the list by defining $(user-defined-trusted-dirs)
263 # before starting make.
264 $(objpfx)trusted-dirs.h: $(objpfx)trusted-dirs.st; @:
265 $(objpfx)trusted-dirs.st: Makefile $(..)Makeconfig
266         $(make-target-directory)
267         echo "$(subst :, ,$(default-rpath) $(user-defined-trusted-dirs))"    \
268         | $(AWK) -f gen-trusted-dirs.awk > ${@:st=T};
269         echo '#define DL_DST_LIB "$(notdir $(slibdir))"' >> ${@:st=T}
270         $(move-if-change) ${@:st=T} ${@:st=h}
271         touch $@
272 CPPFLAGS-dl-load.c = -I$(objpfx). -I$(csu-objpfx).
273
274 ifeq (yes,$(build-shared))
275 $(inst_slibdir)/$(rtld-version-installed-name): $(objpfx)ld.so $(+force)
276         $(make-target-directory)
277         $(do-install-program)
278
279 $(inst_slibdir)/$(rtld-installed-name): \
280   $(inst_slibdir)/$(rtld-version-installed-name) \
281   $(inst_slibdir)/libc-$(version).so
282         $(make-shlib-link)
283
284 # Special target called by parent to install just the dynamic linker.
285 .PHONY: ldso_install
286 ldso_install: $(inst_slibdir)/$(rtld-installed-name)
287 endif
288
289
290 common-ldd-rewrite = -e 's%@RTLD@%$(slibdir)/$(rtld-installed-name)%g' \
291                      -e 's%@VERSION@%$(version)%g'
292 sh-ldd-rewrite = $(common-ldd-rewrite) -e 's%@BASH@%/bin/sh%g;s/\$$"/"/g'
293 bash-ldd-rewrite = $(common-ldd-rewrite) -e 's%@BASH@%$(BASH)%g' \
294                    -e 's%@TEXTDOMAINDIR@%$(msgcatdir)%g'
295
296 ifneq ($(have-bash2),yes)
297 ldd-shell = sh
298 else
299 ldd-shell = bash
300 endif
301
302 ifeq ($(ldd-rewrite-script),no)
303 define gen-ldd
304 sed $($(ldd-shell)-ldd-rewrite) < $< > $@.new
305 endef
306 else
307 define gen-ldd
308 sed $($(ldd-shell)-ldd-rewrite) < $< | sed -f $(ldd-rewrite-script) > $@.new
309 endef
310 endif
311
312 $(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \
313               $(common-objpfx)config.make
314         $(gen-ldd)
315         chmod 555 $@.new
316         mv -f $@.new $@
317
318 $(objpfx)sprof: $(libdl)
319
320 $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
321 SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
322 CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' -D'SLIBDIR="$(slibdir)"'
323 CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
324 CFLAGS-cache.c = $(SYSCONF-FLAGS)
325
326 CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),-DNOT_IN_libc=1 -DIS_IN_rtld=1)
327
328 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
329 generated += $(addsuffix .so,$(strip $(modules-names)))
330
331 ifeq (yes,$(build-shared))
332 ifeq ($(cross-compiling),no)
333 tests: $(objpfx)tst-pathopt.out
334 endif
335 endif
336
337 $(objpfx)testobj1.so: $(libdl)
338 $(objpfx)testobj1_1.so: $(objpfx)testobj1.so $(libdl)
339 $(objpfx)testobj2.so: $(objpfx)testobj1.so $(libdl)
340 $(objpfx)testobj3.so: $(libdl)
341 $(objpfx)testobj4.so: $(libdl)
342 $(objpfx)testobj5.so: $(libdl)
343 $(objpfx)testobj6.so: $(objpfx)testobj1.so $(objpfx)testobj2.so $(libdl)
344 $(objpfx)failobj.so: $(objpfx)testobj6.so
345 $(objpfx)dep1.so: $(objpfx)dep2.so $(objpfx)dep4.so
346 $(objpfx)dep2.so: $(objpfx)dep3.so $(objpfx)dep4.so
347 $(objpfx)dep4.so: $(objpfx)dep3.so
348 $(objpfx)nodelmod3.so: $(objpfx)nodelmod4.so
349 $(objpfx)nextmod1.so: $(libdl)
350 $(objpfx)neededobj1.so: $(libdl)
351 $(objpfx)neededobj2.so: $(objpfx)neededobj1.so $(libdl)
352 $(objpfx)neededobj3.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so $(libdl)
353 $(objpfx)neededobj4.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
354                         $(objpfx)neededobj3.so $(libdl)
355 $(objpfx)neededobj6.so: $(objpfx)neededobj5.so
356 $(objpfx)unload2mod.so: $(objpfx)unload2dep.so
357 $(objpfx)ltglobmod2.so: $(libdl)
358 $(objpfx)firstobj.so: $(shared-thread-library)
359 $(objpfx)globalmod1.so: $(libdl)
360 $(objpfx)reldep4mod1.so: $(objpfx)reldep4mod3.so
361 $(objpfx)reldep4mod2.so: $(objpfx)reldep4mod4.so
362 $(objpfx)dblloadmod1.so: $(objpfx)dblloadmod3.so
363 $(objpfx)dblloadmod2.so: $(objpfx)dblloadmod3.so
364 $(objpfx)reldepmod5.so: $(objpfx)reldepmod2.so
365 $(objpfx)reldepmod6.so: $(objpfx)reldepmod2.so
366 $(objpfx)reldep6mod1.so: $(objpfx)reldep6mod0.so
367 $(objpfx)reldep6mod2.so: $(objpfx)reldep6mod1.so
368 $(objpfx)reldep6mod3.so: $(objpfx)reldep6mod2.so
369 $(objpfx)reldep6mod4.so: $(objpfx)reldep6mod1.so
370 $(objpfx)tst-tlsmod3.so: $(objpfx)tst-tlsmod2.so
371 $(objpfx)reldep8mod3.so: $(objpfx)reldep8mod1.so $(objpfx)reldep8mod2.so
372 $(objpfx)nodel2mod3.so: $(objpfx)nodel2mod1.so $(objpfx)nodel2mod2.so
373 $(objpfx)reldep9mod2.so: $(objpfx)reldep9mod1.so
374 $(objpfx)reldep9mod3.so: $(objpfx)reldep9mod1.so $(objpfx)reldep9mod2.so
375
376 LDFLAGS-tst-tlsmod5.so = -nostdlib
377 LDFLAGS-tst-tlsmod6.so = -nostdlib
378
379 # filtmod1.so has a special rule
380 $(filter-out $(objpfx)filtmod1.so, $(test-modules)): $(objpfx)%.so: $(objpfx)%.os
381         $(build-module)
382
383 $(objpfx)loadtest: $(libdl)
384 LDFLAGS-loadtest = -rdynamic
385
386 $(objpfx)loadtest.out: $(test-modules)
387
388 $(objpfx)neededtest: $(libdl)
389 $(objpfx)neededtest.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
390                          $(objpfx)neededobj3.so
391
392 $(objpfx)neededtest2: $(libdl)
393 $(objpfx)neededtest2.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
394                           $(objpfx)neededobj3.so
395
396 $(objpfx)neededtest3: $(libdl)
397 $(objpfx)neededtest3.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
398                           $(objpfx)neededobj3.so $(objpfx)neededobj4.so
399
400 neededtest4-ENV = LC_ALL=C LANGUAGE=C
401 $(objpfx)neededtest4: $(libdl) $(objpfx)neededobj1.so
402 $(objpfx)neededtest4.out: $(objpfx)neededobj5.so $(objpfx)neededobj6.so
403
404 $(objpfx)restest1: $(objpfx)testobj1.so $(objpfx)testobj1_1.so $(libdl)
405 LDFLAGS-restest1 = -rdynamic
406
407 $(objpfx)restest2: $(libdl)
408 LDFLAGS-restest2 = -rdynamic
409
410 $(objpfx)restest1.out: $(test-modules)
411
412 preloadtest-preloads = testobj1 testobj2 testobj3 testobj4 testobj5
413 $(objpfx)preloadtest: $(objpfx)testobj6.so
414 LDFLAGS-preloadtest = -rdynamic
415 $(objpfx)preloadtest.out: $(preloadtest-preloads:%=$(objpfx)%.so)
416 preloadtest-ENV = \
417   LD_PRELOAD=$(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
418
419 $(objpfx)loadfail: $(libdl)
420 LDFLAGS-loadfail = -rdynamic
421
422 $(objpfx)loadfail.out: $(objpfx)failobj.so
423
424 $(objpfx)multiload: $(libdl)
425 LDFLAGS-multiload = -rdynamic
426 CFLAGS-multiload.c = -DOBJDIR=\"$(elf-objpfx)\"
427
428 $(objpfx)multiload.out: $(objpfx)testobj1.so
429
430 $(objpfx)origtest: $(libdl)
431 LDFLAGS-origtest = -rdynamic
432 $(objpfx)origtest.out: $(objpfx)testobj1.so
433
434 ifeq ($(have-thread-library),yes)
435 $(objpfx)resolvfail: $(libdl) $(shared-thread-library)
436 else
437 $(objpfx)resolvfail: $(libdl)
438 endif
439
440 $(objpfx)constload1: $(libdl)
441 $(objpfx)constload1.out: $(objpfx)constload2.so $(objpfx)constload3.so
442
443 $(objpfx)circleload1: $(libdl)
444 $(objpfx)circleload1.out: $(objpfx)circlemod1.so \
445                           $(objpfx)circlemod1a.so
446
447 $(objpfx)circlemod1.so: $(objpfx)circlemod2.so
448 $(objpfx)circlemod2.so: $(objpfx)circlemod3.so
449 $(objpfx)circlemod1a.so: $(objpfx)circlemod2a.so
450 $(objpfx)circlemod2a.so: $(objpfx)circlemod3a.so
451
452 $(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so)
453
454 $(objpfx)order.out: $(objpfx)order
455         $(elf-objpfx)$(rtld-installed-name) \
456           --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
457           $(objpfx)order > $@
458         (echo "0123456789" | cmp $@ -) > /dev/null
459
460 $(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so)
461 $(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
462 vismain-ENV = LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
463
464 $(objpfx)noload: $(objpfx)testobj1.so
465 LDFLAGS-noload = -rdynamic
466 $(objpfx)noload.out: $(objpfx)testobj5.so
467
468 LDFLAGS-nodelete = -rdynamic
469 LDFLAGS-nodelmod1.so = -Wl,--enable-new-dtags,-z,nodelete
470 LDFLAGS-nodelmod4.so = -Wl,--enable-new-dtags,-z,nodelete
471 $(objpfx)nodelete: $(libdl)
472 $(objpfx)nodelete.out: $(objpfx)nodelmod1.so $(objpfx)nodelmod2.so \
473                        $(objpfx)nodelmod3.so
474
475 LDFLAGS-nodlopenmod.so = -Wl,--enable-new-dtags,-z,nodlopen
476 $(objpfx)nodlopen: $(libdl)
477 $(objpfx)nodlopen.out: $(objpfx)nodlopenmod.so
478
479 $(objpfx)nodlopenmod2.so: $(objpfx)nodlopenmod.so
480 $(objpfx)nodlopen2: $(libdl)
481 $(objpfx)nodlopen2.out: $(objpfx)nodlopenmod2.so
482
483 $(objpfx)filtmod1.so: $(objpfx)filtmod1.os $(objpfx)filtmod2.so
484         $(LINK.o) -shared -o $@ -B$(csu-objpfx) $(LDFLAGS.so) \
485                   -L$(subst :, -L,$(rpath-link)) \
486                   -Wl,-rpath-link=$(rpath-link) \
487                   $< -Wl,-F,$(objpfx)filtmod2.so
488 $(objpfx)filter: $(objpfx)filtmod1.so
489
490 $(objpfx)unload: $(libdl)
491 $(objpfx)unload.out: $(objpfx)unloadmod.so
492
493 $(objpfx)reldep: $(libdl)
494 $(objpfx)reldep.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod2.so
495
496 $(objpfx)reldep2: $(libdl)
497 $(objpfx)reldep2.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod3.so
498
499 $(objpfx)reldep3: $(libdl)
500 $(objpfx)reldep3.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
501
502 $(objpfx)reldep4: $(libdl)
503 $(objpfx)reldep4.out: $(objpfx)reldep4mod1.so $(objpfx)reldep4mod2.so
504
505 $(objpfx)next: $(objpfx)nextmod1.so $(objpfx)nextmod2.so $(libdl)
506
507 $(objpfx)unload2: $(libdl)
508 $(objpfx)unload2.out: $(objpfx)unload2mod.so $(objpfx)unload2dep.so
509
510 $(objpfx)lateglobal: $(libdl)
511 $(objpfx)lateglobal.out: $(objpfx)ltglobmod1.so $(objpfx)ltglobmod2.so
512
513 $(objpfx)tst-pathopt: $(libdl)
514 $(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \
515                           $(objpfx)pathoptobj.so
516         $(SHELL) -e $< $(common-objpfx)
517
518 $(objpfx)initfirst: $(libdl)
519 $(objpfx)initfirst.out: $(objpfx)firstobj.so
520
521 $(objpfx)global: $(objpfx)globalmod1.so
522 $(objpfx)global.out: $(objpfx)reldepmod1.so
523
524 $(objpfx)dblload: $(libdl)
525 $(objpfx)dblload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
526
527 $(objpfx)dblunload: $(libdl)
528 $(objpfx)dblunload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
529
530 $(objpfx)reldep5: $(libdl)
531 $(objpfx)reldep5.out: $(objpfx)reldepmod5.so $(objpfx)reldepmod5.so
532
533 $(objpfx)reldep6: $(libdl)
534 $(objpfx)reldep6.out: $(objpfx)reldep6mod3.so $(objpfx)reldep6mod4.so
535
536 $(objpfx)reldep7: $(libdl)
537 $(objpfx)reldep7.out: $(objpfx)reldep7mod1.so $(objpfx)reldep7mod2.so
538
539 $(objpfx)reldep8: $(libdl)
540 $(objpfx)reldep8.out: $(objpfx)reldep8mod3.so
541
542 LDFLAGS-nodel2mod2.so = -Wl,--enable-new-dtags,-z,nodelete
543 $(objpfx)nodelete2: $(libdl)
544 $(objpfx)nodelete2.out: $(objpfx)nodel2mod3.so
545
546 $(objpfx)reldep9: $(libdl)
547 $(objpfx)reldep9.out: $(objpfx)reldep9mod3.so
548
549 $(objpfx)tst-tls3: $(objpfx)tst-tlsmod1.so
550
551 $(objpfx)tst-tls4: $(libdl)
552 $(objpfx)tst-tls4.out: $(objpfx)tst-tlsmod2.so
553
554 $(objpfx)tst-tls5: $(libdl)
555 $(objpfx)tst-tls5.out: $(objpfx)tst-tlsmod2.so
556
557 $(objpfx)tst-tls6: $(libdl)
558 $(objpfx)tst-tls6.out: $(objpfx)tst-tlsmod2.so
559
560 $(objpfx)tst-tls7: $(libdl)
561 $(objpfx)tst-tls7.out: $(objpfx)tst-tlsmod3.so
562
563 $(objpfx)tst-tls8: $(libdl)
564 $(objpfx)tst-tls8.out: $(objpfx)tst-tlsmod3.so $(objpfx)tst-tlsmod4.so
565
566 $(objpfx)tst-tls9: $(libdl)
567 $(objpfx)tst-tls9.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
568
569 ifdef libdl
570 $(objpfx)tst-tls9-static: $(common-objpfx)dlfcn/libdl.a
571 $(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
572 endif
573
574 $(objpfx)tst-array1.out: $(objpfx)tst-array1
575         $(elf-objpfx)$(rtld-installed-name) \
576           --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
577           $(objpfx)tst-array1 > $@
578         cmp $@ tst-array1.exp > /dev/null
579
580 $(objpfx)tst-array2: $(objpfx)tst-array2dep.so
581 $(objpfx)tst-array2.out: $(objpfx)tst-array2
582         $(elf-objpfx)$(rtld-installed-name) \
583           --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
584           $(objpfx)tst-array2 > $@
585         cmp $@ tst-array2.exp > /dev/null
586
587 $(objpfx)tst-array3.out: $(objpfx)tst-array3
588         $(elf-objpfx)$(rtld-installed-name) \
589           --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
590           $(objpfx)tst-array3 > $@
591         cmp $@ tst-array1.exp > /dev/null
592
593
594 check-textrel-CFLAGS = -O
595 $(objpfx)check-textrel: check-textrel.c
596         $(native-compile)
597
598 ifeq (yes,$(build-shared))
599 tests: $(objpfx)check-textrel.out
600
601 $(objpfx)check-textrel.out: $(objpfx)check-textrel
602         $(dir $<)$(notdir $<) $(common-objpfx)libc.so \
603           $(sort $(wildcard $(common-objpfx)*/lib*.so \
604                             $(common-objpfx)iconvdata/*.so)) > $@
605 generated += check-textrel check-textrel.out
606 endif