about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2013-05-31 16:16:33 +0000
committerJoseph Myers <joseph@codesourcery.com>2013-05-31 16:16:33 +0000
commitfab7ce3f5b4060bf62659e8b58529de4156b5a2f (patch)
tree478613d49200afe992092d00c61f6fb82cec07b8
parenteca5920cd90093d8921f27bfbf7bcf54807165bb (diff)
downloadglibc-fab7ce3f5b4060bf62659e8b58529de4156b5a2f.tar.gz
glibc-fab7ce3f5b4060bf62659e8b58529de4156b5a2f.tar.xz
glibc-fab7ce3f5b4060bf62659e8b58529de4156b5a2f.zip
Link extra-libs consistently with libc and ld.so.
-rw-r--r--ChangeLog52
-rw-r--r--Makefile3
-rw-r--r--Makerules40
-rw-r--r--crypt/Makefile5
-rw-r--r--debug/Makefile10
-rw-r--r--dlfcn/Makefile10
-rw-r--r--hesiod/Makefile9
-rw-r--r--iconvdata/extra-module.mk9
-rw-r--r--libidn/ChangeLog4
-rw-r--r--libidn/Makefile2
-rw-r--r--locale/Makefile6
-rw-r--r--login/Makefile5
-rw-r--r--malloc/Makefile2
-rw-r--r--math/Makefile5
-rw-r--r--nis/Makefile10
-rw-r--r--nptl/ChangeLog5
-rw-r--r--nptl/Makefile8
-rw-r--r--nptl_db/ChangeLog5
-rw-r--r--nptl_db/Makefile6
-rw-r--r--nss/Makefile12
-rw-r--r--ports/ChangeLog.arm6
-rw-r--r--ports/ChangeLog.microblaze18
-rw-r--r--ports/sysdeps/arm/Makefile9
-rw-r--r--ports/sysdeps/microblaze/Makefile15
-rw-r--r--resolv/Makefile16
-rw-r--r--rt/Makefile7
-rw-r--r--stdlib/Makefile2
-rw-r--r--sysdeps/i386/fpu/Makefile3
-rw-r--r--sysdeps/powerpc/fpu/Makefile3
29 files changed, 144 insertions, 143 deletions
diff --git a/ChangeLog b/ChangeLog
index 9134d18f50..8b47a2bea8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,55 @@
+2013-05-31  Joseph Myers  <joseph@codesourcery.com>
+
+	* Makefile ($(common-objpfx)linkobj/libc.so): Define
+	link-libc-deps to empty as target-specific variable.
+	* Makerules (link-libc-args): New variable.
+	(libc-for-link): Likewise.
+	(link-libc-deps): Likewise.
+	(lib%.so): Depend on $(link-libc-deps).  Link with
+	$(link-libc-args).
+	(build-module): Link with $(link-libc-args).
+	(build-module-asneeded): Likewise.
+	(build-module-helper-objlist): Filter out $(link-libc-deps) from
+	list of objects.
+	($(common-objpfx)libc.so): Define link-libc-deps to empty as
+	target-specific variable.
+	($(extra-modules-build:%=$(objpfx)%.so)): Depend on
+	$(link-libc-deps) instead of libc.so and libc_nonshared.a.
+	* crypt/Makefile ($(objpfx)libcrypt.so): Remove dependencies on
+	libc.
+	* debug/Makefile ($(objpfx)libSegFault.so): Remove dependencies on
+	libc and ld.so.
+	($(objpfx)libpcprofile.so): Likewise.
+	* dlfcn/Makefile (LDLIBS-bug-atexit3-lib.so): Remove ld.so and
+	libc_nonshared.a.
+	($(objpfx)libdl.so): Remove dependencies on libc and ld.so.
+	* hesiod/Makefile ($(objpfx)libnss_hesiod.so): Likewise.
+	* iconvdata/extra-module.mk ($(objpfx)$(mod).so): Depend on
+	$(link-libc-deps).
+	($(objpfx)$(mod).so): Remove dependencies on libc and ld.so.
+	* locale/Makefile ($(objpfx)libBrokenLocale.so): Likewise.
+	* login/Makefile ($(objpfx)libutil.so): Likewise.
+	* malloc/Makefile ($(objpfx)libmemusage.so): Likewise.
+	* math/Makefile ($(objpfx)libm.so): Likewise.
+	* nis/Makefile ($(services:%=$(objpfx)libnss_%.so)
+	$(objpfx)libnsl.so): Define libc-for-link as target-specific
+	variable instead of depending directly on libc.
+	* nss/Makefile ($(services:%=$(objpfx)libnss_%.so)): Likewise.
+	($(objpfx)/libnss_test1.so): Change dependencies on libc to
+	$(link-libc-deps).
+	* resolv/Makefile ($(objpfx)libresolv.so): Remove dependencies on
+	libc.
+	[$(have-ssp) = yes] (LDLIBS-resolv.so): Remove variable.
+	($(objpfx)libnss_dns.so): Remove dependencies on libc.
+	($(objpfx)libanl.so): Likewise.
+	* rt/Makefile ($(objpfx)librt.so): Remove dependencies on libc and
+	ld.so.
+	* stdlib/Makefile ($(objpfx)tst-putenvmod.so): Depend on
+	$(link-libc-deps).
+	* sysdeps/i386/fpu/Makefile: Remove file.
+	* sysdeps/powerpc/fpu/Makefile [$(subdir) = math]
+	($(objpfx)libm.so): Remove dependency on ld.so.
+
 2013-05-30  Patsy Franklin  <pfrankli@redhat.com>
 
 	[BZ # 15553]
diff --git a/Makefile b/Makefile
index c12e332503..7d8eccf2e5 100644
--- a/Makefile
+++ b/Makefile
@@ -127,6 +127,9 @@ lib: $(common-objpfx)libc.so
 
 lib: $(common-objpfx)linkobj/libc.so
 
+# Do not filter ld.so out of libc.so link.
+$(common-objpfx)linkobj/libc.so: link-libc-deps = # empty
+
 $(common-objpfx)linkobj/libc.so: $(elfobjdir)/soinit.os \
 				 $(common-objpfx)linkobj/libc_pic.a \
 				 $(elfobjdir)/sofini.os \
diff --git a/Makerules b/Makerules
index d88bb62a0c..2c25233c2f 100644
--- a/Makerules
+++ b/Makerules
@@ -432,13 +432,33 @@ map-file = $(firstword $($(@F:.so=-map)) \
 load-map-file = $(map-file:%=-Wl,--version-script=%)
 endif
 
+# Compiler arguments to use to link a shared object with libc and
+# ld.so.  This is intended to be as similar as possible to a default
+# link with an installed libc.
+link-libc-args = -Wl,--start-group \
+		 $(libc-for-link) \
+		 $(common-objpfx)libc_nonshared.a \
+		 $(as-needed) $(elfobjdir)/ld.so $(no-as-needed) \
+		 -Wl,--end-group
+
+# The corresponding shared libc to use.  This may be modified for a
+# particular target.
+libc-for-link = $(common-objpfx)libc.so
+
+# The corresponding dependencies.  As these are used in dependencies,
+# not just commands, they cannot use target-specific variables so need
+# to name both possible libc.so objects.
+link-libc-deps = $(common-objpfx)libc.so $(common-objpfx)linkobj/libc.so \
+		 $(common-objpfx)libc_nonshared.a $(elfobjdir)/ld.so
+
 # Pattern rule to build a shared object from an archive of PIC objects.
 # This must come after the installation rules so Make doesn't try to
 # build shared libraries in place from the installed *_pic.a files.
 # $(LDLIBS-%.so) may contain -l switches to generate run-time dependencies
-# on other shared objects.
-lib%.so: lib%_pic.a $(+preinit) $(+postinit) $(+interp)
-	$(build-shlib)
+# on other shared objects.  The linking with libc and ld.so is intended
+# to be as similar as possible to a default link with an installed libc.
+lib%.so: lib%_pic.a $(+preinit) $(+postinit) $(+interp) $(link-libc-deps)
+	$(build-shlib) $(link-libc-args)
 
 define build-shlib-helper
 $(LINK.o) -shared $(static-libgcc) -Wl,-O1 $(sysdep-LDFLAGS) \
@@ -513,17 +533,19 @@ endef
 # not for shared objects
 define build-module
 $(build-module-helper) -o $@ $(shlib-lds-flags) \
-	  $(csu-objpfx)abi-note.o $(build-module-objlist)
+	  $(csu-objpfx)abi-note.o $(build-module-objlist) $(link-libc-args)
 endef
 define build-module-asneeded
 $(build-module-helper) -o $@ $(shlib-lds-flags) \
 	  $(csu-objpfx)abi-note.o \
-	  -Wl,--as-needed $(build-module-objlist) -Wl,--no-as-needed
+	  -Wl,--as-needed $(build-module-objlist) -Wl,--no-as-needed \
+	  $(link-libc-args)
 endef
 
 build-module-helper-objlist = \
 	$(patsubst %_pic.a,$(whole-archive) %_pic.a $(no-whole-archive),\
-		   $(filter-out %.lds $(map-file) $(+preinit) $(+postinit),$^))
+		   $(filter-out %.lds $(map-file) $(+preinit) $(+postinit) \
+				$(link-libc-deps),$^))
 
 build-module-objlist = $(build-module-helper-objlist) $(LDLIBS-$(@F:%.so=%).so)
 build-shlib-objlist = $(build-module-helper-objlist) \
@@ -566,6 +588,9 @@ generated += libc_pic.opts libc_pic.os.clean
 libc_pic_clean := .clean
 endif
 
+# Do not filter ld.so out of libc.so link.
+$(common-objpfx)libc.so: link-libc-deps = # empty
+
 # Use our own special initializer and finalizer files for libc.so.
 $(common-objpfx)libc.so: $(elfobjdir)/soinit.os \
 			 $(common-objpfx)libc_pic.os$(libc_pic_clean) \
@@ -621,8 +646,7 @@ include $(patsubst %,$(..)extra-modules.mk,$(modules-names))
 
 extra-modules-build := $(filter-out $(modules-names-nobuild),$(modules-names))
 $(extra-modules-build:%=$(objpfx)%.so): $(objpfx)%.so: \
-		$(objpfx)%.os $(shlib-lds) \
-		$(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a
+		$(objpfx)%.os $(shlib-lds) $(link-libs-deps)
 	$(build-module)
 endif
 
diff --git a/crypt/Makefile b/crypt/Makefile
index 0f5f0992f5..238e52746e 100644
--- a/crypt/Makefile
+++ b/crypt/Makefile
@@ -69,8 +69,3 @@ $(addprefix $(objpfx),$(tests)): $(objpfx)libcrypt.so
 else
 $(addprefix $(objpfx),$(tests)): $(objpfx)libcrypt.a
 endif
-
-# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
-# This ensures they will load libc.so for needed symbols if loaded by
-# a statically-linked program that hasn't already loaded it.
-$(objpfx)libcrypt.so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a
diff --git a/debug/Makefile b/debug/Makefile
index 9b5afb4d22..779741f9ef 100644
--- a/debug/Makefile
+++ b/debug/Makefile
@@ -186,13 +186,3 @@ $(objpfx)xtrace: xtrace.sh
 	    -e 's|@PKGVERSION@|$(PKGVERSION)|' \
 	    -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|' $^ > $@.new \
 	&& rm -f $@ && mv $@.new $@ && chmod +x $@
-
-# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
-# This ensures they will load libc.so for needed symbols if loaded by
-# a statically-linked program that hasn't already loaded it.
-$(objpfx)libSegFault.so: $(common-objpfx)libc.so \
-			 $(common-objpfx)libc_nonshared.a \
-			 $(elf-objpfx)$(rtld-installed-name)
-$(objpfx)libpcprofile.so: $(common-objpfx)libc.so \
-			  $(common-objpfx)libc_nonshared.a \
-			  $(elf-objpfx)$(rtld-installed-name)
diff --git a/dlfcn/Makefile b/dlfcn/Makefile
index cf4428c30e..c2ebdcae61 100644
--- a/dlfcn/Makefile
+++ b/dlfcn/Makefile
@@ -117,14 +117,6 @@ $(objpfx)bug-atexit1.out: $(objpfx)bug-atexit1-lib.so
 $(objpfx)bug-atexit2: $(libdl)
 $(objpfx)bug-atexit2.out: $(objpfx)bug-atexit2-lib.so
 
-LDLIBS-bug-atexit3-lib.so = -lstdc++ -lgcc_eh $(elfobjdir)/ld.so \
-			    $(common-objpfx)libc_nonshared.a
+LDLIBS-bug-atexit3-lib.so = -lstdc++ -lgcc_eh
 $(objpfx)bug-atexit3: $(libdl)
 $(objpfx)bug-atexit3.out: $(objpfx)bug-atexit3-lib.so
-
-
-# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
-# This ensures they will load libc.so for needed symbols if loaded by
-# a statically-linked program that hasn't already loaded it.
-$(objpfx)libdl.so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a \
-		   $(elfobjdir)/ld.so
diff --git a/hesiod/Makefile b/hesiod/Makefile
index 95ec2527f5..b7a13c2504 100644
--- a/hesiod/Makefile
+++ b/hesiod/Makefile
@@ -33,12 +33,7 @@ libnss_hesiod-inhibit-o	= $(filter-out .os,$(object-suffixes))
 
 include ../Rules
 
-# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
-# This ensures they will load libc.so for needed symbols if loaded by
-# a statically-linked program that hasn't already loaded it.
-# The Hesiod NSS modules also needs the resolver and some help from
+# The Hesiod NSS module also needs the resolver and some help from
 # the file service.
 $(objpfx)libnss_hesiod.so: $(common-objpfx)resolv/libresolv.so \
-			   $(common-objpfx)nss/libnss_files.so \
-			   $(common-objpfx)libc.so \
-			   $(common-objpfx)libc_nonshared.a
+			   $(common-objpfx)nss/libnss_files.so
diff --git a/iconvdata/extra-module.mk b/iconvdata/extra-module.mk
index 43f4e12fb7..ecaf507624 100644
--- a/iconvdata/extra-module.mk
+++ b/iconvdata/extra-module.mk
@@ -4,16 +4,9 @@ extra-modules-left := $(strip $(filter-out $(mod),$(extra-modules-left)))
 extra-objs := $(extra-objs) $(patsubst %,%.os,$($(mod)-routines))
 
 $(objpfx)$(mod).so: $(addprefix $(objpfx),$(addsuffix .os,$($(mod)-routines)))\
-		    $(shlib-lds)
+		    $(shlib-lds) $(link-libc-deps)
 	$(build-module-asneeded)
 
-# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
-# This ensures they will load libc.so for needed symbols if loaded by
-# a statically-linked program that hasn't already loaded it.
-$(objpfx)$(mod).so: $(common-objpfx)libc.so \
-	$(common-objpfx)/elf/ld.so \
-	$(common-objpfx)libc_nonshared.a
-
 ifneq (,$(extra-modules-left))
 include extra-module.mk
 endif
diff --git a/libidn/ChangeLog b/libidn/ChangeLog
index 619d891f2f..50e5d53225 100644
--- a/libidn/ChangeLog
+++ b/libidn/ChangeLog
@@ -1,3 +1,7 @@
+2013-05-31  Joseph Myers  <joseph@codesourcery.com>
+
+	* Makefile ($(objpfx)libcidn.so): Remove dependencies on libc.
+
 2013-05-16  Ryan S. Arnold  <rsa@linux.vnet.ibm.com>
 
 	* idna.c: Add missing #include <stdint.h> due to uint64_t or uint32_t
diff --git a/libidn/Makefile b/libidn/Makefile
index 1c578c186c..de26051355 100644
--- a/libidn/Makefile
+++ b/libidn/Makefile
@@ -33,5 +33,3 @@ include $(..)Makeconfig
 libcidn-inhibit-o = $(filter-out .os,$(object-suffixes))
 
 include $(..)Rules
-
-$(objpfx)libcidn.so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a
diff --git a/locale/Makefile b/locale/Makefile
index 8bab9a00ce..8ccc603b15 100644
--- a/locale/Makefile
+++ b/locale/Makefile
@@ -98,9 +98,3 @@ cpp-srcs-left := $(addsuffix .c,$(localedef-modules) $(localedef-aux) \
 				$(locale-modules) $(lib-modules))
 lib := locale-programs
 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
-
-# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
-# This ensures they will load libc.so for needed symbols if loaded by
-# a statically-linked program that hasn't already loaded it.
-$(objpfx)libBrokenLocale.so: $(common-objpfx)libc.so \
-			     $(common-objpfx)libc_nonshared.a
diff --git a/login/Makefile b/login/Makefile
index 61c9d7efbe..0bfe643136 100644
--- a/login/Makefile
+++ b/login/Makefile
@@ -68,8 +68,3 @@ endif
 $(inst_libexecdir)/pt_chown: $(objpfx)pt_chown $(+force)
 	$(make-target-directory)
 	-$(INSTALL_PROGRAM) -m 4755 -o root $< $@
-
-# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
-# This ensures they will load libc.so for needed symbols if loaded by
-# a statically-linked program that hasn't already loaded it.
-$(objpfx)libutil.so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a
diff --git a/malloc/Makefile b/malloc/Makefile
index 05f9b15e89..0fe31a4a02 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -141,7 +141,7 @@ $(objpfx)memusage: memusage.sh
 
 
 # The implementation uses `dlsym'
-$(objpfx)libmemusage.so: $(common-objpfx)dlfcn/libdl.so $(elfobjdir)/ld.so
+$(objpfx)libmemusage.so: $(common-objpfx)dlfcn/libdl.so
 
 # Extra dependencies
 $(foreach o,$(all-object-suffixes),$(objpfx)malloc$(o)): arena.c hooks.c
diff --git a/math/Makefile b/math/Makefile
index 5bbf9d3c48..3ed78fc9c3 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -229,8 +229,3 @@ gmp-objs = $(patsubst %,$(common-objpfx)stdlib/%.o,\
 $(objpfx)atest-exp: $(gmp-objs)
 $(objpfx)atest-sincos: $(gmp-objs)
 $(objpfx)atest-exp2: $(gmp-objs)
-
-# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
-# This ensures they will load libc.so for needed symbols if loaded by
-# a statically-linked program that hasn't already loaded it.
-$(objpfx)libm.so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a
diff --git a/nis/Makefile b/nis/Makefile
index 0b3b6a2c25..0ce99d0770 100644
--- a/nis/Makefile
+++ b/nis/Makefile
@@ -76,12 +76,12 @@ $(objpfx)libnss_nis.so: $(objpfx)libnsl.so$(libnsl.so-version) \
 			$(common-objpfx)nss/libnss_files.so
 $(objpfx)libnss_nisplus.so: $(objpfx)libnsl.so$(libnsl.so-version)
 
-# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
-# This ensures they will load libc.so for needed symbols if loaded by
-# a statically-linked program that hasn't already loaded it.
 libnsl-libc = $(common-objpfx)linkobj/libc.so
-$(services:%=$(objpfx)libnss_%.so) $(objpfx)libnsl.so: $(libnsl-libc) \
-					       $(common-objpfx)libc_nonshared.a
+# Target-specific variable setting to link objects using deprecated
+# RPC interfaces with the version of libc.so that makes them available
+# for new links:
+$(services:%=$(objpfx)libnss_%.so) $(objpfx)libnsl.so: \
+  libc-for-link = $(libnsl-libc)
 
 
 ifeq ($(build-shared),yes)
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 6e5ca4cfa0..7a9ce8e80e 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,8 @@
+2013-05-31  Joseph Myers  <joseph@codesourcery.com>
+
+	* Makefile ($(objpfx)libpthread.so): Remove dependencies on libc
+	and ld.so.
+
 2013-05-16  Ryan S. Arnold  <rsa@linux.vnet.ibm.com>
 
 	* pthread_create.c: Add missing #include <stdint.h> due to uint64_t or
diff --git a/nptl/Makefile b/nptl/Makefile
index 6af4b37af4..7fa991b251 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -507,14 +507,6 @@ $(objpfx)libpthread.so: $(addprefix $(objpfx),$(crti-objs) $(crtn-objs))
 $(objpfx)libpthread.so: +preinit += $(addprefix $(objpfx),$(crti-objs))
 $(objpfx)libpthread.so: +postinit += $(addprefix $(objpfx),$(crtn-objs))
 
-# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
-# This ensures they will load libc.so for needed symbols if loaded by
-# a statically-linked program that hasn't already loaded it.
-# Depend on ld.so too to get proper versions of ld.so symbols.
-$(objpfx)libpthread.so: $(common-objpfx)libc.so \
-			$(common-objpfx)libc_nonshared.a \
-			$(elfobjdir)/ld.so
-
 # Make sure we link with the thread library.
 ifeq ($(build-shared),yes)
 $(addprefix $(objpfx), \
diff --git a/nptl_db/ChangeLog b/nptl_db/ChangeLog
index 34462ceb85..e0935e380b 100644
--- a/nptl_db/ChangeLog
+++ b/nptl_db/ChangeLog
@@ -1,3 +1,8 @@
+2013-05-31  Joseph Myers  <joseph@codesourcery.com>
+
+	* Makefile ($(objpfx)libthread_db.so): Remove dependencies on
+	libc.
+
 2013-05-16  Ryan S. Arnold  <rsa@linux.vnet.ibm.com>
 
 	* db_info.c: Add missing #include <stdint.h> due to uint64_t or
diff --git a/nptl_db/Makefile b/nptl_db/Makefile
index 533fbaef89..77ea46e31b 100644
--- a/nptl_db/Makefile
+++ b/nptl_db/Makefile
@@ -51,12 +51,6 @@ libthread_db.so-no-z-defs = yes
 
 include ../Rules
 
-# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
-# This ensures they will load libc.so for needed symbols if loaded by
-# a statically-linked program that hasn't already loaded it.
-$(objpfx)libthread_db.so: $(common-objpfx)libc.so \
-			  $(common-objpfx)libc_nonshared.a
-
 tests: $(objpfx)db-symbols.out
 $(objpfx)db-symbols.out: $(objpfx)db-symbols.v.i \
 			 $(common-objpfx)nptl/libpthread.so
diff --git a/nss/Makefile b/nss/Makefile
index 553eafaa6b..ae2e5f6d5a 100644
--- a/nss/Makefile
+++ b/nss/Makefile
@@ -84,12 +84,11 @@ ifeq (yes,$(have-selinux))
 LDLIBS-makedb		:= -lselinux
 endif
 
-# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
-# This ensures they will load libc.so for needed symbols if loaded by
-# a statically-linked program that hasn't already loaded it.
 libnss-libc = $(common-objpfx)linkobj/libc.so
-$(services:%=$(objpfx)libnss_%.so): $(libnss-libc) \
-				    $(common-objpfx)libc_nonshared.a
+# Target-specific variable setting to link objects using deprecated
+# RPC interfaces with the version of libc.so that makes them available
+# for new links:
+$(services:%=$(objpfx)libnss_%.so): libc-for-link = $(libnss-libc)
 
 $(objpfx)libnss_db.so: $(objpfx)libnss_files.so
 
@@ -107,8 +106,7 @@ $(inst_vardbdir)/Makefile: db-Makefile $(+force)
 	$(do-install)
 
 CFLAGS-nss_test1.c = -DNOT_IN_libc=1
-$(objpfx)/libnss_test1.so: $(objpfx)nss_test1.os $(common-objpfx)libc.so \
-			   $(common-objpfx)libc_nonshared.a
+$(objpfx)/libnss_test1.so: $(objpfx)nss_test1.os $(link-libc-deps)
 	$(build-module)
 ifdef libnss_test1.so-version
 $(objpfx)/libnss_test1.so$(libnss_test1.so-version): $(objpfx)/libnss_test1.so
diff --git a/ports/ChangeLog.arm b/ports/ChangeLog.arm
index b1f14dfe64..7c025caadc 100644
--- a/ports/ChangeLog.arm
+++ b/ports/ChangeLog.arm
@@ -1,3 +1,9 @@
+2013-05-31  Joseph Myers  <joseph@codesourcery.com>
+
+	* sysdeps/arm/Makefile [$(subdir) = malloc]
+	($(objpfx)libmemusage.so): Remove dependency on libc_nonshared.
+	[$(subdir) = math] ($(objpfx)libm.so): Remove dependency on ld.so.
+
 2013-05-29  Siddhesh Poyarekar  <siddhesh@redhat.com>
 
 	[BZ #15465]
diff --git a/ports/ChangeLog.microblaze b/ports/ChangeLog.microblaze
index 32fcfbc7cb..9890681cf6 100644
--- a/ports/ChangeLog.microblaze
+++ b/ports/ChangeLog.microblaze
@@ -1,3 +1,21 @@
+2013-05-31  Joseph Myers  <joseph@codesourcery.com>
+
+	* sysdeps/microblaze/Makefile ($(objpfx)libm.so): Remove
+	dependency on ld.so.
+	($(objpfx)libcrypt.so): Likewise.
+	($(objpfx)libresolv.so): Likewise.
+	($(objpfx)libnss_dns.so): Likewise.
+	($(objpfx)libnss_files.so): Likewise.
+	($(objpfx)libnss_db.so): Likewise.
+	($(objpfx)libnss_nis.so): Likewise.
+	($(objpfx)libnss_nisplus.so): Likewise.
+	($(objpfx)libnss_hesiod.so): Likewise.
+	($(objpfx)libnss_compat.so): Likewise.
+	($(objpfx)libanl.so): Likewise.
+	($(objpfx)libnsl.so): Likewise.
+	($(objpfx)libcidn.so): Likewise.
+	($(objpfx)libutil.so): Likewise.
+
 2013-05-29  Siddhesh Poyarekar  <siddhesh@redhat.com>
 
 	[BZ #15465]
diff --git a/ports/sysdeps/arm/Makefile b/ports/sysdeps/arm/Makefile
index 3bdb6b32df..b218e76eac 100644
--- a/ports/sysdeps/arm/Makefile
+++ b/ports/sysdeps/arm/Makefile
@@ -25,11 +25,6 @@ sysdep_routines += $(aeabi_constants) $(aeabi_routines)
 static-only-routines += $(aeabi_constants)
 endif
 
-# to pull in __aeabi_read_tp, needed for tls
-ifeq ($(subdir),malloc)
-$(objpfx)libmemusage.so: $(common-objpfx)libc_nonshared.a
-endif
-
 ifeq ($(subdir),gmon)
 sysdep_routines += arm-mcount
 endif
@@ -37,7 +32,3 @@ endif
 ifeq ($(subdir),debug)
 CFLAGS-backtrace.c += -funwind-tables
 endif
-
-ifeq ($(subdir),math)
-$(objpfx)libm.so: $(elfobjdir)/ld.so
-endif
diff --git a/ports/sysdeps/microblaze/Makefile b/ports/sysdeps/microblaze/Makefile
index cc82a7482b..f7c95ae115 100644
--- a/ports/sysdeps/microblaze/Makefile
+++ b/ports/sysdeps/microblaze/Makefile
@@ -9,18 +9,3 @@ endif
 ifeq ($(subdir),resource)
 sysdep_routines += backtrace_linux
 endif
-
-$(objpfx)libm.so: $(elfobjdir)/ld.so
-$(objpfx)libcrypt.so: $(elfobjdir)/ld.so
-$(objpfx)libresolv.so: $(elfobjdir)/ld.so
-$(objpfx)libnss_dns.so: $(elfobjdir)/ld.so
-$(objpfx)libnss_files.so: $(elfobjdir)/ld.so
-$(objpfx)libnss_db.so: $(elfobjdir)/ld.so
-$(objpfx)libnss_nis.so: $(elfobjdir)/ld.so
-$(objpfx)libnss_nisplus.so: $(elfobjdir)/ld.so
-$(objpfx)libnss_hesiod.so: $(elfobjdir)/ld.so
-$(objpfx)libnss_compat.so: $(elfobjdir)/ld.so
-$(objpfx)libanl.so: $(elfobjdir)/ld.so
-$(objpfx)libnsl.so: $(elfobjdir)/ld.so
-$(objpfx)libcidn.so: $(elfobjdir)/ld.so
-$(objpfx)libutil.so: $(elfobjdir)/ld.so
diff --git a/resolv/Makefile b/resolv/Makefile
index d3635bc115..51dcf217af 100644
--- a/resolv/Makefile
+++ b/resolv/Makefile
@@ -83,23 +83,11 @@ CFLAGS-res_hconf.c = -fexceptions
 # The BIND code elicits some harmless warnings.
 +cflags += -Wno-strict-prototypes -Wno-write-strings
 
-# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
-# This ensures they will load libc.so for needed symbols if loaded by
-# a statically-linked program that hasn't already loaded it.
-$(objpfx)libresolv.so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a
-# Some hosts need '__stack_chk_guard', so pull in the definition from
-# ld.so if required.
-ifeq (yes,$(have-ssp))
-LDLIBS-resolv.so += $(as-needed) $(elfobjdir)/ld.so $(no-as-needed)
-endif
-
 # The DNS NSS modules needs the resolver.
-$(objpfx)libnss_dns.so: $(objpfx)libresolv.so $(common-objpfx)libc.so \
-			$(common-objpfx)libc_nonshared.a
+$(objpfx)libnss_dns.so: $(objpfx)libresolv.so
 
 # The asynchronous name lookup code needs the thread library.
-$(objpfx)libanl.so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a \
-		    $(shared-thread-library)
+$(objpfx)libanl.so: $(shared-thread-library)
 
 $(objpfx)ga_test: $(objpfx)libanl.so $(shared-thread-library)
 
diff --git a/rt/Makefile b/rt/Makefile
index ef356d0aa8..b1392f2e0f 100644
--- a/rt/Makefile
+++ b/rt/Makefile
@@ -64,12 +64,7 @@ CFLAGS-librt-cancellation.c = -fasynchronous-unwind-tables
 
 LDFLAGS-rt.so = -Wl,--enable-new-dtags,-z,nodelete
 
-# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
-# This ensures they will load libc.so for needed symbols if loaded by
-# a statically-linked program that hasn't already loaded it.
-$(objpfx)librt.so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a \
-		   $(shared-thread-library) \
-		   $(elfobjdir)/ld.so
+$(objpfx)librt.so: $(shared-thread-library)
 
 ifeq (yes,$(build-shared))
 $(addprefix $(objpfx),$(tests)): $(objpfx)librt.so $(shared-thread-library)
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 27765d15b7..17d80e0f54 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -144,7 +144,7 @@ $(objpfx)tst-fmtmsg.out: tst-fmtmsg.sh $(objpfx)tst-fmtmsg
 $(objpfx)tst-putenv: $(objpfx)tst-putenvmod.so
 LDFLAGS-tst-putenv = $(no-as-needed)
 
-$(objpfx)tst-putenvmod.so: $(objpfx)tst-putenvmod.os
+$(objpfx)tst-putenvmod.so: $(objpfx)tst-putenvmod.os $(link-libc-deps)
 	$(build-module)
 CFLAGS-tst-putenvmod.c = -DNOT_IN_libc=1
 
diff --git a/sysdeps/i386/fpu/Makefile b/sysdeps/i386/fpu/Makefile
deleted file mode 100644
index 1309b64c13..0000000000
--- a/sysdeps/i386/fpu/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ifeq ($(subdir),math)
-$(objpfx)libm.so: $(elfobjdir)/ld.so
-endif
diff --git a/sysdeps/powerpc/fpu/Makefile b/sysdeps/powerpc/fpu/Makefile
index fda59f9fa4..53470a9cf2 100644
--- a/sysdeps/powerpc/fpu/Makefile
+++ b/sysdeps/powerpc/fpu/Makefile
@@ -1,8 +1,5 @@
 ifeq ($(subdir),math)
 libm-support += fenv_const fe_nomask fe_mask t_sqrt
-
-# libm needs ld.so to access dl_hwcap
-$(objpfx)libm.so: $(elfobjdir)/ld.so
 endif
 
 ifeq ($(subdir),stdlib)