[Slackbuilds-users] Use ld.gold?

B Watson yalhcru at gmail.com
Thu Sep 21 14:48:35 UTC 2017


On 9/20/17, Christoph Willing <chris.willing at iinet.net.au> wrote:
>
> I just tried building LibreOffice with LDFLAGS="-fuse-ld=gold". The
> build log notes:
>     checking for explicit LDFLAGS... -fuse-ld=gold
> but apart from that, there's no indication that ld.gold was used and the
> build time was not spectacularly different compared with an otherwise
> identical build done on Sep 2 - it's actually somewhat slower with ld.gold.

It's possible that LibreOffice's build process already checks for ld.gold
and uses it if found. qt5 does that. You can find out by running the build
like this:

strace -f -ostrace.out ./LibreOffice.SlackBuild

...which will take maybe twice as long to run as usual (strace
overhead). Then "grep gold strace.out". Try this with & without
LDFLAGS="-fuse-ld=gold" set in the environment.

Other than speeding up the build, there's no real reason to offer a
ld.gold option. It's only faster at link time, the LibreOffice binary
won't run any faster (or any differently at all) from one built without
ld.gold.

What I've found is that ld.gold speeds up those builds where there's
a *huge* link process (usually at the end), where the build process
looks like it's stalled (but it's eating 100% of one CPU core) and the
currently running command has *many* object files:

gcc -o whatever this.o that.o theother.o <100 or more .o files and/or .a files>

The command might be g++ or ld instead of gcc, of course.

With mame, that one command would take over 2 hours to complete with
the regular ld linker... and finishes in seconds with ld.gold.


More information about the SlackBuilds-users mailing list