On Fri, 12 Aug 2016 21:30:21 +1000
Michael Ellerman <m...@ellerman.id.au> wrote:

> This adds a Kconfig option which can be turned on to enable use of the
> gold linker. It depends on DEBUG_KERNEL to hopefully hide it from users
> who don't really care about it, and also !COMPILE_TEST so that it will
> be turned off for allyes/modconfig builds.
> 
> In the wrapper script we currently always use ${CROSS}ld, so instead
> make that the default if ${LD} isn't already set. When we're called as
> part of a normal build ${LD} will be set, but if the wrapper is called
> separately we will fall back to ${CROSS}ld as before.
> 
> With this enabled I have successfully built a ppc64[le]_defconfig using
> a toolchain which only has ld.gold.

Nice. Out of curiosity, I ran some testing.

On allyesconfig with sfr's thin archives patch and --gc-sections,
ld.gold is about 10% faster than ld.bfd. About 11 seconds vs 12. A lot
of that is in utf8 conversions from "fnmatch" it's using to match
section names though. Setting LANG=C brings it down to 8 seconds and
helps ld.bfd a tiny bit but not much. So that's a pretty good win.
Threading still has some crashes.

ld.gold creates a larger executable though. It seems to be creating a
lot more branch stubs (19000 vs 6500 for ld.bfd). 

I should keep in mind we link the kernel about 4 times every build
before complain too much about linker performance to the binutils guys.
I wonder if we couldn't objcopy the kallsyms onto the end of the image
to avoid that relinking.

Reply via email to