Skip to content

Enable LTO for jdk-openjdk

Vasiliy Stelmachenok requested to merge ventureo/java-openjdk:lto into main

OpenJDK officially supports building with LTO from Java 9 and up (https://bugs.openjdk.org/browse/JDK-8292226), but it is disabled by default for all architectures except ARM, and unlike other packages, enabling it via options=(lto) causes build errors (See similar bug in Gentoo - https://bugs.gentoo.org/833098). Instead, LTO optimizations should be enabled via a special flag --with-jvm-features=link-time-opt. Since RFC 0004 in Arch says to enable LTO by default, I think it's OK to enable it for OpenJDK as well. I tested the LTO build, and it seems to work well only for OpenJDK 21 and 17. JDK 11, although it supports building with LTO, fails at some point.

P.S. I'm not very familiar with how patches should be formed for packages in the arch's tree, so I didn't increase pkgrel here. Let me know if I should do it.

Merge request reports