1
0
forked from pool/libqt5-qtbase
libqt5-qtbase/Require-fPIC-instead-of-just-fPIE-for-reduce-relocations.patch
Dominique Leuenberger fc9008bb2f 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
2015-05-19 21:22:17 +00:00

133 lines
6.1 KiB
Diff

From b8902cfa8f14f72e879ed87f35645f6fbafebc0e Mon Sep 17 00:00:00 2001
From: Thiago Macieira <thiago.macieira@intel.com>
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 <simon.hausmann@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
(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