From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/2] build: add support for as-needed linking
Date: Tue, 20 Sep 2016 20:07:00 +0200 [thread overview]
Message-ID: <20160920200700.1096bb21@free-electrons.com> (raw)
In-Reply-To: <1468767958-19572-1-git-send-email-gustavo.zacarias@free-electrons.com>
Hello,
On Sun, 17 Jul 2016 12:05:57 -0300, gustavo.zacarias at free-electrons.com
wrote:
> From: Gustavo Zacarias <gustavo.zacarias@free-electrons.com>
>
> This option tells the linker to only link to the libraries containing
> symbols that are actually used.
>
> It requires libtool patches to fully clean the needed chain, these are
> used by major distributions such as Debian and Gentoo.
> https://wiki.debian.org/ToolChain/DSOLinking
> https://wiki.gentoo.org/wiki/Project:Quality_Assurance/As-needed
>
> Introduce a BR2_AS_NEEDED global enable option (default=no, marked as
> experimental) that generally disables the libtool patching and avoids
> the extra LDFLAGS (-Wl,--as-needed).
>
> Also add a per-package PACKAGE_AS_NEEDED (default=yes) option to work
> around problematic packages that might not behave too well with
> as-needed linking.
>
> For the libtool patching use a guess (automatic) method since
> version-matching doesn't work accurately with some packages that ship
> patched/modified ltmain.sh scripts, normally based on 2.4. In some of
> these cases the as-needed-v2.2.6.patch works, and in other cases the
> as-needed-v2.4.2.patch is necessary and the exact condition can't be
> found in a deterministic way. If for some reason none of the patches
> applies to a particular package this will only affect said package and
> shouldn't have any consequence even if passing -Wl,--as-needed LDFLAGS.
Just like Yann, I don't understand the usefulness of --as-needed
support. If a library A is not using symbols from a library B it is
linked against, why is library A linked against library B in the first
place ?
The way you present it makes me understand that --as-needed is a
workaround for broken package build systems, which end up producing
binaries (programs or libraries) incorrect linked to too many
libraries, that are in fact not all needed.
In addition to this, it is not really clear what are the benefits of
having less NEEDED entries (i.e practical number of performance
improvements). Since the complexity is quite huge for something that 1/
looks like a workaround and 2/ isn't associated to concrete performance
improvements, I don't think we want to merge this at this point.
Of course, feel free to come back with some more details on why
--as-needed is useful (why it's not a workaround, and prove it's really
useful in practice).
Thanks a lot,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
prev parent reply other threads:[~2016-09-20 18:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-17 15:05 [Buildroot] [PATCH 1/2] build: add support for as-needed linking gustavo.zacarias at free-electrons.com
2016-07-17 15:05 ` [Buildroot] [PATCH 2/2] docs/manual: document PKG_AS_NEEDED gustavo.zacarias at free-electrons.com
2016-07-17 21:01 ` [Buildroot] [PATCH 1/2] build: add support for as-needed linking Yann E. MORIN
2016-07-18 0:36 ` Gustavo Zacarias
2016-09-20 23:17 ` Peter Korsgaard
2016-09-20 18:07 ` Thomas Petazzoni [this message]
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=20160920200700.1096bb21@free-electrons.com \
--to=thomas.petazzoni@free-electrons.com \
--cc=buildroot@busybox.net \
/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