summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIonen Wolkens <ionen@gentoo.org>2024-10-19 08:49:43 -0400
committerIonen Wolkens <ionen@gentoo.org>2024-10-19 09:47:15 -0400
commite91760a3bbc3d9267fb0bfd018b8af834e0b4286 (patch)
treec32696bcd7e4be3a1bf17bee917e18400a4fb694 /eclass/qt6-build.eclass
parentsys-kernel/linux-firmware: Don't check for broken links with savedconfig (diff)
downloadgentoo-e91760a3bbc3d9267fb0bfd018b8af834e0b4286.tar.gz
gentoo-e91760a3bbc3d9267fb0bfd018b8af834e0b4286.tar.bz2
gentoo-e91760a3bbc3d9267fb0bfd018b8af834e0b4286.zip
qt6-build.eclass: extend -m* flags sanitizing
A user on the forums reported a build failure with: `-march=znver4 -mavx512vp2intersect` On its own, there is no issue there (expanded from -march=native) but when Qt passes `-march=haswell` to build certain parts (e.g. avx2 bits for runtime detection regardless of what CHOST supports), it overrides znver4 and keeps -mavx512vp2intersect resulting in an incomplete set and then qsimd_p.h complains Do not plan to pursue this myself, but this specific issue could be improved upstream by passing -mavx2 and others rather than -march=haswell (this would also allow overriding a -mno-avx2 that we currently need to change), and/or ideally by making qsimd_p.h be able to deal with these configurations without #error. If problems keep piling up, could consider always filtering *all* -m{,no-}<instr> flags and doing x86-64-v* unconditionally. Albeit that'd still require maintaining a list of these not to filter unrelated -m* flags which could be important. Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
Diffstat (limited to 'eclass/qt6-build.eclass')
-rw-r--r--eclass/qt6-build.eclass34
1 files changed, 24 insertions, 10 deletions
diff --git a/eclass/qt6-build.eclass b/eclass/qt6-build.eclass
index c6b8db578f46..2dec4b7ec14e 100644
--- a/eclass/qt6-build.eclass
+++ b/eclass/qt6-build.eclass
@@ -301,18 +301,31 @@ _qt6-build_sanitize_cpu_flags() {
fma4 sse4a
)
+ # extras for which -mno-* does not matter, but can lead to enabling
+ # other flags when set and breaking the -march=haswell case below
+ # (add more as needed if users use these)
+ local cpuflags_filter_only=(
+ avx512vp2intersect
+ )
+
# check if any known problematic -mno-* C(XX)FLAGS
if ! is-flagq "@($(IFS='|'; echo "${cpuflags[*]/#/-mno-}"))"; then
- # check if qsimd_p.h (search for "enable all") will accept -march
- : "$($(tc-getCXX) -E -P ${CXXFLAGS} ${CPPFLAGS} - <<-EOF | tail -n 1
- #if (defined(__AVX2__) && (__BMI__ + __BMI2__ + __F16C__ + __FMA__ + __LZCNT__ + __POPCNT__) != 6) || \
- (defined(__AVX512F__) && (__AVX512BW__ + __AVX512CD__ + __AVX512DQ__ + __AVX512VL__) != 4)
- bad
- #endif
- EOF
- assert
- )"
- [[ ${_} == bad ]] || return 0 # *should* be fine as-is
+ # check if qsimd_p.h (search for "enable all") will accept -march, and
+ # further check when -march=haswell is appended (which Qt uses for some
+ # parts) given combination with other -m* could lead to partial support
+ local bad flags
+ for flags in '' '-march=haswell'; do
+ : "$($(tc-getCXX) -E -P ${CXXFLAGS} ${CPPFLAGS} ${flags} - <<-EOF | tail -n 1
+ #if (defined(__AVX2__) && (__BMI__ + __BMI2__ + __F16C__ + __FMA__ + __LZCNT__ + __POPCNT__) != 6) || \
+ (defined(__AVX512F__) && (__AVX512BW__ + __AVX512CD__ + __AVX512DQ__ + __AVX512VL__) != 4)
+ bad
+ #endif
+ EOF
+ assert
+ )"
+ [[ ${_} == bad ]] && bad=1 && break
+ done
+ [[ -v bad ]] || return 0 # *should* be fine as-is
fi
# determine highest(known) usable x86-64 feature level
@@ -332,6 +345,7 @@ _qt6-build_sanitize_cpu_flags() {
assert
)
+ cpuflags+=("${cpuflags_filter_only[@]}")
filter-flags '-march=*' "${cpuflags[@]/#/-m}" "${cpuflags[@]/#/-mno-}"
[[ ${march} == x86-64* ]] && append-flags $(test-flags-CXX -march=${march})
einfo "C(XX)FLAGS were adjusted due to Qt limitations: ${CXXFLAGS}"