public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Andi Kleen <andi@firstfloor.org>,
	Markus Trippelsdorf <markus@trippelsdorf.de>,
	linux-kernel@vger.kernel.org, x86@kernel.org,
	linux-kbuild@vger.kernel.org, mmarek@suse.cz,
	hjl.tools@gmail.com
Subject: Re: Updated Link-Time-Optimization patchkit
Date: Sun, 16 Feb 2014 04:35:04 +0100	[thread overview]
Message-ID: <20140216033504.GC32005@two.firstfloor.org> (raw)
In-Reply-To: <20140215212443.GA27575@ravnborg.org>

On Sat, Feb 15, 2014 at 10:24:43PM +0100, Sam Ravnborg wrote:
> Hi Andi.
> 
> On Sat, Feb 15, 2014 at 06:44:24PM +0100, Andi Kleen wrote:
> > On Sat, Feb 15, 2014 at 02:38:14PM +0100, Markus Trippelsdorf wrote:
> > > On 2014.02.14 at 22:21 +0100, Andi Kleen wrote:
> > > > This is the updated LTO patchkit for 3.14-rc2.  LTO allows
> > > > the compiler to do global optimization over the whole kernel.
> > > 
> > > It is mildly annoying that one couldn't use vanilla binutils. Have you
> > > already opened bugs on sourceware.org/bugzilla/ to get this fixed for
> > > gold and ld.bfd?
> > 
> > The problem is supporting "pass through" of both pure (.S) assembler code and
> > LTO through ld -r, because the kernel makefiles use ld -r heavily.
> > Standard binutils would throw all the assembler away when in plugin LTO
> > mode.
> 
> Long time ago I looked at eliminating the use of -r in the kernel build.
> I lost the patch - but the attached patch managed to build
> a "make defconfig; make" kernel.
> 
> I have not event tried boot with this - it only managed to build!
> 
> What the patch does is for each directory visited a built-in.link file is created
> which is really a linker script.
> It uses INPUT (file file file) to specify all the object files.
> And in the final link the files are all read and the link is performed.
> 
> This limit the depth to 10 levels due to a restriction in ld.
> The binutils people have suggested some other methods that I did not look into.
> 
> Half of the patch is fixes to the security makefiles which I
> will submit anyway as this needs to be cleaned up indendent on
> this patch.
> 
> The patch drops $(cmd_secanalysis) because I did not look into this.
> 
> If this could make it easier to enable LTO then this would be
> a nice win.

I gave it a quick try and it failed like below with LTO

Right now using the Linux binutils is ok for me.

-Andi


+ ld -m elf_x86_64 -r -o vmlinux.o arch/x86/kernel/head_64.o
arch/x86/kernel/head64.o arch/x86/kernel/head.o init/built-in.link
--start-group usr/built-in.link arch/x86/built-in.link
kernel/built-in.link mm/built-in.link fs/built-in.link ipc/built-in.link
security/built-in.link crypto/built-in.link block/built-in.link
lib/lib.a arch/x86/lib/lib.a lib/built-in.link
arch/x86/lib/built-in.link drivers/built-in.link sound/built-in.link
firmware/built-in.link arch/x86/pci/built-in.link
arch/x86/oprofile/built-in.link arch/x86/power/built-in.link
arch/x86/video/built-in.link net/built-in.link --end-group
lib/lib.a: could not read symbols: Bad value


      reply	other threads:[~2014-02-16  3:35 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14 21:21 Updated Link-Time-Optimization patchkit Andi Kleen
2014-02-14 21:21 ` [PATCH 01/19] x86, lto: Disable LTO for the x86 VDSO Andi Kleen
2014-02-15 21:26   ` Sam Ravnborg
2014-02-14 21:21 ` [PATCH 02/19] lto: Disable LTO for hweight functions Andi Kleen
2014-02-14 21:21 ` [PATCH 03/19] lto: Make asmlinkage __visible Andi Kleen
2014-02-15 21:28   ` Sam Ravnborg
2014-02-14 21:21 ` [PATCH 04/19] lto, workaround: Add workaround for initcall reordering Andi Kleen
2014-02-14 21:21 ` [PATCH 05/19] lto: Handle LTO common symbols in module loader Andi Kleen
2014-02-14 21:21 ` [PATCH 06/19] lto: Disable LTO for sys_ni Andi Kleen
2014-02-14 21:21 ` [PATCH 07/19] lto: Don't let LATENCYTOP and LOCKDEP select KALLSYMS_ALL Andi Kleen
2014-02-14 21:21 ` [PATCH 08/19] Kbuild, lto, workaround: Don't warn for initcall_reference in modpost Andi Kleen
2014-02-15 21:36   ` Sam Ravnborg
2014-02-14 21:21 ` [PATCH 09/19] Kbuild, lto: Drop .number postfixes " Andi Kleen
2014-02-14 21:21 ` [PATCH 10/19] Kbuild, lto: add ld-version and ld-ifversion macros Andi Kleen
2014-02-15 21:32   ` Sam Ravnborg
2014-02-14 21:21 ` [PATCH 11/19] Kbuild, lto: Add a gcc-ld script to let run gcc as ld Andi Kleen
2014-02-14 21:21 ` [PATCH 12/19] Kbuild, lto: Disable LTO for asm-offsets.c Andi Kleen
2014-02-14 21:21 ` [PATCH 13/19] Kbuild, lto: Set TMPDIR for LTO v2 Andi Kleen
2014-02-14 21:21 ` [PATCH 14/19] Kbuild, lto: Handle basic LTO in modpost Andi Kleen
2014-02-15 21:35   ` Sam Ravnborg
2014-02-14 21:21 ` [PATCH 15/19] Kbuild, lto: Fix single pass kallsyms for LTO Andi Kleen
2014-02-14 21:21 ` [PATCH 16/19] Kbuild, lto: Add Link Time Optimization support v2 Andi Kleen
2014-02-14 21:21 ` [PATCH 17/19] lto: Mark spinlocks noinline when inline spinlocks are disabled Andi Kleen
2014-02-14 21:21 ` [PATCH 18/19] lto, module: Warn about modules that are not fully LTOed Andi Kleen
2014-02-14 21:21 ` [PATCH 19/19] lto: Don't inline __const_udelay Andi Kleen
2014-02-15 13:38 ` Updated Link-Time-Optimization patchkit Markus Trippelsdorf
2014-02-15 17:44   ` Andi Kleen
2014-02-15 18:41     ` H.J. Lu
2014-02-15 21:24     ` Sam Ravnborg
2014-02-16  3:35       ` Andi Kleen [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=20140216033504.GC32005@two.firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=hjl.tools@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markus@trippelsdorf.de \
    --cc=mmarek@suse.cz \
    --cc=sam@ravnborg.org \
    --cc=x86@kernel.org \
    /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