This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
build-shlib-helper reporting of undefined symbols
- From: David Holsgrove <david dot holsgrove at xilinx dot com>
- To: "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>
- Date: Thu, 4 Apr 2013 06:30:54 +0000
- Subject: build-shlib-helper reporting of undefined symbols
Hi,
I'm in the process of submitting a MicroBlaze port to libc-ports, and I find
that like other architectures, I'm explicitly linking with ld.so for a number
of the libraries in my target's Makefile to resolve undefined symbols.
Joseph Myer asked that I raise the question here as I'm not familiar enough
with glibc's core Make infrastructure to be sure that any out of tree fix I
have would be safe for all ports.
I have seen anecdotally that removing the linker command '-z,defs' in the
build-shlib-helper (diff below) allows me to successfully build a functional
MicroBlaze toolchain without requiring any of the explicit ld.so links.
diff --git a/Makerules b/Makerules
index d88bb62..a5b4528 100644
--- a/Makerules
+++ b/Makerules
@@ -441,8 +441,7 @@ lib%.so: lib%_pic.a $(+preinit) $(+postinit) $(+interp)
$(build-shlib)
define build-shlib-helper
-$(LINK.o) -shared $(static-libgcc) -Wl,-O1 $(sysdep-LDFLAGS) \
- $(if $($(@F)-no-z-defs)$(no-z-defs),,-Wl,-z,defs) $(rtld-LDFLAGS) \
+$(LINK.o) -shared $(static-libgcc) -Wl,-O1 $(sysdep-LDFLAGS) $(rtld-LDFLAGS) \
$(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \
$(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \
-Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
What is the purpose of this warning for unresolved symbols, and could this be
safely removed at this level?
Alternatively, Joseph had suggested that a group with --as-needed ld.so for each
shared library link might be the best option;
>I think we should make all the miscellaneous shared libraries and .so
>files be linked more like normal libraries linked with a shared glibc
>after installation. That is, --start-group libc.so libc_nonshared.a
>--as-needed ld.so --no-as-needed --end-group. And with that change,
>remove all the miscellaneous rules in various makefiles (sysdeps and
>otherwise) to link this or that library with ld.so or libc_nonshared.a.
If this was to be done, where would be the right place to do it?
thanks,
David