From fc9008bb2f834b0147483744d543e0e3831e6e765388c1b4c25aedbd198622a2 Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Tue, 19 May 2015 21:22:17 +0000 Subject: [PATCH] Accepting request 307824 from KDE:Qt5 - Added patches from upstream: Try-to-ensure-that-fPIC-is-used-in-CMake-builds.patch, Require-fPIC-instead-of-just-fPIE-for-reduce-relocations.patch and Make-qglobal.h-complain-if-you-use-fPIE.patch (qtbug#45755) - Add Fix-shortcuts-with-keypad-keys.patch (qtbug#20191,qtbug#33093,kde#344638) OBS-URL: https://build.opensuse.org/request/show/307824 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtbase?expand=0&rev=41 --- Fix-shortcuts-with-keypad-keys.patch | 93 ++++++++++++ Make-qglobal.h-complain-if-you-use-fPIE.patch | 43 ++++++ ...-of-just-fPIE-for-reduce-relocations.patch | 132 ++++++++++++++++++ ...re-that-fPIC-is-used-in-CMake-builds.patch | 35 +++++ libqt5-qtbase.changes | 15 ++ libqt5-qtbase.spec | 12 ++ 6 files changed, 330 insertions(+) create mode 100644 Fix-shortcuts-with-keypad-keys.patch create mode 100644 Make-qglobal.h-complain-if-you-use-fPIE.patch create mode 100644 Require-fPIC-instead-of-just-fPIE-for-reduce-relocations.patch create mode 100644 Try-to-ensure-that-fPIC-is-used-in-CMake-builds.patch diff --git a/Fix-shortcuts-with-keypad-keys.patch b/Fix-shortcuts-with-keypad-keys.patch new file mode 100644 index 0000000..af32f65 --- /dev/null +++ b/Fix-shortcuts-with-keypad-keys.patch @@ -0,0 +1,93 @@ +From c137502c7fd7550c780c9531ec414098d8101757 Mon Sep 17 00:00:00 2001 +From: Alexander Volkov +Date: Thu, 18 Sep 2014 16:16:26 +0400 +Subject: Fix shortcuts with keypad keys + +The way of searching a shortcut match for a key without the keypad +modifier introduced in 547a1bea492954d828aa0798be93384669812489 is +not correct. QKeyEvent::setModifiers() doesn't change native scan code +so we get the incorrect QKeyEvent object which is eventually passed to +the implementation of QPlatformIntegration::possibleKeys(). +And then QPlatformIntegration::possibleKeys() returns the same result +as for the original QKeyEvent object. + +So to fix it we have to remove Qt::KeypadModifier from keys after +calling the implementation of QPlatformIntegration::possibleKeys(), +as it was before 547a1bea492954d828aa0798be93384669812489. + +Task-number: QTBUG-33093 +Task-number: QTBUG-20191 +Change-Id: I5b33c9b6cf2c06b133166a31eba9aff9181c9483 +--- + src/gui/kernel/qshortcutmap.cpp | 12 +++++------- + src/gui/kernel/qshortcutmap_p.h | 4 ++-- + 2 files changed, 7 insertions(+), 9 deletions(-) + +diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp +index cad707a..83377af 100644 +--- a/src/gui/kernel/qshortcutmap.cpp ++++ b/src/gui/kernel/qshortcutmap.cpp +@@ -380,9 +380,7 @@ QKeySequence::SequenceMatch QShortcutMap::nextState(QKeyEvent *e) + result = find(e); + if (result == QKeySequence::NoMatch && (e->modifiers() & Qt::KeypadModifier)) { + // Try to find a match without keypad modifier +- QKeyEvent event = *e; +- event.setModifiers(e->modifiers() & ~Qt::KeypadModifier); +- result = find(&event); ++ result = find(e, Qt::KeypadModifier); + } + if (result == QKeySequence::NoMatch && e->modifiers() & Qt::ShiftModifier) { + // If Shift + Key_Backtab, also try Shift + Qt::Key_Tab +@@ -435,13 +433,13 @@ bool QShortcutMap::hasShortcutForKeySequence(const QKeySequence &seq) const + which can be access through matches(). + \sa matches + */ +-QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e) ++QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e, int ignoredModifiers) + { + Q_D(QShortcutMap); + if (!d->sequences.count()) + return QKeySequence::NoMatch; + +- createNewSequences(e, d->newEntries); ++ createNewSequences(e, d->newEntries, ignoredModifiers); + #if defined(DEBUG_QSHORTCUTMAP) + qDebug() << "Possible shortcut key sequences:" << d->newEntries; + #endif +@@ -543,7 +541,7 @@ void QShortcutMap::clearSequence(QVector &ksl) + Alters \a seq to the new sequence state, based on the + current sequence state, and the new key event \a e. + */ +-void QShortcutMap::createNewSequences(QKeyEvent *e, QVector &ksl) ++void QShortcutMap::createNewSequences(QKeyEvent *e, QVector &ksl, int ignoredModifiers) + { + Q_D(QShortcutMap); + QList possibleKeys = QKeyMapper::possibleKeys(e); +@@ -573,7 +571,7 @@ void QShortcutMap::createNewSequences(QKeyEvent *e, QVector &ksl) + curKsl.setKey(0, 2); + curKsl.setKey(0, 3); + } +- curKsl.setKey(possibleKeys.at(pkNum), index); ++ curKsl.setKey(possibleKeys.at(pkNum) & ~ignoredModifiers, index); + } + } + } +diff --git a/src/gui/kernel/qshortcutmap_p.h b/src/gui/kernel/qshortcutmap_p.h +index b2e0945..d4a0021 100644 +--- a/src/gui/kernel/qshortcutmap_p.h ++++ b/src/gui/kernel/qshortcutmap_p.h +@@ -88,10 +88,10 @@ private: + QKeySequence::SequenceMatch state(); + void dispatchEvent(QKeyEvent *e); + +- QKeySequence::SequenceMatch find(QKeyEvent *e); ++ QKeySequence::SequenceMatch find(QKeyEvent *e, int ignoredModifiers = 0); + QKeySequence::SequenceMatch matches(const QKeySequence &seq1, const QKeySequence &seq2) const; + QVector matches() const; +- void createNewSequences(QKeyEvent *e, QVector &ksl); ++ void createNewSequences(QKeyEvent *e, QVector &ksl, int ignoredModifiers); + void clearSequence(QVector &ksl); + int translateModifiers(Qt::KeyboardModifiers modifiers); + +-- +cgit v0.11.0 diff --git a/Make-qglobal.h-complain-if-you-use-fPIE.patch b/Make-qglobal.h-complain-if-you-use-fPIE.patch new file mode 100644 index 0000000..bcdb953 --- /dev/null +++ b/Make-qglobal.h-complain-if-you-use-fPIE.patch @@ -0,0 +1,43 @@ +From 3eca75de67b3fd2c890715b30c7899cebc096fe9 Mon Sep 17 00:00:00 2001 +From: Thiago Macieira +Date: Mon, 11 May 2015 18:30:00 +0900 +Subject: Make qglobal.h complain if you use -fPIE + +Prior to Qt 5.4.2 (commit 36d6eb721e7d5997ade75e289d4088dc48678d0d), we +allowed it, but now we need to enforce that it is not used. Note that +-fPIE does define __PIC__, so we need this to catch the use of -fPIE. + +[ChangeLog][Important Behavior Changes] On x86 and x86-64 systems with +ELF binaries (especially Linux), due to a new optimization in GCC 5.x in +combination with a recent version of GNU binutils, compiling Qt +applications with -fPIE is no longer enough. Applications now need to be +compiled with the -fPIC option if Qt's option "reduce relocations" is +active. Note that Clang is known to generate incompatible code even with +-fPIC if the -flto option is active. + +Task-number: QTBUG-45755 +Change-Id: I66a35ce5f88941f29aa6ffff13dd210e0aa2728f +Reviewed-by: Dmitry Shachnev +Reviewed-by: Simon Hausmann +--- + src/corelib/global/qglobal.h | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h +index ef84662..4547877 100644 +--- a/src/corelib/global/qglobal.h ++++ b/src/corelib/global/qglobal.h +@@ -1047,9 +1047,9 @@ Q_CORE_EXPORT int qrand(); + # define QT_NO_SHAREDMEMORY + #endif + +-#if !defined(QT_BOOTSTRAPPED) && defined(QT_REDUCE_RELOCATIONS) && defined(__ELF__) && !defined(__PIC__) ++#if !defined(QT_BOOTSTRAPPED) && defined(QT_REDUCE_RELOCATIONS) && defined(__ELF__) && (!defined(__PIC__) || defined(__PIE__)) + # error "You must build your code with position independent code if Qt was built with -reduce-relocations. "\ +- "Compile your code with -fPIC." ++ "Compile your code with -fPIC (-fPIE is not enough)." + #endif + + namespace QtPrivate { +-- +cgit v0.11.0 diff --git a/Require-fPIC-instead-of-just-fPIE-for-reduce-relocations.patch b/Require-fPIC-instead-of-just-fPIE-for-reduce-relocations.patch new file mode 100644 index 0000000..e4d7de8 --- /dev/null +++ b/Require-fPIC-instead-of-just-fPIE-for-reduce-relocations.patch @@ -0,0 +1,132 @@ +From b8902cfa8f14f72e879ed87f35645f6fbafebc0e Mon Sep 17 00:00:00 2001 +From: Thiago Macieira +Date: Tue, 5 May 2015 08:43:42 -0700 +Subject: [PATCH 1/2] Require -fPIC instead of just -fPIE for + -reduce-relocations + +GCC 5 combined with a recent binutils have a new optimization that +allows them to generate copy relocations even in -fPIE code. Clang has +the same functionality when compiling an executable with -flto. We need +to let the compilers know that they cannot use copy relocations, so they +need to use really position-independent code. + +Position independent code throughout is not really required. We just +need the compilers to use position-independent access to symbols coming +from the Qt libraries, but there's currently no other way of doing that. + +Task-number: QTBUG-45755 +Change-Id: I0d4913955e3745b69672ffff13db5df7377398c5 +Reviewed-by: Simon Hausmann +Reviewed-by: Oswald Buddenhagen +(cherry picked from commit 36d6eb721e7d5997ade75e289d4088dc48678d0d) +--- + mkspecs/common/gcc-base.conf | 2 +- + mkspecs/common/qcc-base.conf | 2 +- + mkspecs/linux-icc/qmake.conf | 2 +- + src/corelib/Qt5CoreConfigExtras.cmake.in | 2 +- + src/corelib/global/qglobal.h | 4 ++-- + tests/auto/tools/moc/tst_moc.cpp | 6 +++--- + 6 files changed, 9 insertions(+), 9 deletions(-) + +diff --git a/mkspecs/common/gcc-base.conf b/mkspecs/common/gcc-base.conf +index a149f4d9072fcaf50f32af7a047202bdf42db4f1..e4ccbd7156b5a37e5d17cc25bb1879d678ee0498 100644 +--- a/mkspecs/common/gcc-base.conf ++++ b/mkspecs/common/gcc-base.conf +@@ -42,7 +42,7 @@ QMAKE_CFLAGS_RELEASE += $$QMAKE_CFLAGS_OPTIMIZE + QMAKE_CFLAGS_DEBUG += -g + QMAKE_CFLAGS_SHLIB += -fPIC + QMAKE_CFLAGS_STATIC_LIB += -fPIC +-QMAKE_CFLAGS_APP += -fPIE ++QMAKE_CFLAGS_APP += -fPIC + QMAKE_CFLAGS_ISYSTEM = -isystem + QMAKE_CFLAGS_YACC += -Wno-unused -Wno-parentheses + QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden +diff --git a/mkspecs/common/qcc-base.conf b/mkspecs/common/qcc-base.conf +index f529d7fc7ba2c6a098db0e59e220e3f53d48d051..8276316c3fe3ba55f4055776e3ad3dbb3fd455e5 100644 +--- a/mkspecs/common/qcc-base.conf ++++ b/mkspecs/common/qcc-base.conf +@@ -23,7 +23,7 @@ QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_OPTIMIZE -g + QMAKE_CFLAGS_DEBUG += -g + QMAKE_CFLAGS_SHLIB += -fPIC -shared + QMAKE_CFLAGS_STATIC_LIB += -fPIC +-QMAKE_CFLAGS_APP += -fPIE ++QMAKE_CFLAGS_APP += -fPIC + QMAKE_CFLAGS_YACC += -Wno-unused -Wno-parentheses + QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden + QMAKE_CFLAGS_SSE2 += -msse2 +diff --git a/mkspecs/linux-icc/qmake.conf b/mkspecs/linux-icc/qmake.conf +index 8119c8aa09dc9b991942618b1f8954dc180978c6..9190aa9f28cf6b38455a718afd6851d341ca57b5 100644 +--- a/mkspecs/linux-icc/qmake.conf ++++ b/mkspecs/linux-icc/qmake.conf +@@ -12,7 +12,7 @@ QMAKE_LEXFLAGS = + QMAKE_YACC = yacc + QMAKE_YACCFLAGS = -d + QMAKE_CFLAGS = +-QMAKE_CFLAGS_APP = -fPIE ++QMAKE_CFLAGS_APP = -fPIC + QMAKE_CFLAGS_DEPS = -M + QMAKE_CFLAGS_WARN_ON = -w1 -Wall -Wcheck -wd1572,873,2259,2261 + QMAKE_CFLAGS_WARN_OFF = -w +diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in +index 9bda70ec07cc7fcbd43a07a9d4cca9cf774e22c6..ffe603fbe0892e056a00373ef092770511619733 100644 +--- a/src/corelib/Qt5CoreConfigExtras.cmake.in ++++ b/src/corelib/Qt5CoreConfigExtras.cmake.in +@@ -72,7 +72,7 @@ set(_qt5_corelib_extra_includes) + # macro to add it. + set(Qt5_POSITION_INDEPENDENT_CODE True) + set_property(TARGET Qt5::Core PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE \"ON\") +-set(Qt5Core_EXECUTABLE_COMPILE_FLAGS \"-fPIE\") ++set(Qt5Core_EXECUTABLE_COMPILE_FLAGS \"-fPIC\") + !!ENDIF + + !!IF !isEmpty(QT_NAMESPACE) +diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h +index cb8bd15d8de01900484fc64646d6414471afd37f..746091386d67731eee8ade588cd705a34231c357 100644 +--- a/src/corelib/global/qglobal.h ++++ b/src/corelib/global/qglobal.h +@@ -1046,9 +1046,9 @@ Q_CORE_EXPORT int qrand(); + # define QT_NO_SHAREDMEMORY + #endif + +-#if !defined(QT_BOOTSTRAPPED) && defined(QT_REDUCE_RELOCATIONS) && defined(__ELF__) && !defined(__PIC__) && !defined(__PIE__) ++#if !defined(QT_BOOTSTRAPPED) && defined(QT_REDUCE_RELOCATIONS) && defined(__ELF__) && !defined(__PIC__) + # error "You must build your code with position independent code if Qt was built with -reduce-relocations. "\ +- "Compile your code with -fPIC or -fPIE." ++ "Compile your code with -fPIC." + #endif + + namespace QtPrivate { +diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp +index edb6488eaa2f31731c6c260be790a8e6474fd838..748cb82989dadb983412c7316436de47db473419 100644 +--- a/tests/auto/tools/moc/tst_moc.cpp ++++ b/tests/auto/tools/moc/tst_moc.cpp +@@ -662,7 +662,7 @@ void tst_Moc::oldStyleCasts() + + QStringList args; + args << "-c" << "-x" << "c++" << "-Wold-style-cast" << "-I" << "." +- << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIE" << "-"; ++ << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIC" << "-"; + proc.start("gcc", args); + QVERIFY(proc.waitForStarted()); + proc.write(mocOut); +@@ -732,7 +732,7 @@ void tst_Moc::inputFileNameWithDotsButNoExtension() + + QStringList args; + args << "-c" << "-x" << "c++" << "-I" << ".." +- << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIE" << "-"; ++ << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIC" << "-"; + proc.start("gcc", args); + QVERIFY(proc.waitForStarted()); + proc.write(mocOut); +@@ -1011,7 +1011,7 @@ void tst_Moc::ignoreOptionClashes() + // If -pthread wasn't ignored, it was parsed as a prefix of "thread/", which breaks compilation. + QStringList gccArgs; + gccArgs << "-c" << "-x" << "c++" << "-I" << ".." +- << "-I" << qtIncludePath << "-I" << includeDir << "-o" << "/dev/null" << "-fPIE" << "-"; ++ << "-I" << qtIncludePath << "-I" << includeDir << "-o" << "/dev/null" << "-fPIC" << "-"; + proc.start("gcc", gccArgs); + QVERIFY(proc.waitForStarted()); + proc.write(mocOut); +-- +2.4.1 + diff --git a/Try-to-ensure-that-fPIC-is-used-in-CMake-builds.patch b/Try-to-ensure-that-fPIC-is-used-in-CMake-builds.patch new file mode 100644 index 0000000..1d2c2c9 --- /dev/null +++ b/Try-to-ensure-that-fPIC-is-used-in-CMake-builds.patch @@ -0,0 +1,35 @@ +From cee3096dc26c2f07985a3b2565c60a824aa53860 Mon Sep 17 00:00:00 2001 +From: Evangelos Foutras +Date: Mon, 11 May 2015 12:20:57 +0300 +Subject: [PATCH 2/2] Try to ensure that -fPIC is used in CMake builds + +In commit 36d6eb721e7d5997ade75e289d4088dc48678d0d the -fPIE switch was +replaced with -fPIC in an effort to avoid generating copy relocations +which are incompatible with Qt5 when built with -reduce-relocations. + +Task-number: QTBUG-45755 +Change-Id: I59a55ea15052f498104848c5fd867e563ddc2290 +Reviewed-by: Thiago Macieira +(cherry picked from commit 083c9269ed73e8771e1dbe10812696b45b7389f3) +--- + src/corelib/Qt5CoreConfigExtras.cmake.in | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in +index ffe603fbe0892e056a00373ef092770511619733..785d5252b76fc7d66bc3fb903a614b161bfef34c 100644 +--- a/src/corelib/Qt5CoreConfigExtras.cmake.in ++++ b/src/corelib/Qt5CoreConfigExtras.cmake.in +@@ -71,8 +71,9 @@ set(_qt5_corelib_extra_includes) + # Qt5_POSITION_INDEPENDENT_CODE variable is used in the # qt5_use_module + # macro to add it. + set(Qt5_POSITION_INDEPENDENT_CODE True) +-set_property(TARGET Qt5::Core PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE \"ON\") + set(Qt5Core_EXECUTABLE_COMPILE_FLAGS \"-fPIC\") ++set_property(TARGET Qt5::Core PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE \"ON\") ++set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_COMPILE_OPTIONS ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}) + !!ENDIF + + !!IF !isEmpty(QT_NAMESPACE) +-- +2.4.1 + diff --git a/libqt5-qtbase.changes b/libqt5-qtbase.changes index ca63ba1..14dfe7b 100644 --- a/libqt5-qtbase.changes +++ b/libqt5-qtbase.changes @@ -1,3 +1,18 @@ +------------------------------------------------------------------- +Mon May 18 13:34:07 UTC 2015 - hrvoje.senjan@gmail.com + +- Added patches from upstream: + Try-to-ensure-that-fPIC-is-used-in-CMake-builds.patch, + Require-fPIC-instead-of-just-fPIE-for-reduce-relocations.patch + and Make-qglobal.h-complain-if-you-use-fPIE.patch + (qtbug#45755) + +------------------------------------------------------------------- +Sat May 16 08:24:36 UTC 2015 - hrvoje.senjan@gmail.com + +- Add Fix-shortcuts-with-keypad-keys.patch + (qtbug#20191,qtbug#33093,kde#344638) + ------------------------------------------------------------------- Tue May 5 01:05:55 UTC 2015 - hrvoje.senjan@gmail.com diff --git a/libqt5-qtbase.spec b/libqt5-qtbase.spec index 7f92a6e..5ce6554 100644 --- a/libqt5-qtbase.spec +++ b/libqt5-qtbase.spec @@ -55,6 +55,8 @@ Patch4: protect-geometry-QTBUG-40584.patch Patch5: libqt5-do-not-use-shm-if-display-name-doesnt-look-local.patch # PATCH-FIX-OPENSUSE make-qdbusxml2cpp-output-reproducible.patch -- https://codereview.qt-project.org/#/c/105210/1 Patch7: make-qdbusxml2cpp-output-reproducible.patch +# PATCH-FIX-OPENSUSE Fix-shortcuts-with-keypad-keys.patch -- https://codereview.qt-project.org/#/c/95219/ +Patch8: Fix-shortcuts-with-keypad-keys.patch # patches 1000-2000 and above from upstream 5.3 branch # # patches 2000-3000 and above from upstream 5.4 branch # # PATCH-FIX-UPSTREAM QSystemTrayIcon-handle-submenus-correctly.patch @@ -81,6 +83,12 @@ Patch2009: Fix-regression-in-compose-table-parsing.patch Patch2010: Fix-upload-corruptions-when-server-closes-connection.patch # PATCH-FIX-UPSTREAM Fixed-a-deadlock-when-the-lock-file-is-corrupted.patch Patch2011: Fixed-a-deadlock-when-the-lock-file-is-corrupted.patch +# PATCH-FIX-UPSTREAM Require-fPIC-instead-of-just-fPIE-for-reduce-relocations.patch +Patch2012: Require-fPIC-instead-of-just-fPIE-for-reduce-relocations.patch +# PATCH-FIX-UPSTREAM Make-qglobal.h-complain-if-you-use-fPIE.patch +Patch2013: Make-qglobal.h-complain-if-you-use-fPIE.patch +# PATCH-FIX-UPSTREAM Try-to-ensure-that-fPIC-is-used-in-CMake-builds.patch +Patch2014: Try-to-ensure-that-fPIC-is-used-in-CMake-builds.patch BuildRequires: alsa-devel BuildRequires: cups-devel BuildRequires: gcc-c++ @@ -165,6 +173,7 @@ handling. %patch4 -p1 %patch5 -p1 %patch7 -p0 +%patch8 -p1 %patch2000 -p1 %patch2001 -p1 %patch2002 -p1 @@ -177,6 +186,9 @@ handling. %patch2009 -p1 %patch2010 -p1 %patch2011 -p1 +%patch2012 -p1 +%patch2013 -p1 +%patch2014 -p1 # be sure not to use them rm -r src/3rdparty/{libjpeg,freetype,libpng,zlib}