Make LTO filtering local to the compilation code.  This avoids disabling
LTO for non-Python parts of an ebuild.

Signed-off-by: Michał Górny <mgo...@gentoo.org>
---
 eclass/distutils-r1.eclass | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index ee1dcef24ff6..8193d6d8ecd0 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1828,6 +1828,14 @@ distutils-r1_run_phase() {
                # Rust extensions are incompatible with C/C++ LTO compiler
                # see e.g. https://bugs.gentoo.org/910220
                if has cargo ${INHERITED}; then
+                       # see all-flag-vars in flag-o-matic.eclass
+                       local -x ADAFLAGS="${ADAFLAGS}"
+                       local -x CFLAGS="${CFLAGS}"
+                       local -x CXXFLAGS="${CXXFLAGS}"
+                       local -x CCASFLAGS="${CCASFLAGS}"
+                       local -x FFLAGS="${FFLAGS}"
+                       local -x FCFLAGS="${FCFLAGS}"
+                       local -x LDFLAGS="${LDFLAGS}"
                        filter-lto
                fi
        fi
-- 
2.44.0


Reply via email to