summary refs log tree commit diff
path: root/elf/Makefile
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-06-03 08:26:04 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-06-03 09:11:45 +0200
commit6f1c701026287f6928d3bdd1aea7359308635abe (patch)
tree8dcf3b5a755f131435a912f7629478deaff74264 /elf/Makefile
parent0c1c3a771eceec46e66ce1183cf988e2303bd373 (diff)
downloadglibc-6f1c701026287f6928d3bdd1aea7359308635abe.tar.gz
glibc-6f1c701026287f6928d3bdd1aea7359308635abe.tar.xz
glibc-6f1c701026287f6928d3bdd1aea7359308635abe.zip
dlfcn: Cleanups after -ldl is no longer required
This commit removes the ELF constructor and internal variables from
dlfcn/dlfcn.c.  The file now serves the same purpose as
nptl/libpthread-compat.c, so it is renamed to dlfcn/libdl-compat.c.
The use of libdl-shared-only-routines ensures that libdl.a is empty.

This commit adjusts the test suite not to use $(libdl).  The libdl.so
symbolic link is no longer installed.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'elf/Makefile')
-rw-r--r--elf/Makefile172
1 files changed, 29 insertions, 143 deletions
diff --git a/elf/Makefile b/elf/Makefile
index 0ec736bb0f..e9788d3d4f 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -673,8 +673,6 @@ $(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \
 	chmod 555 $@.new
 	mv -f $@.new $@
 
-$(objpfx)sprof: $(libdl)
-
 $(objpfx)sln: $(sln-modules:%=$(objpfx)%.o)
 
 $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
@@ -699,28 +697,21 @@ include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
 generated += $(addsuffix .so,$(strip $(modules-names)))
 
-$(objpfx)testobj1_1.so: $(objpfx)testobj1.so $(libdl)
-$(objpfx)testobj2.so: $(objpfx)testobj1.so $(libdl)
-$(objpfx)testobj3.so: $(libdl)
-$(objpfx)testobj4.so: $(libdl)
-$(objpfx)testobj5.so: $(libdl)
-$(objpfx)testobj6.so: $(objpfx)testobj1.so $(objpfx)testobj2.so $(libdl)
+$(objpfx)testobj1_1.so: $(objpfx)testobj1.so
+$(objpfx)testobj2.so: $(objpfx)testobj1.so
+$(objpfx)testobj6.so: $(objpfx)testobj1.so $(objpfx)testobj2.so
 $(objpfx)failobj.so: $(objpfx)testobj6.so
 $(objpfx)dep1.so: $(objpfx)dep2.so $(objpfx)dep4.so
 $(objpfx)dep2.so: $(objpfx)dep3.so $(objpfx)dep4.so
 $(objpfx)dep4.so: $(objpfx)dep3.so
 $(objpfx)nodelmod3.so: $(objpfx)nodelmod4.so
-$(objpfx)nextmod1.so: $(libdl)
-$(objpfx)neededobj1.so: $(libdl)
-$(objpfx)neededobj2.so: $(objpfx)neededobj1.so $(libdl)
-$(objpfx)neededobj3.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so $(libdl)
+$(objpfx)neededobj2.so: $(objpfx)neededobj1.so
+$(objpfx)neededobj3.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so
 $(objpfx)neededobj4.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
-			$(objpfx)neededobj3.so $(libdl)
+			$(objpfx)neededobj3.so
 $(objpfx)neededobj6.so: $(objpfx)neededobj5.so
 $(objpfx)unload2mod.so: $(objpfx)unload2dep.so
-$(objpfx)ltglobmod2.so: $(libdl)
 $(objpfx)firstobj.so: $(shared-thread-library)
-$(objpfx)globalmod1.so: $(libdl)
 $(objpfx)reldep4mod1.so: $(objpfx)reldep4mod3.so
 $(objpfx)reldep4mod2.so: $(objpfx)reldep4mod4.so
 $(objpfx)dblloadmod1.so: $(objpfx)dblloadmod3.so
@@ -750,14 +741,9 @@ $(objpfx)unload3mod2.so: $(objpfx)unload3mod3.so
 $(objpfx)unload3mod3.so: $(objpfx)unload3mod4.so
 $(objpfx)unload4mod1.so: $(objpfx)unload4mod2.so $(objpfx)unload4mod3.so
 $(objpfx)unload4mod2.so: $(objpfx)unload4mod4.so $(objpfx)unload4mod3.so
-$(objpfx)unload6mod1.so: $(libdl)
-$(objpfx)unload6mod2.so: $(libdl)
-$(objpfx)unload6mod3.so: $(libdl)
-$(objpfx)unload7mod1.so: $(libdl)
 $(objpfx)unload7mod2.so: $(objpfx)unload7mod1.so
 $(objpfx)unload8mod1.so: $(objpfx)unload8mod2.so
 $(objpfx)unload8mod2.so: $(objpfx)unload8mod3.so
-$(objpfx)unload8mod3.so: $(libdl)
 $(objpfx)tst-initordera2.so: $(objpfx)tst-initordera1.so
 $(objpfx)tst-initorderb2.so: $(objpfx)tst-initorderb1.so $(objpfx)tst-initordera2.so
 $(objpfx)tst-initordera3.so: $(objpfx)tst-initorderb2.so $(objpfx)tst-initorderb1.so
@@ -766,8 +752,6 @@ $(objpfx)tst-initorder: $(objpfx)tst-initordera4.so $(objpfx)tst-initordera1.so
 $(objpfx)tst-null-argv: $(objpfx)tst-null-argv-lib.so
 $(objpfx)tst-tlsalign: $(objpfx)tst-tlsalign-lib.so
 $(objpfx)tst-nodelete-opened.out: $(objpfx)tst-nodelete-opened-lib.so
-$(objpfx)tst-nodelete-opened: $(libdl)
-$(objpfx)tst-noload: $(libdl)
 
 $(objpfx)tst-tlsalign-extern: $(objpfx)tst-tlsalign-vars.o
 $(objpfx)tst-tlsalign-extern-static: $(objpfx)tst-tlsalign-vars.o
@@ -842,30 +826,25 @@ ifeq ($(build-shared),yes)
 tests: $(test-modules)
 endif
 
-$(objpfx)loadtest: $(libdl)
 LDFLAGS-loadtest = -rdynamic
 
 $(objpfx)loadtest.out: $(test-modules)
 
-$(objpfx)neededtest: $(libdl)
 $(objpfx)neededtest.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
 			 $(objpfx)neededobj3.so
 
-$(objpfx)neededtest2: $(libdl)
 $(objpfx)neededtest2.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
 			  $(objpfx)neededobj3.so
 
-$(objpfx)neededtest3: $(libdl)
 $(objpfx)neededtest3.out: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
 			  $(objpfx)neededobj3.so $(objpfx)neededobj4.so
 
-$(objpfx)neededtest4: $(libdl) $(objpfx)neededobj1.so
+$(objpfx)neededtest4: $(objpfx)neededobj1.so
 $(objpfx)neededtest4.out: $(objpfx)neededobj5.so $(objpfx)neededobj6.so
 
-$(objpfx)restest1: $(objpfx)testobj1.so $(objpfx)testobj1_1.so $(libdl)
+$(objpfx)restest1: $(objpfx)testobj1.so $(objpfx)testobj1_1.so
 LDFLAGS-restest1 = -rdynamic
 
-$(objpfx)restest2: $(libdl)
 LDFLAGS-restest2 = -rdynamic
 
 $(objpfx)restest1.out: $(test-modules)
@@ -877,31 +856,24 @@ $(objpfx)preloadtest.out: $(preloadtest-preloads:%=$(objpfx)%.so)
 preloadtest-ENV = \
   LD_PRELOAD=$(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
 
-$(objpfx)loadfail: $(libdl)
 LDFLAGS-loadfail = -rdynamic
 
 $(objpfx)loadfail.out: $(objpfx)failobj.so
 
-$(objpfx)multiload: $(libdl)
 LDFLAGS-multiload = -rdynamic
 CFLAGS-multiload.c += -DOBJDIR=\"$(elf-objpfx)\"
 
 $(objpfx)multiload.out: $(objpfx)testobj1.so
 
-$(objpfx)origtest: $(libdl)
 LDFLAGS-origtest = -rdynamic
 $(objpfx)origtest.out: $(objpfx)testobj1.so
 
 ifeq ($(have-thread-library),yes)
-$(objpfx)resolvfail: $(libdl) $(shared-thread-library)
-else
-$(objpfx)resolvfail: $(libdl)
+$(objpfx)resolvfail: $(shared-thread-library)
 endif
 
-$(objpfx)constload1: $(libdl)
 $(objpfx)constload1.out: $(objpfx)constload2.so $(objpfx)constload3.so
 
-$(objpfx)circleload1: $(libdl)
 $(objpfx)circleload1.out: $(objpfx)circlemod1.so \
 			  $(objpfx)circlemod1a.so
 
@@ -920,7 +892,7 @@ $(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so)
 $(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
 vismain-ENV = LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
 
-$(objpfx)noload: $(objpfx)testobj1.so $(libdl)
+$(objpfx)noload: $(objpfx)testobj1.so
 LDFLAGS-noload = -rdynamic -Wl,--no-as-needed
 $(objpfx)noload.out: $(objpfx)testobj5.so
 
@@ -932,16 +904,13 @@ noload-ENV = MALLOC_TRACE=$(objpfx)noload.mtrace
 LDFLAGS-nodelete = -rdynamic
 LDFLAGS-nodelmod1.so = -Wl,--enable-new-dtags,-z,nodelete
 LDFLAGS-nodelmod4.so = -Wl,--enable-new-dtags,-z,nodelete
-$(objpfx)nodelete: $(libdl)
 $(objpfx)nodelete.out: $(objpfx)nodelmod1.so $(objpfx)nodelmod2.so \
 		       $(objpfx)nodelmod3.so
 
 LDFLAGS-nodlopenmod.so = -Wl,--enable-new-dtags,-z,nodlopen
-$(objpfx)nodlopen: $(libdl)
 $(objpfx)nodlopen.out: $(objpfx)nodlopenmod.so
 
 $(objpfx)nodlopenmod2.so: $(objpfx)nodlopenmod.so
-$(objpfx)nodlopen2: $(libdl)
 $(objpfx)nodlopen2.out: $(objpfx)nodlopenmod2.so
 
 $(objpfx)filtmod1.so: $(objpfx)filtmod1.os $(objpfx)filtmod2.so
@@ -954,31 +923,23 @@ $(objpfx)filter: $(objpfx)filtmod1.so
 # This does not link against libc.
 CFLAGS-filtmod1.c += $(no-stack-protector)
 
-$(objpfx)unload: $(libdl)
 $(objpfx)unload.out: $(objpfx)unloadmod.so
 
-$(objpfx)reldep: $(libdl)
 $(objpfx)reldep.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod2.so
 
-$(objpfx)reldep2: $(libdl)
 $(objpfx)reldep2.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod3.so
 
-$(objpfx)reldep3: $(libdl)
 $(objpfx)reldep3.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
 
-$(objpfx)reldep4: $(libdl)
 $(objpfx)reldep4.out: $(objpfx)reldep4mod1.so $(objpfx)reldep4mod2.so
 
-$(objpfx)next: $(objpfx)nextmod1.so $(objpfx)nextmod2.so $(libdl)
+$(objpfx)next: $(objpfx)nextmod1.so $(objpfx)nextmod2.so
 LDFLAGS-next = -Wl,--no-as-needed
 
-$(objpfx)unload2: $(libdl)
 $(objpfx)unload2.out: $(objpfx)unload2mod.so $(objpfx)unload2dep.so
 
-$(objpfx)lateglobal: $(libdl)
 $(objpfx)lateglobal.out: $(objpfx)ltglobmod1.so $(objpfx)ltglobmod2.so
 
-$(objpfx)tst-pathopt: $(libdl)
 $(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \
 			  $(objpfx)pathoptobj.so
 	$(SHELL) $< $(common-objpfx) '$(test-wrapper-env)' \
@@ -998,55 +959,40 @@ $(objpfx)tst-rtld-preload.out: tst-rtld-preload.sh $(objpfx)ld.so \
 		    '$(rpath-link)' '$(tst-rtld-preload-OBJS)' > $@; \
 	$(evaluate-test)
 
-$(objpfx)initfirst: $(libdl)
 $(objpfx)initfirst.out: $(objpfx)firstobj.so
 
 $(objpfx)global: $(objpfx)globalmod1.so
 $(objpfx)global.out: $(objpfx)reldepmod1.so
 
-$(objpfx)dblload: $(libdl)
 $(objpfx)dblload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
 
-$(objpfx)dblunload: $(libdl)
 $(objpfx)dblunload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
 
-$(objpfx)reldep5: $(libdl)
 $(objpfx)reldep5.out: $(objpfx)reldepmod5.so $(objpfx)reldepmod6.so
 
-$(objpfx)reldep6: $(libdl)
 $(objpfx)reldep6.out: $(objpfx)reldep6mod3.so $(objpfx)reldep6mod4.so
 
-$(objpfx)reldep7: $(libdl)
 $(objpfx)reldep7.out: $(objpfx)reldep7mod1.so $(objpfx)reldep7mod2.so
 
-$(objpfx)reldep8: $(libdl)
 $(objpfx)reldep8.out: $(objpfx)reldep8mod3.so
 
 LDFLAGS-nodel2mod2.so = -Wl,--enable-new-dtags,-z,nodelete
-$(objpfx)nodelete2: $(libdl)
 $(objpfx)nodelete2.out: $(objpfx)nodel2mod3.so
 
-$(objpfx)reldep9: $(libdl)
 $(objpfx)reldep9.out: $(objpfx)reldep9mod3.so
 
 $(objpfx)tst-tls3: $(objpfx)tst-tlsmod1.so
 
-$(objpfx)tst-tls4: $(libdl)
 $(objpfx)tst-tls4.out: $(objpfx)tst-tlsmod2.so
 
-$(objpfx)tst-tls5: $(libdl)
 $(objpfx)tst-tls5.out: $(objpfx)tst-tlsmod2.so
 
-$(objpfx)tst-tls6: $(libdl)
 $(objpfx)tst-tls6.out: $(objpfx)tst-tlsmod2.so
 
-$(objpfx)tst-tls7: $(libdl)
 $(objpfx)tst-tls7.out: $(objpfx)tst-tlsmod3.so
 
-$(objpfx)tst-tls8: $(libdl)
 $(objpfx)tst-tls8.out: $(objpfx)tst-tlsmod3.so $(objpfx)tst-tlsmod4.so
 
-$(objpfx)tst-tls9: $(libdl)
 $(objpfx)tst-tls9.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
 
 $(objpfx)tst-tls10: $(objpfx)tst-tlsmod8.so $(objpfx)tst-tlsmod7.so
@@ -1055,67 +1001,53 @@ $(objpfx)tst-tls11: $(objpfx)tst-tlsmod10.so $(objpfx)tst-tlsmod9.so
 
 $(objpfx)tst-tls12: $(objpfx)tst-tlsmod12.so $(objpfx)tst-tlsmod11.so
 
-$(objpfx)tst-tls13: $(libdl)
 $(objpfx)tst-tls13.out: $(objpfx)tst-tlsmod13a.so
 
-$(objpfx)tst-tls14: $(objpfx)tst-tlsmod14a.so $(libdl)
+$(objpfx)tst-tls14: $(objpfx)tst-tlsmod14a.so
 $(objpfx)tst-tls14.out: $(objpfx)tst-tlsmod14b.so
 
-$(objpfx)tst-tls15: $(libdl)
 $(objpfx)tst-tls15.out: $(objpfx)tst-tlsmod15a.so $(objpfx)tst-tlsmod15b.so
 
-$(objpfx)tst-tls-dlinfo: $(libdl)
 $(objpfx)tst-tls-dlinfo.out: $(objpfx)tst-tlsmod2.so
 
 
 
-$(objpfx)tst-tls16: $(libdl)
 $(objpfx)tst-tls16.out: $(objpfx)tst-tlsmod16a.so $(objpfx)tst-tlsmod16b.so
 
-$(objpfx)tst-tls17: $(libdl)
 $(objpfx)tst-tls17.out: $(objpfx)tst-tlsmod17b.so
 $(patsubst %,$(objpfx)%.os,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.os: tst-tlsmod17a.c
 	$(compile-command.c) -DN=$*
 $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules)): $(objpfx)tst-tlsmod17a%.so: $(objpfx)ld.so
 $(objpfx)tst-tlsmod17b.so: $(patsubst %,$(objpfx)%.so,$(tlsmod17a-modules))
 
-$(objpfx)tst-tls18: $(libdl)
 $(objpfx)tst-tls18.out: $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules))
 $(patsubst %,$(objpfx)%.os,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.os : tst-tlsmod18a.c
 	$(compile-command.c) -DN=$*
 $(patsubst %,$(objpfx)%.so,$(tlsmod18a-modules)): $(objpfx)tst-tlsmod18a%.so: $(objpfx)ld.so
 
-$(objpfx)tst-tls19: $(libdl)
 $(objpfx)tst-tls19.out: $(objpfx)tst-tls19mod1.so
 
 CFLAGS-tst-align.c += $(stack-align-test-flags)
 CFLAGS-tst-align2.c += $(stack-align-test-flags)
 CFLAGS-tst-alignmod.c += $(stack-align-test-flags)
 CFLAGS-tst-alignmod2.c += $(stack-align-test-flags)
-$(objpfx)tst-align: $(libdl)
 $(objpfx)tst-align.out: $(objpfx)tst-alignmod.so
 $(objpfx)tst-align2: $(objpfx)tst-alignmod2.so
 
-$(objpfx)unload3: $(libdl)
 $(objpfx)unload3.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
 		      $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
 
-$(objpfx)unload4: $(libdl)
 $(objpfx)unload4.out: $(objpfx)unload4mod1.so $(objpfx)unload4mod3.so
 
-$(objpfx)unload5: $(libdl)
 $(objpfx)unload5.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
 		      $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
 
-$(objpfx)unload6: $(libdl)
 $(objpfx)unload6.out: $(objpfx)unload6mod1.so $(objpfx)unload6mod2.so \
 		      $(objpfx)unload6mod3.so
 
-$(objpfx)unload7: $(libdl)
 $(objpfx)unload7.out: $(objpfx)unload7mod1.so $(objpfx)unload7mod2.so
 unload7-ENV = MALLOC_PERTURB_=85
 
-$(objpfx)unload8: $(libdl)
 $(objpfx)unload8.out: $(objpfx)unload8mod1.so $(objpfx)unload8mod1x.so
 
 ifdef libdl
@@ -1124,7 +1056,6 @@ $(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
 endif
 
 ifeq ($(have-z-execstack),yes)
-$(objpfx)tst-execstack: $(libdl)
 $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
 CPPFLAGS-tst-execstack.c += -DUSE_PTHREADS=0
 LDFLAGS-tst-execstack = -Wl,-z,noexecstack
@@ -1159,7 +1090,6 @@ $(objpfx)tst-array3-cmp.out: tst-array1.exp $(objpfx)tst-array3.out
 	cmp $^ > $@; \
 	$(evaluate-test)
 
-$(objpfx)tst-array4: $(libdl)
 $(objpfx)tst-array4.out: $(objpfx)tst-array2dep.so
 $(objpfx)tst-array4-cmp.out: tst-array4.exp $(objpfx)tst-array4.out
 	cmp $^ > $@; \
@@ -1180,7 +1110,6 @@ CFLAGS-tst-pie2.c += $(pie-ccflag)
 
 $(objpfx)tst-piemod1.so: $(libsupport)
 $(objpfx)tst-pie1: $(objpfx)tst-piemod1.so
-$(objpfx)tst-dlopen-pie: $(libdl)
 $(objpfx)tst-dlopen-pie.out: $(objpfx)tst-pie1
 
 ifeq (yes,$(build-shared))
@@ -1239,7 +1168,6 @@ $(objpfx)check-wx-segment.out: $(..)scripts/check-wx-segment.py \
 	$(evaluate-test)
 generated += check-wx-segment.out
 
-$(objpfx)tst-dlmodcount: $(libdl)
 $(objpfx)tst-dlmodcount.out: $(test-modules)
 
 $(all-built-dso:=.jmprel): %.jmprel: % Makefile
@@ -1292,38 +1220,31 @@ $(objpfx)check-initfini.out: $(..)scripts/check-initfini.awk \
 	$(evaluate-test)
 generated += check-initfini.out
 
-$(objpfx)tst-dlopenrpathmod.so: $(libdl)
-$(objpfx)tst-dlopenrpath: $(objpfx)tst-dlopenrpathmod.so $(libdl)
+$(objpfx)tst-dlopenrpath: $(objpfx)tst-dlopenrpathmod.so
 CFLAGS-tst-dlopenrpath.c += -DPFX=\"$(objpfx)\"
 LDFLAGS-tst-dlopenrpathmod.so += -Wl,-rpath,\$$ORIGIN/test-subdir
 $(objpfx)tst-dlopenrpath.out: $(objpfx)firstobj.so
 
 $(objpfx)tst-deep1mod2.so: $(objpfx)tst-deep1mod3.so
-$(objpfx)tst-deep1: $(libdl) $(objpfx)tst-deep1mod1.so
+$(objpfx)tst-deep1: $(objpfx)tst-deep1mod1.so
 $(objpfx)tst-deep1.out: $(objpfx)tst-deep1mod2.so
 LDFLAGS-tst-deep1 += -rdynamic
 tst-deep1mod3.so-no-z-defs = yes
 
-$(objpfx)tst-dlmopen1mod.so: $(libdl)
-$(objpfx)tst-dlmopen1: $(libdl)
 $(objpfx)tst-dlmopen1.out: $(objpfx)tst-dlmopen1mod.so
 
-$(objpfx)tst-dlmopen2: $(libdl)
 $(objpfx)tst-dlmopen2.out: $(objpfx)tst-dlmopen1mod.so
 
-$(objpfx)tst-dlmopen3: $(libdl)
 $(objpfx)tst-dlmopen3.out: $(objpfx)tst-dlmopen1mod.so
 
 $(objpfx)tst-audit1.out: $(objpfx)tst-auditmod1.so
 tst-audit1-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
 
-$(objpfx)tst-audit2: $(libdl)
 $(objpfx)tst-audit2.out: $(objpfx)tst-auditmod1.so $(objpfx)tst-auditmod9b.so
 # Prevent GCC-5 from translating a malloc/memset pair into calloc
 CFLAGS-tst-audit2.c += -fno-builtin
 tst-audit2-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
 
-$(objpfx)tst-audit9: $(libdl)
 $(objpfx)tst-audit9.out: $(objpfx)tst-auditmod9a.so $(objpfx)tst-auditmod9b.so
 tst-audit9-ENV = LD_AUDIT=$(objpfx)tst-auditmod9a.so
 
@@ -1331,10 +1252,8 @@ $(objpfx)tst-audit8: $(libm)
 $(objpfx)tst-audit8.out: $(objpfx)tst-auditmod1.so
 tst-audit8-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
 
-$(objpfx)tst-global1: $(libdl)
 $(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
 
-$(objpfx)order2: $(libdl)
 $(objpfx)order2.out: $(objpfx)order2mod1.so $(objpfx)order2mod2.so
 $(objpfx)order2-cmp.out: $(objpfx)order2.out
 	(echo "12345" | cmp $< -) > $@; \
@@ -1355,7 +1274,6 @@ tst-ptrguard1-ARGS = --command "$(host-test-program-cmd) --child"
 CFLAGS-tst-ptrguard1-static.c += -DPTRGUARD_LOCAL
 tst-ptrguard1-static-ARGS = --command "$(objpfx)tst-ptrguard1-static --child"
 
-$(objpfx)tst-leaks1: $(libdl)
 $(objpfx)tst-leaks1-mem.out: $(objpfx)tst-leaks1.out
 	$(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1.mtrace > $@; \
 	$(evaluate-test)
@@ -1368,24 +1286,19 @@ $(objpfx)tst-leaks1-static-mem.out: $(objpfx)tst-leaks1-static.out
 tst-leaks1-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1.mtrace
 tst-leaks1-static-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1-static.mtrace
 
-$(objpfx)tst-addr1: $(libdl)
-
-$(objpfx)tst-thrlock: $(libdl) $(shared-thread-library)
+$(objpfx)tst-thrlock: $(shared-thread-library)
 
 tst-tst-dlopen-tlsmodid-no-pie = yes
-$(objpfx)tst-dlopen-tlsmodid: $(libdl) $(shared-thread-library)
+$(objpfx)tst-dlopen-tlsmodid: $(shared-thread-library)
 $(objpfx)tst-dlopen-tlsmodid.out: $(objpfx)tst-dlopen-self
 CFLAGS-tst-dlopen-tlsmodid-pie.c += $(pie-ccflag)
-$(objpfx)tst-dlopen-tlsmodid-pie: $(libdl) $(shared-thread-library)
+$(objpfx)tst-dlopen-tlsmodid-pie: $(shared-thread-library)
 $(objpfx)tst-dlopen-tlsmodid-pie.out: $(objpfx)tst-dlopen-self-pie
-$(objpfx)tst-dlopen-tlsmodid-container: $(libdl) $(shared-thread-library)
+$(objpfx)tst-dlopen-tlsmodid-container: $(shared-thread-library)
 LDFLAGS-tst-dlopen-tlsmodid-container += -Wl,-rpath,\$$ORIGIN
 
 tst-tst-dlopen-self-no-pie = yes
-$(objpfx)tst-dlopen-self: $(libdl)
 CFLAGS-tst-dlopen-self-pie.c += $(pie-ccflag)
-$(objpfx)tst-dlopen-self-pie: $(libdl)
-$(objpfx)tst-dlopen-self-container: $(libdl)
 LDFLAGS-tst-dlopen-self-container += -Wl,-rpath,\$$ORIGIN
 
 CFLAGS-ifuncmain1pic.c += $(pic-ccflag)
@@ -1437,7 +1350,6 @@ $(objpfx)ifuncmain2pic: $(addprefix $(objpfx),ifuncdep2pic.o)
 $(objpfx)ifuncmain2static: $(addprefix $(objpfx),ifuncdep2.o)
 $(objpfx)ifuncmain2picstatic: $(addprefix $(objpfx),ifuncdep2pic.o)
 
-$(objpfx)ifuncmain3: $(libdl)
 $(objpfx)ifuncmain3.out: $(objpfx)ifuncmod3.so
 
 $(objpfx)ifuncmain5: $(addprefix $(objpfx),ifuncmod5.so)
@@ -1461,19 +1373,17 @@ $(objpfx)tst-ifunc-fault-bindnow.out: $(objpfx)tst-ifunc-fault-bindnow \
    $(objpfx)ld.so
 	$(tst-ifunc-fault-script)
 
-$(objpfx)tst-unique1: $(libdl)
 $(objpfx)tst-unique1.out: $(objpfx)tst-unique1mod1.so \
 			  $(objpfx)tst-unique1mod2.so
 
-$(objpfx)tst-unique2: $(libdl) $(objpfx)tst-unique2mod1.so
+$(objpfx)tst-unique2: $(objpfx)tst-unique2mod1.so
 $(objpfx)tst-unique2.out: $(objpfx)tst-unique2mod2.so
 
-$(objpfx)tst-unique3: $(libdl) $(objpfx)tst-unique3lib.so
+$(objpfx)tst-unique3: $(objpfx)tst-unique3lib.so
 $(objpfx)tst-unique3.out: $(objpfx)tst-unique3lib2.so
 
 $(objpfx)tst-unique4: $(objpfx)tst-unique4lib.so
 
-$(objpfx)tst-nodelete: $(libdl)
 $(objpfx)tst-nodelete.out: $(objpfx)tst-nodelete-uniquemod.so \
 			   $(objpfx)tst-nodelete-rtldmod.so \
 			   $(objpfx)tst-nodelete-zmod.so
@@ -1481,7 +1391,6 @@ $(objpfx)tst-nodelete.out: $(objpfx)tst-nodelete-uniquemod.so \
 LDFLAGS-tst-nodelete = -rdynamic
 LDFLAGS-tst-nodelete-zmod.so = -Wl,--enable-new-dtags,-z,nodelete
 
-$(objpfx)tst-nodelete2: $(libdl)
 $(objpfx)tst-nodelete2.out: $(objpfx)tst-nodelete2mod.so
 
 LDFLAGS-tst-nodelete2 = -rdynamic
@@ -1509,7 +1418,6 @@ $(objpfx)tst-initorder2-cmp.out: tst-initorder2.exp $(objpfx)tst-initorder2.out
 	cmp $^ > $@; \
 	$(evaluate-test)
 
-$(objpfx)tst-relsort1: $(libdl)
 $(objpfx)tst-relsort1mod1.so: $(libm) $(objpfx)tst-relsort1mod2.so
 $(objpfx)tst-relsort1mod2.so: $(libm)
 $(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
@@ -1529,13 +1437,11 @@ $(objpfx)tst-unused-dep-cmp.out: $(objpfx)tst-unused-dep.out
 	$(evaluate-test)
 
 $(objpfx)tst-audit11.out: $(objpfx)tst-auditmod11.so $(objpfx)tst-audit11mod1.so
-$(objpfx)tst-audit11: $(libdl)
 tst-audit11-ENV = LD_AUDIT=$(objpfx)tst-auditmod11.so
 $(objpfx)tst-audit11mod1.so: $(objpfx)tst-audit11mod2.so
 LDFLAGS-tst-audit11mod2.so = -Wl,--version-script=tst-audit11mod2.map,-soname,tst-audit11mod2.so
 
 $(objpfx)tst-audit12.out: $(objpfx)tst-auditmod12.so $(objpfx)tst-audit12mod1.so $(objpfx)tst-audit12mod3.so
-$(objpfx)tst-audit12: $(libdl)
 tst-audit12-ENV = LD_AUDIT=$(objpfx)tst-auditmod12.so
 $(objpfx)tst-audit12mod1.so: $(objpfx)tst-audit12mod2.so
 LDFLAGS-tst-audit12mod2.so = -Wl,--version-script=tst-audit12mod2.map
@@ -1585,13 +1491,11 @@ $(objpfx)tst-sonamemove-link: $(objpfx)tst-sonamemove-linkmod1.so
 $(objpfx)tst-sonamemove-link.out: \
   $(objpfx)tst-sonamemove-runmod1.so \
   $(objpfx)tst-sonamemove-runmod2.so
-$(objpfx)tst-sonamemove-dlopen: $(libdl)
 $(objpfx)tst-sonamemove-dlopen.out: \
   $(objpfx)tst-sonamemove-runmod1.so \
   $(objpfx)tst-sonamemove-runmod2.so
 
-$(objpfx)tst-dlmopen-dlerror: $(libdl)
-$(objpfx)tst-dlmopen-dlerror-mod.so: $(libdl) $(libsupport)
+$(objpfx)tst-dlmopen-dlerror-mod.so: $(libsupport)
 $(objpfx)tst-dlmopen-dlerror.out: $(objpfx)tst-dlmopen-dlerror-mod.so
 
 # Override -z defs, so that we can reference an undefined symbol.
@@ -1602,7 +1506,6 @@ LDFLAGS-tst-latepthreadmod.so = \
 # function this_function_is_not_defined.
 CFLAGS-tst-latepthreadmod.c += -fno-optimize-sibling-calls
 $(objpfx)tst-latepthreadmod.so: $(shared-thread-library)
-$(objpfx)tst-latepthread: $(libdl)
 $(objpfx)tst-latepthread.out: $(objpfx)tst-latepthreadmod.so
 
 # The test modules are parameterized by preprocessor macros.
@@ -1610,7 +1513,7 @@ $(patsubst %,$(objpfx)%.os,$(tst-tls-many-dynamic-modules)): \
   $(objpfx)tst-tls-manydynamic%mod.os : tst-tls-manydynamicmod.c
 	$(compile-command.c) \
 	  -DNAME=tls_global_$* -DSETTER=set_value_$* -DGETTER=get_value_$*
-$(objpfx)tst-tls-manydynamic: $(libdl) $(shared-thread-library)
+$(objpfx)tst-tls-manydynamic: $(shared-thread-library)
 $(objpfx)tst-tls-manydynamic.out: \
   $(patsubst %,$(objpfx)%.so,$(tst-tls-many-dynamic-modules))
 
@@ -1626,8 +1529,6 @@ $(objpfx)tst-ldconfig-X.out : tst-ldconfig-X.sh $(objpfx)ldconfig
 		 '$(run-program-env)' > $@; \
 	$(evaluate-test)
 
-$(objpfx)tst-dlsym-error: $(libdl)
-
 # Test static linking of all the libraries we can possibly link
 # together.  Note that in some configurations this may be less than the
 # complete list of libraries we build but we try to maxmimize this list.
@@ -1661,7 +1562,6 @@ endif
 # The application depends on the DSO, and the DSO loads the plugin.
 # The plugin also depends on the DSO. This creates the circular
 # dependency via dlopen that we're testing to make sure works.
-$(objpfx)tst-nodelete-dlclose-dso.so: $(libdl)
 $(objpfx)tst-nodelete-dlclose-plugin.so: $(objpfx)tst-nodelete-dlclose-dso.so
 $(objpfx)tst-nodelete-dlclose: $(objpfx)tst-nodelete-dlclose-dso.so
 $(objpfx)tst-nodelete-dlclose.out: $(objpfx)tst-nodelete-dlclose-dso.so \
@@ -1670,7 +1570,6 @@ $(objpfx)tst-nodelete-dlclose.out: $(objpfx)tst-nodelete-dlclose-dso.so \
 tst-env-setuid-ENV = MALLOC_CHECK_=2 MALLOC_MMAP_THRESHOLD_=4096 \
 		     LD_HWCAP_MASK=0x1
 
-$(objpfx)tst-debug1: $(libdl)
 $(objpfx)tst-debug1.out: $(objpfx)tst-debug1mod1.so
 
 $(objpfx)tst-debug1mod1.so: $(objpfx)testobj1.so
@@ -1692,8 +1591,7 @@ $(objpfx)tst-absolute-zero: $(objpfx)tst-absolute-zero-lib.so
 
 # Both the main program and the DSO for tst-libc_dlvsym need to link
 # against libdl.
-$(objpfx)tst-libc_dlvsym: $(libdl)
-$(objpfx)tst-libc_dlvsym-dso.so: $(libsupport) $(libdl)
+$(objpfx)tst-libc_dlvsym-dso.so: $(libsupport)
 $(objpfx)tst-libc_dlvsym.out: $(objpfx)tst-libc_dlvsym-dso.so
 $(objpfx)tst-libc_dlvsym-static: $(common-objpfx)dlfcn/libdl.a
 tst-libc_dlvsym-static-ENV = \
@@ -1711,7 +1609,6 @@ $(objpfx)tst-unwind-ctor: $(objpfx)tst-unwind-ctor-lib.so
 
 CFLAGS-tst-unwind-main.c += -funwind-tables -DUSE_PTHREADS=0
 
-$(objpfx)tst-initfinilazyfail: $(libdl)
 $(objpfx)tst-initfinilazyfail.out: \
   $(objpfx)tst-initlazyfailmod.so $(objpfx)tst-finilazyfailmod.so
 # Override -z defs, so that we can reference an undefined symbol.
@@ -1721,7 +1618,6 @@ LDFLAGS-tst-initlazyfailmod.so = \
 LDFLAGS-tst-finilazyfailmod.so = \
   -Wl,-z,lazy -Wl,--unresolved-symbols=ignore-all
 
-$(objpfx)tst-dlopenfail: $(libdl)
 $(objpfx)tst-dlopenfail.out: \
   $(objpfx)tst-dlopenfailmod1.so $(objpfx)tst-dlopenfailmod2.so
 # Order matters here.  tst-dlopenfaillinkmod.so's soname ensures a
@@ -1733,7 +1629,6 @@ $(objpfx)tst-dlopenfailmod1.so: \
   $(shared-thread-library) $(objpfx)tst-dlopenfaillinkmod.so
 LDFLAGS-tst-dlopenfaillinkmod.so = -Wl,-soname,tst-dlopenfail-missingmod.so
 $(objpfx)tst-dlopenfailmod2.so: $(objpfx)tst-dlopenfailnodelmod.so
-$(objpfx)tst-dlopenfail-2: $(libdl)
 $(objpfx)tst-dlopenfail-2.out: \
   $(objpfx)tst-dlopenfailmod1.so $(objpfx)tst-dlopenfailmod2.so \
   $(objpfx)tst-dlopenfailmod3.so
@@ -1745,7 +1640,6 @@ LDFLAGS-tst-dlopenfailnodelmod.so = \
 # tst-dlopenfailnodelmod.so uses them for error reporting.
 LDFLAGS-tst-dlopenfail = -Wl,-E
 
-$(objpfx)tst-dlopen-nodelete-reloc: $(libdl)
 $(objpfx)tst-dlopen-nodelete-reloc.out: \
   $(objpfx)tst-dlopen-nodelete-reloc-mod1.so \
   $(objpfx)tst-dlopen-nodelete-reloc-mod2.so \
@@ -1774,8 +1668,6 @@ $(objpfx)tst-dlopen-nodelete-reloc-mod5.so: \
 LDFLAGS-tst-dlopen-nodelete-reloc-mod5.so = -Wl,-z,nodelete,--no-as-needed
 tst-dlopen-nodelete-reloc-mod5.so-no-z-defs = yes
 tst-dlopen-nodelete-reloc-mod7.so-no-z-defs = yes
-$(objpfx)tst-dlopen-nodelete-reloc-mod8.so: $(libdl)
-$(objpfx)tst-dlopen-nodelete-reloc-mod10.so: $(libdl)
 tst-dlopen-nodelete-reloc-mod11.so-no-z-defs = yes
 $(objpfx)tst-dlopen-nodelete-reloc-mod13.so: \
   $(objpfx)tst-dlopen-nodelete-reloc-mod12.so
@@ -1791,21 +1683,18 @@ $(objpfx)tst-dlopen-nodelete-reloc-mod17.so: \
 LDFLAGS-tst-dlopen-nodelete-reloc-mod17.so = -Wl,--no-as-needed
 
 $(objpfx)tst-ldconfig-ld_so_conf-update.out: $(objpfx)tst-ldconfig-ld-mod.so
-$(objpfx)tst-ldconfig-ld_so_conf-update: $(libdl)
 
 LDFLAGS-tst-filterobj-flt.so = -Wl,--filter=$(objpfx)tst-filterobj-filtee.so
 $(objpfx)tst-filterobj: $(objpfx)tst-filterobj-flt.so
-$(objpfx)tst-filterobj-dlopen: $(libdl)
 $(objpfx)tst-filterobj.out: $(objpfx)tst-filterobj-filtee.so
 $(objpfx)tst-filterobj-dlopen.out: $(objpfx)tst-filterobj-filtee.so
 
 LDFLAGS-tst-filterobj-aux.so = -Wl,--auxiliary=$(objpfx)tst-filterobj-filtee.so
 $(objpfx)tst-auxobj: $(objpfx)tst-filterobj-aux.so
-$(objpfx)tst-auxobj-dlopen: $(libdl)
 $(objpfx)tst-auxobj.out: $(objpfx)tst-filterobj-filtee.so
 $(objpfx)tst-auxobj-dlopen.out: $(objpfx)tst-filterobj-filtee.so
 
-$(objpfx)tst-single_threaded: $(objpfx)tst-single_threaded-mod1.so $(libdl)
+$(objpfx)tst-single_threaded: $(objpfx)tst-single_threaded-mod1.so
 $(objpfx)tst-single_threaded.out: \
   $(objpfx)tst-single_threaded-mod2.so $(objpfx)tst-single_threaded-mod3.so
 $(objpfx)tst-single_threaded-static-dlopen: \
@@ -1813,13 +1702,13 @@ $(objpfx)tst-single_threaded-static-dlopen: \
 $(objpfx)tst-single_threaded-static-dlopen.out: \
   $(objpfx)tst-single_threaded-mod2.so
 $(objpfx)tst-single_threaded-pthread: \
-  $(objpfx)tst-single_threaded-mod1.so $(libdl) $(shared-thread-library)
+  $(objpfx)tst-single_threaded-mod1.so $(shared-thread-library)
 $(objpfx)tst-single_threaded-pthread.out: \
   $(objpfx)tst-single_threaded-mod2.so $(objpfx)tst-single_threaded-mod3.so \
   $(objpfx)tst-single_threaded-mod4.so
 $(objpfx)tst-single_threaded-pthread-static: $(static-thread-library)
 
-$(objpfx)tst-tls-ie: $(libdl) $(shared-thread-library)
+$(objpfx)tst-tls-ie: $(shared-thread-library)
 $(objpfx)tst-tls-ie.out: \
   $(objpfx)tst-tls-ie-mod0.so \
   $(objpfx)tst-tls-ie-mod1.so \
@@ -1829,7 +1718,7 @@ $(objpfx)tst-tls-ie.out: \
   $(objpfx)tst-tls-ie-mod5.so \
   $(objpfx)tst-tls-ie-mod6.so
 
-$(objpfx)tst-tls-ie-dlmopen: $(libdl) $(shared-thread-library)
+$(objpfx)tst-tls-ie-dlmopen: $(shared-thread-library)
 $(objpfx)tst-tls-ie-dlmopen.out: \
   $(objpfx)tst-tls-ie-mod0.so \
   $(objpfx)tst-tls-ie-mod1.so \
@@ -1839,8 +1728,6 @@ $(objpfx)tst-tls-ie-dlmopen.out: \
   $(objpfx)tst-tls-ie-mod5.so \
   $(objpfx)tst-tls-ie-mod6.so
 
-$(objpfx)tst-tls-surplus: $(libdl)
-
 $(objpfx)argv0test.out: tst-rtld-argv0.sh $(objpfx)ld.so \
 			$(objpfx)argv0test
 	$(SHELL) $< $(objpfx)ld.so $(objpfx)argv0test \
@@ -1896,7 +1783,6 @@ $(objpfx)tst-glibc-hwcaps-prepend.out: \
 # Like tst-glibc-hwcaps-prepend, but uses a container and loads the
 # library via ld.so.cache.  Test setup is contained in the test
 # itself.
-$(objpfx)tst-glibc-hwcaps-prepend-cache: $(libdl)
 $(objpfx)tst-glibc-hwcaps-prepend-cache.out: \
   $(objpfx)tst-glibc-hwcaps-prepend-cache $(objpfx)libmarkermod1-1.so \
   $(objpfx)libmarkermod1-2.so $(objpfx)libmarkermod1-3.so
@@ -1941,12 +1827,12 @@ $(objpfx)tst-rtld-help.out: $(objpfx)ld.so
 
 # Reuses tst-tls-many-dynamic-modules
 tst-tls20mod-bad.so-no-z-defs = yes
-$(objpfx)tst-tls20: $(libdl) $(shared-thread-library)
+$(objpfx)tst-tls20: $(shared-thread-library)
 $(objpfx)tst-tls20.out: $(objpfx)tst-tls20mod-bad.so \
 			$(tst-tls-many-dynamic-modules:%=$(objpfx)%.so)
 
 # Reuses tst-tls-many-dynamic-modules
-$(objpfx)tst-tls21: $(libdl) $(shared-thread-library)
+$(objpfx)tst-tls21: $(shared-thread-library)
 $(objpfx)tst-tls21.out: $(objpfx)tst-tls21mod.so
 $(objpfx)tst-tls21mod.so: $(tst-tls-many-dynamic-modules:%=$(objpfx)%.so)