about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrooks Moses <bmoses@google.com>2014-02-18 11:18:44 -0600
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>2014-02-18 11:18:44 -0600
commit052b65bfeee78d8ba82f070f9f10f79bb0de5376 (patch)
treec3792d430517b74b0e47aa848e6166779d5192a4
parent7d000197af0d94220c665c5a655c8575fa348e47 (diff)
downloadglibc-052b65bfeee78d8ba82f070f9f10f79bb0de5376.tar.gz
glibc-052b65bfeee78d8ba82f070f9f10f79bb0de5376.tar.xz
glibc-052b65bfeee78d8ba82f070f9f10f79bb0de5376.zip
Fix erroneous (and circular) implied pattern rule for linkobj/libc.so.
[BZ #15915] As described in the bug, the pattern rule for lib%.so files
in Makerules includes linkobj/libc.so as a dependency.  However, the
explicit rule for linkobj/libc.so is in the top-level Makefile.

Thus, the subdirectory makefiles that include Makerules end up with an
erroneous makefile pattern rule for linkobj/libc.so that includes
itself as a dependency.  The result is make warnings whenever rules
for other .so files are resolved -- and, on occasion, actual makefile
failures when a race condition causes the implicit rule to actually be
used.

This patch moves the explicit rules for linkobj/libc.so into Makerules
to clear up this problem.  It also elaborates a couple of comments
that I'd initially found confusing.

Backport of 5f855e3598a576c35e54623a13b256f3e87fcd4d
-rw-r--r--ChangeLog6
-rw-r--r--Makefile25
-rw-r--r--Makerules37
-rw-r--r--NEWS4
4 files changed, 43 insertions, 29 deletions
diff --git a/ChangeLog b/ChangeLog
index 0afa5ca78b..c448dda711 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-02-18  Brooks Moses  <bmoses@google.com>
+
+	[BZ #15915]
+	* Makefile (linkobj/libc_pic.a, linkobj/libc.so): Move rules to...
+	* Makerules: ...here, and adjust associated comments.
+
 2014-02-06  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
 
 	* sysdeps/powerpc/powerpc64/power5/Implies: Remove inexistent
diff --git a/Makefile b/Makefile
index 7d8eccf2e5..00e4394399 100644
--- a/Makefile
+++ b/Makefile
@@ -123,30 +123,7 @@ lib-noranlib: subdir_lib
 
 ifeq (yes,$(build-shared))
 # Build the shared object from the PIC object library.
-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 \
-				 $(elfobjdir)/interp.os \
-				 $(elfobjdir)/ld.so \
-				 $(shlib-lds)
-	$(build-shlib)
-
-$(common-objpfx)linkobj/libc_pic.a: $(common-objpfx)libc_pic.a \
-				    $(common-objpfx)sunrpc/librpc_compat_pic.a
-	$(..)./scripts/mkinstalldirs $(common-objpfx)linkobj
-	(cd $(common-objpfx)linkobj; \
-	 $(AR) x ../libc_pic.a; \
-	 rm $$($(AR) t ../sunrpc/librpc_compat_pic.a | sed 's/^compat-//'); \
-	 $(AR) x ../sunrpc/librpc_compat_pic.a; \
-	 $(AR) cr libc_pic.a *.os; \
-	 rm *.os)
+lib: $(common-objpfx)libc.so $(common-objpfx)linkobj/libc.so
 endif
 
 
diff --git a/Makerules b/Makerules
index bd8642a470..8ed458f94b 100644
--- a/Makerules
+++ b/Makerules
@@ -565,16 +565,47 @@ generated += libc_pic.opts libc_pic.os.clean
 libc_pic_clean := .clean
 endif
 
-# Do not filter ld.so out of libc.so link.
+# Build a possibly-modified version of libc_pic.a for use in building
+# linkobj/libc.so.
+ifeq (,$(filter sunrpc,$(subdirs)))
+$(common-objpfx)linkobj/libc_pic.a: $(common-objpfx)libc_pic.a
+	$(make-target-directory)
+	ln -f $< $@
+else
+$(common-objpfx)linkobj/libc_pic.a: $(common-objpfx)libc_pic.a \
+				    $(common-objpfx)sunrpc/librpc_compat_pic.a
+	$(make-target-directory)
+	(cd $(common-objpfx)linkobj; \
+	 $(AR) x ../libc_pic.a; \
+	 rm $$($(AR) t ../sunrpc/librpc_compat_pic.a | sed 's/^compat-//'); \
+	 $(AR) x ../sunrpc/librpc_compat_pic.a; \
+	 $(AR) cr libc_pic.a *.os; \
+	 rm *.os)
+endif # $(subdirs) contains sunrpc
+
+# Clear link-libc-deps for the libc.so libraries so build-shlibs does not
+# filter ld.so out of the list of linked objects.
 $(common-objpfx)libc.so: link-libc-deps = # empty
+$(common-objpfx)linkobj/libc.so: link-libc-deps = # empty
 
-# Use our own special initializer and finalizer files for libc.so.
+# Use our own special initializer and finalizer files for the libc.so
+# libraries.
 $(common-objpfx)libc.so: $(elfobjdir)/soinit.os \
 			 $(common-objpfx)libc_pic.os$(libc_pic_clean) \
 			 $(elfobjdir)/sofini.os \
-			 $(elfobjdir)/interp.os $(elfobjdir)/ld.so \
+			 $(elfobjdir)/interp.os \
+			 $(elfobjdir)/ld.so \
+			 $(shlib-lds)
+	$(build-shlib)
+
+$(common-objpfx)linkobj/libc.so: $(elfobjdir)/soinit.os \
+			 $(common-objpfx)linkobj/libc_pic.a \
+			 $(elfobjdir)/sofini.os \
+			 $(elfobjdir)/interp.os \
+			 $(elfobjdir)/ld.so \
 			 $(shlib-lds)
 	$(build-shlib)
+
 ifeq ($(versioning),yes)
 $(common-objpfx)libc.so: $(common-objpfx)libc.map
 endif
diff --git a/NEWS b/NEWS
index 5c2f07ac06..96df7a960a 100644
--- a/NEWS
+++ b/NEWS
@@ -10,8 +10,8 @@ Version 2.18.1
 * The following bugs are resolved with this release:
 
   14143, 14155, 14547, 14699, 15532, 15427, 15522, 15680, 15723, 15734,
-  15735, 15797, 15892, 15895, 15909, 15917, 15996, 16072, 16150, 16414,
-  16430, 16431.
+  15735, 15797, 15892, 15895, 15909, 15915, 15917, 15996, 16072, 16150,
+  16414, 16430, 16431.
 
 * Support for powerpc64le has been added.