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