diff --git a/extra/qt5-declarative/0001-V4-Align-stack-on-16-byte-boundaries-in-the-YarrJIT.patch b/extra/qt5-declarative/0001-V4-Align-stack-on-16-byte-boundaries-in-the-YarrJIT.patch new file mode 100644 index 000000000..cca276454 --- /dev/null +++ b/extra/qt5-declarative/0001-V4-Align-stack-on-16-byte-boundaries-in-the-YarrJIT.patch @@ -0,0 +1,66 @@ +From 4493524ec24afb946eba3942f48d9fc1ff3192c1 Mon Sep 17 00:00:00 2001 +From: Erik Verbruggen +Date: Tue, 9 Aug 2016 10:49:22 +0200 +Subject: [PATCH] V4: Align stack on 16 byte boundaries in the YarrJIT + +This is the required alignment for Aarch64, and a number of other ABIs +prefer this size too when calling into system libraries. + +Change-Id: Ie38cabb77cf83543b915553e69c5c5728a67503b +Reviewed-by: Simon Hausmann +--- + src/3rdparty/masm/yarr/YarrJIT.cpp | 22 ++++++++++++++++++++-- + 1 file changed, 20 insertions(+), 2 deletions(-) + +diff --git a/src/3rdparty/masm/yarr/YarrJIT.cpp b/src/3rdparty/masm/yarr/YarrJIT.cpp +index 5664c58..d8211ec 100644 +--- a/src/3rdparty/masm/yarr/YarrJIT.cpp ++++ b/src/3rdparty/masm/yarr/YarrJIT.cpp +@@ -338,17 +338,31 @@ class YarrGenerator : private MacroAssembler { + jump(Address(stackPointerRegister, frameLocation * sizeof(void*))); + } + ++ unsigned alignCallFrameSizeInBytes(unsigned callFrameSize) ++ { ++ callFrameSize *= sizeof(void*); ++ if (callFrameSize / sizeof(void*) != m_pattern.m_body->m_callFrameSize) ++ CRASH(); ++ // Originally, the code was: ++// callFrameSize = (callFrameSize + 0x3f) & ~0x3f; ++ // However, 64 bytes is a bit surprising. The biggest "alignment" requirement is on Aarch64, where: ++ // "SP mod 16 = 0. The stack must be quad-word aligned." (IHI0055B_aapcs64.pdf) ++ callFrameSize = (callFrameSize + 0xf) & ~0xf; ++ if (!callFrameSize) ++ CRASH(); ++ return callFrameSize; ++ } + void initCallFrame() + { + unsigned callFrameSize = m_pattern.m_body->m_callFrameSize; + if (callFrameSize) +- subPtr(Imm32(callFrameSize * sizeof(void*)), stackPointerRegister); ++ subPtr(Imm32(alignCallFrameSizeInBytes(callFrameSize)), stackPointerRegister); + } + void removeCallFrame() + { + unsigned callFrameSize = m_pattern.m_body->m_callFrameSize; + if (callFrameSize) +- addPtr(Imm32(callFrameSize * sizeof(void*)), stackPointerRegister); ++ addPtr(Imm32(alignCallFrameSizeInBytes(callFrameSize)), stackPointerRegister); + } + + // Used to record subpatters, should only be called if compileMode is IncludeSubpatterns. +@@ -2565,6 +2579,10 @@ class YarrGenerator : private MacroAssembler { + if (compileMode == IncludeSubpatterns) + loadPtr(Address(X86Registers::ebp, 2 * sizeof(void*)), output); + #endif ++#elif CPU(ARM64) ++ // The ABI doesn't guarantee the upper bits are zero on unsigned arguments, so clear them ourselves. ++ zeroExtend32ToPtr(index, index); ++ zeroExtend32ToPtr(length, length); + #elif CPU(ARM) + push(ARMRegisters::r4); + push(ARMRegisters::r5); +-- +2.10.2 + diff --git a/extra/qt5-declarative/PKGBUILD b/extra/qt5-declarative/PKGBUILD new file mode 100644 index 000000000..9ec0bb789 --- /dev/null +++ b/extra/qt5-declarative/PKGBUILD @@ -0,0 +1,63 @@ +# $Id: PKGBUILD 240297 2015-06-03 10:22:03Z fyan $ +# Maintainer: Felix Yan +# Contributor: Andrea Scarpino + +# ALARM: Kevin Mihelich +# - upstream patch for AArch64 + +pkgname=qt5-declarative +_qtver=5.7.0 +pkgver=${_qtver/-/} +pkgrel=3.1 +arch=('i686' 'x86_64') +url='http://qt-project.org/' +license=('GPL3' 'LGPL3' 'FDL' 'custom') +pkgdesc='Classes for QML and JavaScript languages' +depends=('qt5-xmlpatterns') +makedepends=('python2' 'cmake') +groups=('qt' 'qt5') +conflicts=('qtchooser') +_pkgfqn="${pkgname/5-/}-opensource-src-${_qtver}" +source=("http://download.qt.io/official_releases/qt/${pkgver%.*}/${_qtver}/submodules/${_pkgfqn}.tar.xz" qt5-declarative-gcc6.patch + 0001-V4-Align-stack-on-16-byte-boundaries-in-the-YarrJIT.patch) +md5sums=('0d9e461aa54dba4793253fa2eb501f9b' + 'fb2a2a118b356a0a4635111f2e0b0ee6' + '8fc2535cf40f3b8023461b4ca86d07f1') + +prepare() { + mkdir -p build + + # Use python2 for Python 2.x + find -name '*.pro' -o -name '*.pri' | xargs sed -i -e 's|python -c|python2 -c|g' -e 's|python \$|python2 \$|g' + + # Fix i686 segfaults with GCC 6 https://bugreports.qt.io/browse/QTBUG-52057 (Fedora patch) + cd ${_pkgfqn} + patch -p1 -i ../qt5-declarative-gcc6.patch + + patch -p1 -i ../0001-V4-Align-stack-on-16-byte-boundaries-in-the-YarrJIT.patch +} + +build() { + cd build + + export PYTHON=python2 + qmake ../${_pkgfqn} + make +} + +package() { + cd build + make INSTALL_ROOT="$pkgdir" install + + # Symlinks for backwards compatibility + for b in "$pkgdir"/usr/bin/*; do + ln -s /usr/bin/$(basename $b) "$pkgdir"/usr/bin/$(basename $b)-qt5 + done + + # Drop QMAKE_PRL_BUILD_DIR because reference the build dir + find "$pkgdir/usr/lib" -type f -name '*.prl' \ + -exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \; + + install -d "$pkgdir"/usr/share/licenses + ln -s /usr/share/licenses/qt5-base "$pkgdir"/usr/share/licenses/${pkgname} +} diff --git a/extra/qt5-declarative/qt5-declarative-gcc6.patch b/extra/qt5-declarative/qt5-declarative-gcc6.patch new file mode 100644 index 000000000..eaf677ea5 --- /dev/null +++ b/extra/qt5-declarative/qt5-declarative-gcc6.patch @@ -0,0 +1,12 @@ +diff -up qtdeclarative-opensource-src-5.6.0/src/qml/qml.pro.1135 qtdeclarative-opensource-src-5.6.0/src/qml/qml.pro +--- qtdeclarative-opensource-src-5.6.0/src/qml/qml.pro.1135 2016-06-02 08:43:24.509068141 -0500 ++++ qtdeclarative-opensource-src-5.6.0/src/qml/qml.pro 2016-06-02 10:25:28.813766581 -0500 +@@ -21,7 +21,7 @@ exists("qqml_enable_gcov") { + + greaterThan(QT_GCC_MAJOR_VERSION, 5) { + # Our code is bad. Temporary workaround. +- QMAKE_CXXFLAGS += -fno-delete-null-pointer-checks ++ QMAKE_CXXFLAGS += -fno-delete-null-pointer-checks -fno-lifetime-dse + } + + QMAKE_DOCS = $$PWD/doc/qtqml.qdocconf