RFR: JDK-8217723 Switch ld from bfd to gold on gcc toolchain
Erik Joelsson
erik.joelsson at oracle.com
Thu Jan 24 22:22:39 UTC 2019
Hello,
On 2019-01-24 13:18, Martin Buchholz wrote:
> I just copied the command out of
> hotspot/variant-server/libjvm/objs/BUILD_LIBJVM_link.cmdline
> and lightly edited it.
I took the .cmdline verbatim and then just added -fuse-ld=gold, so
should be the same. I'm running on Ubuntu 18.04 using a devkit produced
by the makefiles in make/devkit. I'm running SSDs and AFAIK they are
working as they should. When running the command using /usr/bin/time, I
get 99% cpu. If I instead try the native toolchain on the system, the
times are better, but still miles from yours:
With devkit, default linker: 23s
With devkit, gold: 14.2s
Native compiler, default linker: 12.5s
Native compiler, gold: 8.1s
The machine has 2 cpus identifying as "Intel(R) Xeon(R) CPU E5-2665 0 @
2.40GHz". These are certainly not known for single threaded performance,
but I'm surprised by this difference.
Given our reality, I think you can understand why this change matters.
Cutting off nearly 10s from incremental rebuilds is significant for
developers when in an edit-build-test loop.
/Erik
> On my old underpowered NUC at home I see slightly worse numbers (but
> warmed up, files on SSD - are you I/O bound?).
>
> (BUILDDIR=$HOME/ws/jdk/build/linux-x86_64-server-release; for ld in
> bfd gold; do time /usr/bin/g++ -fuse-ld=$ld -Wl,--hash-style=both
> -Wl,-z,defs -Wl,-z,noexecstack -Wl,-O1 -Wl,-z,relro -m64
> -static-libstdc++ -static-libgcc -shared -m64
> -Wl,-version-script=$BUILDDIR/hotspot/variant-server/libjvm/mapfile
> -Wl,-soname=libjvm.so -o
> $BUILDDIR/support/modules_libs/java.base/server/libjvm.so
> @$BUILDDIR/hotspot/variant-server/libjvm/objs/_BUILD_LIBJVM_objectfilenames.txt
> -lm -ldl -lpthread; done)
> /usr/bin/g++ -fuse-ld=$ld -Wl,--hash-style=both -Wl,-z,defs
> -Wl,-z,noexecstac 2.28s user 0.33s system 99% cpu 2.621 total
> /usr/bin/g++ -fuse-ld=$ld -Wl,--hash-style=both -Wl,-z,defs
> -Wl,-z,noexecstac 0.65s user 0.09s system 98% cpu 0.747 total
>
> On Thu, Jan 24, 2019 at 11:06 AM Erik Joelsson <erik.joelsson at oracle.com> wrote:
>> Are you actually linking libjvm.so in 1.3 seconds? A normal link time
>> for me using bfd is about 23 seconds while gold takes it to 14.2(+-0.2).
>> This is in line with what hotspot developers I have talked to also see
>> (and they have similar hardware).
>>
>> My workstation has a few years on it, but surely machines haven't gotten
>> 17 times faster? There must be something else at play here.
>>
>> /Erik
>>
>> On 2019-01-24 10:49, Martin Buchholz wrote:
>>> Here's an experiment using the 3 competing open source linkers to link
>>> hotspot. This confirms that lld is faster than gold is faster than
>>> bfd, but is the one second saving worth the engineering effort?
>>>
>>> $ (BUILDDIR=$HOME/ws/jdk/build/linux-x86_64-server-release; for
>>> linker in bfd gold lld; do echo --- $linker ---; time /usr/bin/g++
>>> -fuse-ld=$linker -Wl,--hash-style=both -Wl,-z,defs -Wl,-z,noexecstack
>>> -Wl,-O1 -Wl,-z,relro -m64 -static-libstdc++ -static-libgcc -shared
>>> -m64 -Wl,-version-script=$BUILDDIR/hotspot/variant-server/libjvm/mapfile
>>> -Wl,-soname=libjvm.so -o
>>> $BUILDDIR/support/modules_libs/java.base/server/libjvm.so
>>> @$BUILDDIR/hotspot/variant-server/libjvm/objs/_BUILD_LIBJVM_objectfilenames.txt
>>> -lm -ldl -lpthread; done)
>>> --- bfd ---
>>> /usr/bin/g++ -fuse-ld=$linker -Wl,--hash-style=both -Wl,-z,defs
>>> -Wl,-O1 -m6 1.31s user 0.36s system 99% cpu 1.669 total
>>> --- gold ---
>>> /usr/bin/g++ -fuse-ld=$linker -Wl,--hash-style=both -Wl,-z,defs
>>> -Wl,-O1 -m6 0.42s user 0.11s system 99% cpu 0.537 total
>>> --- lld ---
>>> /usr/bin/g++ -fuse-ld=$linker -Wl,--hash-style=both -Wl,-z,defs
>>> -Wl,-O1 -m6 0.25s user 0.20s system 145% cpu 0.310 total
More information about the build-dev
mailing list