linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: Nicolas Pitre <nicolas.pitre@linaro.org>
Cc: David Howells <dhowells@redhat.com>,
	Michal Marek <mmarek@suse.com>,
	linux-kbuild@vger.kernel.org, linux-arch@vger.kernel.org,
	Sam Ravnborg <sam@ravnborg.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Arnd Bergmann <arnd@arndb.de>,
	Segher Boessenkool <segher@kernel.crashing.org>,
	Alan Modra <amodra@gmail.com>
Subject: Re: [PATCH 0/3 v3] kbuild changes, thin archives, --gc-sections
Date: Thu, 25 Aug 2016 12:56:44 +1000	[thread overview]
Message-ID: <20160825125644.37cf118f@roar.ozlabs.ibm.com> (raw)
In-Reply-To: <alpine.LFD.2.20.1608241114430.17623@knanqh.ubzr>

On Wed, 24 Aug 2016 11:21:33 -0400 (EDT)
Nicolas Pitre <nicolas.pitre@linaro.org> wrote:

> On Wed, 24 Aug 2016, David Howells wrote:
> 
> > Out of interest, does using LTO also fix the problem?  
> 
> With those patches in place, that would be the next thing to try.
> Reducing our reliance on 'ld -r' will greatly help promoting LTO for the
> kernel.
> 
> Personally I'd like to have the choice between LTO and -gc-sections at 
> configure time.  They both have advantages of their own.


We discussed this in previous rounds of patches, but to just
expand on Nicolas' answer with some overview:

- Thin archives are needed for linking large kernels of some ISAs.
  I believe the linker becomes constrained in where it can use
  branch stubs when linking large inputs, but haven't looked into
  the internals exactly. There are a number of other ways proposed
  to solve it, but archives are well understood by toolchain and
  look like quite an elegant solution (with other benefits such as
  build output size and helping to enable LTO).

- gc-sections patch is mainly to address some small regressions
  in binary size with the first patch, but I think the results
  make it stand on its own. It's very fast, mature, does not
  transform code, and gives surprisingly good size saving without
  much enablement work. The work that is required (e.g., to
  annotate entry points) is mostly shared with LTO if we add that
  in future, so it's not dead-end cruft.

- LTO: Nicolas has posted far more significant size improvements
  with his more advanced work with reference annotatation and LTO.
  I'm surprised there has not been more interest, but I hope if
  we get this merged, it might give him motivation to look at it
  again. Discussion seemed to die down last time with people
  saying we should look at gc-sections first. 

I see this as enabler to LTO rather than a replacement. LTO is
bigger change to build and less mature, but long term it is the
right way to go IMO. When we iron out toolchains, perhaps have
LTO option for just static elimination rather than transformations
for high speed / low optimization builds, etc., then gc-sections
would be completely supplanted could be removed. Using sections
for dce is a nice linker hack, but real LTO information seems
cleaner in the end (and of course allows more optimization).

Thanks,
Nick

  parent reply	other threads:[~2016-08-25  2:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-24 12:29 [PATCH 0/3 v3] kbuild changes, thin archives, --gc-sections Nicholas Piggin
2016-08-24 12:29 ` Nicholas Piggin
2016-08-24 12:29 ` [PATCH 1/3] kbuild: allow architectures to use thin archives instead of ld -r Nicholas Piggin
2016-08-24 12:29 ` [PATCH 2/3] kbuild: allow archs to select link dead code/data elimination Nicholas Piggin
2016-08-24 12:29 ` [PATCH 3/3] kbuild: add arch specific post-link Makefile Nicholas Piggin
2016-08-24 12:29   ` Nicholas Piggin
2016-08-24 13:32   ` Nicholas Piggin
2016-08-24 13:06 ` [PATCH 0/3 v3] kbuild changes, thin archives, --gc-sections Arnd Bergmann
2016-08-24 13:06   ` Arnd Bergmann
2016-08-24 15:13   ` Nicolas Pitre
2016-08-24 14:21 ` David Howells
2016-08-24 14:21   ` David Howells
2016-08-24 15:21   ` Nicolas Pitre
2016-08-24 15:21     ` Nicolas Pitre
2016-08-25  2:56     ` Nicholas Piggin [this message]
2016-08-25  2:56       ` Nicholas Piggin
2016-09-09  0:23 ` Nicolas Pitre
2016-09-09  0:23   ` Nicolas Pitre
2016-09-09 10:59   ` Michal Marek
2016-09-10  4:05     ` Nicolas Pitre

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=20160825125644.37cf118f@roar.ozlabs.ibm.com \
    --to=npiggin@gmail.com \
    --cc=amodra@gmail.com \
    --cc=arnd@arndb.de \
    --cc=dhowells@redhat.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=mmarek@suse.com \
    --cc=nicolas.pitre@linaro.org \
    --cc=sam@ravnborg.org \
    --cc=segher@kernel.crashing.org \
    --cc=sfr@canb.auug.org.au \
    /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 NNTP newsgroup(s).