This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Pull in ld.so for libresolv
On Wed, 21 Sep 2011, Roland McGrath wrote:
> Thanks for the detailed explanation. I understand the situation now.
> Someone please send a tested version of the patch that uses as-needed.
This patch has been tested on x86_64 (where --as-needed ensures that
ld.so doesn't get linked in to libresolv.so) and on ARM (where ld.so
does get linked in). (This is the most conservative fix, in that the
have-ssp conditional isn't actually needed here - and realistically,
$(elf) conditionals are pretty useless as well.)
2011-09-21 Chung-Lin Tang <cltang@codesourcery.com>
Maxim Kuvyrkov <maxim@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* resolv/Makefile (LDLIBS-resolv.so): Link in $(elfobjdir)/ld.so
if needed for __stack_chk_guard.
diff --git a/resolv/Makefile b/resolv/Makefile
index ec3788f..79f057f 100644
--- a/resolv/Makefile
+++ b/resolv/Makefile
@@ -88,6 +88,11 @@ CFLAGS-res_hconf.c = -fexceptions
# 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 (yesyes,$(have-ssp)$(elf))
+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 \
--
Joseph S. Myers
joseph@codesourcery.com