This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
PATCH: [BZ #14569] ibpthread.a isn't linked in properly
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Mon, 10 Sep 2012 18:13:50 -0700
- Subject: PATCH: [BZ #14569] ibpthread.a isn't linked in properly
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
This patch places libpthread.a before libc.a between -start-group and
--end-group. It also removes the duplicated $(link-libc-static),
which is included in $(+link-static), and +link-static-tests uses
$(link-libc-static-tests), not $(link-libc-static). Tested on x86-64.
OK to install?
Thanks.
H.J.
---
2012-09-10 H.J. Lu <hongjiu.lu@intel.com>
[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.
diff --git a/Makeconfig b/Makeconfig
index 3ed9746..8573643 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -449,8 +449,9 @@ 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-libc-static)
+ $(link-extra-libs-static)
+link-static-after-libc = $(+postctorT) $(+postinit)
+link-static = $(+link-static-before-libc) $(link-libc-static) \
$(+link-static-after-libc)
@@ -520,7 +521,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
link-libc-bounded = $(common-objpfx)libc_b.a $(gnulib) $(common-objpfx)libc_b.a
# How to link against libgcc. Some libgcc functions, such as those