2015-09-27 08:38:22 +02:00
|
|
|
From 38c28ad2420542d795a27c5359226260c886b112 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Thiago Macieira <thiago.macieira@intel.com>
|
|
|
|
Date: Tue, 2 Jun 2015 11:10:22 -0700
|
|
|
|
Subject: [PATCH] Add a linker version script to Qt libraries
|
|
|
|
|
|
|
|
This linker script is only enabled for systems with GCC or GCC-like
|
|
|
|
compilers, though technically it should work on the BSDs too (will
|
|
|
|
enable after testing). For regular modules, this declares one ELF
|
|
|
|
version "Qt_5" and places all QtCore symbols inside, then it declares
|
|
|
|
unused ELF versions "Qt_5.x" for each older minor release. For modules
|
|
|
|
declared "internal_module", all symbols are placed in version
|
|
|
|
Qt_5_PRIVATE_API.
|
|
|
|
|
|
|
|
The big advantage of an ELF version is that, when we do Qt 6, both
|
|
|
|
versions of QtCore could be loaded in memory without conflicts and all
|
|
|
|
symbols would be resolved to the correct library. No module can talk to
|
|
|
|
both at the same time, but this avoids mistakes of loading them
|
|
|
|
indirectly by plugins.
|
|
|
|
|
|
|
|
The extra Qt_5.x versions will be used in the next commit.
|
|
|
|
|
|
|
|
Change-Id: I049a653beeb5454c9539ffff13e3fe6f050fdf31
|
|
|
|
---
|
|
|
|
mkspecs/common/gcc-base-unix.conf | 1 +
|
|
|
|
mkspecs/common/qcc-base-qnx.conf | 1 +
|
|
|
|
mkspecs/features/qt_module.prf | 22 ++++++++++++++++++++++
|
|
|
|
mkspecs/linux-icc/qmake.conf | 1 +
|
|
|
|
mkspecs/unsupported/linux-host-g++/qmake.conf | 1 +
|
|
|
|
5 files changed, 26 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/mkspecs/common/gcc-base-unix.conf b/mkspecs/common/gcc-base-unix.conf
|
2015-10-19 22:46:29 +02:00
|
|
|
index f82c8a843062d6591713160d865b51264cc9cb5b..0178bda75a97398d6ca78b2bb8f04ca3fe8b9455 100644
|
2015-09-27 08:38:22 +02:00
|
|
|
--- a/mkspecs/common/gcc-base-unix.conf
|
|
|
|
+++ b/mkspecs/common/gcc-base-unix.conf
|
|
|
|
@@ -22,3 +22,4 @@ QMAKE_LFLAGS_USE_GOLD = -fuse-ld=gold
|
|
|
|
# -Bsymbolic-functions (ld) support
|
|
|
|
QMAKE_LFLAGS_BSYMBOLIC_FUNC = -Wl,-Bsymbolic-functions
|
|
|
|
QMAKE_LFLAGS_DYNAMIC_LIST = -Wl,--dynamic-list,
|
|
|
|
+QMAKE_LFLAGS_VERSION_SCRIPT = -Wl,--version-script,
|
|
|
|
diff --git a/mkspecs/common/qcc-base-qnx.conf b/mkspecs/common/qcc-base-qnx.conf
|
2015-10-19 22:46:29 +02:00
|
|
|
index a0a88b9605412e9c316a2ab831f71740245fbf20..cebbe06661196834701938cff84127667f9ddb35 100644
|
2015-09-27 08:38:22 +02:00
|
|
|
--- a/mkspecs/common/qcc-base-qnx.conf
|
|
|
|
+++ b/mkspecs/common/qcc-base-qnx.conf
|
|
|
|
@@ -19,6 +19,7 @@ QMAKE_LFLAGS_RPATHLINK = -Wl,-rpath-link,
|
|
|
|
# -Bsymbolic-functions (ld) support
|
|
|
|
QMAKE_LFLAGS_BSYMBOLIC_FUNC = -Wl,-Bsymbolic-functions
|
|
|
|
QMAKE_LFLAGS_DYNAMIC_LIST = -Wl,--dynamic-list,
|
|
|
|
+QMAKE_LFLAGS_VERSION_SCRIPT = -Wl,--version-script,
|
|
|
|
|
|
|
|
# Generic options for all BlackBerry/QNX qcc mkspecs
|
|
|
|
QMAKE_CFLAGS_THREAD = -D_REENTRANT
|
|
|
|
diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf
|
2015-10-19 22:46:29 +02:00
|
|
|
index c89b6d2793bcaef69102c51c4433b304bf6fb769..5206691a17949eab630632f05d0f91d0e56d27b6 100644
|
2015-09-27 08:38:22 +02:00
|
|
|
--- a/mkspecs/features/qt_module.prf
|
|
|
|
+++ b/mkspecs/features/qt_module.prf
|
|
|
|
@@ -185,6 +185,28 @@ equals(QT_ARCH, i386):contains(QT_CPU_FEATURES.$$QT_ARCH, sse2):compiler_support
|
|
|
|
QMAKE_CXXFLAGS += -mfpmath=sse
|
|
|
|
}
|
|
|
|
|
2015-10-19 22:46:29 +02:00
|
|
|
+unix:!isEmpty(QMAKE_LFLAGS_VERSION_SCRIPT):!no_linker_version_script:!static {
|
2015-09-27 08:38:22 +02:00
|
|
|
+ verscript = $$OUT_PWD/$${TARGET}.version
|
|
|
|
+ QMAKE_LFLAGS += $${QMAKE_LFLAGS_VERSION_SCRIPT}$$verscript
|
|
|
|
+
|
|
|
|
+ internal_module {
|
|
|
|
+ verscript_content = "Qt_$${QT_MAJOR_VERSION}_PRIVATE_API { *; };"
|
|
|
|
+ } else {
|
|
|
|
+ current = Qt_$$QT_MAJOR_VERSION
|
|
|
|
+ verscript_content = "$$current { *; };"
|
|
|
|
+ for(i, 0..$$section(VERSION, ., 1, 1)) {
|
|
|
|
+ previous = $$current
|
|
|
|
+ current = Qt_$${QT_MAJOR_VERSION}.$$i
|
|
|
|
+ verscript_content += "$$current {} $$previous;"
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ write_file($$verscript, verscript_content)|error("Aborting.")
|
|
|
|
+ unset(current)
|
|
|
|
+ unset(previous)
|
|
|
|
+ unset(verscript)
|
|
|
|
+ unset(verscript_content)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
android: CONFIG += qt_android_deps
|
|
|
|
|
|
|
|
#install directives
|
|
|
|
diff --git a/mkspecs/linux-icc/qmake.conf b/mkspecs/linux-icc/qmake.conf
|
2015-10-19 22:46:29 +02:00
|
|
|
index 9190aa9f28cf6b38455a718afd6851d341ca57b5..4b10d42d44dd0cb8d788c6247099b42ba25c33a6 100644
|
2015-09-27 08:38:22 +02:00
|
|
|
--- a/mkspecs/linux-icc/qmake.conf
|
|
|
|
+++ b/mkspecs/linux-icc/qmake.conf
|
|
|
|
@@ -97,6 +97,7 @@ QMAKE_CXXFLAGS_PRECOMPILE = -c -pch-create ${QMAKE_PCH_OUTPUT} -include ${QMAKE_
|
|
|
|
# -Bsymbolic-functions (ld) support
|
|
|
|
QMAKE_LFLAGS_BSYMBOLIC_FUNC = -Wl,-Bsymbolic-functions
|
|
|
|
QMAKE_LFLAGS_DYNAMIC_LIST = -Wl,--dynamic-list,
|
|
|
|
+QMAKE_LFLAGS_VERSION_SCRIPT = -Wl,--version-script,
|
|
|
|
|
|
|
|
# Symbol visibility control
|
|
|
|
QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden
|
|
|
|
diff --git a/mkspecs/unsupported/linux-host-g++/qmake.conf b/mkspecs/unsupported/linux-host-g++/qmake.conf
|
2015-10-19 22:46:29 +02:00
|
|
|
index 1523126eaaa4761708fe58e449f8b43f6c3b8c14..546ff213498c80649d5a40810f068aca1c598494 100644
|
2015-09-27 08:38:22 +02:00
|
|
|
--- a/mkspecs/unsupported/linux-host-g++/qmake.conf
|
|
|
|
+++ b/mkspecs/unsupported/linux-host-g++/qmake.conf
|
|
|
|
@@ -71,6 +71,7 @@ QMAKE_PCH_OUTPUT_EXT = .gch
|
|
|
|
# -Bsymbolic-functions (ld) support
|
|
|
|
QMAKE_LFLAGS_BSYMBOLIC_FUNC = -Wl,-Bsymbolic-functions
|
|
|
|
QMAKE_LFLAGS_DYNAMIC_LIST = -Wl,--dynamic-list,
|
|
|
|
+QMAKE_LFLAGS_VERSION_SCRIPT = -Wl,--version-script,
|
|
|
|
|
|
|
|
#
|
|
|
|
# qmake configuration for common linux
|
|
|
|
--
|
2015-10-19 22:46:29 +02:00
|
|
|
2.6.0
|