diff --git a/dev-java/openjdk/metadata.xml b/dev-java/openjdk/metadata.xml index 367d2eb36d3e3..201e1fe75f500 100644 --- a/dev-java/openjdk/metadata.xml +++ b/dev-java/openjdk/metadata.xml @@ -23,6 +23,7 @@ Provide JavaFX support via dev-java/openjfx Import OpenJFX modules at build time, via dev-java/openjfx Build OpenJDK twice, the second time using the result of the first + Enable Link Time Optimization (LTO) Install JVM sources Bootstrap using installed openjdk Enable SystemTAP/DTrace tracing diff --git a/dev-java/openjdk/openjdk-11.0.18_p10.ebuild b/dev-java/openjdk/openjdk-11.0.18_p10.ebuild index b2eafe9b1e683..8f67061d2ac5d 100644 --- a/dev-java/openjdk/openjdk-11.0.18_p10.ebuild +++ b/dev-java/openjdk/openjdk-11.0.18_p10.ebuild @@ -51,7 +51,7 @@ SRC_URI=" LICENSE="GPL-2-with-classpath-exception" KEYWORDS="amd64 ~arm arm64 ppc64 ~riscv x86" -IUSE="alsa big-endian cups debug doc examples headless-awt javafx +jbootstrap selinux source system-bootstrap systemtap" +IUSE="alsa big-endian cups debug doc examples headless-awt javafx +jbootstrap lto selinux source system-bootstrap systemtap" REQUIRED_USE=" javafx? ( alsa !headless-awt ) @@ -173,6 +173,12 @@ src_configure() { # Strip some flags users may set, but should not. #818502 filter-flags -fexceptions + # Strip lto related flags, we rely on USE=lto and --with-jvm-features=link-time-opt + # https://bugs.gentoo.org/833097 + # https://bugs.gentoo.org/833098 + filter-flags '-flto*' + filter-flags -fdevirtualize-at-ltrans + # Enabling full docs appears to break doc building. If not # explicitly disabled, the flag will get auto-enabled if pandoc and # graphviz are detected. pandoc has loads of dependencies anyway. @@ -207,6 +213,8 @@ src_configure() { ) ! use riscv && myconf+=( --with-jvm-features=shenandoahgc ) + use lto && myconf+=( --with-jvm-features=link-time-opt ) + if use javafx; then # this is not useful for users, just for upstream developers # build system compares mesa version in md file diff --git a/dev-java/openjdk/openjdk-17.0.6_p10.ebuild b/dev-java/openjdk/openjdk-17.0.6_p10.ebuild index a4fedb98ad08c..328018b6e7c84 100644 --- a/dev-java/openjdk/openjdk-17.0.6_p10.ebuild +++ b/dev-java/openjdk/openjdk-17.0.6_p10.ebuild @@ -54,7 +54,7 @@ SRC_URI=" LICENSE="GPL-2-with-classpath-exception" KEYWORDS="amd64 ~arm arm64 ppc64 ~riscv x86" -IUSE="alsa big-endian cups debug doc examples headless-awt javafx +jbootstrap selinux source system-bootstrap systemtap" +IUSE="alsa big-endian cups debug doc examples headless-awt javafx +jbootstrap lto selinux source system-bootstrap systemtap" REQUIRED_USE=" javafx? ( alsa !headless-awt ) @@ -191,6 +191,12 @@ src_configure() { # Strip some flags users may set, but should not. #818502 filter-flags -fexceptions + # Strip lto related flags, we rely on USE=lto and --with-jvm-features=link-time-opt + # https://bugs.gentoo.org/833097 + # https://bugs.gentoo.org/833098 + filter-flags '-flto*' + filter-flags -fdevirtualize-at-ltrans + # Enabling full docs appears to break doc building. If not # explicitly disabled, the flag will get auto-enabled if pandoc and # graphviz are detected. pandoc has loads of dependencies anyway. @@ -227,6 +233,8 @@ src_configure() { use riscv && myconf+=( --with-boot-jdk-jvmargs="-Djdk.lang.Process.launchMechanism=vfork" ) + use lto && myconf+=( --with-jvm-features=link-time-opt ) + if use javafx; then local zip="${EPREFIX}/usr/$(get_libdir)/openjfx-${SLOT}/javafx-exports.zip" if [[ -r ${zip} ]]; then diff --git a/dev-java/openjdk/openjdk-8.362_p09.ebuild b/dev-java/openjdk/openjdk-8.362_p09.ebuild index 36aa8a4c97ae7..2da4bca4fce13 100644 --- a/dev-java/openjdk/openjdk-8.362_p09.ebuild +++ b/dev-java/openjdk/openjdk-8.362_p09.ebuild @@ -132,6 +132,12 @@ src_configure() { # Strip some flags users may set, but should not. #818502 filter-flags -fexceptions + # Strip lto related flags, no support in this version. + # https://bugs.gentoo.org/833097 + # https://bugs.gentoo.org/833098 + filter-flags '-flto*' + filter-flags -fdevirtualize-at-ltrans + tc-export_build_env CC CXX PKG_CONFIG STRIP local myconf=(