From 4efdbacc5e2056c199cb9066c4071efe1666487a Mon Sep 17 00:00:00 2001 From: Ionen Wolkens Date: Sun, 15 Sep 2024 09:54:26 -0400 Subject: [PATCH] qt6-build.eclass: work around -march=bdver4 qtbase segfaults clang untested, currently assumed to only happen with gcc Signed-off-by: Ionen Wolkens --- eclass/qt6-build.eclass | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/eclass/qt6-build.eclass b/eclass/qt6-build.eclass index 3cd8b606c235..999d87127d4a 100644 --- a/eclass/qt6-build.eclass +++ b/eclass/qt6-build.eclass @@ -296,18 +296,33 @@ _qt6-build_sanitize_cpu_flags() { fma4 sse4a ) + # TODO?: if these issues keep piling up, could consider dropping the + # following tests and unconditionally force generic -march=x86-64-v* + # (or at most only allow it with unsupported USE=custom-cflags) + # 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 [[ $($(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 + assert) != bad ]] + then + # gcc + -march=bdver4 may result in a broken qtbase, cause + # unknown but can workaround here for the time being + # https://bugs.kde.org/show_bug.cgi?id=492886 + # https://forums.gentoo.org/viewtopic-t-1170690.html + # https://forums.gentoo.org/viewtopic-t-1169619.html + if ! { [[ ${PN} == qtbase ]] && tc-is-gcc && + [[ $($(tc-getCXX) -S -fverbose-asm ${CXXFLAGS} ${CPPFLAGS} \ + -x c++ -o - - <<<'' || die) == *-march=bdver4* ]]; } + then + return 0 # *should* be fine as-is + fi + fi fi # determine highest(known) usable x86-64 feature level -- 2.46.0