From: "Joseph S. Myers" <joseph@codesourcery.com>
To: Roland McGrath <roland@hack.frob.com>
Cc: <libc-alpha@sourceware.org>, <libc-ports@sourceware.org>
Subject: Re: Link extra-libs consistently with libc and ld.so
Date: Fri, 17 May 2013 21:36:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.64.1305172120310.22690@digraph.polyomino.org.uk> (raw)
In-Reply-To: <20130517202428.B17DA2C0BE@topped-with-meat.com>
On Fri, 17 May 2013, Roland McGrath wrote:
> elfobjdir and elf-objpfx are redundant. We should consolidate on just one
> or the other. I don't think it matters which. For linking, using ld.so
> makes sense. There is no need to use $(rtld-installed-name).
I've added this consolidation to the wiki todo list.
> > * Some libraries need to link with the internal linkobj/libc.so,
> > rather than the normal libc.so, because of use of obsolete RPC
> > interfaces. To support this, the rule in Makerules allows
> > $($(@F)-libc) to be used instead of the default
> > $(common-objpfx)libc.so.
>
> What bad things would happen if we just always used linkobj/libc.so for
> linking?
The elf/ directory builds sotruss-lib.so using $(build-module-asneeded),
which uses $(link-libc-args) (which is desirable, on the principle of
consistency of linking), but is (or may be) built before linkobj/libc.so
is built. When I tried changing the dependencies of sotruss-lib.so to
include $(link-libc-deps), I got a build failure because of this (since
link-libc-deps always includes linkobj/libc.so, and elf/Makefile doesn't
know how to build that file).
Now, maybe sotruss-lib.so could be built in a different way that happens
after linkobj/libc.so is built. But the principle of consistency with
building with an installed compiler and libc suggests that linkobj/libc.so
should only be used when necessary.
> > +# Compiler arguments to use to link a shared object with libc and
> > +# ld.so. This is intended to be as similar as possible to a default
> > +# link with an installed libc.
> > +link-libc-args = -Wl,--start-group \
> > + $(if $($(@F)-libc),$($(@F)-libc),$(common-objpfx)libc.so) \
> > + $(common-objpfx)libc_nonshared.a \
> > + $(as-needed) $(common-objpfx)elf/ld.so $(no-as-needed) \
> > + -Wl,--end-group
>
> Given the stated intent, perhaps an approach more likely to ensure it's
> followed would be to generate a linker script with a rule sharing most of
> its logic with the $(inst_libdir)/libc.so rule. If that uses file names
> without leading slash and -L$(common-objdir) before it, then I think it
> will pick up the right builddir files.
I'd think such a linker script might as well include absolute paths; a
helper script that generates the linker script, given arguments that are
the directory names that should go in the linker script, might be a
sensible way of sharing the logic. (Either the links
libc.so$(libc.so-version) and $(rtld-installed-name) are then being used
at build time to link against, or else the names within the directory also
need to vary between the linker scripts.)
> You said just, "Tested." Does that mean you tested that all the object
> came out completely unchanged from before the patch?
No, tested with normal testsuite runs. I don't expect everything to be
unchanged, given that various objects were previously linked
unconditionally with ld.so and after the patch have a --as-needed link
with ld.so (so some may not end up with a dependency on ld.so after all).
--
Joseph S. Myers
joseph@codesourcery.com
next prev parent reply other threads:[~2013-05-17 21:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-09 0:22 Joseph S. Myers
2013-05-10 0:01 ` David Holsgrove
2013-05-14 0:32 ` Joseph S. Myers
2013-05-14 1:12 ` Roland McGrath
2013-05-17 20:24 ` Roland McGrath
2013-05-17 21:36 ` Joseph S. Myers [this message]
2013-05-17 21:42 ` Roland McGrath
2013-05-17 22:56 ` Joseph S. Myers
2013-05-17 23:12 ` Roland McGrath
2013-05-17 23:19 ` Joseph S. Myers
2013-05-28 23:58 ` Roland McGrath
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.1305172120310.22690@digraph.polyomino.org.uk \
--to=joseph@codesourcery.com \
--cc=libc-alpha@sourceware.org \
--cc=libc-ports@sourceware.org \
--cc=roland@hack.frob.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).