From f6d4e1a2398d9c8916648bee91e411fbdff0bc8e Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Fri, 16 Jun 2017 07:02:14 -0500 Subject: [PATCH] use debian's i686/sse2 support patch --- ...lack-of-SSE2-support-on-x86-32-fatal.patch | 122 ++++++++++++++++++ qt5-qtdeclarative.spec | 19 ++- 2 files changed, 135 insertions(+), 6 deletions(-) create mode 100644 Do-not-make-lack-of-SSE2-support-on-x86-32-fatal.patch diff --git a/Do-not-make-lack-of-SSE2-support-on-x86-32-fatal.patch b/Do-not-make-lack-of-SSE2-support-on-x86-32-fatal.patch new file mode 100644 index 0000000..9c300aa --- /dev/null +++ b/Do-not-make-lack-of-SSE2-support-on-x86-32-fatal.patch @@ -0,0 +1,122 @@ +From 4950c366b12265f1ea390a6feb8dbbd0d850d206 Mon Sep 17 00:00:00 2001 +From: Guillem Jover +Date: Mon, 12 Oct 2015 01:45:37 +0200 +Subject: [PATCH v2] Do not make lack of SSE2 support on x86-32 fatal + +When an x86-32 CPU does not have SSE2 support (which is the case for +all AMD CPUs, and older Intel CPUs), fallback to use the interpreter, +otherwise use the JIT engine. + +Even then, make the lack of SSE2 support on x86-32 fatal when trying +to instantiate a JIT engine, which does require it. + +Refactor the required CPU support check into a new pair of privately +exported functions to avoid duplicating the logic, and do so in +functions instead of class members to avoid changing the class +signatures. + +Version: 5.7.x +Bug-Debian: https://bugs.debian.org/792594 +--- + src/qml/jit/qv4isel_masm.cpp | 2 ++ + src/qml/jit/qv4isel_masm_p.h | 18 ++++++++++++++++++ + src/qml/jsruntime/qv4engine.cpp | 1 + + src/qml/qml/v8/qv8engine.cpp | 7 ------- + tools/qmljs/qmljs.cpp | 7 +++---- + 5 files changed, 24 insertions(+), 11 deletions(-) + +--- a/src/qml/jit/qv4isel_masm.cpp ++++ b/src/qml/jit/qv4isel_masm.cpp +@@ -72,6 +72,8 @@ InstructionSelection::Inst + , compilationUnit(new CompilationUnit) + , qmlEngine(qmlEngine) + { ++ checkRequiredCpuSupport(); ++ + compilationUnit->codeRefs.resize(module->functions.size()); + module->unitFlags |= QV4::CompiledData::Unit::ContainsMachineCode; + } +--- a/src/qml/jit/qv4isel_masm_p.h ++++ b/src/qml/jit/qv4isel_masm_p.h +@@ -60,6 +60,7 @@ + + #include + #include ++#include + #include + #include + +@@ -72,6 +73,23 @@ QT_BEGIN_NAMESPACE + namespace QV4 { + namespace JIT { + ++Q_QML_PRIVATE_EXPORT inline bool hasRequiredCpuSupport() ++{ ++#ifdef Q_PROCESSOR_X86_32 ++ return qCpuHasFeature(SSE2); ++#else ++ return true; ++#endif ++} ++ ++Q_QML_PRIVATE_EXPORT inline void checkRequiredCpuSupport() ++{ ++#ifdef Q_PROCESSOR_X86_32 ++ if (!qCpuHasFeature(SSE2)) ++ qFatal("This program requires an X86 processor that supports SSE2 extension, at least a Pentium 4 or newer"); ++#endif ++} ++ + template > + class Q_QML_EXPORT InstructionSelection: + protected IR::IRDecoder, +--- a/src/qml/jsruntime/qv4engine.cpp ++++ b/src/qml/jsruntime/qv4engine.cpp +@@ -165,6 +165,7 @@ ExecutionEngine::ExecutionEngine(EvalISe + + #ifdef V4_ENABLE_JIT + static const bool forceMoth = !qEnvironmentVariableIsEmpty("QV4_FORCE_INTERPRETER") || ++ !JIT::hasRequiredCpuSupport() || + !OSAllocator::canAllocateExecutableMemory(); + if (forceMoth) { + factory = new Moth::ISelFactory; +--- a/src/qml/qml/v8/qv8engine.cpp ++++ b/src/qml/qml/v8/qv8engine.cpp +@@ -64,7 +64,6 @@ + #include + #include + #include +-#include + + #include + #include +@@ -129,12 +128,6 @@ QV8Engine::QV8Engine(QJSEngine* qq) + , m_xmlHttpRequestData(0) + , m_listModelData(0) + { +-#ifdef Q_PROCESSOR_X86_32 +- if (!qCpuHasFeature(SSE2)) { +- qFatal("This program requires an X86 processor that supports SSE2 extension, at least a Pentium 4 or newer"); +- } +-#endif +- + QML_MEMORY_SCOPE_STRING("QV8Engine::QV8Engine"); + qMetaTypeId(); + qMetaTypeId >(); +--- a/tools/qmljs/qmljs.cpp ++++ b/tools/qmljs/qmljs.cpp +@@ -92,11 +92,10 @@ int main(int argc, char *argv[]) + enum { + use_masm, + use_moth +- } mode; ++ } mode = use_moth; + #ifdef V4_ENABLE_JIT +- mode = use_masm; +-#else +- mode = use_moth; ++ if (QV4::JIT::hasRequiredCpuSupport()) ++ mode = use_masm; + #endif + + bool runAsQml = false; diff --git a/qt5-qtdeclarative.spec b/qt5-qtdeclarative.spec index c049c37..f858dbb 100644 --- a/qt5-qtdeclarative.spec +++ b/qt5-qtdeclarative.spec @@ -1,6 +1,7 @@ %global qt_module qtdeclarative -%ifarch %{ix86} +%if 0 +#ifarch %{ix86} %global nosse2_hack 1 ## TODO: # * consider debian's approach of runtime detection instead: @@ -40,6 +41,10 @@ Patch2: qtdeclarative-QQuickShaderEffectSource_deadlock.patch # https://bugs.kde.org/show_bug.cgi?id=346118#c108 Patch201: qtdeclarative-kdebug346118.patch +# https://codereview.qt-project.org/#/c/127354/ +# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=792594 +Patch202: http://sources.debian.net/data/main/q/qtdeclarative-opensource-src/5.9.0~beta3-2/debian/patches/Do-not-make-lack-of-SSE2-support-on-x86-32-fatal.patch + # filter qml provides %global __provides_exclude_from ^%{_qt5_archdatadir}/qml/.*\\.so$ @@ -91,14 +96,10 @@ Requires: %{name}%{?_isa} = %{version}-%{release} %endif %patch2 -p1 -b .QQuickShaderEffectSource_deadlock %patch201 -p0 -b .kdebug346118 +%patch202 -p1 -b .no_sse2_non_fatal %build -# no shadow builds until fixed: https://bugreports.qt.io/browse/QTBUG-37417 -%{qmake_qt5} - -make %{?_smp_mflags} - %if 0%{?nosse2_hack} # build libQt5Qml with no_sse2 mkdir -p %{_target_platform}-no_sse2 @@ -109,6 +110,11 @@ make %{?_smp_mflags} -C src/qml popd %endif +# no shadow builds until fixed: https://bugreports.qt.io/browse/QTBUG-37417 +%{qmake_qt5} + +make %{?_smp_mflags} + %install make install INSTALL_ROOT=%{buildroot} @@ -221,6 +227,7 @@ make check -k -C tests ||: %changelog * Thu Jun 15 2017 Rex Dieter - 5.9.0-3 - drop shadow/out-of-tree builds (#1456211,QTBUG-37417) +- use debian's i686/sse2 support patch * Fri Jun 02 2017 Rex Dieter - 5.9.0-2 - rebuild