commit:     962499a101dac3519c965ab4ea49f76fb46c3cb4
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 28 05:54:25 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jul 28 05:59:15 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=962499a1

dev-java/openjdk: drop USE=lto, use tc-is-lto instead

As we've done in other packages, migrate away from USE=lto towards
tc-is-lto so users enable via -flto in *FLAGS.

This doesn't fix/workaround bug #960257 but it does make it very easy
for us to add such a workaround later.

Bug: https://bugs.gentoo.org/960257
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-java/openjdk/openjdk-11.0.27_p6-r2.ebuild | 14 +++++++-------
 dev-java/openjdk/openjdk-11.0.28_p6.ebuild    | 14 +++++++-------
 dev-java/openjdk/openjdk-17.0.15_p6-r2.ebuild | 14 +++++++-------
 dev-java/openjdk/openjdk-17.0.16_p8.ebuild    | 14 +++++++-------
 dev-java/openjdk/openjdk-21.0.7_p6-r2.ebuild  | 20 +++++++++-----------
 dev-java/openjdk/openjdk-21.0.8_p9.ebuild     | 20 +++++++++-----------
 dev-java/openjdk/openjdk-25_p31.ebuild        | 20 +++++++++-----------
 dev-java/openjdk/openjdk-26_p6.ebuild         | 20 +++++++++-----------
 dev-java/openjdk/openjdk-8.452_p09-r2.ebuild  | 10 ++++++----
 dev-java/openjdk/openjdk-8.462_p08.ebuild     | 10 ++++++----
 10 files changed, 76 insertions(+), 80 deletions(-)

diff --git a/dev-java/openjdk/openjdk-11.0.27_p6-r2.ebuild 
b/dev-java/openjdk/openjdk-11.0.27_p6-r2.ebuild
index ba889036aca2..e9031e5c1cf7 100644
--- a/dev-java/openjdk/openjdk-11.0.27_p6-r2.ebuild
+++ b/dev-java/openjdk/openjdk-11.0.27_p6-r2.ebuild
@@ -55,7 +55,7 @@ LICENSE="GPL-2-with-classpath-exception"
 SLOT="${MY_PV%%[.+]*}"
 KEYWORDS="amd64 ~arm arm64 ppc64 ~riscv x86"
 
-IUSE="alsa big-endian cups debug doc examples headless-awt javafx +jbootstrap 
lto selinux source system-bootstrap systemtap"
+IUSE="alsa big-endian cups debug doc examples headless-awt javafx +jbootstrap 
selinux source system-bootstrap systemtap"
 
 REQUIRED_USE="
        javafx? ( alsa !headless-awt )
@@ -161,6 +161,8 @@ src_prepare() {
 }
 
 src_configure() {
+       local myconf=()
+
        if ! use system-bootstrap; then
                local xpakvar="${ARCH^^}_XPAK"
                export JDK_HOME="${WORKDIR}/openjdk-bootstrap-${!xpakvar}"
@@ -175,9 +177,9 @@ 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
+       # Strip lto related flags, we rely on --with-jvm-features=link-time-opt
+       # See bug #833097 and bug #833098.
+       tc-is-lto && myconf+=( --with-jvm-features=link-time-opt )
        filter-lto
        filter-flags -fdevirtualize-at-ltrans
 
@@ -188,7 +190,7 @@ src_configure() {
        # explicitly disabled, the flag will get auto-enabled if pandoc and
        # graphviz are detected. pandoc has loads of dependencies anyway.
 
-       local myconf=(
+       myconf+=(
                --disable-ccache
                --disable-precompiled-headers
                --enable-full-docs=no
@@ -218,8 +220,6 @@ 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-11.0.28_p6.ebuild 
b/dev-java/openjdk/openjdk-11.0.28_p6.ebuild
index 9c4b8fdfb228..a6195423f363 100644
--- a/dev-java/openjdk/openjdk-11.0.28_p6.ebuild
+++ b/dev-java/openjdk/openjdk-11.0.28_p6.ebuild
@@ -55,7 +55,7 @@ LICENSE="GPL-2-with-classpath-exception"
 SLOT="${MY_PV%%[.+]*}"
 KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86"
 
-IUSE="alsa big-endian cups debug doc examples headless-awt javafx +jbootstrap 
lto selinux source system-bootstrap systemtap"
+IUSE="alsa big-endian cups debug doc examples headless-awt javafx +jbootstrap 
selinux source system-bootstrap systemtap"
 
 REQUIRED_USE="
        javafx? ( alsa !headless-awt )
@@ -161,6 +161,8 @@ src_prepare() {
 }
 
 src_configure() {
+       local myconf=()
+
        if ! use system-bootstrap; then
                local xpakvar="${ARCH^^}_XPAK"
                export JDK_HOME="${WORKDIR}/openjdk-bootstrap-${!xpakvar}"
@@ -175,9 +177,9 @@ 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
+       # Strip lto related flags, we rely on --with-jvm-features=link-time-opt
+       # See bug #833097 and bug #833098.
+       tc-is-lto && myconf+=( --with-jvm-features=link-time-opt )
        filter-lto
        filter-flags -fdevirtualize-at-ltrans
 
@@ -188,7 +190,7 @@ src_configure() {
        # explicitly disabled, the flag will get auto-enabled if pandoc and
        # graphviz are detected. pandoc has loads of dependencies anyway.
 
-       local myconf=(
+       myconf+=(
                --disable-ccache
                --disable-precompiled-headers
                --enable-full-docs=no
@@ -218,8 +220,6 @@ 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.15_p6-r2.ebuild 
b/dev-java/openjdk/openjdk-17.0.15_p6-r2.ebuild
index 547465bf469b..84ba59294f3b 100644
--- a/dev-java/openjdk/openjdk-17.0.15_p6-r2.ebuild
+++ b/dev-java/openjdk/openjdk-17.0.15_p6-r2.ebuild
@@ -55,7 +55,7 @@ LICENSE="GPL-2-with-classpath-exception"
 SLOT="${MY_PV%%[.+]*}"
 KEYWORDS="amd64 ~arm arm64 ppc64 ~riscv x86"
 
-IUSE="alsa big-endian cups debug doc examples headless-awt javafx +jbootstrap 
lto selinux source system-bootstrap systemtap"
+IUSE="alsa big-endian cups debug doc examples headless-awt javafx +jbootstrap 
selinux source system-bootstrap systemtap"
 
 REQUIRED_USE="
        javafx? ( alsa !headless-awt )
@@ -167,6 +167,8 @@ src_prepare() {
 }
 
 src_configure() {
+       local myconf=()
+
        if has_version dev-java/openjdk:${SLOT}; then
                export JDK_HOME=${BROOT}/usr/$(get_libdir)/openjdk-${SLOT}
        elif use !system-bootstrap ; then
@@ -189,9 +191,9 @@ 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
+       # Strip lto related flags, we rely on --with-jvm-features=link-time-opt
+       # See bug #833097 and bug #833098.
+       tc-is-lto && myconf+=( --with-jvm-features=link-time-opt )
        filter-lto
        filter-flags -fdevirtualize-at-ltrans
 
@@ -199,7 +201,7 @@ src_configure() {
        # explicitly disabled, the flag will get auto-enabled if pandoc and
        # graphviz are detected. pandoc has loads of dependencies anyway.
 
-       local myconf=(
+       myconf+=(
                --disable-ccache
                --disable-precompiled-headers
                --disable-warnings-as-errors
@@ -229,8 +231,6 @@ src_configure() {
                $(tc-is-clang && echo "--with-toolchain-type=clang")
        )
 
-       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-17.0.16_p8.ebuild 
b/dev-java/openjdk/openjdk-17.0.16_p8.ebuild
index 5e382dcd3784..d359fe00ce26 100644
--- a/dev-java/openjdk/openjdk-17.0.16_p8.ebuild
+++ b/dev-java/openjdk/openjdk-17.0.16_p8.ebuild
@@ -55,7 +55,7 @@ LICENSE="GPL-2-with-classpath-exception"
 SLOT="${MY_PV%%[.+]*}"
 KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86"
 
-IUSE="alsa big-endian cups debug doc examples headless-awt javafx +jbootstrap 
lto selinux source system-bootstrap systemtap"
+IUSE="alsa big-endian cups debug doc examples headless-awt javafx +jbootstrap 
selinux source system-bootstrap systemtap"
 
 REQUIRED_USE="
        javafx? ( alsa !headless-awt )
@@ -167,6 +167,8 @@ src_prepare() {
 }
 
 src_configure() {
+       local myconf=()
+
        if has_version dev-java/openjdk:${SLOT}; then
                export JDK_HOME=${BROOT}/usr/$(get_libdir)/openjdk-${SLOT}
        elif use !system-bootstrap ; then
@@ -189,9 +191,9 @@ 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
+       # Strip lto related flags, we rely on --with-jvm-features=link-time-opt
+       # See bug #833097 and bug #833098.
+       tc-is-lto && myconf+=( --with-jvm-features=link-time-opt )
        filter-lto
        filter-flags -fdevirtualize-at-ltrans
 
@@ -199,7 +201,7 @@ src_configure() {
        # explicitly disabled, the flag will get auto-enabled if pandoc and
        # graphviz are detected. pandoc has loads of dependencies anyway.
 
-       local myconf=(
+       myconf+=(
                --disable-ccache
                --disable-precompiled-headers
                --disable-warnings-as-errors
@@ -229,8 +231,6 @@ src_configure() {
                $(tc-is-clang && echo "--with-toolchain-type=clang")
        )
 
-       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-21.0.7_p6-r2.ebuild 
b/dev-java/openjdk/openjdk-21.0.7_p6-r2.ebuild
index dfed81348260..a27284c76795 100644
--- a/dev-java/openjdk/openjdk-21.0.7_p6-r2.ebuild
+++ b/dev-java/openjdk/openjdk-21.0.7_p6-r2.ebuild
@@ -51,7 +51,6 @@ LICENSE="GPL-2-with-classpath-exception"
 SLOT="${MY_PV%%[.+]*}"
 KEYWORDS="amd64 arm64 ppc64 ~riscv ~x86"
 
-# lto temporarily disabled due to https://bugs.gentoo.org/916735
 IUSE="alsa big-endian cups debug doc examples headless-awt javafx +jbootstrap 
selinux source +system-bootstrap systemtap"
 
 REQUIRED_USE="
@@ -165,6 +164,8 @@ src_prepare() {
 }
 
 src_configure() {
+       local myconf=()
+
        if has_version dev-java/openjdk:${SLOT}; then
                export JDK_HOME=${BROOT}/usr/$(get_libdir)/openjdk-${SLOT}
        elif use !system-bootstrap ; then
@@ -187,9 +188,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
+       # Strip lto related flags, we rely on --with-jvm-features=link-time-opt
+       # See bug #833097 and bug #833098.
+       #
+       # .. but because of -Werror=odr (bug #916735), we disable it
+       # entirely for now.
+       #tc-is-lto && myconf+=( --with-jvm-features=link-time-opt )
        filter-lto
        filter-flags -fdevirtualize-at-ltrans
 
@@ -197,7 +201,7 @@ src_configure() {
        # explicitly disabled, the flag will get auto-enabled if pandoc and
        # graphviz are detected. pandoc has loads of dependencies anyway.
 
-       local myconf=(
+       myconf+=(
                --disable-ccache
                --disable-precompiled-headers
                --disable-warnings-as-errors
@@ -230,12 +234,6 @@ src_configure() {
 
        use riscv && myconf+=( 
--with-boot-jdk-jvmargs="-Djdk.lang.Process.launchMechanism=vfork" )
 
-       # Werror=odr
-       # https://bugs.gentoo.org/916735
-       #
-       # Disable it for now.
-       #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-21.0.8_p9.ebuild 
b/dev-java/openjdk/openjdk-21.0.8_p9.ebuild
index 19c3c93a5ebf..7d8f0b1f8b42 100644
--- a/dev-java/openjdk/openjdk-21.0.8_p9.ebuild
+++ b/dev-java/openjdk/openjdk-21.0.8_p9.ebuild
@@ -51,7 +51,6 @@ LICENSE="GPL-2-with-classpath-exception"
 SLOT="${MY_PV%%[.+]*}"
 KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~x86"
 
-# lto temporarily disabled due to https://bugs.gentoo.org/916735
 IUSE="alsa big-endian cups debug doc examples headless-awt javafx +jbootstrap 
selinux source +system-bootstrap systemtap"
 
 REQUIRED_USE="
@@ -165,6 +164,8 @@ src_prepare() {
 }
 
 src_configure() {
+       local myconf=()
+
        if has_version dev-java/openjdk:${SLOT}; then
                export JDK_HOME=${BROOT}/usr/$(get_libdir)/openjdk-${SLOT}
        elif use !system-bootstrap ; then
@@ -187,9 +188,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
+       # Strip lto related flags, we rely on --with-jvm-features=link-time-opt
+       # See bug #833097 and bug #833098.
+       #
+       # .. but because of -Werror=odr (bug #916735), we disable it
+       # entirely for now.
+       #tc-is-lto && myconf+=( --with-jvm-features=link-time-opt )
        filter-lto
        filter-flags -fdevirtualize-at-ltrans
 
@@ -197,7 +201,7 @@ src_configure() {
        # explicitly disabled, the flag will get auto-enabled if pandoc and
        # graphviz are detected. pandoc has loads of dependencies anyway.
 
-       local myconf=(
+       myconf+=(
                --disable-ccache
                --disable-precompiled-headers
                --disable-warnings-as-errors
@@ -230,12 +234,6 @@ src_configure() {
 
        use riscv && myconf+=( 
--with-boot-jdk-jvmargs="-Djdk.lang.Process.launchMechanism=vfork" )
 
-       # Werror=odr
-       # https://bugs.gentoo.org/916735
-       #
-       # Disable it for now.
-       #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-25_p31.ebuild 
b/dev-java/openjdk/openjdk-25_p31.ebuild
index e5cab96c9ddb..7d06fee39f01 100644
--- a/dev-java/openjdk/openjdk-25_p31.ebuild
+++ b/dev-java/openjdk/openjdk-25_p31.ebuild
@@ -52,7 +52,6 @@ LICENSE="GPL-2-with-classpath-exception"
 SLOT="${MY_PV%%[.+]*}"
 #      KEYWORDS="" # LTS but not yet released
 
-# lto temporarily disabled due to https://bugs.gentoo.org/916735
 IUSE="alsa big-endian cups debug doc examples headless-awt javafx +jbootstrap 
selinux source +system-bootstrap systemtap"
 
 REQUIRED_USE="
@@ -166,6 +165,8 @@ src_prepare() {
 }
 
 src_configure() {
+       local myconf=()
+
        if has_version dev-java/openjdk:${SLOT}; then
                export JDK_HOME=${BROOT}/usr/$(get_libdir)/openjdk-${SLOT}
        elif use !system-bootstrap ; then
@@ -185,9 +186,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
+       # Strip lto related flags, we rely on --with-jvm-features=link-time-opt
+       # See bug #833097 and bug #833098.
+       #
+       # .. but because of -Werror=odr (bug #916735), we disable it
+       # entirely for now.
+       #tc-is-lto && myconf+=( --with-jvm-features=link-time-opt )
        filter-lto
        filter-flags -fdevirtualize-at-ltrans
 
@@ -195,7 +199,7 @@ src_configure() {
        # explicitly disabled, the flag will get auto-enabled if pandoc and
        # graphviz are detected. pandoc has loads of dependencies anyway.
 
-       local myconf=(
+       myconf+=(
                --disable-ccache
                --disable-precompiled-headers
                --disable-warnings-as-errors
@@ -228,12 +232,6 @@ src_configure() {
 
        use riscv && myconf+=( 
--with-boot-jdk-jvmargs="-Djdk.lang.Process.launchMechanism=vfork" )
 
-       # Werror=odr
-       # https://bugs.gentoo.org/916735
-       #
-       # Disable it for now.
-       #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-26_p6.ebuild 
b/dev-java/openjdk/openjdk-26_p6.ebuild
index 101993eb7a93..f0a842aebc24 100644
--- a/dev-java/openjdk/openjdk-26_p6.ebuild
+++ b/dev-java/openjdk/openjdk-26_p6.ebuild
@@ -52,7 +52,6 @@ LICENSE="GPL-2-with-classpath-exception"
 SLOT="${MY_PV%%[.+]*}"
 #      KEYWORDS="" # Not an LTS candidate
 
-# lto temporarily disabled due to https://bugs.gentoo.org/916735
 IUSE="alsa big-endian cups debug doc examples headless-awt javafx +jbootstrap 
selinux source +system-bootstrap systemtap"
 
 REQUIRED_USE="
@@ -167,6 +166,8 @@ src_prepare() {
 }
 
 src_configure() {
+       local myconf=()
+
        if has_version dev-java/openjdk:25; then
                export JDK_HOME=${BROOT}/usr/$(get_libdir)/openjdk-25
        elif has_version dev-java/openjdk:${SLOT}; then
@@ -188,9 +189,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
+       # Strip lto related flags, we rely on --with-jvm-features=link-time-opt
+       # See bug #833097 and bug #833098.
+       #
+       # .. but because of -Werror=odr (bug #916735), we disable it
+       # entirely for now.
+       #tc-is-lto && myconf+=( --with-jvm-features=link-time-opt )
        filter-lto
        filter-flags -fdevirtualize-at-ltrans
 
@@ -198,7 +202,7 @@ src_configure() {
        # explicitly disabled, the flag will get auto-enabled if pandoc and
        # graphviz are detected. pandoc has loads of dependencies anyway.
 
-       local myconf=(
+       myconf+=(
                --disable-ccache
                --disable-precompiled-headers
                --disable-warnings-as-errors
@@ -231,12 +235,6 @@ src_configure() {
 
        use riscv && myconf+=( 
--with-boot-jdk-jvmargs="-Djdk.lang.Process.launchMechanism=vfork" )
 
-       # Werror=odr
-       # https://bugs.gentoo.org/916735
-       #
-       # Disable it for now.
-       #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.452_p09-r2.ebuild 
b/dev-java/openjdk/openjdk-8.452_p09-r2.ebuild
index d925e84895ce..70d08bf78182 100644
--- a/dev-java/openjdk/openjdk-8.452_p09-r2.ebuild
+++ b/dev-java/openjdk/openjdk-8.452_p09-r2.ebuild
@@ -172,6 +172,8 @@ src_prepare() {
 }
 
 src_configure() {
+       local myconf=()
+
        if ! use system-bootstrap; then
                local xpakvar="${ARCH^^}_XPAK"
                export JDK_HOME="${WORKDIR}/openjdk-bootstrap-${!xpakvar}"
@@ -189,9 +191,9 @@ 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
+       # Strip lto related flags, we rely on --with-jvm-features=link-time-opt
+       # See bug #833097 and bug #833098.
+       tc-is-lto && myconf+=( --with-jvm-features=link-time-opt )
        filter-lto
        filter-flags -fdevirtualize-at-ltrans
 
@@ -200,7 +202,7 @@ src_configure() {
 
        tc-export_build_env CC CXX PKG_CONFIG STRIP
 
-       local myconf=(
+       myconf+=(
                        --disable-ccache
                        --disable-freetype-bundling
                        --disable-precompiled-headers

diff --git a/dev-java/openjdk/openjdk-8.462_p08.ebuild 
b/dev-java/openjdk/openjdk-8.462_p08.ebuild
index c229bd230c76..88b4d42891e3 100644
--- a/dev-java/openjdk/openjdk-8.462_p08.ebuild
+++ b/dev-java/openjdk/openjdk-8.462_p08.ebuild
@@ -172,6 +172,8 @@ src_prepare() {
 }
 
 src_configure() {
+       local myconf=()
+
        if ! use system-bootstrap; then
                local xpakvar="${ARCH^^}_XPAK"
                export JDK_HOME="${WORKDIR}/openjdk-bootstrap-${!xpakvar}"
@@ -189,9 +191,9 @@ 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
+       # Strip lto related flags, we rely on --with-jvm-features=link-time-opt
+       # See bug #833097 and bug #833098.
+       tc-is-lto && myconf+=( --with-jvm-features=link-time-opt )
        filter-lto
        filter-flags -fdevirtualize-at-ltrans
 
@@ -200,7 +202,7 @@ src_configure() {
 
        tc-export_build_env CC CXX PKG_CONFIG STRIP
 
-       local myconf=(
+       myconf+=(
                        --disable-ccache
                        --disable-freetype-bundling
                        --disable-precompiled-headers

Reply via email to