RFR: JDK-8217723 Switch ld from bfd to gold on gcc toolchain
Magnus Ihse Bursie
magnus.ihse.bursie at oracle.com
Thu Jan 24 13:11:19 UTC 2019
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
More information about the build-dev
mailing list