RFR: JDK-8217723 Switch ld from bfd to gold on gcc toolchain
Martin Buchholz
martinrb at google.com
Thu Jan 24 14:48:49 UTC 2019
Getting into the business of choosing the linker is big trouble.
The system default toolchain may have already chosen a linker.
BFD might be configured to have either bfd ld or gold.
# Handle --enable-gold, --enable-ld.
# --disable-gold [--enable-ld]
# Build only ld. Default option.
# --enable-gold [--enable-ld]
# Build both gold and ld. Install gold as "ld.gold", install ld
# as "ld.bfd" and "ld".
# --enable-gold=default [--enable-ld]
# Build both gold and ld. Install gold as "ld.gold" and "ld",
# install ld as "ld.bfd".
# --enable-gold[=default] --disable-ld
# Build only gold, which is then installed as both "ld.gold" and "ld".
# --enable-gold --enable-ld=default
# Build both gold (installed as "ld.gold") and ld (installed as "ld"
# and ld.bfd).
# In other words, ld is default
The compiler driver itself may have been configured to choose a linker.
The system administrator may have used update-alternatives to choose a linker.
A user might have configured openjdk to use -fuse-ld=... (we do this!)
How do you resolve the conflict?
There's evidence that lld is even faster than gold. The Internet says,
"""Liked linking 3x faster with gold? Link 10x faster with lld!"""
so hardcoding gold might be a regression!
So ... -fuse-ld is a flag that is perfect for a local wrapper around
configure that is __not__ part of openjdk (we do this!)
More information about the build-dev
mailing list