[14/16] dlfcn: Cleanups after -ldl is no longer required

Message ID 0deca0d2cb365a2a9da69f89f995d5feb844c767.1622469909.git.fweimer@redhat.com
State New
Headers show
Series
  • Move libdl into libc
Related show

Commit Message

Szabolcs Nagy via Libc-alpha May 31, 2021, 2:12 p.m.
This commit removes the ELF constructor and internal variables from
dlfcn, and adjusts the test suite not to use $(libdl).  The libdl.so
symbolic link is no longer installed.

Moving the dlfcn object file to libdl-shared-only-routines ensures
that libdl.a is empty.
---
 Makeconfig               |   6 --
 dlfcn/Makefile           |  40 +++------
 dlfcn/dlfcn.c            |  18 ----
 elf/Makefile             | 172 +++++++--------------------------------
 htl/Makefile             |   1 -
 iconvdata/Makefile       |   1 -
 include/dlfcn.h          |  18 ----
 malloc/Makefile          |   3 -
 misc/Makefile            |   2 -
 nptl/Makefile            |   7 --
 nss/Makefile             |   5 --
 resolv/Makefile          |  19 ++---
 stdlib/Makefile          |   8 +-
 string/Makefile          |   1 -
 sysdeps/mips/Makefile    |   1 -
 sysdeps/pthread/Makefile |   6 +-
 sysdeps/x86/Makefile     |  13 +--
 17 files changed, 56 insertions(+), 265 deletions(-)

-- 
2.31.1

Comments

Szabolcs Nagy via Libc-alpha June 2, 2021, 6:08 p.m. | #1
On 31/05/2021 11:12, Florian Weimer via Libc-alpha wrote:
> This commit removes the ELF constructor and internal variables from

> dlfcn, and adjusts the test suite not to use $(libdl).  The libdl.so

> symbolic link is no longer installed.

> 

> Moving the dlfcn object file to libdl-shared-only-routines ensures

> that libdl.a is empty.


LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>


> ---

>  Makeconfig               |   6 --

>  dlfcn/Makefile           |  40 +++------

>  dlfcn/dlfcn.c            |  18 ----

>  elf/Makefile             | 172 +++++++--------------------------------

>  htl/Makefile             |   1 -

>  iconvdata/Makefile       |   1 -

>  include/dlfcn.h          |  18 ----

>  malloc/Makefile          |   3 -

>  misc/Makefile            |   2 -

>  nptl/Makefile            |   7 --

>  nss/Makefile             |   5 --

>  resolv/Makefile          |  19 ++---

>  stdlib/Makefile          |   8 +-

>  string/Makefile          |   1 -

>  sysdeps/mips/Makefile    |   1 -

>  sysdeps/pthread/Makefile |   6 +-

>  sysdeps/x86/Makefile     |  13 +--

>  17 files changed, 56 insertions(+), 265 deletions(-)

> 

> diff --git a/Makeconfig b/Makeconfig

> index 1d5e45926c..c3496452b6 100644

> --- a/Makeconfig

> +++ b/Makeconfig

> @@ -1255,12 +1255,6 @@ endif

>  endif # build-shared

>  

>  

> -ifeq ($(build-shared),yes)

> -libdl = $(common-objpfx)dlfcn/libdl.so$(libdl.so-version)

> -else

> -libdl = $(common-objpfx)dlfcn/libdl.a

> -endif

> -

>  ifeq ($(build-shared),yes)

>  libm = $(common-objpfx)math/libm.so$(libm.so-version)

>  libmvec = $(common-objpfx)mathvec/libmvec.so$(libmvec.so-version)


Ok.

> diff --git a/dlfcn/Makefile b/dlfcn/Makefile

> index a471d86071..4d17f770a1 100644

> --- a/dlfcn/Makefile

> +++ b/dlfcn/Makefile

> @@ -22,9 +22,7 @@ include ../Makeconfig

>  headers		:= bits/dlfcn.h dlfcn.h

>  extra-libs	:= libdl

>  libdl-routines	:= dlfcn

> -routines	:= $(patsubst %,s%,$(filter-out dlfcn,$(libdl-routines)))

> -elide-routines.os := $(routines)

> -routines += \

> +routines = \

>    dladdr \

>    dladdr1 \

>    dlclose \


Ok.

> @@ -38,9 +36,16 @@ routines += \

>  

>  extra-libs-others := libdl

>  

> +libdl-shared-only-routines += dlfcn

> +

> +# Pretend that libdl.so is a linker script, so that the symbolic

> +# link is not installed.

> +install-lib-ldscripts = libdl.so

> +$(inst_libdir)/libdl.so:

> +

>  ifeq ($(build-shared),yes)

>  routines += dlopenold

> -shared-only-routines := dlopenold dlfcn

> +shared-only-routines := dlopenold

>  endif

>  

>  ifeq (yes,$(build-shared))


Ok.

> @@ -87,77 +92,54 @@ ifeq ($(build-shared),yes)

>  tests: $(test-modules)

>  endif

>  

> -$(objpfx)glrefmain: $(libdl)

>  $(objpfx)glrefmain.out: $(objpfx)glrefmain \

>  			$(objpfx)glreflib1.so $(objpfx)glreflib2.so

>  

> -$(objpfx)failtest: $(libdl)

>  $(objpfx)failtest.out: $(objpfx)failtestmod.so

>  

> -$(objpfx)tst-dladdr: $(libdl)

>  $(objpfx)tst-dladdr.out: $(objpfx)glreflib1.so

>  

> -$(objpfx)tst-dlinfo: $(libdl)

>  $(objpfx)tst-dlinfo.out: $(objpfx)glreflib3.so

>  LDFLAGS-glreflib3.so = -Wl,-rpath,:

>  

>  LDFLAGS-default = $(LDFLAGS-rdynamic)

> -$(objpfx)default: $(libdl) $(objpfx)defaultmod1.so $(objpfx)defaultmod2.so

> -$(objpfx)defaultmod1.so: $(libdl)

> +$(objpfx)default: $(objpfx)defaultmod1.so $(objpfx)defaultmod2.so

>  LDFLAGS-defaultmod2.so = $(LDFLAGS-Bsymbolic)

> -$(objpfx)defaultmod2.so: $(libdl)

>  

> -$(objpfx)errmsg1: $(libdl)

>  $(objpfx)errmsg1.out: $(objpfx)errmsg1 $(objpfx)errmsg1mod.so

>  

> -$(objpfx)tstatexit: $(libdl)

>  $(objpfx)tstatexit.out: $(objpfx)tstatexit $(objpfx)modatexit.so

>  

> -$(objpfx)tstcxaatexit: $(libdl)

>  $(objpfx)tstcxaatexit.out: $(objpfx)tstcxaatexit $(objpfx)modcxaatexit.so

>  

> -$(objpfx)tststatic: $(objpfx)libdl.a

>  $(objpfx)tststatic.out: $(objpfx)tststatic $(objpfx)modstatic.so

>  

> -$(objpfx)tststatic2: $(objpfx)libdl.a

>  $(objpfx)tststatic2.out: $(objpfx)tststatic2 $(objpfx)modstatic.so \

>  			 $(objpfx)modstatic2.so

>  

> -$(objpfx)modstatic2.so: $(libdl)

> -

> -$(objpfx)tststatic3: $(objpfx)libdl.a

>  $(objpfx)tststatic3.out: $(objpfx)tststatic3 $(objpfx)modstatic3.so

>  

> -$(objpfx)tststatic4: $(objpfx)libdl.a

>  $(objpfx)tststatic4.out: $(objpfx)tststatic4 $(objpfx)modstatic3.so

>  

> -$(objpfx)tststatic5: $(objpfx)libdl.a

>  $(objpfx)tststatic5.out: $(objpfx)tststatic5 $(objpfx)modstatic5.so

>  

> -$(objpfx)bug-dlopen1: $(libdl)

> -

> -$(objpfx)bug-dlsym1: $(libdl) $(objpfx)bug-dlsym1-lib2.so

> +$(objpfx)bug-dlsym1: $(objpfx)bug-dlsym1-lib2.so

>  $(objpfx)bug-dlsym1.out: $(objpfx)bug-dlsym1-lib1.so \

>  			 $(objpfx)bug-dlsym1-lib2.so

>  $(objpfx)bug-dlsym1-lib1.so: $(objpfx)bug-dlsym1-lib2.so

>  

> -$(objpfx)bug-atexit1: $(libdl)

>  $(objpfx)bug-atexit1.out: $(objpfx)bug-atexit1-lib.so

>  

> -$(objpfx)bug-atexit2: $(libdl)

>  $(objpfx)bug-atexit2.out: $(objpfx)bug-atexit2-lib.so

>  

>  ifneq (,$(CXX))

>  LDLIBS-bug-atexit3-lib.so = -lstdc++ -lgcc_eh

>  $(objpfx)bug-atexit3-lib.so: $(libsupport)

> -$(objpfx)bug-atexit3: $(libdl)

>  $(objpfx)bug-atexit3.out: $(objpfx)bug-atexit3-lib.so

>  endif

>  

>  $(objpfx)bug-dl-leaf: $(objpfx)bug-dl-leaf-lib.so

>  $(objpfx)bug-dl-leaf.out: $(objpfx)bug-dl-leaf-lib-cb.so

> -$(objpfx)bug-dl-leaf-lib.so: $(libdl)

>  $(objpfx)bug-dl-leaf-lib-cb.so: $(objpfx)bug-dl-leaf-lib.so

>  

> -$(objpfx)tst-rec-dlopen: $(libdl)

>  $(objpfx)tst-rec-dlopen.out: $(objpfx)moddummy1.so $(objpfx)moddummy2.so


Ok.

> diff --git a/dlfcn/dlfcn.c b/dlfcn/dlfcn.c

> index ef750bc27a..e7fa01ecf5 100644

> --- a/dlfcn/dlfcn.c

> +++ b/dlfcn/dlfcn.c

> @@ -19,24 +19,6 @@

>  #include <dlfcn.h>

>  #include <shlib-compat.h>

>  

> -int __dlfcn_argc attribute_hidden;

> -char **__dlfcn_argv attribute_hidden;

> -

> -

> -static void

> -init (int argc, char *argv[])

> -{

> -  __dlfcn_argc = argc;

> -  __dlfcn_argv = argv;

> -}

> -

> -static void (*const init_array []) (int argc, char *argv[])

> -     __attribute__ ((section (".init_array"), aligned (sizeof (void *))))

> -     __attribute_used__ =

> -{

> -  init

> -};

> -

>  /* The remainder of this file is used to keep specific symbol versions

>     occupied, so that ld does not generate weak symbol version

>     definitions.  */


Ok.

> 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)


Ok.

> @@ -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


Ok.

> @@ -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

>  


Ok.

> @@ -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


Ok.

> @@ -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

>  


Ok.

> @@ -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)

>  


Ok.

> diff --git a/htl/Makefile b/htl/Makefile

> index 4c5767b04c..8c5ad3c5de 100644

> --- a/htl/Makefile

> +++ b/htl/Makefile

> @@ -215,7 +215,6 @@ $(addprefix $(objpfx), \

>      $(tests-nolibpthread), \

>      $(tests) $(tests-internal) $(xtests) $(test-srcs) $(tests-container))): \

>  	$(objpfx)libpthread.so

> -$(objpfx)tst-unload: $(libdl)

>  # $(objpfx)../libc.so is used instead of $(common-objpfx)libc.so,

>  # since otherwise libpthread.so comes before libc.so when linking.

>  $(addprefix $(objpfx), $(tests-reverse)): \


Ok.

> diff --git a/iconvdata/Makefile b/iconvdata/Makefile

> index 55c527a5f7..6eeb92f4b3 100644

> --- a/iconvdata/Makefile

> +++ b/iconvdata/Makefile

> @@ -307,7 +307,6 @@ $(objpfx)bug-iconv1.out: $(objpfx)gconv-modules \

>  			 $(addprefix $(objpfx),$(modules.so))

>  $(objpfx)bug-iconv2.out: $(objpfx)gconv-modules \

>  			 $(addprefix $(objpfx),$(modules.so))

> -$(objpfx)bug-iconv3: $(libdl)

>  $(objpfx)bug-iconv3.out: $(objpfx)gconv-modules \

>  			 $(addprefix $(objpfx),$(modules.so))

>  $(objpfx)bug-iconv5.out: $(objpfx)gconv-modules \


Ok.

> diff --git a/include/dlfcn.h b/include/dlfcn.h

> index 4274eddbc9..711bbb0f12 100644

> --- a/include/dlfcn.h

> +++ b/include/dlfcn.h

> @@ -19,16 +19,6 @@

>  extern int __libc_argc attribute_hidden;

>  extern char **__libc_argv attribute_hidden;

>  

> -#ifdef SHARED

> -/* Locally stored program arguments.  */

> -extern int __dlfcn_argc attribute_hidden;

> -extern char **__dlfcn_argv attribute_hidden;

> -#else

> -# define __dlfcn_argc __libc_argc

> -# define __dlfcn_argv __libc_argv

> -#endif

> -

> -

>  /* Now define the internal interfaces.  */

>  

>  /* Use RTLD_NOW here because:


Ok.

> @@ -101,14 +91,6 @@ libc_hidden_proto (_dl_vsym)

>  extern int _dlerror_run (void (*operate) (void *), void *args);

>  libc_hidden_proto (_dlerror_run)

>  

> -#ifdef SHARED

> -# define DL_CALLER_DECL /* Nothing */

> -# define DL_CALLER RETURN_ADDRESS (0)

> -#else

> -# define DL_CALLER_DECL , void *dl_caller

> -# define DL_CALLER dl_caller

> -#endif

> -

>  struct dlfcn_hook

>  {

>    void *(*dlopen) (const char *file, int mode, void *dl_caller);


Ok.

> diff --git a/malloc/Makefile b/malloc/Makefile

> index 857e2ebbd9..149dc7471f 100644

> --- a/malloc/Makefile

> +++ b/malloc/Makefile

> @@ -244,9 +244,6 @@ $(objpfx)memusage: memusage.sh

>  	&& rm -f $@ && mv $@.new $@ && chmod +x $@

>  

>  

> -# The implementation uses `dlsym'

> -$(objpfx)libmemusage.so: $(libdl)

> -

>  # Extra dependencies

>  $(foreach o,$(all-object-suffixes),$(objpfx)malloc$(o)): arena.c hooks.c

>  


Ok.

> diff --git a/misc/Makefile b/misc/Makefile

> index 38dad737f2..c103b6bff4 100644

> --- a/misc/Makefile

> +++ b/misc/Makefile

> @@ -158,5 +158,3 @@ tst-allocate_once-ENV = MALLOC_TRACE=$(objpfx)tst-allocate_once.mtrace

>  $(objpfx)tst-allocate_once-mem.out: $(objpfx)tst-allocate_once.out

>  	$(common-objpfx)malloc/mtrace $(objpfx)tst-allocate_once.mtrace > $@; \

>  	$(evaluate-test)

> -

> -$(objpfx)tst-gethostid: $(libdl)


Ok.

> diff --git a/nptl/Makefile b/nptl/Makefile

> index 9a5628b751..f7d7a2c7e2 100644

> --- a/nptl/Makefile

> +++ b/nptl/Makefile

> @@ -497,7 +497,6 @@ $(objpfx)tst-stack3-mem.out: $(objpfx)tst-stack3.out

>  	$(evaluate-test)

>  generated += tst-stack3-mem.out tst-stack3.mtrace

>  

> -$(objpfx)tst-stack4: $(libdl)

>  tst-stack4mod.sos=$(shell for i in 0 1 2 3 4 5 6 7 8 9 10 \

>  				   11 12 13 14 15 16 17 18 19; do \

>  			    for j in 0 1 2 3 4 5 6 7 8 9 10 \

> @@ -513,11 +512,9 @@ clean:

>  $(objpfx)tst-cleanup4: $(objpfx)tst-cleanup4aux.o

>  $(objpfx)tst-cleanupx4: $(objpfx)tst-cleanupx4aux.o

>  

> -$(objpfx)tst-tls3: $(libdl)

>  LDFLAGS-tst-tls3 = -rdynamic

>  $(objpfx)tst-tls3.out: $(objpfx)tst-tls3mod.so

>  

> -$(objpfx)tst-tls3-malloc: $(libdl)

>  LDFLAGS-tst-tls3-malloc = -rdynamic

>  $(objpfx)tst-tls3-malloc.out: $(objpfx)tst-tls3mod.so

>  

> @@ -535,8 +532,6 @@ $(objpfx)tst-tls6.out: tst-tls6.sh $(objpfx)tst-tls5 \

>  	$(evaluate-test)

>  endif

>  

> -$(objpfx)tst-dlsym1: $(libdl)

> -

>  ifeq (yes,$(build-shared))

>  librt = $(common-objpfx)rt/librt.so

>  else

> @@ -550,14 +545,12 @@ LDLIBS-tst-cancel24 = -Wl,--no-as-needed -lstdc++

>  LDLIBS-tst-cancel24-static = $(LDLIBS-tst-cancel24)

>  

>  ifeq ($(build-shared),yes)

> -$(objpfx)tst-unload: $(libdl)

>  

>  generated += multidir.mk tst-tls6.out

>  endif

>  

>  tst-exec4-ARGS = $(host-test-program-cmd)

>  

> -$(objpfx)tst-execstack: $(libdl)

>  $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so

>  LDFLAGS-tst-execstack = -Wl,-z,noexecstack

>  CFLAGS-tst-execstack-mod.c += -Wno-trampolines


Ok.

> diff --git a/nss/Makefile b/nss/Makefile

> index 71fbe583bf..9682a31e20 100644

> --- a/nss/Makefile

> +++ b/nss/Makefile

> @@ -181,10 +181,5 @@ ifeq (yes,$(have-thread-library))

>  $(objpfx)tst-cancel-getpwuid_r: $(shared-thread-library)

>  endif

>  

> -$(objpfx)tst-nss-files-hosts-erange: $(libdl)

> -$(objpfx)tst-nss-files-hosts-multi: $(libdl)

> -$(objpfx)tst-nss-files-hosts-getent: $(libdl)

> -$(objpfx)tst-nss-files-alias-leak: $(libdl)

>  $(objpfx)tst-nss-files-alias-leak.out: $(objpfx)/libnss_files.so

> -$(objpfx)tst-nss-files-alias-truncated: $(libdl)

>  $(objpfx)tst-nss-files-alias-truncated.out: $(objpfx)/libnss_files.so


Ok.

> diff --git a/resolv/Makefile b/resolv/Makefile

> index fb19c93026..3fbc320ee1 100644

> --- a/resolv/Makefile

> +++ b/resolv/Makefile

> @@ -149,7 +149,7 @@ $(objpfx)libnss_dns.so: $(objpfx)libresolv.so

>  # The asynchronous name lookup code needs the thread library.

>  $(objpfx)libanl.so: $(shared-thread-library)

>  

> -$(objpfx)tst-res_hconf_reorder: $(libdl) $(shared-thread-library)

> +$(objpfx)tst-res_hconf_reorder: $(shared-thread-library)

>  tst-res_hconf_reorder-ENV = RESOLV_REORDER=on

>  

>  $(objpfx)tst-leaks: $(objpfx)libresolv.so

> @@ -173,12 +173,11 @@ $(objpfx)mtrace-tst-resolv-res_ninit.out: $(objpfx)tst-resolv-res_ninit.out

>  

>  $(objpfx)tst-bug18665-tcp: $(objpfx)libresolv.so $(shared-thread-library)

>  $(objpfx)tst-bug18665: $(objpfx)libresolv.so $(shared-thread-library)

> -$(objpfx)tst-resolv-ai_idn: \

> -  $(libdl) $(objpfx)libresolv.so $(shared-thread-library)

> +$(objpfx)tst-resolv-ai_idn: $(objpfx)libresolv.so $(shared-thread-library)

>  $(objpfx)tst-resolv-ai_idn-latin1: \

> -  $(libdl) $(objpfx)libresolv.so $(shared-thread-library)

> +  $(objpfx)libresolv.so $(shared-thread-library)

>  $(objpfx)tst-resolv-ai_idn-nolibidn2: \

> -  $(libdl) $(objpfx)libresolv.so $(shared-thread-library)

> +  $(objpfx)libresolv.so $(shared-thread-library)

>  $(objpfx)tst-resolv-ai_idn.out: $(gen-locales)

>  $(objpfx)tst-resolv-ai_idn-latin1.out: $(gen-locales)

>  $(objpfx)tst-resolv-ai_idn-nolibidn2.out: \

> @@ -187,22 +186,20 @@ $(objpfx)tst-resolv-basic: $(objpfx)libresolv.so $(shared-thread-library)

>  $(objpfx)tst-resolv-binary: $(objpfx)libresolv.so $(shared-thread-library)

>  $(objpfx)tst-resolv-edns: $(objpfx)libresolv.so $(shared-thread-library)

>  $(objpfx)tst-resolv-network: $(objpfx)libresolv.so $(shared-thread-library)

> -$(objpfx)tst-resolv-res_init: $(libdl) $(objpfx)libresolv.so

> +$(objpfx)tst-resolv-res_init: $(objpfx)libresolv.so

>  $(objpfx)tst-resolv-res_init-multi: $(objpfx)libresolv.so \

>    $(shared-thread-library)

> -$(objpfx)tst-resolv-res_init-thread: $(libdl) $(objpfx)libresolv.so \

> +$(objpfx)tst-resolv-res_init-thread: $(objpfx)libresolv.so \

>    $(shared-thread-library)

>  $(objpfx)tst-resolv-nondecimal: $(objpfx)libresolv.so $(shared-thread-library)

>  $(objpfx)tst-resolv-qtypes: $(objpfx)libresolv.so $(shared-thread-library)

>  $(objpfx)tst-resolv-rotate: $(objpfx)libresolv.so $(shared-thread-library)

>  $(objpfx)tst-resolv-search: $(objpfx)libresolv.so $(shared-thread-library)

>  $(objpfx)tst-resolv-trailing: $(objpfx)libresolv.so $(shared-thread-library)

> -$(objpfx)tst-resolv-threads: \

> -  $(libdl) $(objpfx)libresolv.so $(shared-thread-library)

> +$(objpfx)tst-resolv-threads: $(objpfx)libresolv.so $(shared-thread-library)

>  $(objpfx)tst-resolv-txnid-collision: $(objpfx)libresolv.a \

>    $(static-thread-library)

> -$(objpfx)tst-resolv-canonname: \

> -  $(libdl) $(objpfx)libresolv.so $(shared-thread-library)

> +$(objpfx)tst-resolv-canonname: $(objpfx)libresolv.so $(shared-thread-library)

>  $(objpfx)tst-resolv-trustad: $(objpfx)libresolv.so $(shared-thread-library)

>  

>  $(objpfx)tst-ns_name: $(objpfx)libresolv.so


Ok.

> diff --git a/stdlib/Makefile b/stdlib/Makefile

> index ec30011b4c..7c15549caf 100644

> --- a/stdlib/Makefile

> +++ b/stdlib/Makefile

> @@ -106,7 +106,7 @@ LDLIBS-test-cxa_atexit-race2 = $(shared-thread-library)

>  LDLIBS-test-on_exit-race = $(shared-thread-library)

>  LDLIBS-tst-canon-bz26341 = $(shared-thread-library)

>  

> -LDLIBS-test-dlclose-exit-race = $(shared-thread-library) $(libdl)

> +LDLIBS-test-dlclose-exit-race = $(shared-thread-library)

>  LDFLAGS-test-dlclose-exit-race = $(LDFLAGS-rdynamic)

>  LDLIBS-test-dlclose-exit-race-helper.so = $(libsupport) $(shared-thread-library)

>  

> @@ -233,10 +233,10 @@ $(objpfx)tst-strtod-nan-sign: $(libm)

>  tst-tls-atexit-lib.so-no-z-defs = yes

>  test-dlclose-exit-race-helper.so-no-z-defs = yes

>  

> -$(objpfx)tst-tls-atexit: $(shared-thread-library) $(libdl)

> +$(objpfx)tst-tls-atexit: $(shared-thread-library)

>  $(objpfx)tst-tls-atexit.out: $(objpfx)tst-tls-atexit-lib.so

>  

> -$(objpfx)tst-tls-atexit-nodelete: $(shared-thread-library) $(libdl)

> +$(objpfx)tst-tls-atexit-nodelete: $(shared-thread-library)

>  $(objpfx)tst-tls-atexit-nodelete.out: $(objpfx)tst-tls-atexit-lib.so

>  

>  $(objpfx)tst-setcontext3.out: tst-setcontext3.sh $(objpfx)tst-setcontext3

> @@ -244,5 +244,3 @@ $(objpfx)tst-setcontext3.out: tst-setcontext3.sh $(objpfx)tst-setcontext3

>  		 '$(run-program-env)' '$(test-program-prefix-after-env)' \

>  		 $(common-objpfx)stdlib/; \

>  	$(evaluate-test)

> -

> -$(objpfx)tst-makecontext: $(libdl)


Ok.

> diff --git a/string/Makefile b/string/Makefile

> index d17626ed39..f0fce2a0b8 100644

> --- a/string/Makefile

> +++ b/string/Makefile

> @@ -80,7 +80,6 @@ xtests = tst-strcoll-overflow

>  # This test needs libdl.

>  ifeq (yes,$(build-shared))

>  tests += test-strerror-errno

> -LDLIBS-test-strerror-errno = $(libdl)

>  endif

>  

>  ifeq ($(run-built-tests),yes)


Ok.

> diff --git a/sysdeps/mips/Makefile b/sysdeps/mips/Makefile

> index 150518bc6d..d770e59fc9 100644

> --- a/sysdeps/mips/Makefile

> +++ b/sysdeps/mips/Makefile

> @@ -64,7 +64,6 @@ fpabi_list=$(subst $(space),$(comma),$(patsubst tst-abi-%mod,o_%,\

>  CPPFLAGS-tst-abi-interlink.c += -DFPABI_LIST=$(fpabi_list)

>  CPPFLAGS-tst-abi-interlink.c += -DFPABI_COUNT=$(words $(fpabi-modules-names))

>  CPPFLAGS-tst-abi-interlink.c += -DFPABI_NATIVE=o_fp$(o32-fpabi)

> -$(objpfx)tst-abi-interlink: $(libdl)

>  $(objpfx)tst-abi-interlink.out: $(patsubst %,$(objpfx)%.so,\

>  					   $(fpabi-modules-names))

>  endif


Ok.

> diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile

> index bca642f438..e4690a7bc4 100644

> --- a/sysdeps/pthread/Makefile

> +++ b/sysdeps/pthread/Makefile

> @@ -203,7 +203,7 @@ CFLAGS-tst-pt-align3.c += $(stack-align-test-flags)

>  

>  tst-umask1-ARGS = $(objpfx)tst-umask1.temp

>  

> -$(objpfx)tst-atfork2: $(libdl) $(shared-thread-library)

> +$(objpfx)tst-atfork2: $(shared-thread-library)

>  LDFLAGS-tst-atfork2 = -rdynamic

>  tst-atfork2-ENV = MALLOC_TRACE=$(objpfx)tst-atfork2.mtrace

>  $(objpfx)tst-atfork2mod.so: $(shared-thread-library)

> @@ -236,7 +236,7 @@ LDFLAGS-tst-_res1mod2.so = -Wl,-soname,tst-_res1mod2.so

>  $(objpfx)tst-_res1: $(objpfx)tst-_res1mod1.so $(objpfx)tst-_res1mod2.so \

>  		    $(shared-thread-library)

>  

> -$(objpfx)tst-pt-tls4: $(libdl) $(shared-thread-library)

> +$(objpfx)tst-pt-tls4: $(shared-thread-library)

>  $(objpfx)tst-pt-tls4.out: $(objpfx)tst-tls4moda.so $(objpfx)tst-tls4modb.so

>  

>  generated += tst-atfork2.mtrace

> @@ -260,7 +260,7 @@ CFLAGS-tst-oncex4.c += -fexceptions

>  CFLAGS-tst-oncey3.c += -fno-exceptions -fno-asynchronous-unwind-tables

>  CFLAGS-tst-oncey4.c += -fno-exceptions -fno-asynchronous-unwind-tables

>  

> -$(objpfx)tst-join7: $(libdl) $(shared-thread-library)

> +$(objpfx)tst-join7: $(shared-thread-library)

>  $(objpfx)tst-join7.out: $(objpfx)tst-join7mod.so

>  $(objpfx)tst-join7mod.so: $(shared-thread-library)

>  LDFLAGS-tst-join7mod.so = -Wl,-soname,tst-join7mod.so


Ok.

> diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile

> index aa016f7b5a..346ec491b3 100644

> --- a/sysdeps/x86/Makefile

> +++ b/sysdeps/x86/Makefile

> @@ -51,7 +51,6 @@ CFLAGS-tst-isa-level-mod-1-v4.c += -DINCLUDE_X86_ISA_LEVEL \

>  				   -DISA_LEVEL=0xf \

>  				   -march=x86-64

>  

> -$(objpfx)tst-isa-level-1: $(libdl)

>  $(objpfx)tst-isa-level-1.out: $(objpfx)tst-isa-level-mod-1-baseline.so \

>  			      $(objpfx)tst-isa-level-mod-1-v2.so \

>  			      $(objpfx)tst-isa-level-mod-1-v3.so \

> @@ -162,38 +161,30 @@ $(objpfx)tst-cet-legacy-1: $(objpfx)tst-cet-legacy-mod-1.so \

>  		       $(objpfx)tst-cet-legacy-mod-2.so

>  $(objpfx)tst-cet-legacy-1a: $(objpfx)tst-cet-legacy-mod-1.so \

>  		       $(objpfx)tst-cet-legacy-mod-2.so

> -$(objpfx)tst-cet-legacy-2: $(objpfx)tst-cet-legacy-mod-2.so $(libdl)

> +$(objpfx)tst-cet-legacy-2: $(objpfx)tst-cet-legacy-mod-2.so

>  $(objpfx)tst-cet-legacy-2.out: $(objpfx)tst-cet-legacy-mod-1.so

> -$(objpfx)tst-cet-legacy-2a: $(objpfx)tst-cet-legacy-mod-2.so $(libdl)

> +$(objpfx)tst-cet-legacy-2a: $(objpfx)tst-cet-legacy-mod-2.so

>  $(objpfx)tst-cet-legacy-2a.out: $(objpfx)tst-cet-legacy-mod-1.so

> -$(objpfx)tst-cet-legacy-4: $(libdl)

>  $(objpfx)tst-cet-legacy-4.out: $(objpfx)tst-cet-legacy-mod-4.so

> -$(objpfx)tst-cet-legacy-5a: $(libdl)

>  $(objpfx)tst-cet-legacy-5a.out: $(objpfx)tst-cet-legacy-mod-5a.so \

>  				$(objpfx)tst-cet-legacy-mod-5b.so

>  $(objpfx)tst-cet-legacy-mod-5a.so: $(objpfx)tst-cet-legacy-mod-5c.so

>  $(objpfx)tst-cet-legacy-mod-5b.so: $(objpfx)tst-cet-legacy-mod-5c.so

> -$(objpfx)tst-cet-legacy-6a: $(libdl)

>  $(objpfx)tst-cet-legacy-6a.out: $(objpfx)tst-cet-legacy-mod-6a.so \

>  				$(objpfx)tst-cet-legacy-mod-6b.so

>  $(objpfx)tst-cet-legacy-mod-6a.so: $(objpfx)tst-cet-legacy-mod-6c.so

>  $(objpfx)tst-cet-legacy-mod-6b.so: $(objpfx)tst-cet-legacy-mod-6c.so

>  LDFLAGS-tst-cet-legacy-mod-6c.so = -Wl,--enable-new-dtags,-z,nodelete

>  ifneq (no,$(have-tunables))

> -$(objpfx)tst-cet-legacy-4a: $(libdl)

>  $(objpfx)tst-cet-legacy-4a.out: $(objpfx)tst-cet-legacy-mod-4.so

>  tst-cet-legacy-4a-ENV = GLIBC_TUNABLES=glibc.cpu.x86_shstk=permissive

> -$(objpfx)tst-cet-legacy-4b: $(libdl)

>  $(objpfx)tst-cet-legacy-4b.out: $(objpfx)tst-cet-legacy-mod-4.so

>  tst-cet-legacy-4b-ENV = GLIBC_TUNABLES=glibc.cpu.x86_shstk=on

> -$(objpfx)tst-cet-legacy-4c: $(libdl)

>  $(objpfx)tst-cet-legacy-4c.out: $(objpfx)tst-cet-legacy-mod-4.so

>  tst-cet-legacy-4c-ENV = GLIBC_TUNABLES=glibc.cpu.x86_shstk=off

> -$(objpfx)tst-cet-legacy-5b: $(libdl)

>  $(objpfx)tst-cet-legacy-5b.out: $(objpfx)tst-cet-legacy-mod-5a.so \

>  				$(objpfx)tst-cet-legacy-mod-5b.so

>  tst-cet-legacy-5b-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK

> -$(objpfx)tst-cet-legacy-6b: $(libdl)

>  $(objpfx)tst-cet-legacy-6b.out: $(objpfx)tst-cet-legacy-mod-6a.so \

>  				$(objpfx)tst-cet-legacy-mod-6b.so

>  tst-cet-legacy-6b-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK

> 


Ok.

Patch

diff --git a/Makeconfig b/Makeconfig
index 1d5e45926c..c3496452b6 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -1255,12 +1255,6 @@  endif
 endif # build-shared
 
 
-ifeq ($(build-shared),yes)
-libdl = $(common-objpfx)dlfcn/libdl.so$(libdl.so-version)
-else
-libdl = $(common-objpfx)dlfcn/libdl.a
-endif
-
 ifeq ($(build-shared),yes)
 libm = $(common-objpfx)math/libm.so$(libm.so-version)
 libmvec = $(common-objpfx)mathvec/libmvec.so$(libmvec.so-version)
diff --git a/dlfcn/Makefile b/dlfcn/Makefile
index a471d86071..4d17f770a1 100644
--- a/dlfcn/Makefile
+++ b/dlfcn/Makefile
@@ -22,9 +22,7 @@  include ../Makeconfig
 headers		:= bits/dlfcn.h dlfcn.h
 extra-libs	:= libdl
 libdl-routines	:= dlfcn
-routines	:= $(patsubst %,s%,$(filter-out dlfcn,$(libdl-routines)))
-elide-routines.os := $(routines)
-routines += \
+routines = \
   dladdr \
   dladdr1 \
   dlclose \
@@ -38,9 +36,16 @@  routines += \
 
 extra-libs-others := libdl
 
+libdl-shared-only-routines += dlfcn
+
+# Pretend that libdl.so is a linker script, so that the symbolic
+# link is not installed.
+install-lib-ldscripts = libdl.so
+$(inst_libdir)/libdl.so:
+
 ifeq ($(build-shared),yes)
 routines += dlopenold
-shared-only-routines := dlopenold dlfcn
+shared-only-routines := dlopenold
 endif
 
 ifeq (yes,$(build-shared))
@@ -87,77 +92,54 @@  ifeq ($(build-shared),yes)
 tests: $(test-modules)
 endif
 
-$(objpfx)glrefmain: $(libdl)
 $(objpfx)glrefmain.out: $(objpfx)glrefmain \
 			$(objpfx)glreflib1.so $(objpfx)glreflib2.so
 
-$(objpfx)failtest: $(libdl)
 $(objpfx)failtest.out: $(objpfx)failtestmod.so
 
-$(objpfx)tst-dladdr: $(libdl)
 $(objpfx)tst-dladdr.out: $(objpfx)glreflib1.so
 
-$(objpfx)tst-dlinfo: $(libdl)
 $(objpfx)tst-dlinfo.out: $(objpfx)glreflib3.so
 LDFLAGS-glreflib3.so = -Wl,-rpath,:
 
 LDFLAGS-default = $(LDFLAGS-rdynamic)
-$(objpfx)default: $(libdl) $(objpfx)defaultmod1.so $(objpfx)defaultmod2.so
-$(objpfx)defaultmod1.so: $(libdl)
+$(objpfx)default: $(objpfx)defaultmod1.so $(objpfx)defaultmod2.so
 LDFLAGS-defaultmod2.so = $(LDFLAGS-Bsymbolic)
-$(objpfx)defaultmod2.so: $(libdl)
 
-$(objpfx)errmsg1: $(libdl)
 $(objpfx)errmsg1.out: $(objpfx)errmsg1 $(objpfx)errmsg1mod.so
 
-$(objpfx)tstatexit: $(libdl)
 $(objpfx)tstatexit.out: $(objpfx)tstatexit $(objpfx)modatexit.so
 
-$(objpfx)tstcxaatexit: $(libdl)
 $(objpfx)tstcxaatexit.out: $(objpfx)tstcxaatexit $(objpfx)modcxaatexit.so
 
-$(objpfx)tststatic: $(objpfx)libdl.a
 $(objpfx)tststatic.out: $(objpfx)tststatic $(objpfx)modstatic.so
 
-$(objpfx)tststatic2: $(objpfx)libdl.a
 $(objpfx)tststatic2.out: $(objpfx)tststatic2 $(objpfx)modstatic.so \
 			 $(objpfx)modstatic2.so
 
-$(objpfx)modstatic2.so: $(libdl)
-
-$(objpfx)tststatic3: $(objpfx)libdl.a
 $(objpfx)tststatic3.out: $(objpfx)tststatic3 $(objpfx)modstatic3.so
 
-$(objpfx)tststatic4: $(objpfx)libdl.a
 $(objpfx)tststatic4.out: $(objpfx)tststatic4 $(objpfx)modstatic3.so
 
-$(objpfx)tststatic5: $(objpfx)libdl.a
 $(objpfx)tststatic5.out: $(objpfx)tststatic5 $(objpfx)modstatic5.so
 
-$(objpfx)bug-dlopen1: $(libdl)
-
-$(objpfx)bug-dlsym1: $(libdl) $(objpfx)bug-dlsym1-lib2.so
+$(objpfx)bug-dlsym1: $(objpfx)bug-dlsym1-lib2.so
 $(objpfx)bug-dlsym1.out: $(objpfx)bug-dlsym1-lib1.so \
 			 $(objpfx)bug-dlsym1-lib2.so
 $(objpfx)bug-dlsym1-lib1.so: $(objpfx)bug-dlsym1-lib2.so
 
-$(objpfx)bug-atexit1: $(libdl)
 $(objpfx)bug-atexit1.out: $(objpfx)bug-atexit1-lib.so
 
-$(objpfx)bug-atexit2: $(libdl)
 $(objpfx)bug-atexit2.out: $(objpfx)bug-atexit2-lib.so
 
 ifneq (,$(CXX))
 LDLIBS-bug-atexit3-lib.so = -lstdc++ -lgcc_eh
 $(objpfx)bug-atexit3-lib.so: $(libsupport)
-$(objpfx)bug-atexit3: $(libdl)
 $(objpfx)bug-atexit3.out: $(objpfx)bug-atexit3-lib.so
 endif
 
 $(objpfx)bug-dl-leaf: $(objpfx)bug-dl-leaf-lib.so
 $(objpfx)bug-dl-leaf.out: $(objpfx)bug-dl-leaf-lib-cb.so
-$(objpfx)bug-dl-leaf-lib.so: $(libdl)
 $(objpfx)bug-dl-leaf-lib-cb.so: $(objpfx)bug-dl-leaf-lib.so
 
-$(objpfx)tst-rec-dlopen: $(libdl)
 $(objpfx)tst-rec-dlopen.out: $(objpfx)moddummy1.so $(objpfx)moddummy2.so
diff --git a/dlfcn/dlfcn.c b/dlfcn/dlfcn.c
index ef750bc27a..e7fa01ecf5 100644
--- a/dlfcn/dlfcn.c
+++ b/dlfcn/dlfcn.c
@@ -19,24 +19,6 @@ 
 #include <dlfcn.h>
 #include <shlib-compat.h>
 
-int __dlfcn_argc attribute_hidden;
-char **__dlfcn_argv attribute_hidden;
-
-
-static void
-init (int argc, char *argv[])
-{
-  __dlfcn_argc = argc;
-  __dlfcn_argv = argv;
-}
-
-static void (*const init_array []) (int argc, char *argv[])
-     __attribute__ ((section (".init_array"), aligned (sizeof (void *))))
-     __attribute_used__ =
-{
-  init
-};
-
 /* The remainder of this file is used to keep specific symbol versions
    occupied, so that ld does not generate weak symbol version
    definitions.  */
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)
 
diff --git a/htl/Makefile b/htl/Makefile
index 4c5767b04c..8c5ad3c5de 100644
--- a/htl/Makefile
+++ b/htl/Makefile
@@ -215,7 +215,6 @@  $(addprefix $(objpfx), \
     $(tests-nolibpthread), \
     $(tests) $(tests-internal) $(xtests) $(test-srcs) $(tests-container))): \
 	$(objpfx)libpthread.so
-$(objpfx)tst-unload: $(libdl)
 # $(objpfx)../libc.so is used instead of $(common-objpfx)libc.so,
 # since otherwise libpthread.so comes before libc.so when linking.
 $(addprefix $(objpfx), $(tests-reverse)): \
diff --git a/iconvdata/Makefile b/iconvdata/Makefile
index 55c527a5f7..6eeb92f4b3 100644
--- a/iconvdata/Makefile
+++ b/iconvdata/Makefile
@@ -307,7 +307,6 @@  $(objpfx)bug-iconv1.out: $(objpfx)gconv-modules \
 			 $(addprefix $(objpfx),$(modules.so))
 $(objpfx)bug-iconv2.out: $(objpfx)gconv-modules \
 			 $(addprefix $(objpfx),$(modules.so))
-$(objpfx)bug-iconv3: $(libdl)
 $(objpfx)bug-iconv3.out: $(objpfx)gconv-modules \
 			 $(addprefix $(objpfx),$(modules.so))
 $(objpfx)bug-iconv5.out: $(objpfx)gconv-modules \
diff --git a/include/dlfcn.h b/include/dlfcn.h
index 4274eddbc9..711bbb0f12 100644
--- a/include/dlfcn.h
+++ b/include/dlfcn.h
@@ -19,16 +19,6 @@ 
 extern int __libc_argc attribute_hidden;
 extern char **__libc_argv attribute_hidden;
 
-#ifdef SHARED
-/* Locally stored program arguments.  */
-extern int __dlfcn_argc attribute_hidden;
-extern char **__dlfcn_argv attribute_hidden;
-#else
-# define __dlfcn_argc __libc_argc
-# define __dlfcn_argv __libc_argv
-#endif
-
-
 /* Now define the internal interfaces.  */
 
 /* Use RTLD_NOW here because:
@@ -101,14 +91,6 @@  libc_hidden_proto (_dl_vsym)
 extern int _dlerror_run (void (*operate) (void *), void *args);
 libc_hidden_proto (_dlerror_run)
 
-#ifdef SHARED
-# define DL_CALLER_DECL /* Nothing */
-# define DL_CALLER RETURN_ADDRESS (0)
-#else
-# define DL_CALLER_DECL , void *dl_caller
-# define DL_CALLER dl_caller
-#endif
-
 struct dlfcn_hook
 {
   void *(*dlopen) (const char *file, int mode, void *dl_caller);
diff --git a/malloc/Makefile b/malloc/Makefile
index 857e2ebbd9..149dc7471f 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -244,9 +244,6 @@  $(objpfx)memusage: memusage.sh
 	&& rm -f $@ && mv $@.new $@ && chmod +x $@
 
 
-# The implementation uses `dlsym'
-$(objpfx)libmemusage.so: $(libdl)
-
 # Extra dependencies
 $(foreach o,$(all-object-suffixes),$(objpfx)malloc$(o)): arena.c hooks.c
 
diff --git a/misc/Makefile b/misc/Makefile
index 38dad737f2..c103b6bff4 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -158,5 +158,3 @@  tst-allocate_once-ENV = MALLOC_TRACE=$(objpfx)tst-allocate_once.mtrace
 $(objpfx)tst-allocate_once-mem.out: $(objpfx)tst-allocate_once.out
 	$(common-objpfx)malloc/mtrace $(objpfx)tst-allocate_once.mtrace > $@; \
 	$(evaluate-test)
-
-$(objpfx)tst-gethostid: $(libdl)
diff --git a/nptl/Makefile b/nptl/Makefile
index 9a5628b751..f7d7a2c7e2 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -497,7 +497,6 @@  $(objpfx)tst-stack3-mem.out: $(objpfx)tst-stack3.out
 	$(evaluate-test)
 generated += tst-stack3-mem.out tst-stack3.mtrace
 
-$(objpfx)tst-stack4: $(libdl)
 tst-stack4mod.sos=$(shell for i in 0 1 2 3 4 5 6 7 8 9 10 \
 				   11 12 13 14 15 16 17 18 19; do \
 			    for j in 0 1 2 3 4 5 6 7 8 9 10 \
@@ -513,11 +512,9 @@  clean:
 $(objpfx)tst-cleanup4: $(objpfx)tst-cleanup4aux.o
 $(objpfx)tst-cleanupx4: $(objpfx)tst-cleanupx4aux.o
 
-$(objpfx)tst-tls3: $(libdl)
 LDFLAGS-tst-tls3 = -rdynamic
 $(objpfx)tst-tls3.out: $(objpfx)tst-tls3mod.so
 
-$(objpfx)tst-tls3-malloc: $(libdl)
 LDFLAGS-tst-tls3-malloc = -rdynamic
 $(objpfx)tst-tls3-malloc.out: $(objpfx)tst-tls3mod.so
 
@@ -535,8 +532,6 @@  $(objpfx)tst-tls6.out: tst-tls6.sh $(objpfx)tst-tls5 \
 	$(evaluate-test)
 endif
 
-$(objpfx)tst-dlsym1: $(libdl)
-
 ifeq (yes,$(build-shared))
 librt = $(common-objpfx)rt/librt.so
 else
@@ -550,14 +545,12 @@  LDLIBS-tst-cancel24 = -Wl,--no-as-needed -lstdc++
 LDLIBS-tst-cancel24-static = $(LDLIBS-tst-cancel24)
 
 ifeq ($(build-shared),yes)
-$(objpfx)tst-unload: $(libdl)
 
 generated += multidir.mk tst-tls6.out
 endif
 
 tst-exec4-ARGS = $(host-test-program-cmd)
 
-$(objpfx)tst-execstack: $(libdl)
 $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
 LDFLAGS-tst-execstack = -Wl,-z,noexecstack
 CFLAGS-tst-execstack-mod.c += -Wno-trampolines
diff --git a/nss/Makefile b/nss/Makefile
index 71fbe583bf..9682a31e20 100644
--- a/nss/Makefile
+++ b/nss/Makefile
@@ -181,10 +181,5 @@  ifeq (yes,$(have-thread-library))
 $(objpfx)tst-cancel-getpwuid_r: $(shared-thread-library)
 endif
 
-$(objpfx)tst-nss-files-hosts-erange: $(libdl)
-$(objpfx)tst-nss-files-hosts-multi: $(libdl)
-$(objpfx)tst-nss-files-hosts-getent: $(libdl)
-$(objpfx)tst-nss-files-alias-leak: $(libdl)
 $(objpfx)tst-nss-files-alias-leak.out: $(objpfx)/libnss_files.so
-$(objpfx)tst-nss-files-alias-truncated: $(libdl)
 $(objpfx)tst-nss-files-alias-truncated.out: $(objpfx)/libnss_files.so
diff --git a/resolv/Makefile b/resolv/Makefile
index fb19c93026..3fbc320ee1 100644
--- a/resolv/Makefile
+++ b/resolv/Makefile
@@ -149,7 +149,7 @@  $(objpfx)libnss_dns.so: $(objpfx)libresolv.so
 # The asynchronous name lookup code needs the thread library.
 $(objpfx)libanl.so: $(shared-thread-library)
 
-$(objpfx)tst-res_hconf_reorder: $(libdl) $(shared-thread-library)
+$(objpfx)tst-res_hconf_reorder: $(shared-thread-library)
 tst-res_hconf_reorder-ENV = RESOLV_REORDER=on
 
 $(objpfx)tst-leaks: $(objpfx)libresolv.so
@@ -173,12 +173,11 @@  $(objpfx)mtrace-tst-resolv-res_ninit.out: $(objpfx)tst-resolv-res_ninit.out
 
 $(objpfx)tst-bug18665-tcp: $(objpfx)libresolv.so $(shared-thread-library)
 $(objpfx)tst-bug18665: $(objpfx)libresolv.so $(shared-thread-library)
-$(objpfx)tst-resolv-ai_idn: \
-  $(libdl) $(objpfx)libresolv.so $(shared-thread-library)
+$(objpfx)tst-resolv-ai_idn: $(objpfx)libresolv.so $(shared-thread-library)
 $(objpfx)tst-resolv-ai_idn-latin1: \
-  $(libdl) $(objpfx)libresolv.so $(shared-thread-library)
+  $(objpfx)libresolv.so $(shared-thread-library)
 $(objpfx)tst-resolv-ai_idn-nolibidn2: \
-  $(libdl) $(objpfx)libresolv.so $(shared-thread-library)
+  $(objpfx)libresolv.so $(shared-thread-library)
 $(objpfx)tst-resolv-ai_idn.out: $(gen-locales)
 $(objpfx)tst-resolv-ai_idn-latin1.out: $(gen-locales)
 $(objpfx)tst-resolv-ai_idn-nolibidn2.out: \
@@ -187,22 +186,20 @@  $(objpfx)tst-resolv-basic: $(objpfx)libresolv.so $(shared-thread-library)
 $(objpfx)tst-resolv-binary: $(objpfx)libresolv.so $(shared-thread-library)
 $(objpfx)tst-resolv-edns: $(objpfx)libresolv.so $(shared-thread-library)
 $(objpfx)tst-resolv-network: $(objpfx)libresolv.so $(shared-thread-library)
-$(objpfx)tst-resolv-res_init: $(libdl) $(objpfx)libresolv.so
+$(objpfx)tst-resolv-res_init: $(objpfx)libresolv.so
 $(objpfx)tst-resolv-res_init-multi: $(objpfx)libresolv.so \
   $(shared-thread-library)
-$(objpfx)tst-resolv-res_init-thread: $(libdl) $(objpfx)libresolv.so \
+$(objpfx)tst-resolv-res_init-thread: $(objpfx)libresolv.so \
   $(shared-thread-library)
 $(objpfx)tst-resolv-nondecimal: $(objpfx)libresolv.so $(shared-thread-library)
 $(objpfx)tst-resolv-qtypes: $(objpfx)libresolv.so $(shared-thread-library)
 $(objpfx)tst-resolv-rotate: $(objpfx)libresolv.so $(shared-thread-library)
 $(objpfx)tst-resolv-search: $(objpfx)libresolv.so $(shared-thread-library)
 $(objpfx)tst-resolv-trailing: $(objpfx)libresolv.so $(shared-thread-library)
-$(objpfx)tst-resolv-threads: \
-  $(libdl) $(objpfx)libresolv.so $(shared-thread-library)
+$(objpfx)tst-resolv-threads: $(objpfx)libresolv.so $(shared-thread-library)
 $(objpfx)tst-resolv-txnid-collision: $(objpfx)libresolv.a \
   $(static-thread-library)
-$(objpfx)tst-resolv-canonname: \
-  $(libdl) $(objpfx)libresolv.so $(shared-thread-library)
+$(objpfx)tst-resolv-canonname: $(objpfx)libresolv.so $(shared-thread-library)
 $(objpfx)tst-resolv-trustad: $(objpfx)libresolv.so $(shared-thread-library)
 
 $(objpfx)tst-ns_name: $(objpfx)libresolv.so
diff --git a/stdlib/Makefile b/stdlib/Makefile
index ec30011b4c..7c15549caf 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -106,7 +106,7 @@  LDLIBS-test-cxa_atexit-race2 = $(shared-thread-library)
 LDLIBS-test-on_exit-race = $(shared-thread-library)
 LDLIBS-tst-canon-bz26341 = $(shared-thread-library)
 
-LDLIBS-test-dlclose-exit-race = $(shared-thread-library) $(libdl)
+LDLIBS-test-dlclose-exit-race = $(shared-thread-library)
 LDFLAGS-test-dlclose-exit-race = $(LDFLAGS-rdynamic)
 LDLIBS-test-dlclose-exit-race-helper.so = $(libsupport) $(shared-thread-library)
 
@@ -233,10 +233,10 @@  $(objpfx)tst-strtod-nan-sign: $(libm)
 tst-tls-atexit-lib.so-no-z-defs = yes
 test-dlclose-exit-race-helper.so-no-z-defs = yes
 
-$(objpfx)tst-tls-atexit: $(shared-thread-library) $(libdl)
+$(objpfx)tst-tls-atexit: $(shared-thread-library)
 $(objpfx)tst-tls-atexit.out: $(objpfx)tst-tls-atexit-lib.so
 
-$(objpfx)tst-tls-atexit-nodelete: $(shared-thread-library) $(libdl)
+$(objpfx)tst-tls-atexit-nodelete: $(shared-thread-library)
 $(objpfx)tst-tls-atexit-nodelete.out: $(objpfx)tst-tls-atexit-lib.so
 
 $(objpfx)tst-setcontext3.out: tst-setcontext3.sh $(objpfx)tst-setcontext3
@@ -244,5 +244,3 @@  $(objpfx)tst-setcontext3.out: tst-setcontext3.sh $(objpfx)tst-setcontext3
 		 '$(run-program-env)' '$(test-program-prefix-after-env)' \
 		 $(common-objpfx)stdlib/; \
 	$(evaluate-test)
-
-$(objpfx)tst-makecontext: $(libdl)
diff --git a/string/Makefile b/string/Makefile
index d17626ed39..f0fce2a0b8 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -80,7 +80,6 @@  xtests = tst-strcoll-overflow
 # This test needs libdl.
 ifeq (yes,$(build-shared))
 tests += test-strerror-errno
-LDLIBS-test-strerror-errno = $(libdl)
 endif
 
 ifeq ($(run-built-tests),yes)
diff --git a/sysdeps/mips/Makefile b/sysdeps/mips/Makefile
index 150518bc6d..d770e59fc9 100644
--- a/sysdeps/mips/Makefile
+++ b/sysdeps/mips/Makefile
@@ -64,7 +64,6 @@  fpabi_list=$(subst $(space),$(comma),$(patsubst tst-abi-%mod,o_%,\
 CPPFLAGS-tst-abi-interlink.c += -DFPABI_LIST=$(fpabi_list)
 CPPFLAGS-tst-abi-interlink.c += -DFPABI_COUNT=$(words $(fpabi-modules-names))
 CPPFLAGS-tst-abi-interlink.c += -DFPABI_NATIVE=o_fp$(o32-fpabi)
-$(objpfx)tst-abi-interlink: $(libdl)
 $(objpfx)tst-abi-interlink.out: $(patsubst %,$(objpfx)%.so,\
 					   $(fpabi-modules-names))
 endif
diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
index bca642f438..e4690a7bc4 100644
--- a/sysdeps/pthread/Makefile
+++ b/sysdeps/pthread/Makefile
@@ -203,7 +203,7 @@  CFLAGS-tst-pt-align3.c += $(stack-align-test-flags)
 
 tst-umask1-ARGS = $(objpfx)tst-umask1.temp
 
-$(objpfx)tst-atfork2: $(libdl) $(shared-thread-library)
+$(objpfx)tst-atfork2: $(shared-thread-library)
 LDFLAGS-tst-atfork2 = -rdynamic
 tst-atfork2-ENV = MALLOC_TRACE=$(objpfx)tst-atfork2.mtrace
 $(objpfx)tst-atfork2mod.so: $(shared-thread-library)
@@ -236,7 +236,7 @@  LDFLAGS-tst-_res1mod2.so = -Wl,-soname,tst-_res1mod2.so
 $(objpfx)tst-_res1: $(objpfx)tst-_res1mod1.so $(objpfx)tst-_res1mod2.so \
 		    $(shared-thread-library)
 
-$(objpfx)tst-pt-tls4: $(libdl) $(shared-thread-library)
+$(objpfx)tst-pt-tls4: $(shared-thread-library)
 $(objpfx)tst-pt-tls4.out: $(objpfx)tst-tls4moda.so $(objpfx)tst-tls4modb.so
 
 generated += tst-atfork2.mtrace
@@ -260,7 +260,7 @@  CFLAGS-tst-oncex4.c += -fexceptions
 CFLAGS-tst-oncey3.c += -fno-exceptions -fno-asynchronous-unwind-tables
 CFLAGS-tst-oncey4.c += -fno-exceptions -fno-asynchronous-unwind-tables
 
-$(objpfx)tst-join7: $(libdl) $(shared-thread-library)
+$(objpfx)tst-join7: $(shared-thread-library)
 $(objpfx)tst-join7.out: $(objpfx)tst-join7mod.so
 $(objpfx)tst-join7mod.so: $(shared-thread-library)
 LDFLAGS-tst-join7mod.so = -Wl,-soname,tst-join7mod.so
diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
index aa016f7b5a..346ec491b3 100644
--- a/sysdeps/x86/Makefile
+++ b/sysdeps/x86/Makefile
@@ -51,7 +51,6 @@  CFLAGS-tst-isa-level-mod-1-v4.c += -DINCLUDE_X86_ISA_LEVEL \
 				   -DISA_LEVEL=0xf \
 				   -march=x86-64
 
-$(objpfx)tst-isa-level-1: $(libdl)
 $(objpfx)tst-isa-level-1.out: $(objpfx)tst-isa-level-mod-1-baseline.so \
 			      $(objpfx)tst-isa-level-mod-1-v2.so \
 			      $(objpfx)tst-isa-level-mod-1-v3.so \
@@ -162,38 +161,30 @@  $(objpfx)tst-cet-legacy-1: $(objpfx)tst-cet-legacy-mod-1.so \
 		       $(objpfx)tst-cet-legacy-mod-2.so
 $(objpfx)tst-cet-legacy-1a: $(objpfx)tst-cet-legacy-mod-1.so \
 		       $(objpfx)tst-cet-legacy-mod-2.so
-$(objpfx)tst-cet-legacy-2: $(objpfx)tst-cet-legacy-mod-2.so $(libdl)
+$(objpfx)tst-cet-legacy-2: $(objpfx)tst-cet-legacy-mod-2.so
 $(objpfx)tst-cet-legacy-2.out: $(objpfx)tst-cet-legacy-mod-1.so
-$(objpfx)tst-cet-legacy-2a: $(objpfx)tst-cet-legacy-mod-2.so $(libdl)
+$(objpfx)tst-cet-legacy-2a: $(objpfx)tst-cet-legacy-mod-2.so
 $(objpfx)tst-cet-legacy-2a.out: $(objpfx)tst-cet-legacy-mod-1.so
-$(objpfx)tst-cet-legacy-4: $(libdl)
 $(objpfx)tst-cet-legacy-4.out: $(objpfx)tst-cet-legacy-mod-4.so
-$(objpfx)tst-cet-legacy-5a: $(libdl)
 $(objpfx)tst-cet-legacy-5a.out: $(objpfx)tst-cet-legacy-mod-5a.so \
 				$(objpfx)tst-cet-legacy-mod-5b.so
 $(objpfx)tst-cet-legacy-mod-5a.so: $(objpfx)tst-cet-legacy-mod-5c.so
 $(objpfx)tst-cet-legacy-mod-5b.so: $(objpfx)tst-cet-legacy-mod-5c.so
-$(objpfx)tst-cet-legacy-6a: $(libdl)
 $(objpfx)tst-cet-legacy-6a.out: $(objpfx)tst-cet-legacy-mod-6a.so \
 				$(objpfx)tst-cet-legacy-mod-6b.so
 $(objpfx)tst-cet-legacy-mod-6a.so: $(objpfx)tst-cet-legacy-mod-6c.so
 $(objpfx)tst-cet-legacy-mod-6b.so: $(objpfx)tst-cet-legacy-mod-6c.so
 LDFLAGS-tst-cet-legacy-mod-6c.so = -Wl,--enable-new-dtags,-z,nodelete
 ifneq (no,$(have-tunables))
-$(objpfx)tst-cet-legacy-4a: $(libdl)
 $(objpfx)tst-cet-legacy-4a.out: $(objpfx)tst-cet-legacy-mod-4.so
 tst-cet-legacy-4a-ENV = GLIBC_TUNABLES=glibc.cpu.x86_shstk=permissive
-$(objpfx)tst-cet-legacy-4b: $(libdl)
 $(objpfx)tst-cet-legacy-4b.out: $(objpfx)tst-cet-legacy-mod-4.so
 tst-cet-legacy-4b-ENV = GLIBC_TUNABLES=glibc.cpu.x86_shstk=on
-$(objpfx)tst-cet-legacy-4c: $(libdl)
 $(objpfx)tst-cet-legacy-4c.out: $(objpfx)tst-cet-legacy-mod-4.so
 tst-cet-legacy-4c-ENV = GLIBC_TUNABLES=glibc.cpu.x86_shstk=off
-$(objpfx)tst-cet-legacy-5b: $(libdl)
 $(objpfx)tst-cet-legacy-5b.out: $(objpfx)tst-cet-legacy-mod-5a.so \
 				$(objpfx)tst-cet-legacy-mod-5b.so
 tst-cet-legacy-5b-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK
-$(objpfx)tst-cet-legacy-6b: $(libdl)
 $(objpfx)tst-cet-legacy-6b.out: $(objpfx)tst-cet-legacy-mod-6a.so \
 				$(objpfx)tst-cet-legacy-mod-6b.so
 tst-cet-legacy-6b-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK