I just copied the command out of hotspot/variant-server/libjvm/objs/BUILD_LIBJVM_link.cmdline and lightly edited it.
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.joels...@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