summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorIonen Wolkens <ionen@gentoo.org>2024-12-11 05:52:55 -0500
committerIonen Wolkens <ionen@gentoo.org>2024-12-11 06:44:35 -0500
commitd2d4b0b7154f57c9962e01d75b27b8aacbd8764e (patch)
treeb0fecd57d6177a38a38aaf553f573ba6e4e40cd3 /eclass
parentqt6-build.eclass: split sanitize_cpu_flags checks in separate blocks (diff)
downloadgentoo-d2d4b0b7154f57c9962e01d75b27b8aacbd8764e.tar.gz
gentoo-d2d4b0b7154f57c9962e01d75b27b8aacbd8764e.tar.bz2
gentoo-d2d4b0b7154f57c9962e01d75b27b8aacbd8764e.zip
qt6-build.eclass: add workaround for cpus with broken rdrand/rdseed
Not perfect but it should prevent failures for the average user. Formerly meant to check if -march=native is in *FLAGS, but it shouldn't matter as long as it is not cross. Can't test myself, but it should work in theory. Closes: https://bugs.gentoo.org/922498 Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/qt6-build.eclass12
1 files changed, 12 insertions, 0 deletions
diff --git a/eclass/qt6-build.eclass b/eclass/qt6-build.eclass
index a0ca9c619405..75630843c087 100644
--- a/eclass/qt6-build.eclass
+++ b/eclass/qt6-build.eclass
@@ -335,6 +335,18 @@ _qt6-build_sanitize_cpu_flags() {
done
fi
+ # some cpus have broken rdrand/rdseed and it's enabled regardless
+ # with -march=native, Qt detects this and fails (bug #922498)
+ if [[ ! -v sanitize ]] &&
+ ! tc-is-cross-compiler &&
+ # the kernel also detects this and removes it from cpuinfo
+ [[ -r /proc/cpuinfo && $(</proc/cpuinfo) != *rdrand* ]] &&
+ tc-cpp-is-true __RDRND__ ${CXXFLAGS} ${CPPFLAGS}
+ then
+ einfo "Detected CPU with (likely) broken rdrand/rdseed (bug #922498)"
+ sanitize=1
+ fi
+
[[ -v sanitize ]] || return 0 # *should* be fine as-is
# determine highest(known) usable x86-64 feature level