Testing the gold linker on Mozilla

I decided it is time to do something that isn’t Fedora or JBoss related. I noticed that Dave Humphrey would like to test the new Gold linker included in binutils with Firefox.

I used kvm test this.
I launched kvm with sudo qemu-kvm -hda gold-tests -cdrom F10-Snap2-i686-Live.iso -boot d -smp 2 -m 3500. I installed the required software to build Firefox then make 2 additional copies of the hard disk image, giving me three in total. One as backup, one for regular ld and one for gold. I compiled binutils from source without using RPM because this is a one off test system which I don’t care about breaking. If I was going to continue using this system I would have modified the package descriptor for binutils to enable gold.

The Following packages were installed to facilitate compilation:

  • groupinstall “Development Tools”
  • gtk2-devel
  • libXt-devel
  • freetype-devel
  • dbus-glib-devel
  • alsa-lib-devel
  • curl-devel
  • ORBit2-devel

According to this news list post when you compile binutils you either get the regular linker or the gold linker. To do this you specify --enable-gold when running ./configure. I am going to install binutils using both to test both with the same version of binutils. I will start from my clean image each time.

Since the version of binutils in my installation is different to my tarball, i used the –version option to verify that it installed successfully. As suggested in the original contributions page, I will export LD=gold as an environmental variable, but only on the vm with gold for obvious reasons. I am compiling firefox with the default options from the tarball as ./configure --prefix=/home/jhford --enable-application=browser; time make -j8 -s > ~/mozbuildtime; make install. I also bumped my -smp flag to 4 to match my host and to ensure I get the best possible performance out of my vms.

Here is the time for a non-gold build.

real 9m3.720s
user 4m28.562s
sys 11m1.834s

And the times for a gold build I aliased ld to ‘ld –threads –thread-count 4′ for these runs as well as exporting LD=gold.

real 8m41.445s
user 4m18.749s
sys 10m45.263s

Initially, I was getting that gold was cutting my builds in half, but it turns out I accidentally did make with j4 instead of j8. I found that consistently, gold builds were faster but not by a substantial enough amount to justify having to manually enable it in your package manager of choice.

One Response to Testing the gold linker on Mozilla

  1. Interesting results. When I tested it, I didn’t see much difference in building with/without the gold linker.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>