Page MenuHomePhabricator

[CMAKE] Use gold as a linker when available
ClosedPublic

Authored by Fabien on Mar 11 2020, 22:57.

Details

Summary

This diff adds an USE_LD_GOLD option that attempts to use gold
instead of the default toolchain linker. It is ON by default since it
has a safe fallback path.
Note that it works when cross compiling too. The option is also
available with MinGw but supposedly has no effect since gold is
ELF-only.

Building with debug on my machine (with ccache so linking time is more
relevant), before:

real    1m28.916s
user    1m46.125s
sys     0m46.567s

After:

real    1m5.641s
user    1m21.068s
sys     0m42.618s
Test Plan

On Linux and OSX:

ninja all check

Run the Gitian builds twice and check the build is still deterministic.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable