[SCM] qtbase packaging branch, experimental, updated. debian/5.4.1+dfsg-2-14-g298878d

Lisandro Damián Nicanor Pérez lisandro at moszumanska.debian.org
Wed May 13 15:18:36 UTC 2015


Gitweb-URL: http://git.debian.org/?p=pkg-kde/qt/qtbase.git;a=commitdiff;h=298878d

The following commit has been merged in the experimental branch:
commit 298878dc232c5dea504fe1cd026e2cdf52338e93
Author: Lisandro Damián Nicanor Pérez Meyer <perezmeyer at gmail.com>
Date:   Wed May 13 12:17:57 2015 -0300

    Fix applications crashing when built with GCC5.
---
 debian/changelog                                   |   4 +
 .../make_qglobal_h_complain_if_you_use_fpie.patch  |  63 ++++++++++
 debian/patches/require_fpic_instead_of_fpie.patch  | 130 +++++++++++++++++++++
 debian/patches/series                              |   2 +
 4 files changed, 199 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index daa9d3d..43bcce1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -21,6 +21,10 @@ qtbase-opensource-src (5.4.1+dfsg-3) UNRELEASED; urgency=medium
     - xcb_delay_showing_tray_icon_window_until_it_is_embedded.patch
       (Closes: #775398)
     - qtsystemtrayicon_handle_submenus_correctly.patch
+  * Fix applications crashing when built with GCC5 by backporting upstream
+    patches (Closes: #783127):
+    - make_qglobal_h_complain_if_you_use_fpie.patch
+    - require_fpic_instead_of_fpie.patch
 
  -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>  Thu, 05 Mar 2015 10:26:29 +0300
 
diff --git a/debian/patches/make_qglobal_h_complain_if_you_use_fpie.patch b/debian/patches/make_qglobal_h_complain_if_you_use_fpie.patch
new file mode 100644
index 0000000..0d257ee
--- /dev/null
+++ b/debian/patches/make_qglobal_h_complain_if_you_use_fpie.patch
@@ -0,0 +1,63 @@
+From 3eca75de67b3fd2c890715b30c7899cebc096fe9 Mon Sep 17 00:00:00 2001
+From: Thiago Macieira <thiago.macieira at intel.com>
+Date: Mon, 11 May 2015 18:30:00 +0900
+Subject: [PATCH] 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 <mitya57 at gmail.com>
+Reviewed-by: Simon Hausmann <simon.hausmann at theqtcompany.com>
+---
+ dist/changes-5.4.2           | 7 +++++++
+ src/corelib/global/qglobal.h | 4 ++--
+ 2 files changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/dist/changes-5.4.2 b/dist/changes-5.4.2
+index e1ad9b6..5827187 100644
+--- a/dist/changes-5.4.2
++++ b/dist/changes-5.4.2
+@@ -34,6 +34,13 @@ information about a particular change.
+   common EXIF-format (big-endian) was not working until 5.4.1. 5.4.2 restores the
+   behavior of 5.4.0 and earlier for most EXIF-tagged JPEGs.
+   EXIF orientation will be an opt-in starting with Qt 5.5.
++- 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.
+ 
+ ****************************************************************************
+ *                               Library                                    *
+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 {
+-- 
+2.1.4
+
diff --git a/debian/patches/require_fpic_instead_of_fpie.patch b/debian/patches/require_fpic_instead_of_fpie.patch
new file mode 100644
index 0000000..0de75b9
--- /dev/null
+++ b/debian/patches/require_fpic_instead_of_fpie.patch
@@ -0,0 +1,130 @@
+From 36d6eb721e7d5997ade75e289d4088dc48678d0d Mon Sep 17 00:00:00 2001
+From: Thiago Macieira <thiago.macieira at intel.com>
+Date: Tue, 5 May 2015 08:43:42 -0700
+Subject: [PATCH] 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 <simon.hausmann at theqtcompany.com>
+Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen at theqtcompany.com>
+---
+ 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 a149f4d..e4ccbd7 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 f529d7f..8276316 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 8119c8a..9190aa9 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 7213a84..48d5f21 100644
+--- a/src/corelib/Qt5CoreConfigExtras.cmake.in
++++ b/src/corelib/Qt5CoreConfigExtras.cmake.in
+@@ -71,7 +71,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\")
+ 
+ !!IF !isEmpty(QT_NAMESPACE)
+ list(APPEND Qt5Core_DEFINITIONS -DQT_NAMESPACE=$$QT_NAMESPACE)
+diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
+index 455582e..ef84662 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__) && !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 edb6488..748cb82 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.1.4
+
diff --git a/debian/patches/series b/debian/patches/series
index 8bcbfd2..246a5f9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,6 +5,8 @@ gnukfreebsd.diff
 cve-2015-0295.diff
 qtsystemtrayicon_handle_submenus_correctly.patch
 xcb_delay_showing_tray_icon_window_until_it_is_embedded.patch
+require_fpic_instead_of_fpie.patch
+make_qglobal_h_complain_if_you_use_fpie.patch
 
 # Debian specific.
 revert_upstream_bsymbolic_change.patch

-- 
qtbase packaging



More information about the pkg-kde-commits mailing list