RFR: JDK-8217723 Switch ld from bfd to gold on gcc toolchain

Magnus Ihse Bursie magnus.ihse.bursie at oracle.com
Thu Jan 24 14:04:27 UTC 2019


On 2019-01-24 14:45, Florian Weimer wrote:
> * Magnus Ihse Bursie:
>
>> The default binutils linker used by gcc, the bfd linker, is slow. The
>> new replacement, gold, has been distributed alongside gcc for several
>> years now, and is a well mature, and much faster, replacement.
> The gold linker is an optional component of binutils, not available in
> all builds.  For example, binutils in Red Hat Enterprise Linux 7.6 does
> not include gold on the ppc64le architecture.
>
> The gold linker also supports a different set of features compared to
> BFD ld, which may or may not be what you want.  But I think OpenJDK does
> not use many tricky ELF features, so the differences probably do not
> matter.
>
> Is it possible to add -fuse-ld=gold to LDFLAGS externally, outside the
> build system, so that the build system can use the gold linker if people
> prefer it over BFD ld?
>
> Or you could configure your binutils with --enable-gold=default, so that
> it defaults to ld.gold, again not requiring any OpenJDK changes.
One of the driving forces behind this bug is the speed increase in gold 
by itself. You are correct that to achieve this, a solution outside the 
build system can be used.

However, the other driving force is the ability to enable incremental 
linking. The build system must know if we use gold, so that it knows 
that those command line options are available. So to resort to the 
solution of changing the environment would not enable that second part.

But I'm leaning more towards just enabling gold on x86_64 -- for other 
platforms, we might as well keep the good ol' bfd linker. Does that 
sound like a good solution to you?

/Magnus

>
> Thanks,
> Florian




More information about the build-dev mailing list