RFR: JDK-8217910: Slow linking with devkit on Linux

Erik Joelsson erik.joelsson at oracle.com
Mon Jan 28 22:17:39 UTC 2019


Hello,

While investigating performance with different linkers and linker 
configuration, we discovered that the devkit linker on Linux (both bfd 
and gold) was a lot slower than the native linker on Ubuntu (23s vs 12s 
for bfd to link libjvm.so on my machine). They are both the same version 
(2.30), so this was puzzling.

It turned out to be a difference in how binutils was built. On Ubuntu 
(and I assume most major Linux vendors), they explicitly set 
CFLAGS="-O2" when running the build for binutils. I had naively assumed 
that binutils set reasonable default CFLAGS in their build so have not 
modified them like this before. I tried adding -O2 for our devkit, and 
that created a kit with comparable linking performance on par with the 
Ubuntu linker. Since this seems to be widely done, I assume the change 
to be quite safe.

With this patch, I'm modifying the devkit creation makefiles to add -O2 
when building binutils. I'm also adding --enable-threads so that the 
user may run the gold linker with --threads (as well as updating a 
download link which now requires https). For Oracle users, the devkit 
versions are bumped in jib-profiles.js so the new devkits are used.

Bug: https://bugs.openjdk.java.net/browse/JDK-8217910

Webrev: http://cr.openjdk.java.net/~erikj/8217910/webrev.01/index.html

/Erik




More information about the build-dev mailing list