On Thu, 24 Jan 2019 at 13:12, Magnus Ihse Bursie
<magnus.ihse.bur...@oracle.com> wrote:
>
> 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.
>
> This issue is about replacing ld.bfd with ld.gold for our gcc toolchain.
> In general, this cuts linking times by half or more.
>
> As a future improvement, gold also allows for incremental linking.
> Turning on that is outside the scope of this issue.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8217723
> Patch inline:
> diff --git a/make/autoconf/flags-ldflags.m4 b/make/autoconf/flags-ldflags.m4
> --- a/make/autoconf/flags-ldflags.m4
> +++ b/make/autoconf/flags-ldflags.m4
> @@ -70,7 +70,7 @@
>       fi
>
>       # Add -z defs, to forbid undefined symbols in object files.
> -    BASIC_LDFLAGS="$BASIC_LDFLAGS -Wl,-z,defs"
> +    BASIC_LDFLAGS="$BASIC_LDFLAGS -Wl,-z,defs -fuse-ld=gold"
>
>       BASIC_LDFLAGS_JVM_ONLY="-Wl,-O1 -Wl,-z,relro"
>
> /Magnus

I'm aware of the benefits of using gold, and also occasional issues with
it, but that's not the debate here. It's already perfectly possible to
build with gold by using --with-ldflags="-fuse-ld=gold", as I've been
doing for quite a while, or setting the system ld to be gold. What you're
asking is that this option should be forced onto every build.

My experience suggests that compiler flags should be kept to a minimum,
and tested for where possible. One of the great benefits of OpenJDK finally
having a configure system is that we can now check whether flags work
before enabling them (e.g. my own changes to support GCC 6). What seems
to work wonderfully on one's local machine often breaks in a variety
of different
ways when exposed to the variety of build environments out there.

I guess you could add this with an --enable-gold option (on by default) and
testing that the flag works in configure. I do have to wonder though if it
is worth the effort and possible risks.

Thanks,
-- 
Andrew :)

Senior Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Web Site: http://fuseyism.com
Twitter: https://twitter.com/gnu_andrew_java
PGP Key: ed25519/0xCFDA0F9B35964222 (hkp://keys.gnupg.net)
Fingerprint = 5132 579D D154 0ED2 3E04  C5A0 CFDA 0F9B 3596 4222

Reply via email to