commit:     2af06d2df0b0d41594490a46fb239b1ed587a76d
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 27 06:21:13 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Mar 27 06:24:42 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2af06d2d

sys-devel/llvm: add workaround for ppc with < GCC 14

Pass -fno-ipa-sra -fno-ipa-modref -fno-ipa-icf on ppc with < GCC 14. We know
the problem is related to IPA and these 3 together help. Someone is welcome
to spend the time trying to narrow it down more, but applying this as a bandaid
which is better than nothing.

GCC 14 seems fine without this, but the "fix" bisects to something odd
just like the original "break" commit, so...

Bug: https://gcc.gnu.org/PR108250
Bug: https://bugs.gentoo.org/914888
Closes: https://bugs.gentoo.org/880677
Closes: https://bugs.gentoo.org/875776
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-devel/llvm/llvm-15.0.7-r3.ebuild          | 7 ++++++-
 sys-devel/llvm/llvm-16.0.6.ebuild             | 5 +++++
 sys-devel/llvm/llvm-17.0.6.ebuild             | 5 +++++
 sys-devel/llvm/llvm-18.1.2.ebuild             | 5 +++++
 sys-devel/llvm/llvm-19.0.0.9999.ebuild        | 5 +++++
 sys-devel/llvm/llvm-19.0.0_pre20240316.ebuild | 5 +++++
 sys-devel/llvm/llvm-19.0.0_pre20240322.ebuild | 5 +++++
 7 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/sys-devel/llvm/llvm-15.0.7-r3.ebuild 
b/sys-devel/llvm/llvm-15.0.7-r3.ebuild
index 438fd4add8ae..8dd8837831a9 100644
--- a/sys-devel/llvm/llvm-15.0.7-r3.ebuild
+++ b/sys-devel/llvm/llvm-15.0.7-r3.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 PYTHON_COMPAT=( python3_{10..11} )
-inherit cmake llvm.org multilib-minimal pax-utils python-any-r1 \
+inherit cmake flag-o-matic llvm.org multilib-minimal pax-utils python-any-r1 \
        toolchain-funcs
 
 DESCRIPTION="Low Level Virtual Machine"
@@ -321,6 +321,11 @@ get_distribution_components() {
 }
 
 multilib_src_configure() {
+       if use ppc && tc-is-gcc && [[ $(gcc-major-version) -lt 14 ]]; then
+               # Workaround for bug #880677
+               append-flags $(test-flags-CXX -fno-ipa-sra -fno-ipa-modref 
-fno-ipa-icf)
+       fi
+
        local ffi_cflags ffi_ldflags
        if use libffi; then
                ffi_cflags=$($(tc-getPKG_CONFIG) --cflags-only-I libffi)

diff --git a/sys-devel/llvm/llvm-16.0.6.ebuild 
b/sys-devel/llvm/llvm-16.0.6.ebuild
index 809dbc7f3b8c..ab3f64bf71cd 100644
--- a/sys-devel/llvm/llvm-16.0.6.ebuild
+++ b/sys-devel/llvm/llvm-16.0.6.ebuild
@@ -324,6 +324,11 @@ get_distribution_components() {
 }
 
 multilib_src_configure() {
+       if use ppc && tc-is-gcc && [[ $(gcc-major-version) -lt 14 ]]; then
+               # Workaround for bug #880677
+               append-flags $(test-flags-CXX -fno-ipa-sra -fno-ipa-modref 
-fno-ipa-icf)
+       fi
+
        tc-is-gcc && filter-lto # GCC miscompiles LLVM, bug #873670
 
        local ffi_cflags ffi_ldflags

diff --git a/sys-devel/llvm/llvm-17.0.6.ebuild 
b/sys-devel/llvm/llvm-17.0.6.ebuild
index 1bcff3456a9b..c32eee3908c7 100644
--- a/sys-devel/llvm/llvm-17.0.6.ebuild
+++ b/sys-devel/llvm/llvm-17.0.6.ebuild
@@ -338,6 +338,11 @@ get_distribution_components() {
 }
 
 multilib_src_configure() {
+       if use ppc && tc-is-gcc && [[ $(gcc-major-version) -lt 14 ]]; then
+               # Workaround for bug #880677
+               append-flags $(test-flags-CXX -fno-ipa-sra -fno-ipa-modref 
-fno-ipa-icf)
+       fi
+
        # ODR violations (bug #917536, bug #926529). Just do it for GCC for now
        # to avoid people grumbling. GCC is, anecdotally, more likely to 
miscompile
        # LLVM with LTO anyway (which is not necessarily its fault).

diff --git a/sys-devel/llvm/llvm-18.1.2.ebuild 
b/sys-devel/llvm/llvm-18.1.2.ebuild
index af10d82f811a..8c3d70f01423 100644
--- a/sys-devel/llvm/llvm-18.1.2.ebuild
+++ b/sys-devel/llvm/llvm-18.1.2.ebuild
@@ -346,6 +346,11 @@ get_distribution_components() {
 }
 
 multilib_src_configure() {
+       if use ppc && tc-is-gcc && [[ $(gcc-major-version) -lt 14 ]]; then
+               # Workaround for bug #880677
+               append-flags $(test-flags-CXX -fno-ipa-sra -fno-ipa-modref 
-fno-ipa-icf)
+       fi
+
        # ODR violations (bug #917536, bug #926529). Just do it for GCC for now
        # to avoid people grumbling. GCC is, anecdotally, more likely to 
miscompile
        # LLVM with LTO anyway (which is not necessarily its fault).

diff --git a/sys-devel/llvm/llvm-19.0.0.9999.ebuild 
b/sys-devel/llvm/llvm-19.0.0.9999.ebuild
index b4633658a186..8624219a7e20 100644
--- a/sys-devel/llvm/llvm-19.0.0.9999.ebuild
+++ b/sys-devel/llvm/llvm-19.0.0.9999.ebuild
@@ -345,6 +345,11 @@ get_distribution_components() {
 }
 
 multilib_src_configure() {
+       if use ppc && tc-is-gcc && [[ $(gcc-major-version) -lt 14 ]]; then
+               # Workaround for bug #880677
+               append-flags $(test-flags-CXX -fno-ipa-sra -fno-ipa-modref 
-fno-ipa-icf)
+       fi
+
        # ODR violations (bug #917536, bug #926529). Just do it for GCC for now
        # to avoid people grumbling. GCC is, anecdotally, more likely to 
miscompile
        # LLVM with LTO anyway (which is not necessarily its fault).

diff --git a/sys-devel/llvm/llvm-19.0.0_pre20240316.ebuild 
b/sys-devel/llvm/llvm-19.0.0_pre20240316.ebuild
index b4633658a186..8624219a7e20 100644
--- a/sys-devel/llvm/llvm-19.0.0_pre20240316.ebuild
+++ b/sys-devel/llvm/llvm-19.0.0_pre20240316.ebuild
@@ -345,6 +345,11 @@ get_distribution_components() {
 }
 
 multilib_src_configure() {
+       if use ppc && tc-is-gcc && [[ $(gcc-major-version) -lt 14 ]]; then
+               # Workaround for bug #880677
+               append-flags $(test-flags-CXX -fno-ipa-sra -fno-ipa-modref 
-fno-ipa-icf)
+       fi
+
        # ODR violations (bug #917536, bug #926529). Just do it for GCC for now
        # to avoid people grumbling. GCC is, anecdotally, more likely to 
miscompile
        # LLVM with LTO anyway (which is not necessarily its fault).

diff --git a/sys-devel/llvm/llvm-19.0.0_pre20240322.ebuild 
b/sys-devel/llvm/llvm-19.0.0_pre20240322.ebuild
index b4633658a186..8624219a7e20 100644
--- a/sys-devel/llvm/llvm-19.0.0_pre20240322.ebuild
+++ b/sys-devel/llvm/llvm-19.0.0_pre20240322.ebuild
@@ -345,6 +345,11 @@ get_distribution_components() {
 }
 
 multilib_src_configure() {
+       if use ppc && tc-is-gcc && [[ $(gcc-major-version) -lt 14 ]]; then
+               # Workaround for bug #880677
+               append-flags $(test-flags-CXX -fno-ipa-sra -fno-ipa-modref 
-fno-ipa-icf)
+       fi
+
        # ODR violations (bug #917536, bug #926529). Just do it for GCC for now
        # to avoid people grumbling. GCC is, anecdotally, more likely to 
miscompile
        # LLVM with LTO anyway (which is not necessarily its fault).

Reply via email to