linux: faster linking using multiple threads

1,008 views
Skip to first unread message

Evan Martin

unread,
Feb 23, 2011, 2:16:04 PM2/23/11
to chromium-dev
I've recently checked in some changes that make linking faster on Linux.

This change relies on a feature in gold (threading support) that is
off by default.
At gyp time, we detect whether your linker supports threading, so
there is nothing you need to do other than install a new linker to get
faster links.

== Timing
On my very fast desktop a debug build of Chrome linked in about 25
seconds. With this change, it was around 20. 5 seconds isn't a lot
but I'll take it when it's basically free. :)
Release mode links were around 2.5 seconds either way (it might be my
computer is too fast for the change to have much effect).

== Install instructions for Googlers
You should already have an "ld" binary in a "bin" subdir next to your
checkout. You just need to overwrite this with the new one I built,
which you can get from
/google/data/ro/projects/chrome/setup/gold/
or
~evanm/projects/chrome/ld

== Install instructions for everyone else
You'll need to get a copy of the binutils source and build it with
--enable-threads. (That doesn't show up in the top-level ./configure
--help but it is passed down to the gold ./configure.)

== Verification
You can test whether your linker supports threads by running it with
the --threads argument:
$ /usr/bin/ld.bfd --threads
/usr/bin/ld.bfd: unrecognized option '--threads'
$ /usr/bin/ld.gold --threads
/usr/bin/ld.gold: warning: ignoring --threads: /usr/bin/ld.gold was
compiled without thread support


PS: also recently I turned on "thin" ar archives again, which should
cut down on disk cache thrashing a lot on systems that support it.
Let me know if you run into any problems.

graph.png

Paweł Hajdan, Jr.

unread,
Feb 23, 2011, 2:40:19 PM2/23/11
to ev...@chromium.org, chromium-dev
On Wed, Feb 23, 2011 at 20:16, Evan Martin <ev...@chromium.org> wrote:
== Install instructions for everyone else
You'll need to get a copy of the binutils source and build it with
--enable-threads.  (That doesn't show up in the top-level ./configure
--help but it is passed down to the gold ./configure.)

Is it possible to just add this option to build/install-build-deps.sh? 

Lei Zhang

unread,
Feb 23, 2011, 3:00:27 PM2/23/11
to phajd...@chromium.org, ev...@chromium.org, chromium-dev

Ya, I'm already working on updating the gold installer in
build/install-build-deps.sh.

Lei Zhang

unread,
Feb 23, 2011, 4:31:51 PM2/23/11
to phajd...@chromium.org, ev...@chromium.org, chromium-dev

Run build/install-build-deps.sh at r75790 or later to build and
install the latest release of gold with threads enabled.

任青妹

unread,
Dec 5, 2016, 9:24:49 AM12/5/16
to Chromium-dev, phajd...@chromium.org, ev...@chromium.org, the...@chromium.org
How to install new version gold with threads support, now I encounter such an error.

在 2011年2月24日星期四 UTC+8上午5:31:51,Lei Zhang写道:
Reply all
Reply to author
Forward
0 new messages