[lfs-dev] Building with gold

DJ Lucas dj at linuxfromscratch.org
Tue Feb 9 21:35:24 PST 2016

On 2/9/2016 9:52 PM, Ken Moffat wrote:
> After last month's discussions on lfs-dev about building with gold, I
> thought I would give it a go.  I'll CC this to blfs-dev and
> blfs-support : if you reply, please consider which list is
> appropriate.
> For those who have not encountered it, gold is a different linker,
> developed by google and supposedly much faster.  I was initially
> dubious - when I last saw comments about it (a long while ago) I
> recall that the linux kernel failed to link, perhaps only for some
> .config options, and I anticipated problems in BLFS.
> I built using LFS-svn from the 2nd of this month, and BLFS from the
> 4th - my normal desktop, plus all of TeX and most of kde5.
> This was with GNU gold (GNU Binutils 2.26.20160125) 1.11 -
> for LFS I had to add bison to the end of chapter five and pass
>   --enable-gold --enable-plugins
> to chapter six binutils.  I managed to get a vast amount of output on
> my screen while running the tests (instead of to my test log), but
> all that my log shows for the gold summary is:
> ==================
> All 3 tests passed
> ==================
> When I initially built gold on a completed system, I think there
> were about 225 other tests before or after that, so I need to fix my
> script (2>>&1 in the wrong place!).
> I did not attempt to use gold until chapter 6 had completed (so, my
> first package was the linux kernel) and I hacked up an ld symlink at
> /usr/bin/gold/ld to avoid major changes to my scripts (i.e. just
> alter the PATH in my main scripts - this also simplifies trying to
> test if a build failure is because of gold: just drop that part of
> the PATH).
> In practice, my problems were few.  A list of the packages I built
> is at
> http://www.linuxfromscratch.org/~ken/gold-tests/packages-built-with-gold-Feb-2016
> and of those only libglade [ patch now in patches ], firefox (! :
> it told me to use --disable-elf-hack
> https://bugzilla.mozilla.org/show_bug.cgi?id=1246416) and
> gtkimageview-1.6.4 (for ufraw : fixed with a sed which is in my
> lsit).
> Please note that I did not attempt to compare build times with gold
> and regular old ld.  This was just a test to estimate how many
> packages will need fixes, and the number looks manageable.
> I also have no idea whether gold can be used when building chapter
> five.
> ĸen

Holy cow, that's a lot of info, and a ton of work to just throw at a 
newer linker! I've put this on back burner until after 7.9, but your 
results are obviously very encouraging. Thanks for doing all that work 
and sharing! When I get a few free cycles, I'll give it a go with the 
ld->ld.gold in chapter 5 and 6.


More information about the lfs-dev mailing list