about summary refs log tree commit diff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-09-11 05:10:03 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-09-16 10:54:44 -0700
commit6e1ae9bae180f0cf43d73ee2ee395252d1e22e17 (patch)
tree525a4e900aadd8b8e8d0f7a0ee6b31ce4cbe8b47
parent9a638a9be6ccaa543607f1655f73806bd41b2140 (diff)
downloadglibc-6e1ae9bae180f0cf43d73ee2ee395252d1e22e17.tar.gz
glibc-6e1ae9bae180f0cf43d73ee2ee395252d1e22e17.tar.xz
glibc-6e1ae9bae180f0cf43d73ee2ee395252d1e22e17.zip
Place libpthread.a right before libc.a
GCC driver places -lpthread in --start-group -lgcc -lgcc_eh -lpthread
-lc --end-group.  Glibc tests should do the same.

	[BZ #14569]
	* Makeconfig (+link-static-before-libc): Also filter out
	$(common-objpfx)nptl/libpthread%.  Remove $(link-libc-static).
	(link-libc-static-tests): Place libpthread.a before libc.a.
	* nptl/Makefile (tests-static): Add tst-cancelx7-static,
	tst-raise1-static and tst-cancel7-static.
	(tests): Likewise.
	* nptl/tst-cancel7-static.c: New file.
	* nptl/tst-cancelx7-static.c: Likewise.
	* nptl/tst-raise1-static.c: Likewise.
-rw-r--r--Makeconfig8
-rw-r--r--nptl/Makefile9
-rw-r--r--nptl/tst-cancel7-static.c1
-rw-r--r--nptl/tst-cancelx7-static.c1
-rw-r--r--nptl/tst-raise1-static.c1
5 files changed, 16 insertions, 4 deletions
diff --git a/Makeconfig b/Makeconfig
index f136b88da1..6f5e4fb97d 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -427,6 +427,7 @@ ifndef +link-static
 	      $(filter-out $(addprefix $(csu-objpfx),start.o \
 						     $(start-installed-name))\
 			   $(+preinit) $(link-extra-libs-static) \
+			   $(common-objpfx)nptl/libpthread% \
 			   $(common-objpfx)libc% $(+postinit),$^) \
 	      $(link-extra-libs-static)
 +link-static-after-libc = $(+postctorT) $(+postinit)
@@ -534,7 +535,12 @@ endif
 
 # The static libraries.
 link-libc-static = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib) -Wl,--end-group
-link-libc-static-tests = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib-tests) -Wl,--end-group
+# libpthread.a must be placed before libc.a between -start-group and
+# --end-group.
+link-libc-static-tests = -Wl,--start-group \
+			 $(filter $(common-objpfx)nptl/libpthread.a,$^) \
+			 $(common-objpfx)libc.a \
+			 $(static-gnulib-tests) -Wl,--end-group
 
 # How to link against libgcc.  Some libgcc functions, such as those
 # for "long long" arithmetic or software floating point, can always be
diff --git a/nptl/Makefile b/nptl/Makefile
index aaca0a4700..faf2c192d5 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -313,7 +313,8 @@ tests += tst-cancelx2 tst-cancelx3 tst-cancelx4 tst-cancelx5 \
 	 tst-cancelx11 tst-cancelx12 tst-cancelx13 tst-cancelx14 tst-cancelx15 \
 	 tst-cancelx16 tst-cancelx17 tst-cancelx18 tst-cancelx20 tst-cancelx21 \
 	 tst-cleanupx0 tst-cleanupx1 tst-cleanupx2 tst-cleanupx3 tst-cleanupx4 \
-	 tst-oncex3 tst-oncex4
+	 tst-oncex3 tst-oncex4 tst-cancelx7-static
+tests-static += tst-cancelx7-static
 endif
 ifeq ($(build-shared),yes)
 tests += tst-atfork2 tst-tls3 tst-tls4 tst-tls5 tst-_res1 tst-fini1 \
@@ -382,10 +383,12 @@ link-libc-static := $(common-objpfx)libc.a $(static-gnulib) \
 tests-static += tst-locale1 tst-locale2 tst-stackguard1-static \
 		tst-cancel21-static tst-cancel24-static tst-cond8-static \
 		tst-mutex8-static tst-mutexpi8-static tst-sem11-static \
-		tst-sem12-static
+		tst-sem12-static \
+		tst-raise1-static tst-cancel7-static
 tests += tst-stackguard1-static tst-cancel21-static tst-cancel24-static \
 	 tst-cond8-static tst-mutex8-static tst-mutexpi8-static \
-	 tst-sem11-static tst-sem12-static
+	 tst-sem11-static tst-sem12-static \
+	 tst-raise1-static tst-cancel7-static
 xtests-static += tst-setuid1-static
 
 # These tests are linked with libc before libpthread
diff --git a/nptl/tst-cancel7-static.c b/nptl/tst-cancel7-static.c
new file mode 100644
index 0000000000..4df1a58818
--- /dev/null
+++ b/nptl/tst-cancel7-static.c
@@ -0,0 +1 @@
+#include "tst-cancel7.c"
diff --git a/nptl/tst-cancelx7-static.c b/nptl/tst-cancelx7-static.c
new file mode 100644
index 0000000000..a15dfe2e1a
--- /dev/null
+++ b/nptl/tst-cancelx7-static.c
@@ -0,0 +1 @@
+#include "tst-cancelx7.c"
diff --git a/nptl/tst-raise1-static.c b/nptl/tst-raise1-static.c
new file mode 100644
index 0000000000..f25ad50198
--- /dev/null
+++ b/nptl/tst-raise1-static.c
@@ -0,0 +1 @@
+#include "tst-raise1.c"